Krait L1/L2 EDAC driver
Subsystems (5)
v4 cover Krait L1/L2 EDAC driver
This patchset adds support for the Krait L1/L2 cache error detection hardware. The first patch fixes a generic framework bug. The next two patches lay the groundwork for this driver to be added by exporting percpu irq functions as well as adding the Krait l2 indirection register code. The next two patches add the driver and the binding and the final patch hooks it all up by adding the device tree node.
I'm not sure which tree this is supposed to go through. Ideally we could send the first 3 plus the 5th one through an edac tree. The final dts changes could go through arm-soc via davidb's tree and the Documentation patch could go through the devicetree tree.
Changes since v3:
* Fixed l1_irq handler to properly dereference dev_id
Changes since v2:
* Picked up acks
* s/an/a/ in DT binding
Changes since v1:
* Moved binding into cpus node
* Picked up acks on first two patches
* Commented krait l2 accessor functions
Stephen Boyd (6):
edac: Don't try to cancel workqueue when it's never setup
genirq: export percpu irq functions for module usage
ARM: Add Krait L2 accessor functions
devicetree: bindings: Document Krait L1/L2 EDAC
edac: Add support for Krait CPU cache error detection
ARM: dts: msm: Add Krait CPU/L2 nodes
Documentation/devicetree/bindings/arm/cpus.txt | 72 +++++ arch/arm/boot/dts/qcom-msm8974.dtsi | 41 +++ arch/arm/common/Kconfig | 3 + arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++ arch/arm/include/asm/krait-l2-accessors.h | 20 ++ drivers/edac/Kconfig | 8 + drivers/edac/Makefile | 2 + drivers/edac/edac_device.c | 3 + drivers/edac/krait_edac.c | 346 +++++++++++++++++++++++++ kernel/irq/manage.c | 2 + 11 files changed, 556 insertions(+) create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.h create mode 100644 drivers/edac/krait_edac.c
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 1/6 edac: Don't try to cancel workqueue when it's never setup
We only setup a workqueue for edac devices that use the polling method. We still try to cancel the workqueue if an edac_device uses the irq method though. This causes a warning from debug objects when we remove an edac device:
WARNING: CPU: 0 PID: 56 at lib/debugobjects.c:260 debug_print_object+0x98/0xc0() ODEBUG: assert_init not available (active state 0) object type: timer_list hint: stub_timer+0x0/0x28 Modules linked in: krait_edac(-) CPU: 0 PID: 56 Comm: rmmod Not tainted 3.12.0-rc2-00035-g15292a0 #69 (unwind_backtrace+0x0/0x144) (show_stack+0x20/0x24) (dump_stack+0x74/0xb4) (warn_slowpath_common+0x78/0x9c) (warn_slowpath_fmt+0x40/0x48) (debug_print_object+0x98/0xc0) (debug_object_assert_init+0xdc/0xec) (del_timer+0x24/0x7c) (try_to_grab_pending+0xc0/0x1b0) (cancel_delayed_work+0x2c/0xa0) (edac_device_workq_teardown+0x1c/0x38) (edac_device_del_device+0xb8/0xe4) (krait_edac_remove+0x50/0x70 [krait_edac]) (platform_drv_remove+0x24/0x28) (__device_release_driver+0x68/0xc0) (driver_detach+0xc4/0xc8) (bus_remove_driver+0xac/0x114) (driver_unregister+0x38/0x58) (platform_driver_unregister+0x1c/0x20) (krait_edac_driver_exit+0x14/0x1c [krait_edac]) (SyS_delete_module+0x178/0x2b4)
Fix it by skipping the workqueue teardown for such devices.
--- drivers/edac/edac_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/edac/edac_device.c +3 -0
@@ -437,6 +437,9 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) {int status; +if (!edac_dev->edac_check) +return ; + status =cancel_delayed_work (&edac_dev->work);if (status ==0 ) {/* workq instance might be running, wait for it */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v4 1/6] edac: Don't try to cancel workqueue when it's never setup
Quoted 31 lines · Stephen Boyd
We only setup a workqueue for edac devices that use the polling method. We still try to cancel the workqueue if an
edac_deviceuses the irq method though. This causes a warning from debug objects when we remove an edac device:WARNING: CPU: 0 PID: 56 at lib/debugobjects.c:260 debug_print_object+0x98/0xc0() ODEBUG: assert_init not available (active state 0) object type: timer_list hint: stub_timer+0x0/0x28 Modules linked in: krait_edac(-) CPU: 0 PID: 56 Comm: rmmod Not tainted 3.12.0-rc2-00035-g15292a0 #69 (unwind_backtrace+0x0/0x144) (show_stack+0x20/0x24) (dump_stack+0x74/0xb4) (warn_slowpath_common+0x78/0x9c) (warn_slowpath_fmt+0x40/0x48) (debug_print_object+0x98/0xc0) (debug_object_assert_init+0xdc/0xec) (del_timer+0x24/0x7c) (try_to_grab_pending+0xc0/0x1b0) (cancel_delayed_work+0x2c/0xa0) (edac_device_workq_teardown+0x1c/0x38) (edac_device_del_device+0xb8/0xe4) (krait_edac_remove+0x50/0x70 [krait_edac]) (platform_drv_remove+0x24/0x28) (__device_release_driver+0x68/0xc0) (driver_detach+0xc4/0xc8) (bus_remove_driver+0xac/0x114) (driver_unregister+0x38/0x58) (platform_driver_unregister+0x1c/0x20) (krait_edac_driver_exit+0x14/0x1c [krait_edac]) (SyS_delete_module+0x178/0x2b4)
Quoted 4 lines
Fix it by skipping the workqueue teardown for such devices.
Acked-by Borislav Petkov <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Applied, thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--PATCH v4 2/6 genirq: export percpu irq functions for module usage
In reply to Stephen BoydIn the near future we're going to use these percpu irq functions in the Krait CPU EDAC driver. Export them so that the EDAC driver can be compiled as a module.
--- kernel/irq/manage.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/irq/manage.c +2 -0
@@ -1623,6 +1623,7 @@ void free_percpu_irq(unsigned int irq, void __percpu *dev_id)kfree (__free_percpu_irq (irq, dev_id));chip_bus_sync_unlock (desc); } +EXPORT_SYMBOL_GPL (free_percpu_irq);/** * setup_percpu_irq - setup a per-cpu interrupt
@@ -1693,3 +1694,4 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return retval; } +EXPORT_SYMBOL_GPL (request_percpu_irq);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v4 2/6] genirq: export percpu irq functions for module usage
Quoted 6 lines · Stephen Boyd
In the near future we're going to use these percpu irq functions in the Krait CPU EDAC driver. Export them so that the EDAC driver can be compiled as a module.
Acked-by Thomas Gleixner <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Applied, thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--PATCH v4 3/6 ARM: Add Krait L2 accessor functions
In reply to Stephen BoydKrait CPUs have a handful of L2 cache controller registers that live behind a cp15 based indirection register. First you program the indirection register (l2cpselr) to point the L2 'window' register (l2cpdr) at what you want to read/write. Then you read/write the 'window' register to do what you want. The l2cpselr register is not banked per-cpu so we must lock around accesses to it to prevent other CPUs from re-pointing l2cpdr underneath us.
--- arch/arm/common/Kconfig | 3 ++ arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++ 4 files changed, 82 insertions(+) create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.h
arch/arm/common/Kconfig +3 -0
@@ -9,6 +9,9 @@ config DMABOUNCE bool select ZONE_DMA +config KRAIT_L2_ACCESSORS + bool + config SHARP_LOCOMO bool
arch/arm/common/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += firmware.o obj-$(CONFIG_ICST) += icst.o obj-$(CONFIG_SA1111) += sa1111.o obj-$(CONFIG_DMABOUNCE) += dmabounce.o +obj-$(CONFIG_KRAIT_L2_ACCESSORS) += krait-l2-accessors.o obj-$(CONFIG_SHARP_LOCOMO) += locomo.o obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o
arch/arm/common/krait-l2-accessors.c new file +58 -0
58 lines not on this page · raw message
arch/arm/include/asm/krait-l2-accessors.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASMARM_KRAIT_L2_ACCESSORS_H +#define __ASMARM_KRAIT_L2_ACCESSORS_H + +extern void set_l2_indirect_reg (u32 addr,u32 val); +extern u32 get_l2_indirect_reg (u32 addr); + +#endif
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Borislav Petkov
maintainerRe: [PATCH v4 3/6] ARM: Add Krait L2 accessor functions
Quoted 9 lines · Stephen Boyd
Krait CPUs have a handful of L2 cache controller registers that live behind a cp15 based indirection register. First you program the indirection register (l2cpselr) to point the L2 'window' register (l2cpdr) at what you want to read/write. Then you read/write the 'window' register to do what you want. The l2cpselr register is not banked per-cpu so we must lock around accesses to it to prevent other CPUs from re-pointing l2cpdr underneath us.
Quoted 8 lines
Cc Mark Rutland <[email protected]>Cc Russell King <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- arch/arm/common/Kconfig | 3 ++ arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++
I'm no ARM guy but out of curiosity, why is this code not part of the krait edac driver? IOW, is there a compelling reason for it to be in arch/arm/common/?
Quoted 108 lines
4 files changed, 82 insertions(+) create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.harch/arm/common/Kconfig +3
-0@@ -9,6 +9,9 @@ config DMABOUNCE bool select ZONE_DMA +config KRAIT_L2_ACCESSORS + bool + config SHARP_LOCOMO boolarch/arm/common/Makefile +1
-0@@ -7,6 +7,7 @@ obj-y += firmware.o obj-$(CONFIG_ICST) += icst.o obj-$(CONFIG_SA1111) += sa1111.o obj-$(CONFIG_DMABOUNCE) += dmabounce.o +obj-$(CONFIG_KRAIT_L2_ACCESSORS) += krait-l2-accessors.o obj-$(CONFIG_SHARP_LOCOMO) += locomo.o obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.oarch/arm/common/krait-l2-accessors.c new file +58
-0@@ -0,0 +1,58 @@ +/* +* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/spinlock.h> +#include <linux/export.h> + +#include <asm/barrier.h> +#include <asm/krait-l2-accessors.h> + +static DEFINE_RAW_SPINLOCK (krait_l2_lock); + +void set_l2_indirect_reg (u32 addr,u32 val) +{ +unsigned long flags; + +raw_spin_lock_irqsave (&krait_l2_lock, flags); +/* +* Select the L2 window by poking l2cpselr, then write to the window +* via l2cpdr. +*/ + asmvolatile ("mcr p15, 3, %0, c15, c0, 6 @ l2cpselr" : :"r" (addr)); +isb (); + asmvolatile ("mcr p15, 3, %0, c15, c0, 7 @ l2cpdr" : :"r" (val)); +isb (); + +raw_spin_unlock_irqrestore (&krait_l2_lock, flags); +} +EXPORT_SYMBOL (set_l2_indirect_reg); + +u32 get_l2_indirect_reg (u32 addr) +{ +u32 val; +unsigned long flags; + +raw_spin_lock_irqsave (&krait_l2_lock, flags); +/* +* Select the L2 window by poking l2cpselr, then read from the window +* via l2cpdr. +*/ + asmvolatile ("mcr p15, 3, %0, c15, c0, 6 @ l2cpselr" : :"r" (addr)); +isb (); + asmvolatile ("mrc p15, 3, %0, c15, c0, 7 @ l2cpdr" :"=r" (val)); + +raw_spin_unlock_irqrestore (&krait_l2_lock, flags); + +return val; +} +EXPORT_SYMBOL (get_l2_indirect_reg);arch/arm/include/asm/krait-l2-accessors.h new file +8
-0@@ -0,0 +1,20 @@ +/* +* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful,
arch/arm/include/asm/krait-l2-accessors.h line 18
Quoted 10 lines
arch/arm/include/asm/krait-l2-accessors.h new file +10
-0+* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASMARM_KRAIT_L2_ACCESSORS_H +#define __ASMARM_KRAIT_L2_ACCESSORS_H + +extern void set_l2_indirect_reg (u32 addr,u32 val); +extern u32 get_l2_indirect_reg (u32 addr);
No need for the "extern"s here.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [PATCH v4 3/6] ARM: Add Krait L2 accessor functions
Quoted 18 lines · Borislav Petkov
Quoted 9 lines · Stephen Boyd
Krait CPUs have a handful of L2 cache controller registers that live behind a cp15 based indirection register. First you program the indirection register (l2cpselr) to point the L2 'window' register (l2cpdr) at what you want to read/write. Then you read/write the 'window' register to do what you want. The l2cpselr register is not banked per-cpu so we must lock around accesses to it to prevent other CPUs from re-pointing l2cpdr underneath us.
Quoted 8 lines
Cc Mark Rutland <[email protected]>Cc Russell King <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- arch/arm/common/Kconfig | 3 ++ arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++
Quoted 3 lines
I'm no ARM guy but out of curiosity, why is this code not part of the krait edac driver? IOW, is there a compelling reason for it to be in
arch/arm/common/?
This is used for more than just the edac driver. In the future, we'll need this for the cpufreq driver and the l2 performance monitor driver. I suppose I could have stated that in the commit text.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v4 3/6] ARM: Add Krait L2 accessor functions
In reply to Stephen BoydQuoted 20 lines · Stephen Boyd
Krait CPUs have a handful of L2 cache controller registers that live behind a cp15 based indirection register. First you program the indirection register (l2cpselr) to point the L2 'window' register (l2cpdr) at what you want to read/write. Then you read/write the 'window' register to do what you want. The l2cpselr register is not banked per-cpu so we must lock around accesses to it to prevent other CPUs from re-pointing l2cpdr underneath us.
Cc Mark Rutland <[email protected]>Cc Russell King <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- arch/arm/common/Kconfig | 3 ++ arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++ 4 files changed, 82 insertions(+) create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.h
[...]
arch/arm/include/asm/krait-l2-accessors.h line 18
Quoted 3 lines
arch/arm/include/asm/krait-l2-accessors.h new file +3
-0+ +extern void set_l2_indirect_reg (u32 addr,u32 val); +extern u32 get_l2_indirect_reg (u32 addr);
As these are Krait specific, please rename the functions to reflect this.
-Courtney
Re: [PATCH v4 3/6] ARM: Add Krait L2 accessor functions
Quoted 21 lines · Courtney Cavin
Quoted 12 lines · Stephen Boyd
Krait CPUs have a handful of L2 cache controller registers that live behind a cp15 based indirection register. First you program the indirection register (l2cpselr) to point the L2 'window' register (l2cpdr) at what you want to read/write. Then you read/write the 'window' register to do what you want. The l2cpselr register is not banked per-cpu so we must lock around accesses to it to prevent other CPUs from re-pointing l2cpdr underneath us.
Cc Mark Rutland <[email protected]>Cc Russell King <[email protected]>Signed-off-by Stephen Boyd <[email protected]>Quoted 8 lines
--- arch/arm/common/Kconfig | 3 ++ arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++ 4 files changed, 82 insertions(+) create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.h
Quoted 7 lines
[...]
arch/arm/include/asm/krait-l2-accessors.h line 18
Quoted 3 lines
arch/arm/include/asm/krait-l2-accessors.h new file +3
-0+ +extern void set_l2_indirect_reg (u32 addr,u32 val); +extern u32 get_l2_indirect_reg (u32 addr);As these are Krait specific, please rename the functions to reflect this.
Ok. Borislav, should I resend to add krait_ before these functions?
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Borislav Petkov
maintainerRe: [PATCH v4 3/6] ARM: Add Krait L2 accessor functions
Quoted 1 line · Stephen Boyd
Ok. Borislav, should I resend to add
krait_before these functions?
Yes please - I can't even build-test here so I'm relying on you.
That's why I thought it might be a better idea for this purely arm patch to go through some other tree where it sees some build-testing at least.
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--PATCH v4 4/6 devicetree: bindings: Document Krait L1/L2 EDAC
In reply to Stephen BoydThe Krait L1/L2 error reporting device is made up of two interrupts, one per-CPU interrupt for the L1 caches and one interrupt for the L2 cache.
--- Documentation/devicetree/bindings/arm/cpus.txt | 72 ++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +72 -0
@@ -191,6 +191,35 @@ nodes to be present and contain the properties described below. property identifying a 64-bit zero-initialised memory location. + - interrupts + Usage: required for cpus with compatible string "qcom,krait". + Value type: <prop-encoded-array> + Definition: L1/CPU error interrupt + + - next-level-cache + Usage: optional + Value type: <phandle> + Definition: phandle pointing to the next level cache + +- cache node + + Description: Describes a cache in an ARM based system + + - compatible + Usage: required + Value type: <string> + Definition: shall contain at least "cache" + + - cache-level + Usage: required + Value type: <u32> + Definition: level in the cache heirachy + + - interrupts + Usage: required for cpus with compatible string "qcom,krait" + Value type: <prop-encoded-array> + Definition: the L2 error interrupt + Example 1 (dual-cluster big.LITTLE system 32-bit): cpus {
@@ -382,3 +411,46 @@ cpus { cpu-release-addr = <0 0x20000000>; }; }; + + +Example 5 (Krait 32-bit system): + +cpus { + #address-cells = <1>; + #size-cells = <0>; + interrupts = <1 9 0xf04>; + + cpu at 0 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <0>; + next-level-cache = <&L2>; + }; + + cpu at 1 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <3>; + next-level-cache = <&L2>; + }; + + L2: l2-cache { + compatible = "cache"; + cache-level = <2>; + interrupts = <0 2 0x4>; + }; +};
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v4 4/6] devicetree: bindings: Document Krait L1/L2 EDAC
Quoted 22 lines · Stephen Boyd
The Krait L1/L2 error reporting device is made up of two interrupts, one per-CPU interrupt for the L1 caches and one interrupt for the L2 cache.
Cc Lorenzo Pieralisi <[email protected]>Cc Mark Rutland <[email protected]>Cc Kumar Gala <[email protected]>Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- Documentation/devicetree/bindings/arm/cpus.txt | 72 ++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)Documentation/devicetree/bindings/arm/cpus.txt +1
-0@@ -191,6 +191,35 @@ nodes to be present and contain the properties described below. property identifying a 64-bit zero-initialised memory location. + - interrupts
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 204
Quoted 10 lines
Documentation/devicetree/bindings/arm/cpus.txt +10
-0+ Usage: required for cpus with compatible string "qcom,krait". + Value type: <prop-encoded-array> + Definition: L1/CPU error interrupt + + - next-level-cache + Usage: optional + Value type: <phandle> + Definition: phandle pointing to the next level cache + +- cache node
Not sure this binding (cache node) belongs in cpus.txt
I am working on defining cache bindings for ARM within the C-state standardization effort:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/215543.html
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 211
Quoted 7 lines
Documentation/devicetree/bindings/arm/cpus.txt +7
-0+ + Description: Describes a cache in an ARM based system + + - compatible + Usage: required + Value type: <string> + Definition: shall contain at least "cache"
It is a bit vague, can't we just follow the ePAPR compatible definition ? See posting above.
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 216
Quoted 5 lines
Documentation/devicetree/bindings/arm/cpus.txt +5
-0+ + - cache-level + Usage: required + Value type: <u32> + Definition: level in the cache heirachy
"hierarchy". I have a problem with the cache level definition, and in particular the numbering, ie what the level number represents. If we mean the cache level seen through the CLIDR and co., it is hard to use it for shared caches since the level seen by different CPUs can actually be different, or put it differently the level number might not be unique for a shared cache. I need to think about a proper way to sort this out.
Lorenzo
Re: [PATCH v4 4/6] devicetree: bindings: Document Krait L1/L2 EDAC
Quoted 7 lines · Lorenzo Pieralisi
Not sure this binding (cache node) belongs in cpus.txt
I am working on defining cache bindings for ARM within the C-state standardization effort:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/215543.html
Thanks I'll take a look.
Quoted 11 lines
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 211
Quoted 8 lines
Documentation/devicetree/bindings/arm/cpus.txt +7
-0+ + Description: Describes a cache in an ARM based system + + - compatible + Usage: required + Value type: <string> + Definition: shall contain at least "cache"It is a bit vague, can't we just follow the ePAPR compatible definition ? See posting above.
Hm.. I thought this did follow the ePAPR spec. I see 'compatible, required, string, A standard property. The value shall include the string "cache".' Looks the same?
And I see 'cache-level, required, u32, Specifies the level in the cache hierarchy. For example, a level 2 cache has a value of <2>.'
Quoted 8 lines
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 216
Quoted 6 lines
Documentation/devicetree/bindings/arm/cpus.txt +5
-0+ + - cache-level + Usage: required + Value type: <u32> + Definition: level in the cache heirachy"hierarchy".
Thanks.
Quoted 7 lines
I have a problem with the cache level definition, and in particular the numbering, ie what the level number represents. If we mean the cache level seen through the CLIDR and co., it is hard to use it for shared caches since the level seen by different CPUs can actually be different, or put it differently the level number might not be unique for a shared cache. I need to think about a proper way to sort this out.
Ok. I don't even use this property in my driver. All I really need is the phandle from cpus pointing to the L2 and the interrupts property in the L2 node.
How do you want to proceed here? If your cache binding goes through I would just need to add the interrupts part. Or you could even add that part in the same patch, you could have my signed-off-by for that.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v4 4/6] devicetree: bindings: Document Krait L1/L2 EDAC
Quoted 23 lines · Stephen Boyd
Quoted 7 lines · Lorenzo Pieralisi
Not sure this binding (cache node) belongs in cpus.txt
I am working on defining cache bindings for ARM within the C-state standardization effort:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/215543.html
Thanks I'll take a look.
Quoted 11 lines
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 211
Quoted 8 lines
Documentation/devicetree/bindings/arm/cpus.txt +7
-0+ + Description: Describes a cache in an ARM based system + + - compatible + Usage: required + Value type: <string> + Definition: shall contain at least "cache"It is a bit vague, can't we just follow the ePAPR compatible definition ? See posting above.
Quoted 3 lines
Hm.. I thought this did follow the ePAPR spec. I see 'compatible, required, string, A standard property. The value shall include the string "cache".' Looks the same?
Sorry, my bad, you are right.
Quoted 3 lines
And I see 'cache-level, required, u32, Specifies the level in the cache hierarchy. For example, a level 2 cache has a value of <2>.'
We need to define it properly for ARM, I am not sure we can use level as defined in CLIDR, I need to think more about this.
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 216
Quoted 6 lines
Documentation/devicetree/bindings/arm/cpus.txt +5
-0+ + - cache-level + Usage: required + Value type: <u32> + Definition: level in the cache heirachy"hierarchy".
Thanks.
Quoted 7 lines
I have a problem with the cache level definition, and in particular the numbering, ie what the level number represents. If we mean the cache level seen through the CLIDR and co., it is hard to use it for shared caches since the level seen by different CPUs can actually be different, or put it differently the level number might not be unique for a shared cache. I need to think about a proper way to sort this out.
Quoted 8 lines
Ok. I don't even use this property in my driver. All I really need is the phandle from cpus pointing to the L2 and the interrupts property in the L2 node.
How do you want to proceed here? If your cache binding goes through I would just need to add the interrupts part. Or you could even add that part in the same patch, you could have my signed-off-by for that.
Ok, I will try to update the bindings with the interrupt part and copy you in, even though the level definition worries me a bit, it is an important property for power management and I need to find a proper solution before bindings can get accepted (basically the problem is:
if different CPUs can see a cache at different levels as defined in the CLIDR we cannot describe a cache with a single cache level or put it differently, level can not represent the value in the CLIDR hence we need to describe it differently).
Lorenzo
Re: [PATCH v4 4/6] devicetree: bindings: Document Krait L1/L2 EDAC
Quoted 18 lines · Lorenzo Pieralisi
Quoted 9 lines · Stephen Boyd
Quoted 7 lines · Lorenzo Pieralisi
I have a problem with the cache level definition, and in particular the numbering, ie what the level number represents. If we mean the cache level seen through the CLIDR and co., it is hard to use it for shared caches since the level seen by different CPUs can actually be different, or put it differently the level number might not be unique for a shared cache. I need to think about a proper way to sort this out.
Quoted 8 lines
Ok. I don't even use this property in my driver. All I really need is the phandle from cpus pointing to the L2 and the interrupts property in the L2 node.
How do you want to proceed here? If your cache binding goes through I would just need to add the interrupts part. Or you could even add that part in the same patch, you could have my signed-off-by for that.
Quoted 8 lines
Ok, I will try to update the bindings with the interrupt part and copy you in, even though the level definition worries me a bit, it is an important property for power management and I need to find a proper solution before bindings can get accepted (basically the problem is:
if different CPUs can see a cache at different levels as defined in the CLIDR we cannot describe a cache with a single cache level or put it differently, level can not represent the value in the CLIDR hence we need to describe it differently).
Ok. I've dropped the cache part from this patch. I left the example as is minus the cache-level attribute.
Understanding how the cache-level value would be used might help. I wonder if the cache-level can just be a number that describes the largest value that the cache could be assigned. Then if you have different CPUs seeing different levels of cache they can traverse from their CPU node to the cache and count how many phandles they went through.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v4 4/6] devicetree: bindings: Document Krait L1/L2 EDAC
Quoted 28 lines · Stephen Boyd
Quoted 18 lines · Lorenzo Pieralisi
Quoted 9 lines · Stephen Boyd
Quoted 7 lines · Lorenzo Pieralisi
I have a problem with the cache level definition, and in particular the numbering, ie what the level number represents. If we mean the cache level seen through the CLIDR and co., it is hard to use it for shared caches since the level seen by different CPUs can actually be different, or put it differently the level number might not be unique for a shared cache. I need to think about a proper way to sort this out.
Quoted 8 lines
Ok. I don't even use this property in my driver. All I really need is the phandle from cpus pointing to the L2 and the interrupts property in the L2 node.
How do you want to proceed here? If your cache binding goes through I would just need to add the interrupts part. Or you could even add that part in the same patch, you could have my signed-off-by for that.
Quoted 8 lines
Ok, I will try to update the bindings with the interrupt part and copy you in, even though the level definition worries me a bit, it is an important property for power management and I need to find a proper solution before bindings can get accepted (basically the problem is:
if different CPUs can see a cache at different levels as defined in the CLIDR we cannot describe a cache with a single cache level or put it differently, level can not represent the value in the CLIDR hence we need to describe it differently).
Quoted 8 lines
Ok. I've dropped the cache part from this patch. I left the example as is minus the cache-level attribute.
Understanding how the cache-level value would be used might help. I wonder if the cache-level can just be a number that describes the largest value that the cache could be assigned. Then if you have different CPUs seeing different levels of cache they can traverse from their CPU node to the cache and count how many phandles they went through.
Yes, that's one of the solutions I envisaged, and likely to be the one that I will put forward since it requires almost no changes. If we go that way cache-level becomes pretty useless though (which might be a good thing) and I do not like the implicit cache level obtained by counting phandles. Another option would be making cache-level a list and add a property "cache-level-affinity" as 1:1 map list of phandles to cpu-map node to define for each CPU the level at which that cache is mapped, somthing like the bindings described here for IRQ affinity:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-April/162466.html
I would say I tend to prefer the latter option, since I do not like relying on unwritten rules (implicit level numbering implied by phandle traversal) but I am open to suggestions.
Thanks,
Lorenzo
PATCH v4 5/6 edac: Add support for Krait CPU cache error detection
In reply to Stephen BoydAdd support for the Krait CPU cache error detection. This is a simplified version of the code originally written by Stepan Moskovchenko[1] ported to the EDAC device framework.
[1] https://www.codeaurora.org/cgit/quic/la/kernel/msm/tree/arch/arm/mach-msm/cache_erp.c?h=msm-3.4
--- drivers/edac/Kconfig | 8 ++ drivers/edac/Makefile | 2 + drivers/edac/krait_edac.c | 346 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 356 insertions(+) create mode 100644 drivers/edac/krait_edac.c
drivers/edac/Kconfig +8 -0
@@ -368,4 +368,12 @@ config EDAC_OCTEON_PCI Support for error detection and correction on the Cavium Octeon family of SOCs. +config EDAC_KRAIT_CACHE + tristate "Krait L1/L2 Cache" + depends on EDAC_MM_EDAC && ARCH_MSM + select KRAIT_L2_ACCESSORS + help + Support for error detection and correction on the + Krait L1/L2 cache controller. + endif # EDAC
drivers/edac/Makefile +2 -0
@@ -64,3 +64,5 @@ obj-$(CONFIG_EDAC_OCTEON_PC) += octeon_edac-pc.o obj-$(CONFIG_EDAC_OCTEON_L2C) += octeon_edac-l2c.o obj-$(CONFIG_EDAC_OCTEON_LMC) += octeon_edac-lmc.o obj-$(CONFIG_EDAC_OCTEON_PCI) += octeon_edac-pci.o + +obj-$(CONFIG_EDAC_KRAIT_CACHE) += krait_edac.o
drivers/edac/krait_edac.c new file +346 -0
346 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Borislav Petkov
maintainerRe: [PATCH v4 5/6] edac: Add support for Krait CPU cache error detection
Quoted 6 lines · Stephen Boyd
Add support for the Krait CPU cache error detection. This is a simplified version of the code originally written by Stepan Moskovchenko[1] ported to the EDAC device framework.
[1] https://www.codeaurora.org/cgit/quic/la/kernel/msm/tree/arch/arm/mach-msm/cache_erp.c?h=msm-3.4
Quoted 8 lines
Cc Stepan Moskovchenko <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- drivers/edac/Kconfig | 8 ++ drivers/edac/Makefile | 2 + drivers/edac/krait_edac.c | 346 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 356 insertions(+) create mode 100644 drivers/edac/krait_edac.c
Looks nice and clean, applied.
So, patch 1/6 I'm taking anyway as it is a bugfix - for the others I'll wait until 3/6 is cleared which way/how it goes.
HTH.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--PATCH v4 6/6 ARM: dts: msm: Add Krait CPU/L2 nodes
In reply to Stephen BoydThis allows us to probe the krait-edac driver.
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +41 -0
@@ -9,6 +9,47 @@ compatible = "qcom,msm8974"; interrupt-parent = <&intc>; + cpus { + #address-cells = <1>; + #size-cells = <0>; + interrupts = <1 9 0xf04>; + compatible = "qcom,krait"; + + cpu at 0 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <0>; + next-level-cache = <&L2>; + }; + + cpu at 1 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + device_type = "cpu"; + compatible = "qcom,krait"; + reg = <3>; + next-level-cache = <&L2>; + }; + + L2: l2-cache { + compatible = "cache"; + cache-level = <2>; + interrupts = <0 2 0x4>; + }; + }; + timer { compatible = "arm,armv7-timer"; interrupts = <1 2 0xf08>,
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Borislav Petkov
maintainerQuoted 9 lines · Stephen Boyd
This patchset adds support for the Krait L1/L2 cache error detection hardware. The first patch fixes a generic framework bug. The next two patches lay the groundwork for this driver to be added by exporting percpu irq functions as well as adding the Krait l2 indirection register code. The next two patches add the driver and the binding and the final patch hooks it all up by adding the device tree node.
I'm not sure which tree this is supposed to go through. Ideally we could send the first 3 plus the 5th one through an edac tree.
Sure, I can take a look at the drivers/edac/ changes but I'd need an ack for the arch/arm/ stuff before/if I pick it up, i.e. patch 3.
Thanks.
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · Stephen Boyd
This patchset adds support for the Krait L1/L2 cache error detection hardware. The first patch fixes a generic framework bug. The next two patches lay the groundwork for this driver to be added by exporting percpu irq functions as well as adding the Krait l2 indirection register code. The next two patches add the driver and the binding and the final patch hooks it all up by adding the device tree node.
Quoted 4 lines
Quoted 2 lines
I'm not sure which tree this is supposed to go through. Ideally we could send the first 3 plus the 5th one through an edac tree.
Sure, I can take a look at the
drivers/edac/changes but I'd need an ack for thearch/arm/stuff before/if I pick it up, i.e. patch 3.
Ok great. Perhaps Russell King or Mark Rutland can ack the arch/arm patch.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation