Skip to contentSkip to conversation

dt-bindings: Add an enable method to RISC-V

PATCH In review Palmer Dabbelt 2 participants 2 messages Dec 7, 2017 – Dec 20, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt-bindings: Add an enable method to RISC-V

RISC-V doesn't currently specify a mechanism for enabling or disabling CPUs. Instead, we assume that all CPUs are enabled on boot, and if someone wants to save power we instead put a CPU to sleep via a WFI loop. Future systems may have an explicit mechanism for putting a CPU to sleep, so we're standardizing the device tree entry for when that happens.

We're not defining a spin-table based interface to the firmware, as the plan is to handle this entirely within the kernel instead.

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/riscv/cpus.txt +9 -0
index adf7b7af5dc3..68f88eacc594 100644
@@ -82,6 +82,15 @@ described below.
                 Value type: <string>
                 Definition: Contains the RISC-V ISA string of this hart.  These
                             ISA strings are defined by the RISC-V ISA manual.
+        - cpu-enable-method:
+                Usage: optional
+                Value type: <stringlist>
+                Definition: When absent, default is either "always-disabled"
+                            "always-enabled", depending on the current state
+                            of the CPU.
+                            Must be one of:
+                                * "always-disabled": This CPU cannot be enabled.
+                                * "always-enabled": This CPU cannot be disabled.
 
 Example: SiFive Freedom U540G Development Kit
 ---------------------------------------------
Signature · 6 lines
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#1 lore raw
Quoted 21 lines · Palmer Dabbelt

RISC-V doesn't currently specify a mechanism for enabling or disabling CPUs. Instead, we assume that all CPUs are enabled on boot, and if someone wants to save power we instead put a CPU to sleep via a WFI loop. Future systems may have an explicit mechanism for putting a CPU to sleep, so we're standardizing the device tree entry for when that happens.

We're not defining a spin-table based interface to the firmware, as the plan is to handle this entirely within the kernel instead.

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/riscv/cpus.txt +0 -0
index adf7b7af5dc3..68f88eacc594 100644

Documentation/devicetree/bindings/riscv/cpus.txt described below. · line 90

Quoted 9 lines
Documentation/devicetree/bindings/riscv/cpus.txt +6 -0
@@ -82,6 +82,15 @@ described below.
                 Value type: <string>
                 Definition: Contains the RISC-V ISA string of this hart.  These
                             ISA strings are defined by the RISC-V ISA manual.
+        - cpu-enable-method:
+                Usage: optional
+                Value type: <stringlist>
+                Definition: When absent, default is either "always-disabled"
+                            "always-enabled", depending on the current state
+                            of the CPU.

How does one determine the state of other cpus?

Documentation/devicetree/bindings/riscv/cpus.txt described below. · line 92

Quoted 2 lines
Documentation/devicetree/bindings/riscv/cpus.txt +2 -0
+                            Must be one of:
+                                * "always-disabled": This CPU cannot be enabled.

status = "disabled" already serves this purpose.

Documentation/devicetree/bindings/riscv/cpus.txt described below. · line 93

Quoted 1 line
Documentation/devicetree/bindings/riscv/cpus.txt +1 -0
+                                * "always-enabled": This CPU cannot be disabled.

I don't see how this can work unless the kernel is loaded prior to bringing all cpus out of reset. You have to halt cpus in some way until the kernel is loaded.

Quoted 6 lines
Documentation/devicetree/bindings/riscv/cpus.txt +0 -0
 Example: SiFive Freedom U540G Development Kit
 ---------------------------------------------
Signature · 1 line
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html