mbox series

[0/4] Add support for drivers to decide bridge D3 policy

Message ID 20231025020546.504-1-mario.limonciello@amd.com (mailing list archive)
Headers show
Series Add support for drivers to decide bridge D3 policy | expand

Message

Mario Limonciello Oct. 25, 2023, 2:05 a.m. UTC
The policy for whether PCI bridges are allowed to select D3 is dictated
by empirical results that are enumerated into pci_bridge_d3_possible().

In Windows this behaves differently in that Windows internal policy is
not used for devices when a power engine plugin driver provided by the
SOC vendor is installed.  This driver is used to decide the policy in
those cases.

This series implements a system that lets drivers register such a policy
control as well. It isn't activated for any SOCs by default.

This is heavily leveraged from the work in [1]

[1] https://lore.kernel.org/platform-driver-x86/20230906184354.45846-1-mario.limonciello@amd.com/

RFC v1->PATCH v1
 * Simplify the logic, use pci_d3cold_enable()/pci_d3cold_disable() functions
 * Roll https://lore.kernel.org/linux-pci/20231004144731.158342-1-mario.limonciello@amd.com/ into series
 * Updates for some typos
 * Re-order series.  Patches 1 and 2 can potentially apply to PCI tree, 3 and 4 to platform-x86 tree.

Mario Limonciello (4):
  PCI: Make d3cold_allowed sysfs attribute read only
  PCI: Refresh root ports in pci_bridge_d3_update()
  ACPI: x86: s2idle: Export symbol for fetching constraints for module
    use
  platform/x86/amd: pmc: Add support for using constraints to decide D3
    policy

 Documentation/ABI/testing/sysfs-bus-pci |  4 +-
 drivers/acpi/x86/s2idle.c               |  1 +
 drivers/pci/pci-acpi.c                  |  2 +-
 drivers/pci/pci-sysfs.c                 | 14 +-----
 drivers/pci/pci.c                       | 12 ++++--
 drivers/platform/x86/amd/pmc/pmc.c      | 57 +++++++++++++++++++++++++
 include/linux/pci.h                     |  1 -
 7 files changed, 72 insertions(+), 19 deletions(-)

Comments

Rafael J. Wysocki Oct. 26, 2023, 5:04 p.m. UTC | #1
On Wednesday, October 25, 2023 4:05:42 AM CEST Mario Limonciello wrote:
> The policy for whether PCI bridges are allowed to select D3 is dictated
> by empirical results that are enumerated into pci_bridge_d3_possible().
> 
> In Windows this behaves differently in that Windows internal policy is
> not used for devices when a power engine plugin driver provided by the
> SOC vendor is installed.  This driver is used to decide the policy in
> those cases.
> 
> This series implements a system that lets drivers register such a policy
> control as well. It isn't activated for any SOCs by default.
> 
> This is heavily leveraged from the work in [1]
> 
> [1] https://lore.kernel.org/platform-driver-x86/20230906184354.45846-1-mario.limonciello@amd.com/
> 
> RFC v1->PATCH v1
>  * Simplify the logic, use pci_d3cold_enable()/pci_d3cold_disable() functions
>  * Roll https://lore.kernel.org/linux-pci/20231004144731.158342-1-mario.limonciello@amd.com/ into series
>  * Updates for some typos
>  * Re-order series.  Patches 1 and 2 can potentially apply to PCI tree, 3 and 4 to platform-x86 tree.
> 
> Mario Limonciello (4):
>   PCI: Make d3cold_allowed sysfs attribute read only
>   PCI: Refresh root ports in pci_bridge_d3_update()
>   ACPI: x86: s2idle: Export symbol for fetching constraints for module
>     use
>   platform/x86/amd: pmc: Add support for using constraints to decide D3
>     policy
> 
>  Documentation/ABI/testing/sysfs-bus-pci |  4 +-
>  drivers/acpi/x86/s2idle.c               |  1 +
>  drivers/pci/pci-acpi.c                  |  2 +-
>  drivers/pci/pci-sysfs.c                 | 14 +-----
>  drivers/pci/pci.c                       | 12 ++++--
>  drivers/platform/x86/amd/pmc/pmc.c      | 57 +++++++++++++++++++++++++
>  include/linux/pci.h                     |  1 -
>  7 files changed, 72 insertions(+), 19 deletions(-)

