Skip to contentSkip to conversation

Krait L1/L2 EDAC driver

PATCH Superseded Stephen Boyd 4 participants 22 messages Jan 14, 2014 – Mar 11, 2014

Subsystems (4)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Krait L1/L2 EDAC driver

This patchset adds support for the Krait L1/L2 cache error detection hardware. The first patch adds the Krait l2 indirection register code. This patch is in need of an ACK from ARM folks. 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 think Boris will pick up the first and third patches since they depend on each other. The final dts change could go through arm-soc via davidb's tree and the Documentation patch could go through the devicetree tree. Or patches 1 through 3 can go through Boris' tree.

Changes since v4:
* Prefixed l2 accessors functions with krait_
* Dropped first two patches as Boris says he picked them up

Changes since v3:
* Fixed l1_irq handler to properly dereference dev_id

Changes since v2:
* Picked up acks
* s/an/a/ in DT binding

Stephen Boyd (4):
ARM: Add Krait L2 register accessor functions
devicetree: bindings: Document Krait CPU/L1 EDAC
edac: Add support for Krait CPU cache error detection
ARM: dts: msm: Add Krait CPU/L2 nodes

 Documentation/devicetree/bindings/arm/cpus.txt |  52 ++++
 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/krait_edac.c                      | 346 +++++++++++++++++++++++++
 9 files changed, 531 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
#1 lore raw

