Skip to contentSkip to conversation

drivers: cpuidle: add status property to ARM idle states

PATCH New Lorenzo Pieralisi 3 participants 7 messages Oct 16, 2014 – Nov 10, 2014

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

PATCH 1/3 drivers: cpuidle: add status property to ARM idle states

On some platforms the device tree bindings must provide the kernel with a status flag for idle states, that defines whether the idle state is operational or not in the current configuration.

This patch adds a status property to the ARM idle states compliant with ePAPR v1.1 and updates the DT parsing code accordingly.

---
 Documentation/devicetree/bindings/arm/idle-states.txt | 14 ++++++++++++++
 drivers/cpuidle/dt_idle_states.c                      |  3 +++
 2 files changed, 17 insertions(+)
Documentation/devicetree/bindings/arm/idle-states.txt +14 -0
index 37375c7..d8ab4b9 100644
@@ -317,6 +317,20 @@ follows:
 			    In such systems entry-latency-us + exit-latency-us
 			    will exceed wakeup-latency-us by this duration.
 
+	- status:
+		Usage: Optional
+		Value type: <string>
+		Definition: A standard device tree property [5] that indicates
+			    the operational status of an idle-state.
+			    If present, it shall be:
+			    "okay": to indicate that the idle state is
+				    operational.
+			    "disabled": to indicate that the idle state has
+					been disabled in firmware so it is not
+					operational.
+			    If property is not present the idle-state must be
+			    considered operational.
+
 	In addition to the properties listed above, a state node may require
 	additional properties specifics to the entry-method defined in the
 	idle-states node, please refer to the entry-method bindings
drivers/cpuidle/dt_idle_states.c +3 -0
index 52f4d11..22840f4 100644
@@ -169,6 +169,9 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,
 		if (!state_node)
 			break;
 
+		if (!of_device_is_available(state_node))
+			continue;
+
 		if (!idle_state_valid(state_node, i, cpumask)) {
 			pr_warn("%s idle state not valid, bailing out\n",
 				state_node->full_name);
Signature · 1 line
2.1.2
#1 lore raw

PATCH 2/3 drivers: cpuidle: add idle-state-name description to ARM idle states

On ARM machines, where generally speaking the idle state numbering has no fixed and standard meaning it is useful to provide a description of the idle state inner workings for benchmarking and monitoring purposes.

This patch adds a property to the idle states bindings that if present gives platform firmware a means of describing the idle state and export the string description to user space.

The patch updates the DT parsing code accordingly to take the description, if present, into consideration.

---
 Documentation/devicetree/bindings/arm/idle-states.txt | 6 ++++++
 drivers/cpuidle/dt_idle_states.c                      | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/idle-states.txt +6 -0
index d8ab4b9..6f68718 100644
@@ -331,6 +331,12 @@ follows:
 			    If property is not present the idle-state must be
 			    considered operational.
 
+	- idle-state-name:
+		Usage: Optional
+		Value type: <string>
+		Definition: A string used as a descriptive name for the idle
+			    state.
+
 	In addition to the properties listed above, a state node may require
 	additional properties specifics to the entry-method defined in the
 	idle-states node, please refer to the entry-method bindings
drivers/cpuidle/dt_idle_states.c +6 -1
index 22840f4..5301912 100644
@@ -27,6 +27,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
 {
 	int err;
 	const struct of_device_id *match_id;
+	const char *desc;
 
 	match_id = of_match_node(matches, state_node);
 	if (!match_id)
@@ -73,6 +74,10 @@ static int init_state_node(struct cpuidle_state *idle_state,
 		return -EINVAL;
 	}
 
+	err = of_property_read_string(state_node, "idle-state-name", &desc);
+	if (err)
+		desc = state_node->name;
+
 	idle_state->flags = CPUIDLE_FLAG_TIME_VALID;
 	if (of_property_read_bool(state_node, "local-timer-stop"))
 		idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP;
@@ -82,7 +87,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
 	 *	and desc become string pointers
 	 */
 	strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1);
-	strncpy(idle_state->desc, state_node->name, CPUIDLE_DESC_LEN - 1);
+	strncpy(idle_state->desc, desc, CPUIDLE_DESC_LEN - 1);
 	return 0;
 }
 
