All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / LPIT: Register attributes based on FADT
@ 2018-09-28  8:54 Rajneesh Bhardwaj
  2018-10-05  9:46 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Rajneesh Bhardwaj @ 2018-09-28  8:54 UTC (permalink / raw)
  To: linux-acpi, linux-kernel
  Cc: rjw, lenb, rajneesh.bhardwaj, Rajneesh Bhardwaj,
	Rafael J . Wysocki, Srinivas Pandruvada

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 <rafael.j.wysocki@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
---
 drivers/acpi/acpi_lpit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
index cf4fc0161164..e43cb71b6972 100644
--- a/drivers/acpi/acpi_lpit.c
+++ b/drivers/acpi/acpi_lpit.c
@@ -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,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI / LPIT: Register attributes based on FADT
  2018-09-28  8:54 [PATCH] ACPI / LPIT: Register attributes based on FADT Rajneesh Bhardwaj
@ 2018-10-05  9:46 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2018-10-05  9:46 UTC (permalink / raw)
  To: Rajneesh Bhardwaj
  Cc: linux-acpi, linux-kernel, lenb, rajneesh.bhardwaj,
	Rafael J . Wysocki, Srinivas Pandruvada

On Friday, September 28, 2018 10:54:02 AM CEST Rajneesh Bhardwaj wrote:
> 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 <rafael.j.wysocki@intel.com>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
> ---
>  drivers/acpi/acpi_lpit.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
> index cf4fc0161164..e43cb71b6972 100644
> --- a/drivers/acpi/acpi_lpit.c
> +++ b/drivers/acpi/acpi_lpit.c
> @@ -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,
> 

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-05  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-28  8:54 [PATCH] ACPI / LPIT: Register attributes based on FADT Rajneesh Bhardwaj
2018-10-05  9:46 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.