PATCH v5 1/4 ARM: Add Krait L2 register accessor functions

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]>
Cc Courtney Cavin <[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/common/Kconfig +3 -0
index c3a4e9ceba34..9da52dc6260b 100644
@@ -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
index 4bdc41622c36..2836f992ee5d 100644
@@ -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
new file mode 100644
index 000000000000..48fe5527bc01
@@ -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 krait_set_l2_indirect_reg(u32 addr, u32 val);
+extern u32 krait_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
#2 lore raw

PATCH v5 2/4 devicetree: bindings: Document Krait CPU/L1 EDAC

In reply to Stephen Boyd

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 52 ++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +52 -0
index 91304353eea4..c332b5168456 100644
@@ -191,6 +191,16 @@ 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
+
 Example 1 (dual-cluster big.LITTLE system 32-bit):
 
 	cpus {
@@ -382,3 +392,45 @@ 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";
+		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
#3 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 18 lines · Stephen Boyd

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 52 ++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +0 -0
index 91304353eea4..c332b5168456 100644

Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 197

Quoted 7 lines
Documentation/devicetree/bindings/arm/cpus.txt +4 -0
@@ -191,6 +191,16 @@ 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

I reckon you want this property to belong in the cpus node (example below), not in cpu nodes, right ?

Are you relying on a platform device to be created for /cpus node in order for this series to work ? I guess that's why you want the interrupts property to be defined in /cpus so that it becomes a platform device resource (and you also add a compatible property in /cpus that is missing in these bindings).

Quoted 11 lines
Documentation/devicetree/bindings/arm/cpus.txt +6 -0
+
+	- next-level-cache
+		Usage: optional
+		Value type: <phandle>
+		Definition: phandle pointing to the next level cache
+
 Example 1 (dual-cluster big.LITTLE system 32-bit):
 
 	cpus {
@@ -382,3 +392,45 @@ cpus {
 		cpu-release-addr = <0 0x20000000>;

Documentation/devicetree/bindings/arm/cpus.txt cpus { · line 402

Quoted 10 lines
Documentation/devicetree/bindings/arm/cpus.txt +8 -0
 	};
 };
+
+
+Example 5 (Krait 32-bit system):
+
+cpus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	interrupts = <1 9 0xf04>;

In patch 4 you also add a compatible property here, and that's not documented, and honestly I do not think that's acceptable either. I guess you want a compatible property here to match the platform driver, right ?

Thank you,
Lorenzo

Quoted 39 lines
Documentation/devicetree/bindings/arm/cpus.txt +34 -0
+
+	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";
+		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
#4 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 22 lines · Lorenzo Pieralisi
Quoted 21 lines · Stephen Boyd

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 52 ++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +0 -0
index 91304353eea4..c332b5168456 100644
@@ -191,6 +191,16 @@ nodes to be present and contain the properties described below.
 			  property identifying a 64-bit zero-initialised
 			  memory location.
 
Quoted 7 lines

Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 197

Quoted 4 lines
Documentation/devicetree/bindings/arm/cpus.txt +4 -0
+	- interrupts
+		Usage: required for cpus with compatible string "qcom,krait".
+		Value type: <prop-encoded-array>
+		Definition: L1/CPU error interrupt

I reckon you want this property to belong in the cpus node (example below), not in cpu nodes, right ?

Yes.

Quoted 6 lines

Are you relying on a platform device to be created for /cpus node in order for this series to work ? I guess that's why you want the interrupts property to be defined in /cpus so that it becomes a platform device resource (and you also add a compatible property in /cpus that is missing in these bindings).

Ah yes. I'll move this to the /cpus section.

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/arm/cpus.txt +10 -0
+
+	- next-level-cache
+		Usage: optional
+		Value type: <phandle>
+		Definition: phandle pointing to the next level cache
+
 Example 1 (dual-cluster big.LITTLE system 32-bit):
 
 	cpus {
@@ -382,3 +392,45 @@ cpus {
 		cpu-release-addr = <0 0x20000000>;
 	};
 };
+
+
+Example 5 (Krait 32-bit system):
+
Quoted 8 lines

Documentation/devicetree/bindings/arm/cpus.txt cpus { · line 402

Quoted 4 lines
Documentation/devicetree/bindings/arm/cpus.txt +4 -0
+cpus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	interrupts = <1 9 0xf04>;

In patch 4 you also add a compatible property here, and that's not documented, and honestly I do not think that's acceptable either. I guess you want a compatible property here to match the platform driver, right ?

Ah sorry, I forgot to put the compatible property here like in the dts change. I'll do that in the next revision. Yes we need a compatible property here to match the platform driver.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#5 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 5 lines · Stephen Boyd

Ah sorry, I forgot to put the compatible property here like in the dts change. I'll do that in the next revision. Yes we need a compatible property here to match the platform driver.

This is the replacement patch

-----8<------
From: Stephen Boyd <[email protected]>
Subject: [PATCH v9] devicetree: bindings: Document Krait CPU/L1 EDAC

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 58 ++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +58 -0
index 91304353eea4..03a529e791c4 100644
@@ -62,6 +62,20 @@ nodes to be present and contain the properties described below.
 		Value type: <u32>
 		Definition: must be set to 0
 
+	- compatible
+		Usage: optional
+		Value type: <string>
+		Definition: should be one of the compatible strings listed
+			    in the cpu node compatible property. This property
+			    shall only be present if all the cpu nodes have the
+			    same compatible property.
+
+	- interrupts
+		Usage: required when node contains cpus with compatible
+		       string "qcom,krait".
+		Value type: <prop-encoded-array>
+		Definition: L1/CPU error interrupt
+
 - cpu node
 
 	Description: Describes a CPU in an ARM based system
@@ -191,6 +205,11 @@ nodes to be present and contain the properties described below.
 			  property identifying a 64-bit zero-initialised
 			  memory location.
 
+	- next-level-cache
+		Usage: optional
+		Value type: <phandle>
+		Definition: phandle pointing to the next level cache
+
 Example 1 (dual-cluster big.LITTLE system 32-bit):
 
 	cpus {
@@ -382,3 +401,42 @@ cpus {
 		cpu-release-addr = <0 0x20000000>;
 	};
 };
+
+
+Example 5 (Krait 32-bit system):
+
+cpus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	interrupts = <1 9 0xf04>;
+	compatible = "qcom,krait";
+
+	cpu at 0 {
+		device_type = "cpu";
+		reg = <0>;
+		next-level-cache = <&L2>;
+	};
+
+	cpu at 1 {
+		device_type = "cpu";
+		reg = <1>;
+		next-level-cache = <&L2>;
+	};
+
+	cpu at 2 {
+		device_type = "cpu";
+		reg = <2>;
+		next-level-cache = <&L2>;
+	};
+
+	cpu at 3 {
+		device_type = "cpu";
+		reg = <3>;
+		next-level-cache = <&L2>;
+	};
+
+	L2: l2-cache {
+		compatible = "cache";
+		interrupts = <0 2 0x4>;
+	};
+};
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#6 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 31 lines · Stephen Boyd
Quoted 5 lines · Stephen Boyd

Ah sorry, I forgot to put the compatible property here like in the dts change. I'll do that in the next revision. Yes we need a compatible property here to match the platform driver.

This is the replacement patch

-----8<------
From: Stephen Boyd <[email protected]>
Subject: [PATCH v9] devicetree: bindings: Document Krait CPU/L1 EDAC

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 58 ++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +0 -0
index 91304353eea4..03a529e791c4 100644

Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 71

Quoted 10 lines
Documentation/devicetree/bindings/arm/cpus.txt +7 -0
@@ -62,6 +62,20 @@ nodes to be present and contain the properties described below.
 		Value type: <u32>
 		Definition: must be set to 0
 
+	- compatible
+		Usage: optional
+		Value type: <string>
+		Definition: should be one of the compatible strings listed
+			    in the cpu node compatible property. This property
+			    shall only be present if all the cpu nodes have the
+			    same compatible property.

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

interrupts is a cpu node property and I think it should be kept as such.

I know it will be duplicated and I know you can't rely on a platform device for probing (since if I am not mistaken, removing a compatible string from cpus prevents its platform device creation), but that's an issue related to how the kernel works, you should not define DT bindings to solve that IMHO.

Lorenzo

Quoted 69 lines
Documentation/devicetree/bindings/arm/cpus.txt +51 -0
+
+	- interrupts
+		Usage: required when node contains cpus with compatible
+		       string "qcom,krait".
+		Value type: <prop-encoded-array>
+		Definition: L1/CPU error interrupt
+
 - cpu node
 
 	Description: Describes a CPU in an ARM based system
@@ -191,6 +205,11 @@ nodes to be present and contain the properties described below.
 			  property identifying a 64-bit zero-initialised
 			  memory location.
 
+	- next-level-cache
+		Usage: optional
+		Value type: <phandle>
+		Definition: phandle pointing to the next level cache
+
 Example 1 (dual-cluster big.LITTLE system 32-bit):
 
 	cpus {
@@ -382,3 +401,42 @@ cpus {
 		cpu-release-addr = <0 0x20000000>;
 	};
 };
+
+
+Example 5 (Krait 32-bit system):
+
+cpus {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	interrupts = <1 9 0xf04>;
+	compatible = "qcom,krait";
+
+	cpu at 0 {
+		device_type = "cpu";
+		reg = <0>;
+		next-level-cache = <&L2>;
+	};
+
+	cpu at 1 {
+		device_type = "cpu";
+		reg = <1>;
+		next-level-cache = <&L2>;
+	};
+
+	cpu at 2 {
+		device_type = "cpu";
+		reg = <2>;
+		next-level-cache = <&L2>;
+	};
+
+	cpu at 3 {
+		device_type = "cpu";
+		reg = <3>;
+		next-level-cache = <&L2>;
+	};
+
+	L2: l2-cache {
+		compatible = "cache";
+		interrupts = <0 2 0x4>;
+	};
+};
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#7 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 35 lines · Lorenzo Pieralisi
Quoted 34 lines · Stephen Boyd
Quoted 5 lines · Stephen Boyd

Ah sorry, I forgot to put the compatible property here like in the dts change. I'll do that in the next revision. Yes we need a compatible property here to match the platform driver.

This is the replacement patch

-----8<------
From: Stephen Boyd <[email protected]>
Subject: [PATCH v9] devicetree: bindings: Document Krait CPU/L1 EDAC

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 58 ++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +0 -0
index 91304353eea4..03a529e791c4 100644
@@ -62,6 +62,20 @@ nodes to be present and contain the properties described below.
 		Value type: <u32>
 		Definition: must be set to 0
 
Quoted 11 lines

Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 71

Quoted 7 lines
Documentation/devicetree/bindings/arm/cpus.txt +7 -0
+	- compatible
+		Usage: optional
+		Value type: <string>
+		Definition: should be one of the compatible strings listed
+			    in the cpu node compatible property. This property
+			    shall only be present if all the cpu nodes have the
+			    same compatible property.

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

Quoted 8 lines

interrupts is a cpu node property and I think it should be kept as such.

I know it will be duplicated and I know you can't rely on a platform device for probing (since if I am not mistaken, removing a compatible string from cpus prevents its platform device creation), but that's an issue related to how the kernel works, you should not define DT bindings to solve that IMHO.

The interrupts property is also common for all cpus so it seems fine to collapse the value down into a PPI specifier indicating that all CPUs get the interrupt, similar to how we compress the information about the compatible string.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#8 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 48 lines · Stephen Boyd
Quoted 35 lines · Lorenzo Pieralisi
Quoted 34 lines · Stephen Boyd
Quoted 5 lines · Stephen Boyd

Ah sorry, I forgot to put the compatible property here like in the dts change. I'll do that in the next revision. Yes we need a compatible property here to match the platform driver.

This is the replacement patch

-----8<------
From: Stephen Boyd <[email protected]>
Subject: [PATCH v9] devicetree: bindings: Document Krait CPU/L1 EDAC

The Krait CPU/L1 error reporting device is made up a per-CPU interrupt. While we're here, document the next-level-cache property that's used by the Krait EDAC driver.

Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 58 ++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +0 -0
index 91304353eea4..03a529e791c4 100644
@@ -62,6 +62,20 @@ nodes to be present and contain the properties described below.
 		Value type: <u32>
 		Definition: must be set to 0
 
Quoted 11 lines

Documentation/devicetree/bindings/arm/cpus.txt nodes to be present and contain the properties described below. · line 71

Quoted 7 lines
Documentation/devicetree/bindings/arm/cpus.txt +7 -0
+	- compatible
+		Usage: optional
+		Value type: <string>
+		Definition: should be one of the compatible strings listed
+			    in the cpu node compatible property. This property
+			    shall only be present if all the cpu nodes have the
+			    same compatible property.

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

What would you do for big.LITTLE systems ? We are going to create two cpus node because we need two platform devices ? I really think there must be a better way to implement this, but I will let DT maintainers make a decision.

Quoted 8 lines
Quoted 7 lines

interrupts is a cpu node property and I think it should be kept as such.

I know it will be duplicated and I know you can't rely on a platform device for probing (since if I am not mistaken, removing a compatible string from cpus prevents its platform device creation), but that's an issue related to how the kernel works, you should not define DT bindings to solve that IMHO.

Quoted 4 lines

The interrupts property is also common for all cpus so it seems fine to collapse the value down into a PPI specifier indicating that all CPUs get the interrupt, similar to how we compress the information about the compatible string.

I think it is nicer to create a device node (as I said, like a pmu or an arch-timer) and define interrupts there along with a proper compatible property. This would serve the same purpose without adding properties in the cpus node.

cpu-edac {
	compatible = "qcom,cpu-edac";
	interrupts = <...>;
};

Thanks,
Lorenzo

#9 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 6 lines · Lorenzo Pieralisi
Quoted 5 lines · Stephen Boyd
Quoted 3 lines · Lorenzo Pieralisi

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 8 lines
Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

I had what you're suggesting before in the original revision of this patch. Please take a look at the original patch series[1]. I suppose it could be tweaked slightly to still have a cache node for the L2 interrupt and the next-level-cache pointer from the CPUs.

Quoted 4 lines

What would you do for big.LITTLE systems ? We are going to create two cpus node because we need two platform devices ? I really think there must be a better way to implement this, but I will let DT maintainers make a decision.

There is no such thing as big.LITTLE for Krait, so this is not a concern.

Quoted 19 lines
Quoted 9 lines
Quoted 8 lines

interrupts is a cpu node property and I think it should be kept as such.

I know it will be duplicated and I know you can't rely on a platform device for probing (since if I am not mistaken, removing a compatible string from cpus prevents its platform device creation), but that's an issue related to how the kernel works, you should not define DT bindings to solve that IMHO.

Quoted 4 lines

The interrupts property is also common for all cpus so it seems fine to collapse the value down into a PPI specifier indicating that all CPUs get the interrupt, similar to how we compress the information about the compatible string.

I think it is nicer to create a device node (as I said, like a pmu or an arch-timer) and define interrupts there along with a proper compatible property. This would serve the same purpose without adding properties in the cpus node.

Quoted 4 lines
cpu-edac {
	compatible = "qcom,cpu-edac";
	interrupts = <...>;
};

Yes, please see the original thread.

[1] https://lkml.org/lkml/2013/10/29/134

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#10 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 16 lines · Stephen Boyd
Quoted 6 lines · Lorenzo Pieralisi
Quoted 5 lines · Stephen Boyd
Quoted 3 lines · Lorenzo Pieralisi

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 8 lines
Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

Quoted 5 lines

I had what you're suggesting before in the original revision of this patch. Please take a look at the original patch series[1]. I suppose it could be tweaked slightly to still have a cache node for the L2 interrupt and the next-level-cache pointer from the CPUs.

Ok, sorry, we are running around in circles here, basically you moved the node to cpus according to reviews. I still think that treating cpus as a device is not a great idea, even though I am in the same position with C-states and probably will add C-state tables in the cpus node.

http://comments.gmane.org/gmane.linux.power-management.general/41012

I just would like to see under cpus nodes and properties that apply to all ARM systems, and avoid defining properties (eg interrupts) that have different meanings for different ARM cores.

The question related to why the kernel should create a platform device out of cpus is still open. I really do not want to block your series for these simple issues but we have to make a decision and stick to that, I am fine either way if we have a plan.

Quoted 7 lines
Quoted 4 lines

What would you do for big.LITTLE systems ? We are going to create two cpus node because we need two platform devices ? I really think there must be a better way to implement this, but I will let DT maintainers make a decision.

There is no such thing as big.LITTLE for Krait, so this is not a concern.

Yes, but if a core supporting big.LITTLE requires the same concept you need here we have to cater for that because after all cpus is a node that exists on ALL ARM systems, we should not rush and find a solution du jour without thinking about all foreseeable use cases.

Thank you,
Lorenzo

#11 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

(Sorry, this discussion stalled due to merge window + life events)

Quoted 31 lines · Lorenzo Pieralisi
Quoted 16 lines · Stephen Boyd
Quoted 6 lines · Lorenzo Pieralisi
Quoted 5 lines · Stephen Boyd
Quoted 3 lines · Lorenzo Pieralisi

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 8 lines
Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

Quoted 5 lines

I had what you're suggesting before in the original revision of this patch. Please take a look at the original patch series[1]. I suppose it could be tweaked slightly to still have a cache node for the L2 interrupt and the next-level-cache pointer from the CPUs.

Ok, sorry, we are running around in circles here, basically you moved the node to cpus according to reviews. I still think that treating cpus as a device is not a great idea, even though I am in the same position with C-states and probably will add C-state tables in the cpus node.

http://comments.gmane.org/gmane.linux.power-management.general/41012

Quoted 9 lines

I just would like to see under cpus nodes and properties that apply to all ARM systems, and avoid defining properties (eg interrupts) that have different meanings for different ARM cores.

The question related to why the kernel should create a platform device out of cpus is still open. I really do not want to block your series for these simple issues but we have to make a decision and stick to that, I am fine either way if we have a plan.

Do you just want a backup plan in case we don't make a platform device out of the cpus node? I believe we can always add code somewhere to create a platform device at runtime if we detect the cpus node has a compatible string equal to "qcom,krait". We could probably change this driver's module_init() to scan the DT for such a compatible string and create the platform device right there. If we get more than one interrupt in the cpus node we can add interrupt-names and then have software look for interrupts by name instead of number.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#12 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Hi Stephen,

Quoted 1 line · Stephen Boyd

(Sorry, this discussion stalled due to merge window + life events)

Sorry for the delay in replying on my side too.

Quoted 42 lines · Lorenzo Pieralisi
Quoted 31 lines · Stephen Boyd
Quoted 16 lines · Lorenzo Pieralisi
Quoted 6 lines · Stephen Boyd
Quoted 5 lines · Lorenzo Pieralisi
Quoted 3 lines

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 8 lines
Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

Quoted 5 lines

I had what you're suggesting before in the original revision of this patch. Please take a look at the original patch series[1]. I suppose it could be tweaked slightly to still have a cache node for the L2 interrupt and the next-level-cache pointer from the CPUs.

Ok, sorry, we are running around in circles here, basically you moved the node to cpus according to reviews. I still think that treating cpus as a device is not a great idea, even though I am in the same position with C-states and probably will add C-state tables in the cpus node.

http://comments.gmane.org/gmane.linux.power-management.general/41012

Quoted 9 lines

I just would like to see under cpus nodes and properties that apply to all ARM systems, and avoid defining properties (eg interrupts) that have different meanings for different ARM cores.

The question related to why the kernel should create a platform device out of cpus is still open. I really do not want to block your series for these simple issues but we have to make a decision and stick to that, I am fine either way if we have a plan.

Quoted 9 lines

Do you just want a backup plan in case we don't make a platform device out of the cpus node? I believe we can always add code somewhere to create a platform device at runtime if we detect the cpus node has a compatible string equal to "qcom,krait". We could probably change this driver's module_init() to scan the DT for such a compatible string and create the platform device right there. If we get more than one interrupt in the cpus node we can add interrupt-names and then have software look for interrupts by name instead of number.

As I mentioned, I do not like the idea of adding compatible properties just to force the kernel to create platform devices out of device tree nodes. On top of that I would avoid adding a compatible property to the cpus node (after all properties like enable-method are common for all cpus but still duplicated), my only concern being backward compatibility here (ie if we do that for interrupts, we should do that also for other common cpu nodes properties, otherwise we have different rules for different properties).

I think you can then add interrupts to cpu nodes ("qcom,krait" specific), and as you mentioned create a platform device for that.

Thanks,
Lorenzo

#13 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 68 lines · Lorenzo Pieralisi

Hi Stephen,

Quoted 1 line · Stephen Boyd

(Sorry, this discussion stalled due to merge window + life events)

Sorry for the delay in replying on my side too.

Quoted 42 lines · Lorenzo Pieralisi
Quoted 31 lines · Stephen Boyd
Quoted 16 lines · Lorenzo Pieralisi
Quoted 6 lines · Stephen Boyd
Quoted 5 lines · Lorenzo Pieralisi
Quoted 3 lines

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 8 lines
Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

Quoted 5 lines

I had what you're suggesting before in the original revision of this patch. Please take a look at the original patch series[1]. I suppose it could be tweaked slightly to still have a cache node for the L2 interrupt and the next-level-cache pointer from the CPUs.

Ok, sorry, we are running around in circles here, basically you moved the node to cpus according to reviews. I still think that treating cpus as a device is not a great idea, even though I am in the same position with C-states and probably will add C-state tables in the cpus node.

http://comments.gmane.org/gmane.linux.power-management.general/41012

Quoted 9 lines

I just would like to see under cpus nodes and properties that apply to all ARM systems, and avoid defining properties (eg interrupts) that have different meanings for different ARM cores.

The question related to why the kernel should create a platform device out of cpus is still open. I really do not want to block your series for these simple issues but we have to make a decision and stick to that, I am fine either way if we have a plan.

Quoted 9 lines

Do you just want a backup plan in case we don't make a platform device out of the cpus node? I believe we can always add code somewhere to create a platform device at runtime if we detect the cpus node has a compatible string equal to "qcom,krait". We could probably change this driver's module_init() to scan the DT for such a compatible string and create the platform device right there. If we get more than one interrupt in the cpus node we can add interrupt-names and then have software look for interrupts by name instead of number.

As I mentioned, I do not like the idea of adding compatible properties just to force the kernel to create platform devices out of device tree nodes. On top of that I would avoid adding a compatible property to the cpus node (after all properties like enable-method are common for all cpus but still duplicated), my only concern being backward compatibility here (ie if we do that for interrupts, we should do that also for other common cpu nodes properties, otherwise we have different rules for different properties).

Quoted 5 lines

I think you can then add interrupts to cpu nodes ("qcom,krait" specific), and as you mentioned create a platform device for that.

Thanks,
Lorenzo

So I agree with the statement about adding compatibles just to create platform devices is wrong. However its seems perfectly reasonable for a cpu node to have a compatible property. I don?t see why a CPU is any different from any other device described in a DT.

- k

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#14 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 71 lines · Kumar Gala
Quoted 68 lines · Lorenzo Pieralisi

Hi Stephen,

Quoted 1 line · Stephen Boyd

(Sorry, this discussion stalled due to merge window + life events)

Sorry for the delay in replying on my side too.

Quoted 42 lines · Lorenzo Pieralisi
Quoted 31 lines · Stephen Boyd
Quoted 16 lines · Lorenzo Pieralisi
Quoted 6 lines · Stephen Boyd
Quoted 5 lines · Lorenzo Pieralisi
Quoted 3 lines

Do we really want to do that ? I am not sure. A cpus node is supposed to be a container node, we should not define this binding just because we know the kernel creates a platform device for it then.

Quoted 8 lines
Quoted 3 lines

This is just copying more of the ePAPR spec into this document. It just so happens that having a compatible field here allows a platform device to be created. I don't see why that's a problem.

I do not see why you cannot define a node like pmu or arch-timer and stick a compatible property in there. cpus node does not represent a device, and must not be created as a platform device, that's my opinion.

Quoted 5 lines

I had what you're suggesting before in the original revision of this patch. Please take a look at the original patch series[1]. I suppose it could be tweaked slightly to still have a cache node for the L2 interrupt and the next-level-cache pointer from the CPUs.

Ok, sorry, we are running around in circles here, basically you moved the node to cpus according to reviews. I still think that treating cpus as a device is not a great idea, even though I am in the same position with C-states and probably will add C-state tables in the cpus node.

http://comments.gmane.org/gmane.linux.power-management.general/41012

Quoted 9 lines

I just would like to see under cpus nodes and properties that apply to all ARM systems, and avoid defining properties (eg interrupts) that have different meanings for different ARM cores.

The question related to why the kernel should create a platform device out of cpus is still open. I really do not want to block your series for these simple issues but we have to make a decision and stick to that, I am fine either way if we have a plan.

Quoted 9 lines

Do you just want a backup plan in case we don't make a platform device out of the cpus node? I believe we can always add code somewhere to create a platform device at runtime if we detect the cpus node has a compatible string equal to "qcom,krait". We could probably change this driver's module_init() to scan the DT for such a compatible string and create the platform device right there. If we get more than one interrupt in the cpus node we can add interrupt-names and then have software look for interrupts by name instead of number.

As I mentioned, I do not like the idea of adding compatible properties just to force the kernel to create platform devices out of device tree nodes. On top of that I would avoid adding a compatible property to the cpus node (after all properties like enable-method are common for all cpus but still duplicated), my only concern being backward compatibility here (ie if we do that for interrupts, we should do that also for other common cpu nodes properties, otherwise we have different rules for different properties).

Quoted 7 lines
Quoted 5 lines

I think you can then add interrupts to cpu nodes ("qcom,krait" specific), and as you mentioned create a platform device for that.

Thanks,
Lorenzo

So I agree with the statement about adding compatibles just to create platform devices is wrong. However its seems perfectly reasonable for a cpu node to have a compatible property. I don't see why a CPU is any different from any other device described in a DT.

I was referring to the /cpus node, not to individual cpu nodes, where the compatible property is already present now.

Lorenzo

#15 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 16 lines · Lorenzo Pieralisi
Quoted 15 lines · Kumar Gala
Quoted 13 lines · Lorenzo Pieralisi

As I mentioned, I do not like the idea of adding compatible properties just to force the kernel to create platform devices out of device tree nodes. On top of that I would avoid adding a compatible property to the cpus node (after all properties like enable-method are common for all cpus but still duplicated), my only concern being backward compatibility here (ie if we do that for interrupts, we should do that also for other common cpu nodes properties, otherwise we have different rules for different properties).

I think you can then add interrupts to cpu nodes ("qcom,krait" specific), and as you mentioned create a platform device for that.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thanks,
Lorenzo

So I agree with the statement about adding compatibles just to create platform devices is wrong. However its seems perfectly reasonable for a cpu node to have a compatible property. I don't see why a CPU is any different from any other device described in a DT.

I was referring to the /cpus node, not to individual cpu nodes, where the compatible property is already present now.

Ok I think I'll go ahead with moving the interrupts into each cpu node, i.e.:

        cpus {  
                #address-cells = <1>;
                #size-cells = <0>;

                cpu at 0 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <0>;
                        interrupts = <1 14 0x304>;
                        next-level-cache = <&L2>;
                };

                cpu at 1 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <1>;
                        interrupts = <1 14 0x304>;
                        next-level-cache = <&L2>;
                };

                L2: l2-cache {
                        compatible = "cache";
                        interrupts = <0 2 0x4>;
		};
	};

Or should we be expressing the L1 cache as well? Something like:

        cpus {  
                #address-cells = <1>;
                #size-cells = <0>;

                cpu at 0 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <0>;
                        next-level-cache = <&L1_0>;

			L1_0: l1-cache {
				compatible = "arm,arch-cache";
				interrupts = <1 14 0x304>;
				next-level-cache = <&L2>;
			}
                };

                cpu at 1 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <1>;
                        next-level-cache = <&L1_1>;

			L1_1: l1-cache {
				compatible = "arm,arch-cache";
				interrupts = <1 14 0x304>;
				next-level-cache = <&L2>;
			}
                };

                L2: l2-cache {
                        compatible = "arm,arch-cache";
                        interrupts = <0 2 0x4>;
		};
	};