Signature · 1 line
2.1.2
#2 lore raw

PATCH 3/3 drivers: cpuidle: remove cpuidle-arm64 duplicate error messages

In reply to Lorenzo Pieralisi

Current CPUidle driver for arm64 machines spits errors upon idle state initialization and cpuidle driver registration failures. These error messages are already printed in core code so there is no need to print them again.

This patch removes the duplicate print messages from the cpuidle-arm64 driver.

---
 drivers/cpuidle/cpuidle-arm64.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/cpuidle/cpuidle-arm64.c +2 -11
index 50997ea..1b10f92e 100644
@@ -104,11 +104,8 @@ static int __init arm64_idle_init(void)
 	 * reason to initialize the idle driver if only wfi is supported.
 	 */
 	ret = dt_init_idle_driver(drv, arm64_idle_state_match, 1);
-	if (ret <= 0) {
-		if (ret)
-			pr_err("failed to initialize idle states\n");
+	if (ret <= 0)
 		return ret ? : -ENODEV;
-	}
 
 	/*
 	 * Call arch CPU operations in order to initialize
@@ -122,12 +119,6 @@ static int __init arm64_idle_init(void)
 		}
 	}
 
-	ret = cpuidle_register(drv, NULL);
-	if (ret) {
-		pr_err("failed to register cpuidle driver\n");
-		return ret;
-	}
-
-	return 0;
+	return cpuidle_register(drv, NULL);
 }
 device_initcall(arm64_idle_init);
Signature · 1 line
2.1.2
#3 lore raw

PATCH 1/3 drivers: cpuidle: add status property to ARM idle states

In reply to Lorenzo Pieralisi
Quoted 8 lines · Lorenzo Pieralisi

On some platforms the device tree bindings must provide the kernel with a status flag for idle states, that defines whether the idle state is operational or not in the current configuration.

This patch adds a status property to the ARM idle states compliant with ePAPR v1.1 and updates the DT parsing code accordingly.

For the series:

Kevin

#4 lore raw

PATCH 1/3 drivers: cpuidle: add status property to ARM idle states

Quoted 6 lines · Kevin Hilman
Quoted 4 lines · Lorenzo Pieralisi

On some platforms the device tree bindings must provide the kernel with a status flag for idle states, that defines whether the idle state is operational or not in the current configuration.

Quoted 8 lines
Quoted 4 lines

This patch adds a status property to the ARM idle states compliant with ePAPR v1.1 and updates the DT parsing code accordingly.

For the series:

Thanks ! I will queue it for 3.19 then.

Lorenzo

#5 lore raw

PATCH 1/3 drivers: cpuidle: add status property to ARM idle states

Quoted 10 lines · Lorenzo Pieralisi
Quoted 9 lines · Kevin Hilman
Quoted 7 lines · Lorenzo Pieralisi

On some platforms the device tree bindings must provide the kernel with a status flag for idle states, that defines whether the idle state is operational or not in the current configuration.

This patch adds a status property to the ARM idle states compliant with ePAPR v1.1 and updates the DT parsing code accordingly.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

For the series:

Thanks ! I will queue it for 3.19 then.

Applied to my tree for 3.19.

Thanks
-- Daniel

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#6 lore raw

PATCH 1/3 drivers: cpuidle: add status property to ARM idle states

Quoted 15 lines · Daniel Lezcano
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Kevin Hilman
Quoted 8 lines · Lorenzo Pieralisi

On some platforms the device tree bindings must provide the kernel with a status flag for idle states, that defines whether the idle state is operational or not in the current configuration.

This patch adds a status property to the ARM idle states compliant with ePAPR v1.1 and updates the DT parsing code accordingly.

For the series:

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks ! I will queue it for 3.19 then.

Applied to my tree for 3.19.

Thanks
-- Daniel

Thank you !

Lorenzo