Any chance to CC this series to linux-pm and linux-acpi?
Mario Limonciello Oct. 26, 2023, 5:06 p.m. UTC | #2
On 10/26/2023 12:04, Rafael J. Wysocki wrote:
> On Wednesday, October 25, 2023 4:05:42 AM CEST Mario Limonciello wrote:
>> The policy for whether PCI bridges are allowed to select D3 is dictated
>> by empirical results that are enumerated into pci_bridge_d3_possible().
>>
>> In Windows this behaves differently in that Windows internal policy is
>> not used for devices when a power engine plugin driver provided by the
>> SOC vendor is installed.  This driver is used to decide the policy in
>> those cases.
>>
>> This series implements a system that lets drivers register such a policy
>> control as well. It isn't activated for any SOCs by default.
>>
>> This is heavily leveraged from the work in [1]
>>
>> [1] https://lore.kernel.org/platform-driver-x86/20230906184354.45846-1-mario.limonciello@amd.com/
>>
>> RFC v1->PATCH v1
>>   * Simplify the logic, use pci_d3cold_enable()/pci_d3cold_disable() functions
>>   * Roll https://lore.kernel.org/linux-pci/20231004144731.158342-1-mario.limonciello@amd.com/ into series
>>   * Updates for some typos
>>   * Re-order series.  Patches 1 and 2 can potentially apply to PCI tree, 3 and 4 to platform-x86 tree.
>>
>> Mario Limonciello (4):
>>    PCI: Make d3cold_allowed sysfs attribute read only
>>    PCI: Refresh root ports in pci_bridge_d3_update()
>>    ACPI: x86: s2idle: Export symbol for fetching constraints for module
>>      use
>>    platform/x86/amd: pmc: Add support for using constraints to decide D3
>>      policy
>>
>>   Documentation/ABI/testing/sysfs-bus-pci |  4 +-
>>   drivers/acpi/x86/s2idle.c               |  1 +
>>   drivers/pci/pci-acpi.c                  |  2 +-
>>   drivers/pci/pci-sysfs.c                 | 14 +-----
>>   drivers/pci/pci.c                       | 12 ++++--
>>   drivers/platform/x86/amd/pmc/pmc.c      | 57 +++++++++++++++++++++++++
>>   include/linux/pci.h                     |  1 -
>>   7 files changed, 72 insertions(+), 19 deletions(-)
> 
> Any chance to CC this series to linux-pm and linux-acpi?
> 
> 
> 
> 

Sure if it needs to spin again I'll send it to those lists as well.

Here's a lore link for you for now though if you want to respond to the 
other patches.