(I'm also wondering if the 3rd cell of the interrupt binding should only indicate the CPU that the interrupt property is inside?)

Finally we can have the edac driver look for a "qcom,krait" compatible node in cpus that it can create a platform device for, i.e..

static int __init krait_edac_driver_init(void)

{
        struct device_node *np;

        np = of_get_cpu_node(0, NULL);
        if (!np)
                return 0;

        if (!krait_edacp && of_device_is_compatible(np, "qcom,krait"))
                krait_edacp = of_platform_device_create(np, "krait_edac", NULL);
        of_node_put(np);

        return platform_driver_register(&krait_edac_driver);
}

module_init(krait_edac_driver_init);

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#16 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 92 lines · Stephen Boyd
Quoted 16 lines · Lorenzo Pieralisi
Quoted 15 lines · Kumar Gala
Quoted 13 lines · Lorenzo Pieralisi

As I mentioned, I do not like the idea of adding compatible properties just to force the kernel to create platform devices out of device tree nodes. On top of that I would avoid adding a compatible property to the cpus node (after all properties like enable-method are common for all cpus but still duplicated), my only concern being backward compatibility here (ie if we do that for interrupts, we should do that also for other common cpu nodes properties, otherwise we have different rules for different properties).

I think you can then add interrupts to cpu nodes ("qcom,krait" specific), and as you mentioned create a platform device for that.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thanks,
Lorenzo

So I agree with the statement about adding compatibles just to create platform devices is wrong. However its seems perfectly reasonable for a cpu node to have a compatible property. I don't see why a CPU is any different from any other device described in a DT.

I was referring to the /cpus node, not to individual cpu nodes, where the compatible property is already present now.

Ok I think I'll go ahead with moving the interrupts into each cpu node, i.e.:

        cpus {  
                #address-cells = <1>;
                #size-cells = <0>;

                cpu at 0 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <0>;
                        interrupts = <1 14 0x304>;
                        next-level-cache = <&L2>;
                };

                cpu at 1 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <1>;
                        interrupts = <1 14 0x304>;
                        next-level-cache = <&L2>;
                };

                L2: l2-cache {
                        compatible = "cache";
                        interrupts = <0 2 0x4>;
		};
	};

