Amazon's Annapurna Labs POS Driver
v2 cover Amazon's Annapurna Labs POS Driver
The Amazon's Annapurna Labs SoCs includes Point Of Serialization error logging unit that reports an error in case of write error (e.g. attempt to write to a read only register).
This patch series introduces the support for this unit.
Changes since v1: =================
- move MODULE_ to the end of the file
- simplified resource remapping devm_platform_ioremap_resource()
- use platform_get_irq() instead of irq_of_parse_and_map()
- removed the use of _relaxed accessor in favor to the regular ones
- removed driver selected based on arch
- added casting to u64 before left shifting (reported by kbuild test robot)
Talel Shenhar (3):
dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
soc: amazon: al-pos: cast to u64 before left shifting
.../bindings/soc/amazon/amazon,al-pos.txt | 18 +++ MAINTAINERS | 7 ++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/amazon/Kconfig | 5 + drivers/soc/amazon/Makefile | 1 + drivers/soc/amazon/al_pos.c | 127 +++++++++++++++++++++ 7 files changed, 160 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt create mode 100644 drivers/soc/amazon/Kconfig create mode 100644 drivers/soc/amazon/Makefile create mode 100644 drivers/soc/amazon/al_pos.c
Signature · 1 line
2.7.4
PATCH v2 1/3 dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
Document Amazon's Annapurna Labs POS SoC binding.
--- .../devicetree/bindings/soc/amazon/amazon,al-pos.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +18 -0
@@ -0,0 +1,18 @@ +Amazon's Annapurna Labs POS + +POS node is defined to describe the Point Of Serialization (POS) logger +unit. + +Required properties: +- compatible: Shall be "amazon,al-pos". +- reg: POS logger resources. +- interrupts: should contain the interrupt for pos error event. + +Example: + +al_pos { + compatible = "amazon,al-pos"; + reg = <0x0 0xf0070084 0x0 0x00000008>; + interrupt-parent = <&amazon_system_fabric>; + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; +};
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
Quoted 7 lines · Talel Shenhar
Document Amazon's Annapurna Labs POS SoC binding.
Signed-off-by Talel Shenhar <[email protected]>--- .../devicetree/bindings/soc/amazon/amazon,al-pos.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt
Please convert to DT schema.
Quoted 10 lines
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +3
-0@@ -0,0 +1,18 @@ +Amazon's Annapurna Labs POS + +POS node is defined to describe the Point Of Serialization (POS) logger
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt line 13
Quoted 10 lines
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +10
-0+unit. + +Required properties: +- compatible: Shall be "amazon,al-pos". +- reg: POS logger resources. +- interrupts: should contain the interrupt for pos error event. + +Example: + +al_pos {
Needs a unit-address.
Quoted 8 lines
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +5
-0+ compatible = "amazon,al-pos"; + reg = <0x0 0xf0070084 0x0 0x00000008>; + interrupt-parent = <&amazon_system_fabric>; + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; +};Signature · 1 line
2.7.4
Re: [PATCH v2 1/3] dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
Tnx Rob for the review.
Shall be part of v3.
Waiting for responses from Arnd and James and will publish v3.
Quoted 39 lines · Rob Herring
Quoted 7 lines · Talel Shenhar
Document Amazon's Annapurna Labs POS SoC binding.
Signed-off-by Talel Shenhar <[email protected]>--- .../devicetree/bindings/soc/amazon/amazon,al-pos.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txtPlease convert to DT schema.
Quoted 9 lines
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +3
-0@@ -0,0 +1,18 @@ +Amazon's Annapurna Labs POS + +POS node is defined to describe the Point Of Serialization (POS) loggerDocumentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt line 13
Quoted 10 lines
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +10
-0+unit. + +Required properties: +- compatible: Shall be "amazon,al-pos". +- reg: POS logger resources. +- interrupts: should contain the interrupt for pos error event. + +Example: + +al_pos {Needs a unit-address.
Quoted 8 lines
Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt new file +5
-0+ compatible = "amazon,al-pos"; + reg = <0x0 0xf0070084 0x0 0x00000008>; + interrupt-parent = <&amazon_system_fabric>; + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; +};Signature · 1 line
2.7.4
PATCH v2 2/3 soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
In reply to Talel ShenharThe Amazon's Annapurna Labs SoCs includes Point Of Serialization error logging unit that reports an error in case write error (e.g. attempt to write to a read only register).
This patch introduces the support for this unit.
--- MAINTAINERS | 7 +++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/amazon/Kconfig | 5 ++ drivers/soc/amazon/Makefile | 1 + drivers/soc/amazon/al_pos.c | 127 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 142 insertions(+) create mode 100644 drivers/soc/amazon/Kconfig create mode 100644 drivers/soc/amazon/Makefile create mode 100644 drivers/soc/amazon/al_pos.c
MAINTAINERS +7 -0
@@ -751,6 +751,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS POS +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt +F: drivers/soc/amazon/al_pos.c + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintained
drivers/soc/Kconfig +1 -0
@@ -2,6 +2,7 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/actions/Kconfig" +source "drivers/soc/amazon/Kconfig" source "drivers/soc/amlogic/Kconfig" source "drivers/soc/aspeed/Kconfig" source "drivers/soc/atmel/Kconfig"
drivers/soc/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_ACTIONS) += actions/ obj-$(CONFIG_SOC_ASPEED) += aspeed/ obj-$(CONFIG_ARCH_AT91) += atmel/ +obj-y += amazon/ obj-y += bcm/ obj-$(CONFIG_ARCH_DOVE) += dove/ obj-$(CONFIG_MACH_DOVE) += dove/
drivers/soc/amazon/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config AL_POS + bool "Amazon's Annapurna Labs POS driver" + depends on ARCH_ALPINE || COMPILE_TEST + help + Include support for the SoC POS error capability.
drivers/soc/amazon/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_AL_POS) += al_pos.o
drivers/soc/amazon/al_pos.c new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 2/3] soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
[+James]
Hi Talel,
Quoted 67 lines · Talel Shenhar
The Amazon's Annapurna Labs SoCs includes Point Of Serialization error logging unit that reports an error in case write error (e.g. attempt to write to a read only register).
This patch introduces the support for this unit.Signed-off-by Talel Shenhar <[email protected]>--- MAINTAINERS | 7 +++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/amazon/Kconfig | 5 ++ drivers/soc/amazon/Makefile | 1 + drivers/soc/amazon/al_pos.c | 127 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 142 insertions(+) create mode 100644 drivers/soc/amazon/Kconfig create mode 100644 drivers/soc/amazon/Makefile create mode 100644 drivers/soc/amazon/al_pos.cMAINTAINERS +7
-0@@ -751,6 +751,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS POS +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/soc/amazon/amazon,al-pos.txt +F: drivers/soc/amazon/al_pos.c + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintaineddrivers/soc/Kconfig +1
-0@@ -2,6 +2,7 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/actions/Kconfig" +source "drivers/soc/amazon/Kconfig" source "drivers/soc/amlogic/Kconfig" source "drivers/soc/aspeed/Kconfig" source "drivers/soc/atmel/Kconfig"drivers/soc/Makefile +1
-0@@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_ACTIONS) += actions/ obj-$(CONFIG_SOC_ASPEED) += aspeed/ obj-$(CONFIG_ARCH_AT91) += atmel/ +obj-y += amazon/ obj-y += bcm/ obj-$(CONFIG_ARCH_DOVE) += dove/ obj-$(CONFIG_MACH_DOVE) += dove/drivers/soc/amazon/Kconfig new file +0
-0
drivers/soc/amazon/Kconfig line 2
Quoted 2 lines
drivers/soc/amazon/Kconfig new file +2
-0@@ -0,0 +1,5 @@ +config AL_POS + bool "Amazon's Annapurna Labs POS driver"
Some would say that the name is ever slightly unfortunate...
Quoted 50 lines
drivers/soc/amazon/Kconfig new file +3
-0+ depends on ARCH_ALPINE || COMPILE_TEST + help + Include support for the SoC POS error capability.drivers/soc/amazon/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_AL_POS) += al_pos.odrivers/soc/amazon/al_pos.c new file +34
-0@@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +*/ +#include <linux/bitfield.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +/* Registers Offset */ +#define AL_POS_ERROR_LOG_1 0x0 +#define AL_POS_ERROR_LOG_0 0x4 + +/* Registers Fields */ +#define AL_POS_ERROR_LOG_1_VALID GENMASK(31, 31) +#define AL_POS_ERROR_LOG_1_BRESP GENMASK(18, 17) +#define AL_POS_ERROR_LOG_1_REQUEST_ID GENMASK(16, 8) +#define AL_POS_ERROR_LOG_1_ADDR_HIGH GENMASK(7, 0) + +#define AL_POS_ERROR_LOG_0_ADDR_LOW GENMASK(31, 0) + +static int al_pos_panic; +module_param (al_pos_panic, int,0 ); +MODULE_PARM_DESC (al_pos_panic,"Defines if POS error is causing panic()" ); + +struct al_pos { +struct platform_device *pdev; +void __iomem *mmio_base; +int irq; +}; + +static irqreturn_t al_pos_irq_handler (int irq,void *info)
drivers/soc/amazon/al_pos.c line 44
Quoted 10 lines
drivers/soc/amazon/al_pos.c new file +10
-0+{ +struct platform_device *pdev = info; +struct al_pos *pos =platform_get_drvdata (pdev); +u32 log1; +u32 log0; +u64 addr; +u16 request_id; +u8 bresp; + + log1 =readl (pos->mmio_base +AL_POS_ERROR_LOG_1 );
Do you actually need the implied barriers? I'd expect that relaxed accesses should be enough.
drivers/soc/amazon/al_pos.c line 57
Quoted 13 lines
drivers/soc/amazon/al_pos.c new file +13
-0+if (!FIELD_GET (AL_POS_ERROR_LOG_1_VALID , log1)) +return IRQ_NONE ; + + log0 =readl (pos->mmio_base +AL_POS_ERROR_LOG_0 ); +writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); + + addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); + addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); + bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1); + +dev_err (&pdev->dev,"addr=0x%llx request_id=0x%x bresp=0x%x\n" , + addr, request_id, bresp);
What is this information? How do we make use of it? Given that this is asynchronous, how do we correlate it to the offending software?
Quoted 73 lines
drivers/soc/amazon/al_pos.c new file +70
-0+ +if (al_pos_panic) +panic ("POS" ); + +return IRQ_HANDLED ; +} + +static int al_pos_probe (struct platform_device *pdev) +{ +struct al_pos *pos; +int ret; + + pos =devm_kzalloc (&pdev->dev,sizeof (*pos),GFP_KERNEL ); +if (!pos) +return -ENOMEM ; + +platform_set_drvdata (pdev, pos); + pos->pdev = pdev; + + pos->mmio_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (pos->mmio_base)) { +dev_err (&pdev->dev,"failed to ioremap memory (%ld)\n" , +PTR_ERR (pos->mmio_base)); +return PTR_ERR (pos->mmio_base); + } + + pos->irq =platform_get_irq (pdev,0 ); +if (pos->irq <=0 ) { +dev_err (&pdev->dev,"fail to parse and map irq\n" ); +return -EINVAL ; + } + + ret =devm_request_irq (&pdev->dev, + pos->irq, + al_pos_irq_handler, +0 , + pdev->name, + pdev); +if (ret !=0 ) { +dev_err (&pdev->dev, +"failed to register to irq %d (%d)\n" , + pos->irq, ret); +return ret; + } + +dev_info (&pdev->dev,"successfully loaded\n" ); + +return 0 ; +} + +static const struct of_device_id al_pos_of_match[] = { + { .compatible ="amazon,al-pos" , }, + {}, +}; + +MODULE_DEVICE_TABLE (of, al_pos_of_match); + +static struct platform_driver al_pos_driver = { + .probe = al_pos_probe, + .driver = { + .name ="al-pos" , + .of_match_table = al_pos_of_match, + }, +}; + +module_platform_driver (al_pos_driver); + +MODULE_LICENSE ("GPL v2" ); +MODULE_AUTHOR ("Talel Shenhar" ); +MODULE_DESCRIPTION ("Amazon's Annapurna Labs POS driver" );Signature · 1 line
2.7.4
The whole think looks to me like a poor man's EDAC handling, and I'd expect to be plugged in that subsystem instead. Any reason why this isn't the case? It would certainly make the handling uniform for the user.
Thanks,
M.
Signature · 1 line
Jazz is not dead, it just smells funny.
Re: [UNVERIFIED SENDER] Re: [PATCH v2 2/3] soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
Hi Marc,
Quoted 10 lines · Marc Zyngier
[+James]
Hi Talel,
drivers/soc/amazon/al_pos.c line 44
Quoted 1 line · Talel Shenhar
drivers/soc/amazon/al_pos.c new file +1
-0+ log1 =readl (pos->mmio_base +AL_POS_ERROR_LOG_1 );Do you actually need the implied barriers? I'd expect that relaxed accesses should be enough.
You are correct. Barriers are not needed, In v1 this driver indeed used _relaxed versions.
Due to request coming from Arnd in v1 patch series I removed it. As this is not data path I had no strong objection for removing it.
Quoted 16 lines
Quoted 4 lines
drivers/soc/amazon/al_pos.c new file +3
-0+if (!FIELD_GET (AL_POS_ERROR_LOG_1_VALID , log1)) +return IRQ_NONE ; +drivers/soc/amazon/al_pos.c line 57
Quoted 10 lines
drivers/soc/amazon/al_pos.c new file +10
-0+ log0 =readl (pos->mmio_base +AL_POS_ERROR_LOG_0 ); +writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); + + addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); + addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); + bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1); + +dev_err (&pdev->dev,"addr=0x%llx request_id=0x%x bresp=0x%x\n" , + addr, request_id, bresp);What is this information? How do we make use of it? Given that this is asynchronous, how do we correlate it to the offending software?
Indeed this information arriving from the HW is asynchronous.
There is no direct method to get the offending software.
There are all kinds of hacks we do to find the offending software once we find this error. most of the time its a new patch introduced but some of the time is just digging.
Quoted 4 lines
The whole think looks to me like a poor man's EDAC handling, and I'd expect to be plugged in that subsystem instead. Any reason why this isn't the case? It would certainly make the handling uniform for the user.
This logic was not plugged into EDAC as there is no "Correctable" error here. its just error event. Not all errors are EDAC in the sense of Error Detection And *Correction*. There are no correctable errors for this driver.
So plugging it under EDAC seems like abusing the EDAC system.
Now that I've emphasize the reason for not putting this under EDAC, what do you think? should this "only uncorrectable event" driver should be part of EDAC?
Thanks,
Talel
Re: [UNVERIFIED SENDER] Re: [PATCH v2 2/3] soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
Quoted 16 lines · Talel
Hi Marc,
Quoted 10 lines · Marc Zyngier
[+James]
Hi Talel,
drivers/soc/amazon/al_pos.c line 44
Quoted 1 line · Talel Shenhar
drivers/soc/amazon/al_pos.c new file +1
-0+ log1 =readl (pos->mmio_base +AL_POS_ERROR_LOG_1 );Do you actually need the implied barriers? I'd expect that relaxed accesses should be enough.
Quoted 5 lines
You are correct. Barriers are not needed, In v1 this driver indeed used
_relaxedversions.Due to request coming from Arnd in v1 patch series I removed it. As this is not data path I had no strong objection for removing it.
Independently from whether this has any material impact on performance (this obviously isn't a hot path, unless it can be directly generated by userspace or a guest), I believe it is important to use the right type of accessor, if only because code gets copied around... Others would probably argue that this is the very reason why we should always use the "safe" option...
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
drivers/soc/amazon/al_pos.c new file +3
-0+if (!FIELD_GET (AL_POS_ERROR_LOG_1_VALID , log1)) +return IRQ_NONE ; +drivers/soc/amazon/al_pos.c line 57
Quoted 10 lines
drivers/soc/amazon/al_pos.c new file +10
-0+ log0 =readl (pos->mmio_base +AL_POS_ERROR_LOG_0 ); +writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); + + addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); + addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); + bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1); + +dev_err (&pdev->dev,"addr=0x%llx request_id=0x%x bresp=0x%x\n" , + addr, request_id, bresp);What is this information? How do we make use of it? Given that this is asynchronous, how do we correlate it to the offending software?
Quoted 7 lines
Indeed this information arriving from the HW is asynchronous.
There is no direct method to get the offending software.
There are all kinds of hacks we do to find the offending software once we find this error. most of the time its a new patch introduced but some of the time is just digging.
OK, so that the moment, this is more of a debug tool than anything else, right?
Quoted 9 lines
Quoted 4 lines
The whole think looks to me like a poor man's EDAC handling, and I'd expect to be plugged in that subsystem instead. Any reason why this isn't the case? It would certainly make the handling uniform for the user.
This logic was not plugged into EDAC as there is no "Correctable" error here. its just error event. Not all errors are EDAC in the sense of Error Detection And *Correction*. There are no correctable errors for this driver.
I'd argue the opposite! Because you obviously don't let a read-only register being written to, the error has been corrected, and you signal the correction status.
Quoted 5 lines
So plugging it under EDAC seems like abusing the EDAC system.
Now that I've emphasize the reason for not putting this under EDAC, what do you think? should this "only uncorrectable event" driver should be part of EDAC?
My choice would be to plug it into the EDAC subsystem, and report all interrupts as "Corrected" events. Optionally, and only if you are debugging something that requires it, report the error as "Uncorrectable", in which case the EDAC subsystem should trigger a panic.
At least you'd get the infrastructure, logging and tooling that the EDAC subsystem offers (parsing the kernel log doesn't really count).
Thanks,
M.
Signature · 1 line
Jazz is not dead, it just smells funny.
Re: [UNVERIFIED SENDER] Re: [UNVERIFIED SENDER] Re: [PATCH v2 2/3] soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
Quoted 19 lines · Marc Zyngier
Quoted 17 lines · Talel
Hi Marc,
Quoted 10 lines · Marc Zyngier
[+James]
Hi Talel,
drivers/soc/amazon/al_pos.c line 44
Quoted 1 line · Talel Shenhar
drivers/soc/amazon/al_pos.c new file +1
-0+ log1 =readl (pos->mmio_base +AL_POS_ERROR_LOG_1 );Do you actually need the implied barriers? I'd expect that relaxed accesses should be enough.
You are correct. Barriers are not needed, In v1 this driver indeed used
_relaxedversions.
Quoted 8 lines
Quoted 2 lines
Due to request coming from Arnd in v1 patch series I removed it. As this is not data path I had no strong objection for removing it.
Independently from whether this has any material impact on performance (this obviously isn't a hot path, unless it can be directly generated by userspace or a guest), I believe it is important to use the right type of accessor, if only because code gets copied around... Others would probably argue that this is the very reason why we should always use the "safe" option...
Arnld, would love your inputs before publishing v3 to avoid ping-pong.
Quoted 18 lines
Quoted 18 lines
Quoted 16 lines
Quoted 4 lines
drivers/soc/amazon/al_pos.c new file +3
-0+if (!FIELD_GET (AL_POS_ERROR_LOG_1_VALID , log1)) +return IRQ_NONE ; +drivers/soc/amazon/al_pos.c line 57
Quoted 10 lines
drivers/soc/amazon/al_pos.c new file +10
-0+ log0 =readl (pos->mmio_base +AL_POS_ERROR_LOG_0 ); +writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); + + addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); + addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); + bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1); + +dev_err (&pdev->dev,"addr=0x%llx request_id=0x%x bresp=0x%x\n" , + addr, request_id, bresp);What is this information? How do we make use of it? Given that this is asynchronous, how do we correlate it to the offending software?
Indeed this information arriving from the HW is asynchronous.
Quoted 7 lines
Quoted 5 lines
There is no direct method to get the offending software.
There are all kinds of hacks we do to find the offending software once we find this error. most of the time its a new patch introduced but some of the time is just digging.
OK, so that the moment, this is more of a debug tool than anything else, right?
Not sure what do you mean by debug tool. this is used to capture iliigle access and allow panic() based on them or simple logging.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
The whole think looks to me like a poor man's EDAC handling, and I'd expect to be plugged in that subsystem instead. Any reason why this isn't the case? It would certainly make the handling uniform for the user.
Quoted 7 lines
Quoted 4 lines
This logic was not plugged into EDAC as there is no "Correctable" error here. its just error event. Not all errors are EDAC in the sense of Error Detection And *Correction*. There are no correctable errors for this driver.
I'd argue the opposite! Because you obviously don't let a read-only register being written to, the error has been corrected, and you signal the correction status.
Not the meaning of corrected from my point of view - the system as a whole (sw&hw) are not working state. a driver thinks it configured the system to do A while the system doesn't really do that. and the critical part is that the driver that did operation A doesn't even have a way to know it.
So I would not call this corrected.
Quoted 6 lines
Quoted 6 lines
So plugging it under EDAC seems like abusing the EDAC system.
Now that I've emphasize the reason for not putting this under EDAC, what do you think? should this "only uncorrectable event" driver should be part of EDAC?
Quoted 8 lines
My choice would be to plug it into the EDAC subsystem, and report all interrupts as "Corrected" events. Optionally, and only if you are debugging something that requires it, report the error as "Uncorrectable", in which case the EDAC subsystem should trigger a panic.
At least you'd get the infrastructure, logging and tooling that the EDAC subsystem offers (parsing the kernel log doesn't really count).
I see what you say. However, I don't see too much added value in plugging this to EDAC and feel like it would abuse EDAC framework.
James, will love your input from EDAC point of view, does it make sense to plug un-correctable only event to EDAC?
Quoted 5 lines
Thanks,
M.
Re: [UNVERIFIED SENDER] Re: [UNVERIFIED SENDER] Re: [PATCH v2 2/3] soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
Hi guys,
Quoted 31 lines · Talel
Quoted 29 lines · Marc Zyngier
Quoted 27 lines · Talel
Quoted 18 lines · Marc Zyngier
drivers/soc/amazon/al_pos.c line 57
Quoted 13 lines · Talel Shenhar
+ if (!FIELD_GET(AL_POS_ERROR_LOG_1_VALID, log1)) + return
IRQ_NONE;drivers/soc/amazon/al_pos.c new file +11
-0+ + log0 = readl(pos->mmio_base + AL_POS_ERROR_LOG_0); + writel(0, pos->mmio_base + AL_POS_ERROR_LOG_1); + + addr = FIELD_GET(AL_POS_ERROR_LOG_0_ADDR_LOW, log0); + addr |= (FIELD_GET(AL_POS_ERROR_LOG_1_ADDR_HIGH, log1) << 32); + request_id = FIELD_GET(AL_POS_ERROR_LOG_1_REQUEST_ID, log1); + bresp = FIELD_GET(AL_POS_ERROR_LOG_1_BRESP, log1); + + dev_err(&pdev->dev, "addr=0x%llx request_id=0x%x bresp=0x%x\n", + addr, request_id, bresp);What is this information? How do we make use of it? Given that this is asynchronous, how do we correlate it to the offending software?
Indeed this information arriving from the HW is asynchronous.
There is no direct method to get the offending software.
There are all kinds of hacks we do to find the offending software once we find this error. most of the time its a new patch introduced but some of the time is just digging.
Quoted 5 lines
Quoted 2 lines
OK, so that the moment, this is more of a debug tool than anything else, right?
Not sure what do you mean by debug tool. this is used to capture iliigle access and allow
panic()based on them or simple logging.
Plumbing this into edac as a 'device' gives you the existing/standard interface for user-space. For example the 'panic_on_ue' that is exposed via sysfs, this saves you having another interface to toggle it for your driver. You can then use the existing distro tools to drive/monitor/sample it.
Quoted 14 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
The whole think looks to me like a poor man's EDAC handling, and I'd expect to be plugged in that subsystem instead. Any reason why this isn't the case? It would certainly make the handling uniform for the user.
Quoted 8 lines
Quoted 4 lines
This logic was not plugged into EDAC as there is no "Correctable" error here. its just error event. Not all errors are EDAC in the sense of Error Detection And *Correction*. There are no correctable errors for this driver.
I'd argue the opposite! Because you obviously don't let a read-only register being written to, the error has been corrected, and you signal the correction status.
Quoted 6 lines
Not the meaning of corrected from my point of view - the system as a whole (sw&hw) are not working state. a driver thinks it configured the system to do A while the system doesn't really do that. and the critical part is that the driver that did operation A doesn't even have a way to know it.
So I would not call this corrected.
I don't think corrected/uncorrected helps here. If the register is read-only, and software writes to it, its a software bug.
(from the v8.2's RAS extensions view, its somewhere between unrecoverable and uncontained)
Quoted 1 line
Quoted 1 line
Quoted 1 line
So plugging it under EDAC seems like abusing the EDAC system.
If EDAC doesn't do what you need, it can always be extended.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Now that I've emphasize the reason for not putting this under EDAC, what do you think? should this "only uncorrectable event" driver should be part of EDAC?
Sure, (its for memory controllers, but:) enum edac_type has a EDAC_EC: "Error Checking, no correction". This wouldn't be the only device that only reports uncorrectable errors.
Quoted 6 lines
Quoted 5 lines
My choice would be to plug it into the EDAC subsystem, and report all interrupts as "Corrected" events. Optionally, and only if you are debugging something that requires it, report the error as "Uncorrectable", in which case the EDAC subsystem should trigger a panic.
Quoted 8 lines
Quoted 2 lines
At least you'd get the infrastructure, logging and tooling that the EDAC subsystem offers (parsing the kernel log doesn't really count).
I see what you say. However, I don't see too much added value in plugging this to EDAC and feel like it would abuse EDAC framework.
James, will love your input from EDAC point of view, does it make sense to plug un-correctable only event to EDAC?
I think this device is an example of something like a "Fabric switch units" in Documentation/driver-api/edac.rst. It makes sense that it should be described as a 'device' to edac. You can then use the existing user-space tools to control/report/monitor the values.
Thanks,
James
Re: [UNVERIFIED SENDER] Re: [UNVERIFIED SENDER] Re: [PATCH v2 2/3] soc: amazon: al-pos: Introduce Amazon's Annapurna Labs POS driver
Quoted 10 lines · James Morse
Hi guys,
Quoted 7 lines · Talel
Quoted 6 lines · Marc Zyngier
Quoted 4 lines · Talel
Quoted 3 lines · Marc Zyngier
On Tue, 10 Sep 2019 20:05:09 +0100,
Talel Shenhar <[email protected]> wrote:
Quoted 6 lines
Quoted 2 lines
James, will love your input from EDAC point of view, does it make sense to plug un-correctable only event to EDAC?
I think this device is an example of something like a "Fabric switch units" in
Documentation/driver-api/edac.rst. It makes sense that it should be described as a 'device' to edac. You can then use the existing user-space tools to control/report/monitor the values.
Thank you James,
Will port this logic to be edac device.
Quoted 5 lines
Thanks,
James
PATCH v2 3/3 soc: amazon: al-pos: cast to u64 before left shifting
In reply to Talel ShenharFix wrap around for pos errors on addresses above 32 bit.
--- drivers/soc/amazon/al_pos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/amazon/al_pos.c +1 -1
@@ -49,7 +49,7 @@ static irqreturn_t al_pos_irq_handler(int irq, void *info)writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); - addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + addr |= (((u64 )FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1)) <<32 ); request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1);
Signature · 1 line
2.7.4
Re: [PATCH v2 3/3] soc: amazon: al-pos: cast to u64 before left shifting
Quoted 25 lines · Talel Shenhar
Fix wrap around for pos errors on addresses above 32 bit.
Reported-by kbuild test robot <[email protected]>Signed-off-by Talel Shenhar <[email protected]>--- drivers/soc/amazon/al_pos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/amazon/al_pos.c +1
-1@@ -49,7 +49,7 @@ static irqreturn_t al_pos_irq_handler(int irq, void *info)writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); - addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + addr |= (((u64 )FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1)) <<32 ); request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1);Signature · 1 line
2.7.4
This fix should be squashed into the previous patch.
Thanks,
M.
Signature · 1 line
Jazz is not dead, it just smells funny.
Re: [UNVERIFIED SENDER] Re: [PATCH v2 3/3] soc: amazon: al-pos: cast to u64 before left shifting
Quoted 23 lines · Marc Zyngier
Quoted 21 lines · Talel Shenhar
Fix wrap around for pos errors on addresses above 32 bit.
Reported-by kbuild test robot <[email protected]>Signed-off-by Talel Shenhar <[email protected]>--- drivers/soc/amazon/al_pos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/amazon/al_pos.c +1
-1@@ -49,7 +49,7 @@ static irqreturn_t al_pos_irq_handler(int irq, void *info)writel (0 , pos->mmio_base +AL_POS_ERROR_LOG_1 ); addr =FIELD_GET (AL_POS_ERROR_LOG_0_ADDR_LOW , log0); - addr |= (FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1) <<32 ); + addr |= (((u64 )FIELD_GET (AL_POS_ERROR_LOG_1_ADDR_HIGH , log1)) <<32 ); request_id =FIELD_GET (AL_POS_ERROR_LOG_1_REQUEST_ID , log1); bresp =FIELD_GET (AL_POS_ERROR_LOG_1_BRESP , log1);
Quoted 4 lines
Quoted 3 lines
Signature · 1 line
2.7.4This fix should be squashed into the previous patch.
Sure, Shall be part of v3.
Quoted 5 lines
Thanks,
M.