https://lore.kernel.org/platform-driver-x86/0cd6648d-21f1-445d-95f6-20f580bbcfd1@amd.com/T/
Rafael J. Wysocki Oct. 26, 2023, 5:10 p.m. UTC | #3
On Thursday, October 26, 2023 7:06:13 PM CEST Mario Limonciello wrote:
> On 10/26/2023 12:04, Rafael J. Wysocki wrote:
> > On Wednesday, October 25, 2023 4:05:42 AM CEST Mario Limonciello wrote:
> >> The policy for whether PCI bridges are allowed to select D3 is dictated
> >> by empirical results that are enumerated into pci_bridge_d3_possible().
> >>
> >> In Windows this behaves differently in that Windows internal policy is
> >> not used for devices when a power engine plugin driver provided by the
> >> SOC vendor is installed.  This driver is used to decide the policy in
> >> those cases.
> >>
> >> This series implements a system that lets drivers register such a policy
> >> control as well. It isn't activated for any SOCs by default.
> >>
> >> This is heavily leveraged from the work in [1]
> >>
> >> [1] https://lore.kernel.org/platform-driver-x86/20230906184354.45846-1-mario.limonciello@amd.com/
> >>
> >> RFC v1->PATCH v1
> >>   * Simplify the logic, use pci_d3cold_enable()/pci_d3cold_disable() functions
> >>   * Roll https://lore.kernel.org/linux-pci/20231004144731.158342-1-mario.limonciello@amd.com/ into series
> >>   * Updates for some typos
> >>   * Re-order series.  Patches 1 and 2 can potentially apply to PCI tree, 3 and 4 to platform-x86 tree.
> >>
> >> Mario Limonciello (4):
> >>    PCI: Make d3cold_allowed sysfs attribute read only
> >>    PCI: Refresh root ports in pci_bridge_d3_update()
> >>    ACPI: x86: s2idle: Export symbol for fetching constraints for module
> >>      use
> >>    platform/x86/amd: pmc: Add support for using constraints to decide D3
> >>      policy
> >>
> >>   Documentation/ABI/testing/sysfs-bus-pci |  4 +-
> >>   drivers/acpi/x86/s2idle.c               |  1 +
> >>   drivers/pci/pci-acpi.c                  |  2 +-
> >>   drivers/pci/pci-sysfs.c                 | 14 +-----
> >>   drivers/pci/pci.c                       | 12 ++++--
> >>   drivers/platform/x86/amd/pmc/pmc.c      | 57 +++++++++++++++++++++++++
> >>   include/linux/pci.h                     |  1 -
> >>   7 files changed, 72 insertions(+), 19 deletions(-)
> > 
> > Any chance to CC this series to linux-pm and linux-acpi?
> > 
> > 
> > 
> > 
> 
> Sure if it needs to spin again I'll send it to those lists as well.
> 
> Here's a lore link for you for now though if you want to respond to the 
> other patches.
> 
> https://lore.kernel.org/platform-driver-x86/0cd6648d-21f1-445d-95f6-20f580bbcfd1@amd.com/T/

Thanks, but I'm not the only person on linux-acpi and linux-pm
that may be interested in these changes.

Also please note that the material is related to ACPI and PM, so
quite relevant for those lists.
Hans de Goede Nov. 20, 2023, 10:13 a.m. UTC | #4
Hi,

On 10/25/23 04:05, Mario Limonciello wrote:
> The policy for whether PCI bridges are allowed to select D3 is dictated
> by empirical results that are enumerated into pci_bridge_d3_possible().
> 
> In Windows this behaves differently in that Windows internal policy is
> not used for devices when a power engine plugin driver provided by the
> SOC vendor is installed.  This driver is used to decide the policy in
> those cases.
> 
> This series implements a system that lets drivers register such a policy
> control as well. It isn't activated for any SOCs by default.

I must admit that I've lost track of the status of this series...

With that said patch 4/4 looks good to me and I believe that
if this series gets accepted it will be best to send 4/4
upstream together with the rest through some other tree
then the the pdx86 tree.

So here is my ack for sending a future version of patch 4/4
("platform/x86/amd: pmc: Add support for using constraints
to decide D3 policy") upstream through another subsystem tree:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans






> This is heavily leveraged from the work in [1]
> 
> [1] https://lore.kernel.org/platform-driver-x86/20230906184354.45846-1-mario.limonciello@amd.com/
> 
> RFC v1->PATCH v1
>  * Simplify the logic, use pci_d3cold_enable()/pci_d3cold_disable() functions
>  * Roll https://lore.kernel.org/linux-pci/20231004144731.158342-1-mario.limonciello@amd.com/ into series
>  * Updates for some typos
>  * Re-order series.  Patches 1 and 2 can potentially apply to PCI tree, 3 and 4 to platform-x86 tree.
> 
> Mario Limonciello (4):
>   PCI: Make d3cold_allowed sysfs attribute read only
>   PCI: Refresh root ports in pci_bridge_d3_update()
>   ACPI: x86: s2idle: Export symbol for fetching constraints for module
>     use
>   platform/x86/amd: pmc: Add support for using constraints to decide D3
>     policy
> 
>  Documentation/ABI/testing/sysfs-bus-pci |  4 +-
>  drivers/acpi/x86/s2idle.c               |  1 +
>  drivers/pci/pci-acpi.c                  |  2 +-
>  drivers/pci/pci-sysfs.c                 | 14 +-----
>  drivers/pci/pci.c                       | 12 ++++--
>  drivers/platform/x86/amd/pmc/pmc.c      | 57 +++++++++++++++++++++++++
>  include/linux/pci.h                     |  1 -
>  7 files changed, 72 insertions(+), 19 deletions(-)
>