Or should we be expressing the L1 cache as well? Something like:

        cpus {  
                #address-cells = <1>;
                #size-cells = <0>;

                cpu at 0 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <0>;
                        next-level-cache = <&L1_0>;

			L1_0: l1-cache {
				compatible = "arm,arch-cache";
				interrupts = <1 14 0x304>;
				next-level-cache = <&L2>;
			}
                };

                cpu at 1 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <1>;
                        next-level-cache = <&L1_1>;

			L1_1: l1-cache {
				compatible = "arm,arch-cache";
				interrupts = <1 14 0x304>;
				next-level-cache = <&L2>;
			}
                };

                L2: l2-cache {
                        compatible = "arm,arch-cache";
                        interrupts = <0 2 0x4>;
		};
	};
Quoted 3 lines

(I'm also wondering if the 3rd cell of the interrupt binding should only indicate the CPU that the interrupt property is inside?)

I am not aware of interrupts associated with vanilla :) "arm,arch-cache" objects, so I think that should be handled as a "qcom,krait" specific property (in the cpu node), or you should add another cache binding (compatible) for that.

As you might have noticed (idle states thread) I am keen on defining objects for L1 caches explicitly, that patch still requires an ACK though (and you need to update it since you cannot add an interrupt property for all "arm,arch-cache" objects. I am sorry for being a pain, but I do not think that's correct from a HW description standpoint).

Quoted 18 lines

Finally we can have the edac driver look for a "qcom,krait" compatible node in cpus that it can create a platform device for, i.e..

static int __init krait_edac_driver_init(void)

{
        struct device_node *np;

        np = of_get_cpu_node(0, NULL);
        if (!np)
                return 0;

        if (!krait_edacp && of_device_is_compatible(np, "qcom,krait"))
                krait_edacp = of_platform_device_create(np, "krait_edac", NULL);
        of_node_put(np);

        return platform_driver_register(&krait_edac_driver);
}
Quoted 1 line

module_init(krait_edac_driver_init);

It seems fine to me, but it requires an ACK from platform bus and DT maintainers.

Lorenzo

#17 lore raw

Re: [PATCH v5 2/4] devicetree: bindings: Document Krait CPU/L1 EDAC

Quoted 49 lines · Lorenzo Pieralisi
Quoted 39 lines · Stephen Boyd

Or should we be expressing the L1 cache as well? Something like:

        cpus {  
                #address-cells = <1>;
                #size-cells = <0>;

                cpu at 0 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <0>;
                        next-level-cache = <&L1_0>;

			L1_0: l1-cache {
				compatible = "arm,arch-cache";
				interrupts = <1 14 0x304>;
				next-level-cache = <&L2>;
			}
                };

                cpu at 1 { 
                        compatible = "qcom,krait";
                        device_type = "cpu";
                        reg = <1>;
                        next-level-cache = <&L1_1>;

			L1_1: l1-cache {
				compatible = "arm,arch-cache";
				interrupts = <1 14 0x304>;
				next-level-cache = <&L2>;
			}
                };

                L2: l2-cache {
                        compatible = "arm,arch-cache";
                        interrupts = <0 2 0x4>;
		};
	};
