Amazon's Annapurna Labs POS Driver
Subsystems (2)
v6 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 v5:
=================
- added missing include to dt binding
Changes since v4:
================
- fixed dt binding according to new dt scheme
- added back the use of _relaxed accessors
Changes since v3:
=================
- ported to be edac device
- converted dt-bindings to new scheme
- added unit address to dt example
Changes since v2:
=================
- squashed left shifting fix to the driver
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 (2):
dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
soc: amazon: al-pos-edac: Introduce Amazon's Annapurna Labs POS EDAC
driver
.../bindings/edac/amazon,al-pos-edac.yaml | 41 +++++ MAINTAINERS | 7 + drivers/edac/Kconfig | 6 + drivers/edac/Makefile | 1 + drivers/edac/al_pos_edac.c | 173 +++++++++++++++++++++ 5 files changed, 228 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml create mode 100644 drivers/edac/al_pos_edac.c
Signature · 1 line
2.7.4
PATCH v6 1/2 dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
Document Amazon's Annapurna Labs POS SoC binding.
--- .../bindings/edac/amazon,al-pos-edac.yaml | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml
Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml new file +41 -0
@@ -0,0 +1,41 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/edac/amazon,al-pos-edac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amazon's Annapurna Labs POS + +maintainers: + - Talel Shenhar <[email protected]> + - Talel Shenhar <[email protected]> + +description: | + POS node is defined to describe the Point Of Serialization (POS) error + detection capability. + +properties: + + compatible: + const: "amazon,al-pos-edac" + + reg: + maxItems: 1 + + interrupts: + description: Interrupt for the error event. + maxItems: 1 + +required: + - compatible + - reg + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + edac@f0070084 { + compatible = "amazon,al-pos-edac"; + reg = <0x0 0xf0070084 0x0 0x00000008>; + interrupt-parent = <&amazon_system_fabric>; + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
2.7.4
Re: [PATCH v6 1/2] dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
Quoted 8 lines · Talel Shenhar
Document Amazon's Annapurna Labs POS SoC binding.
Signed-off-by Talel Shenhar <[email protected]>--- .../bindings/edac/amazon,al-pos-edac.yaml | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml
Re: [PATCH v6 1/2] dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS
Quoted 10 lines · Rob Herring
Quoted 8 lines · Talel Shenhar
Document Amazon's Annapurna Labs POS SoC binding.
Signed-off-by Talel Shenhar <[email protected]>--- .../bindings/edac/amazon,al-pos-edac.yaml | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+)create mode 100644
Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yamlReviewed-by Rob Herring <[email protected]>
Thanks Rob, shall add your reviewed-by with a minor fix, add "-only" to the GPL.
PATCH v6 2/2 soc: amazon: al-pos-edac: Introduce Amazon's Annapurna Labs POS EDAC 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 error shall be reported to EDAC subsystem as uncorrectable-error.
--- MAINTAINERS | 7 ++ drivers/edac/Kconfig | 6 ++ drivers/edac/Makefile | 1 + drivers/edac/al_pos_edac.c | 173 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 drivers/edac/al_pos_edac.c
MAINTAINERS +7 -0
@@ -757,6 +757,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS POS EDAC DRIVER +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml +F: drivers/edac/al-pos-edac.c + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintained
drivers/edac/Kconfig +6 -0
@@ -100,6 +100,12 @@ config EDAC_AMD64_ERROR_INJECTION In addition, there are two control files, inject_read and inject_write, which trigger the DRAM ECC Read and Write respectively. +config EDAC_AL_POS + tristate "Amazon's Annapurna Labs POS EDAC driver" + depends on (ARCH_ALPINE || COMPILE_TEST) + help + Include support for the SoC POS EDAC error capability. + config EDAC_AMD76X tristate "AMD 76x (760, 762, 768)" depends on PCI && X86_32
drivers/edac/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_EDAC_GHES) += ghes_edac.o edac_mce_amd-y := mce_amd.o obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o +obj-$(CONFIG_EDAC_AL_POS) += al_pos_edac.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o obj-$(CONFIG_EDAC_I5000) += i5000_edac.o
drivers/edac/al_pos_edac.c new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v6 2/2] soc: amazon: al-pos-edac: Introduce Amazon's Annapurna Labs POS EDAC driver
Hi Talel,
Quoted 2 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
(This is tricky to parse. "error in case write error" -> "error when a write error occurs"?)
Quoted 9 lines
write to a read only register).
This error shall be reported to EDAC subsystem as uncorrectable-error.MAINTAINERS +0
-0
MAINTAINERS F: drivers/tty/serial/altera_jtaguart.c · line 766
Quoted 10 lines
MAINTAINERS +6
-0@@ -757,6 +757,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS POS EDAC DRIVER +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml +F: drivers/edac/al-pos-edac.c
~s/-/_/
Quoted 13 lines
drivers/edac/al_pos_edac.c new file +5
-0@@ -0,0 +1,173 @@ +static int al_pos_handle (struct al_pos_edac *al_pos) +{ + log1 =readl_relaxed (al_pos->mmio_base +AL_POS_ERROR_LOG_1 ); +if (!FIELD_GET (AL_POS_ERROR_LOG_1_VALID , log1)) +return 0 ;
[...]
Quoted 4 lines
drivers/edac/al_pos_edac.c new file +4
-0+edac_device_handle_ue (al_pos->edac_dev,0 ,0 , msg); + +return 1 ; +}
[...]
Quoted 19 lines
drivers/edac/al_pos_edac.c new file +16
-0+static irqreturn_t al_pos_irq_handler (int irq,void *info) +{ +if (al_pos_handle (al_pos)) +return IRQ_HANDLED ; +return IRQ_NONE ; +} +static int al_pos_probe (struct platform_device *pdev) +{ +struct edac_device_ctl_info *edac_dev; +struct al_pos_edac *al_pos; +int ret; + + edac_dev =edac_device_alloc_ctl_info (sizeof (*al_pos),DRV_NAME ,1 , +DRV_NAME ,1 ,0 ,NULL ,0 , +edac_device_alloc_index ()); +if (!edac_dev)
drivers/edac/al_pos_edac.c line 96
Quoted 10 lines
drivers/edac/al_pos_edac.c new file +10
-0+return -ENOMEM ; + + al_pos = edac_dev->pvt_info; + al_pos->edac_dev = edac_dev; +platform_set_drvdata (pdev, al_pos); + + al_pos->mmio_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (al_pos->mmio_base)) { +dev_err (&pdev->dev,"failed to ioremap memory (%ld)\n" , +PTR_ERR (al_pos->mmio_base));
edac_device_free_ctl_info(al_pos->edac_dev) or goto err_free_edac ?
drivers/edac/al_pos_edac.c line 107
Quoted 11 lines
drivers/edac/al_pos_edac.c new file +11
-0+return PTR_ERR (al_pos->mmio_base); + } + + al_pos->irq =platform_get_irq (pdev,0 ); +if (al_pos->irq <=0 ) + edac_dev->edac_check = al_pos_edac_check; + + edac_dev->dev = &pdev->dev; + edac_dev->mod_name =DRV_NAME ; + edac_dev->dev_name =dev_name (&pdev->dev); + edac_dev->ctl_name ="POS" ;
Does this show up in sysfs? The 'AL_' prefix may make it easier to find the corresponding driver. (The TLA space is a little crowded!)
drivers/edac/al_pos_edac.c line 119
Quoted 12 lines
drivers/edac/al_pos_edac.c new file +11
-0+ ret =edac_device_add_device (edac_dev); +if (ret) { +dev_err (&pdev->dev,"Failed to add edac device\n" ); + goto err_free_edac; + } + +if (al_pos->irq >0 ) { + ret = devm_request_irq(&pdev->dev, + al_pos->irq, + al_pos_irq_handler, + 0,
Can this be IRQF_SHARED? This lets other devices register the interrupt too, which is easily allowed if you can identify whether your device has triggered the interrupt. (which you are already doing with the valid bit in your log1 register).
Quoted 9 lines
drivers/edac/al_pos_edac.c new file +9
-0+ pdev->name, + pdev); +if (ret !=0 ) { +dev_err (&pdev->dev, +"failed to register to irq %d (%d)\n" , + al_pos->irq, ret); + goto err_remove_edac; + } + }
drivers/edac/al_pos_edac.c line 138
Quoted 10 lines
drivers/edac/al_pos_edac.c new file +10
-0+ +return 0 ; + +err_remove_edac: +edac_device_del_device (edac_dev->dev); +err_free_edac: +edac_device_free_ctl_info (edac_dev); + +return ret; +}
With the edac_dev-leak fixed and the -/_ in MAINTAINERS:
Thanks,
James
Re: [PATCH v6 2/2] soc: amazon: al-pos-edac: Introduce Amazon's Annapurna Labs POS EDAC driver
Quoted 6 lines · James Morse
Hi Talel,
Quoted 2 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
(This is tricky to parse. "error in case write error" -> "error when a write error occurs"?)
ack
Quoted 12 lines
Quoted 12 lines
write to a read only register).
This error shall be reported to EDAC subsystem as uncorrectable-error.MAINTAINERS +0
-0@@ -757,6 +757,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h
Quoted 7 lines
MAINTAINERS F: drivers/tty/serial/altera_jtaguart.c · line 765
Quoted 6 lines
MAINTAINERS +6
-0+AMAZON ANNAPURNA LABS POS EDAC DRIVER +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/edac/amazon,al-pos-edac.yaml +F: drivers/edac/al-pos-edac.c~s/-/_/
ack
Quoted 41 lines
Quoted 13 lines
drivers/edac/al_pos_edac.c new file +5
-0@@ -0,0 +1,173 @@ +static int al_pos_handle (struct al_pos_edac *al_pos) +{ + log1 =readl_relaxed (al_pos->mmio_base +AL_POS_ERROR_LOG_1 ); +if (!FIELD_GET (AL_POS_ERROR_LOG_1_VALID , log1)) +return 0 ;[...]
Quoted 4 lines
drivers/edac/al_pos_edac.c new file +4
-0+edac_device_handle_ue (al_pos->edac_dev,0 ,0 , msg); + +return 1 ; +}[...]
Quoted 20 lines
drivers/edac/al_pos_edac.c new file +19
-0+static irqreturn_t al_pos_irq_handler (int irq,void *info) +{ +if (al_pos_handle (al_pos)) +return IRQ_HANDLED ; +return IRQ_NONE ; +} +static int al_pos_probe (struct platform_device *pdev) +{ +struct edac_device_ctl_info *edac_dev; +struct al_pos_edac *al_pos; +int ret; + + edac_dev =edac_device_alloc_ctl_info (sizeof (*al_pos),DRV_NAME ,1 , +DRV_NAME ,1 ,0 ,NULL ,0 , +edac_device_alloc_index ()); +if (!edac_dev) +return -ENOMEM ; + + al_pos = edac_dev->pvt_info;
Quoted 8 lines
drivers/edac/al_pos_edac.c line 96
Quoted 7 lines
drivers/edac/al_pos_edac.c new file +7
-0+ al_pos->edac_dev = edac_dev; +platform_set_drvdata (pdev, al_pos); + + al_pos->mmio_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (al_pos->mmio_base)) { +dev_err (&pdev->dev,"failed to ioremap memory (%ld)\n" , +PTR_ERR (al_pos->mmio_base));
edac_device_free_ctl_info(al_pos->edac_dev)or gotoerr_free_edac?
ack, shall add managed handling using devm
Quoted 14 lines
drivers/edac/al_pos_edac.c line 107
Quoted 12 lines
drivers/edac/al_pos_edac.c new file +11
-0+return PTR_ERR (al_pos->mmio_base); + } + + al_pos->irq =platform_get_irq (pdev,0 ); +if (al_pos->irq <=0 ) + edac_dev->edac_check = al_pos_edac_check; + + edac_dev->dev = &pdev->dev; + edac_dev->mod_name =DRV_NAME ; + edac_dev->dev_name =dev_name (&pdev->dev); + edac_dev->ctl_name ="POS" ;Does this show up in sysfs? The '
AL_' prefix may make it easier to find the corresponding driver. (The TLA space is a little crowded!)
ack
Quoted 16 lines
drivers/edac/al_pos_edac.c line 119
Quoted 13 lines
drivers/edac/al_pos_edac.c new file +11
-0+ ret =edac_device_add_device (edac_dev); +if (ret) { +dev_err (&pdev->dev,"Failed to add edac device\n" ); + goto err_free_edac; + } + +if (al_pos->irq >0 ) { + ret = devm_request_irq(&pdev->dev, + al_pos->irq, + al_pos_irq_handler, + 0,Can this be
IRQF_SHARED? This lets other devices register the interrupt too, which is easily allowed if you can identify whether your device has triggered the interrupt. (which you are already doing with the valid bit in your log1 register).
ack
Quoted 24 lines
Quoted 11 lines
drivers/edac/al_pos_edac.c new file +9
-0+ pdev->name, + pdev); +if (ret !=0 ) { +dev_err (&pdev->dev, +"failed to register to irq %d (%d)\n" , + al_pos->irq, ret); + goto err_remove_edac; + } + }drivers/edac/al_pos_edac.c line 138
Quoted 10 lines
drivers/edac/al_pos_edac.c new file +10
-0+ +return 0 ; + +err_remove_edac: +edac_device_del_device (edac_dev->dev); +err_free_edac: +edac_device_free_ctl_info (edac_dev); + +return ret; +}With the edac_dev-leak fixed and the -/_ in
MAINTAINERS:
Quoted 1 line
Reviewed-by James Morse <[email protected]>
thanks. shall post v7 with the fixes
Quoted 5 lines
Thanks,
James