Skip to contentSkip to conversation

ACPI / LPIT: Register attributes based on FADT

PATCH Applied Rajneesh Bhardwaj 2 participants 2 messages Sep 28, 2018 – Oct 5, 2018 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / LPIT: Register attributes based on FADT

ACPI Low Power S0 Idle capabilities are announced via FADT table and can be used to inform the kernel about the presence of one or more Low Power Idle (LPI) entries as descried in LPIT table. LPIT table can exist independently even if the FADT S0 Idle flag is not set and thus it could confuse user since the following cpuidle attributes are created.

/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us

Presence or absence of above attributes could mean that the given platform supports S0ix state or not.

This change allows to create the above cpuidle attributes only if FADT table supports Low Power S0 Idle.

Cc Rafael J . Wysocki <[email protected]>
Cc Srinivas Pandruvada <[email protected]>
---
 drivers/acpi/acpi_lpit.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/acpi_lpit.c +6 -0
index cf4fc0161164..e43cb71b6972 100644
@@ -117,11 +117,17 @@ static void lpit_update_residency(struct lpit_residency_info *info,
 		if (!info->iomem_addr)
 			return;
 
+		if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+			return;
+
 		/* Silently fail, if cpuidle attribute group is not present */
 		sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
 					&dev_attr_low_power_idle_system_residency_us.attr,
 					"cpuidle");
 	} else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
+		if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+			return;
+
 		/* Silently fail, if cpuidle attribute group is not present */
 		sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
 					&dev_attr_low_power_idle_cpu_residency_us.attr,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 35 lines · CEST Rajneesh Bhardwaj

ACPI Low Power S0 Idle capabilities are announced via FADT table and can be used to inform the kernel about the presence of one or more Low Power Idle (LPI) entries as descried in LPIT table. LPIT table can exist independently even if the FADT S0 Idle flag is not set and thus it could confuse user since the following cpuidle attributes are created.

/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us

Presence or absence of above attributes could mean that the given platform supports S0ix state or not.

This change allows to create the above cpuidle attributes only if FADT table supports Low Power S0 Idle.

Cc Rafael J . Wysocki <[email protected]>
Cc Srinivas Pandruvada <[email protected]>
---
 drivers/acpi/acpi_lpit.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/acpi_lpit.c +3 -0
index cf4fc0161164..e43cb71b6972 100644
@@ -117,11 +117,17 @@ static void lpit_update_residency(struct lpit_residency_info *info,
 		if (!info->iomem_addr)
 			return;
 
+		if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+			return;
+
 		/* Silently fail, if cpuidle attribute group is not present */

drivers/acpi/acpi_lpit.c static void lpit_update_residency(struct lpit_residency_info *info, · line 133

Quoted 10 lines
drivers/acpi/acpi_lpit.c +3 -0
 		sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
 					&dev_attr_low_power_idle_system_residency_us.attr,
 					"cpuidle");
 	} else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
+		if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+			return;
+
 		/* Silently fail, if cpuidle attribute group is not present */
 		sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
 					&dev_attr_low_power_idle_cpu_residency_us.attr,

Applied, thanks!