Quoted 3 lines

(I'm also wondering if the 3rd cell of the interrupt binding should only indicate the CPU that the interrupt property is inside?)

I am not aware of interrupts associated with vanilla :) "arm,arch-cache" objects, so I think that should be handled as a "qcom,krait" specific property (in the cpu node), or you should add another cache binding (compatible) for that.

Quoted 6 lines

As you might have noticed (idle states thread) I am keen on defining objects for L1 caches explicitly, that patch still requires an ACK though (and you need to update it since you cannot add an interrupt property for all "arm,arch-cache" objects. I am sorry for being a pain, but I do not think that's correct from a HW description standpoint).

Ok. s/arm,arch-cache/qcom,arch-cache/ then. I imagine it is easy enough to add some bits in the cache binding once it's accepted.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#18 lore raw

PATCH v5 3/4 edac: Add support for Krait CPU cache error detection

In reply to 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

Cc Stepan Moskovchenko <[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
drivers/edac/Kconfig +8 -0
index 878f09005fad..68f612d06eed 100644
@@ -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
index 4154ed6a02c6..b6ea50564223 100644
@@ -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
#19 lore raw

PATCH v5 4/4 ARM: dts: msm: Add Krait CPU/L2 nodes

In reply to Stephen Boyd

This 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
index 9fa57d72f41e..7a494eaabd24 100644
@@ -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
maintainer
#20 lore raw
In reply to Stephen Boyd
Quoted 6 lines · Stephen Boyd

This patchset adds support for the Krait L1/L2 cache error detection hardware. The first patch adds the Krait l2 indirection register code. This patch is in need of an ACK from ARM folks. 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 8 lines

I think Boris will pick up the first and third patches since they depend on each other. The final dts change could go through arm-soc via davidb's tree and the Documentation patch could go through the devicetree tree. Or patches 1 through 3 can go through Boris' tree.

Changes since v4:
* Prefixed l2 accessors functions with krait_
* Dropped first two patches as Boris says he picked them up

Hey Stephen,

I'm going to send upstream only

[PATCH v4 1/6] edac: Don't try to cancel workqueue when it's never setup

as it is a clear bugfix.

The second one

[PATCH v4 2/6] genirq: export percpu irq functions for module usage

will have to wait for when the driver goes in. But the driver depends on "ARM: Add Krait L2 register accessor functions" which still waits for ACKs, right?

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#21 lore raw
Quoted 23 lines · Borislav Petkov
Quoted 6 lines · Stephen Boyd

This patchset adds support for the Krait L1/L2 cache error detection hardware. The first patch adds the Krait l2 indirection register code. This patch is in need of an ACK from ARM folks. 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 8 lines

I think Boris will pick up the first and third patches since they depend on each other. The final dts change could go through arm-soc via davidb's tree and the Documentation patch could go through the devicetree tree. Or patches 1 through 3 can go through Boris' tree.

Changes since v4:
* Prefixed l2 accessors functions with krait_
* Dropped first two patches as Boris says he picked them up

Hey Stephen,

I'm going to send upstream only

[PATCH v4 1/6] edac: Don't try to cancel workqueue when it's never setup

as it is a clear bugfix.

Quoted 8 lines

The second one

[PATCH v4 2/6] genirq: export percpu irq functions for module usage

will have to wait for when the driver goes in. But the driver depends on "ARM: Add Krait L2 register accessor functions" which still waits for ACKs, right?

Ok that sounds fine. The ARM patch is fairly minor so I'm not sure if anyone is willing to ack it, but I'm willing to wait a little while to see if anyone will.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation