Skip to content
Commit 80a129af authored by Maximilian Luz's avatar Maximilian Luz Committed by Bjorn Helgaas
Browse files

PCI: Add sysfs attribute for device power state

While PCI power states D0-D3hot can be queried from user-space via lspci,
D3cold cannot.  lspci cannot provide an accurate value when the device is
in D3cold as it has to restore the device to D0 before it can access its
power state via the configuration space, leading to it reporting D0 or
another on-state. Thus lspci cannot be used to diagnose power consumption
issues for devices that can enter D3cold or to ensure that devices properly
enter D3cold at all.

Add a new sysfs device attribute for the PCI power state, showing the
current power state as seen by the kernel.

[bhelgaas: drop READ_ONCE(), see discussion at the link]
Link: https://lore.kernel.org/r/20201102141520.831630-1-luzmaximilian@gmail.com


Signed-off-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent f8394f23
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment