[V8,0/4] PCI: vmd: Enable PCIe ASPM and LTR on select hardware

Message ID 20221103021822.308586-1-david.e.box@linux.intel.com
Headers
Series PCI: vmd: Enable PCIe ASPM and LTR on select hardware |

Message

David E. Box Nov. 3, 2022, 2:18 a.m. UTC
  This series adds a work around for enabling PCIe ASPM and for setting PCIe
LTR values on VMD reserved root ports on select platforms. While
configuration of these capabilities is usually done by BIOS, on these
platforms these capabilities will not be configured because the ports are
not visible to BIOS. This was part of an initial design that expected the
driver to completely handle the ports, including power management. However
on Linux those ports are still managed by the PCIe core, which has the
expectation that they adhere to device standards including BIOS
configuration, leading to this problem.

The target platforms are Tiger Lake, Alder Lake, and Raptor Lake though the
latter has already implemented support for configuring the LTR values.
Meteor Lake is expected add BIOS ASPM support, eliminating the future need
for this work around.

Note, the driver programs the LTRs because BIOS would also normally do this
for devices that do not set them by default. Without this, SoC power
management would be blocked on those platform. This SoC specific value is
the maximum latency required to allow the SoC to enter the deepest power
state.

This patch addresses the following open bugzillas on VMD enabled laptops
that cannot enter low power states.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717

David E. Box (3):
  PCI: vmd: Use PCI_VDEVICE in device list
  PCI: vmd: Create feature grouping for client products
  PCI: vmd: Add quirk to configure PCIe ASPM and LTR

Michael Bottini (1):
  PCI/ASPM: Add pci_enable_link_state()

 drivers/pci/controller/vmd.c | 96 ++++++++++++++++++++++++++----------
 drivers/pci/pcie/aspm.c      | 54 ++++++++++++++++++++
 include/linux/pci.h          |  7 +++
 3 files changed, 131 insertions(+), 26 deletions(-)


base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
  

Comments

You-Sheng Yang Nov. 23, 2022, 10:27 a.m. UTC | #1
Hi David,

On 11/3/22 10:18, David E. Box wrote:
> This series adds a work around for enabling PCIe ASPM and for setting PCIe
> LTR values on VMD reserved root ports on select platforms. While
> configuration of these capabilities is usually done by BIOS, on these
> platforms these capabilities will not be configured because the ports are
> not visible to BIOS. This was part of an initial design that expected the
> driver to completely handle the ports, including power management. However
> on Linux those ports are still managed by the PCIe core, which has the
> expectation that they adhere to device standards including BIOS
> configuration, leading to this problem.
>
> The target platforms are Tiger Lake, Alder Lake, and Raptor Lake though the
> latter has already implemented support for configuring the LTR values.
> Meteor Lake is expected add BIOS ASPM support, eliminating the future need
> for this work around.


It appears to me that this patch series works only on Tiger Lake. We 
have tried to revert our current work-arounds in Ubuntu kernels 
generic-5.15/oem-5.17/oem-6.0/unstable-6.1 and apply this series, the 
prebuilt kernels can be found in:

   https://launchpad.net/~vicamo/+archive/ubuntu/ppa-1996620

However, only TGL can still enter PC10 as before.


ADL-M, RPL platforms will stay in PC3 with vmd LTR set, but ASPM 
disabled. i915 RC6 blocked, too:

$ sudo cat /sys/kernel/debug/dri/

0/i915_dmc_info
...
DC3CO count: 0
DC3 -> DC5 count: 100
DC5 -> DC6 count: 0


> Note, the driver programs the LTRs because BIOS would also normally do this
> for devices that do not set them by default. Without this, SoC power
> management would be blocked on those platform. This SoC specific value is
> the maximum latency required to allow the SoC to enter the deepest power
> state.
>
> This patch addresses the following open bugzillas on VMD enabled laptops
> that cannot enter low power states.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717
>
> David E. Box (3):
>    PCI: vmd: Use PCI_VDEVICE in device list
>    PCI: vmd: Create feature grouping for client products
>    PCI: vmd: Add quirk to configure PCIe ASPM and LTR
>
> Michael Bottini (1):
>    PCI/ASPM: Add pci_enable_link_state()
>
>   drivers/pci/controller/vmd.c | 96 ++++++++++++++++++++++++++----------
>   drivers/pci/pcie/aspm.c      | 54 ++++++++++++++++++++
>   include/linux/pci.h          |  7 +++
>   3 files changed, 131 insertions(+), 26 deletions(-)
>
>
> base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740


Regards,
You-Sheng Yang
  
David E. Box Nov. 23, 2022, 4:09 p.m. UTC | #2
Hi You-Sheng,

On Wed, 2022-11-23 at 18:27 +0800, You-Sheng Yang wrote:
> Hi David,
> 
> On 11/3/22 10:18, David E. Box wrote:
> > This series adds a work around for enabling PCIe ASPM and for setting PCIe
> > LTR values on VMD reserved root ports on select platforms. While
> > configuration of these capabilities is usually done by BIOS, on these
> > platforms these capabilities will not be configured because the ports are
> > not visible to BIOS. This was part of an initial design that expected the
> > driver to completely handle the ports, including power management. However
> > on Linux those ports are still managed by the PCIe core, which has the
> > expectation that they adhere to device standards including BIOS
> > configuration, leading to this problem.
> > 
> > The target platforms are Tiger Lake, Alder Lake, and Raptor Lake though the
> > latter has already implemented support for configuring the LTR values.
> > Meteor Lake is expected add BIOS ASPM support, eliminating the future need
> > for this work around.
> 
> 
> It appears to me that this patch series works only on Tiger Lake. We 
> have tried to revert our current work-arounds in Ubuntu kernels 
> generic-5.15/oem-5.17/oem-6.0/unstable-6.1 and apply this series, the 
> prebuilt kernels can be found in:
> 
>    https://launchpad.net/~vicamo/+archive/ubuntu/ppa-1996620
> 
> However, only TGL can still enter PC10 as before.
> 
> 
> ADL-M, RPL platforms will stay in PC3 with vmd LTR set, but ASPM 
> disabled.

For the patch to work BIOS must allow the OS to control ASPM. If this is not the
case then you will see the message "ACPI FADT declares the system doesn't
support PCIe ASPM, so disable it". Please check for this on the systems that
don't work. If so the only option is a BIOS change to enable it.

David

>  i915 RC6 blocked, too:
> 
> $ sudo cat /sys/kernel/debug/dri/
> 
> 0/i915_dmc_info
> ...
> DC3CO count: 0
> DC3 -> DC5 count: 100
> DC5 -> DC6 count: 0
> 
> 
> > Note, the driver programs the LTRs because BIOS would also normally do this
> > for devices that do not set them by default. Without this, SoC power
> > management would be blocked on those platform. This SoC specific value is
> > the maximum latency required to allow the SoC to enter the deepest power
> > state.
> > 
> > This patch addresses the following open bugzillas on VMD enabled laptops
> > that cannot enter low power states.
> > 
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717
> > 
> > David E. Box (3):
> >    PCI: vmd: Use PCI_VDEVICE in device list
> >    PCI: vmd: Create feature grouping for client products
> >    PCI: vmd: Add quirk to configure PCIe ASPM and LTR
> > 
> > Michael Bottini (1):
> >    PCI/ASPM: Add pci_enable_link_state()
> > 
> >   drivers/pci/controller/vmd.c | 96 ++++++++++++++++++++++++++----------
> >   drivers/pci/pcie/aspm.c      | 54 ++++++++++++++++++++
> >   include/linux/pci.h          |  7 +++
> >   3 files changed, 131 insertions(+), 26 deletions(-)
> > 
> > 
> > base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
> 
> 
> Regards,
> You-Sheng Yang
>
  
You-Sheng Yang Nov. 24, 2022, 4:39 p.m. UTC | #3
On Thu, Nov 24, 2022 at 12:09 AM David E. Box
<david.e.box@linux.intel.com> wrote:
>
> Hi You-Sheng,
>
> On Wed, 2022-11-23 at 18:27 +0800, You-Sheng Yang wrote:
> > Hi David,
> >
> > On 11/3/22 10:18, David E. Box wrote:
> > > This series adds a work around for enabling PCIe ASPM and for setting PCIe
> > > LTR values on VMD reserved root ports on select platforms. While
> > > configuration of these capabilities is usually done by BIOS, on these
> > > platforms these capabilities will not be configured because the ports are
> > > not visible to BIOS. This was part of an initial design that expected the
> > > driver to completely handle the ports, including power management. However
> > > on Linux those ports are still managed by the PCIe core, which has the
> > > expectation that they adhere to device standards including BIOS
> > > configuration, leading to this problem.
> > >
> > > The target platforms are Tiger Lake, Alder Lake, and Raptor Lake though the
> > > latter has already implemented support for configuring the LTR values.
> > > Meteor Lake is expected add BIOS ASPM support, eliminating the future need
> > > for this work around.
> >
> >
> > It appears to me that this patch series works only on Tiger Lake. We
> > have tried to revert our current work-arounds in Ubuntu kernels
> > generic-5.15/oem-5.17/oem-6.0/unstable-6.1 and apply this series, the
> > prebuilt kernels can be found in:
> >
> >    https://launchpad.net/~vicamo/+archive/ubuntu/ppa-1996620
> >
> > However, only TGL can still enter PC10 as before.
> >
> >
> > ADL-M, RPL platforms will stay in PC3 with vmd LTR set, but ASPM
> > disabled.
>
> For the patch to work BIOS must allow the OS to control ASPM. If this is not the
> case then you will see the message "ACPI FADT declares the system doesn't
> support PCIe ASPM, so disable it". Please check for this on the systems that
> don't work. If so the only option is a BIOS change to enable it.

Thank you. It's exactly what you said. The ADL-M/RPL platforms I have
do not support OS PCIe ASPM.

> David
>
> >  i915 RC6 blocked, too:
> >
> > $ sudo cat /sys/kernel/debug/dri/
> >
> > 0/i915_dmc_info
> > ...
> > DC3CO count: 0
> > DC3 -> DC5 count: 100
> > DC5 -> DC6 count: 0
> >
> >
> > > Note, the driver programs the LTRs because BIOS would also normally do this
> > > for devices that do not set them by default. Without this, SoC power
> > > management would be blocked on those platform. This SoC specific value is
> > > the maximum latency required to allow the SoC to enter the deepest power
> > > state.
> > >
> > > This patch addresses the following open bugzillas on VMD enabled laptops
> > > that cannot enter low power states.
> > >
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717
> > >
> > > David E. Box (3):
> > >    PCI: vmd: Use PCI_VDEVICE in device list
> > >    PCI: vmd: Create feature grouping for client products
> > >    PCI: vmd: Add quirk to configure PCIe ASPM and LTR
> > >
> > > Michael Bottini (1):
> > >    PCI/ASPM: Add pci_enable_link_state()
> > >
> > >   drivers/pci/controller/vmd.c | 96 ++++++++++++++++++++++++++----------
> > >   drivers/pci/pcie/aspm.c      | 54 ++++++++++++++++++++
> > >   include/linux/pci.h          |  7 +++
> > >   3 files changed, 131 insertions(+), 26 deletions(-)
> > >
> > >
> > > base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
> >
> >
> > Regards,
> > You-Sheng Yang
> >
>
  
Luke Jones Dec. 7, 2022, 9:05 a.m. UTC | #4
On Wed, 2022-11-02 at 19:18 -0700, David E. Box wrote:
> This series adds a work around for enabling PCIe ASPM and for setting
> PCIe
> LTR values on VMD reserved root ports on select platforms. While
> configuration of these capabilities is usually done by BIOS, on these
> platforms these capabilities will not be configured because the ports
> are
> not visible to BIOS. This was part of an initial design that expected
> the
> driver to completely handle the ports, including power management.
> However
> on Linux those ports are still managed by the PCIe core, which has
> the
> expectation that they adhere to device standards including BIOS
> configuration, leading to this problem.
> 
> The target platforms are Tiger Lake, Alder Lake, and Raptor Lake
> though the
> latter has already implemented support for configuring the LTR
> values.
> Meteor Lake is expected add BIOS ASPM support, eliminating the future
> need
> for this work around.
> 
> Note, the driver programs the LTRs because BIOS would also normally
> do this
> for devices that do not set them by default. Without this, SoC power
> management would be blocked on those platform. This SoC specific
> value is
> the maximum latency required to allow the SoC to enter the deepest
> power
> state.
> 
> This patch addresses the following open bugzillas on VMD enabled
> laptops
> that cannot enter low power states.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717
> 
> David E. Box (3):
>   PCI: vmd: Use PCI_VDEVICE in device list
>   PCI: vmd: Create feature grouping for client products
>   PCI: vmd: Add quirk to configure PCIe ASPM and LTR
> 
> Michael Bottini (1):
>   PCI/ASPM: Add pci_enable_link_state()
> 
>  drivers/pci/controller/vmd.c | 96 ++++++++++++++++++++++++++--------
> --
>  drivers/pci/pcie/aspm.c      | 54 ++++++++++++++++++++
>  include/linux/pci.h          |  7 +++
>  3 files changed, 131 insertions(+), 26 deletions(-)
> 
> 
> base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740

I'd like to confirm that this patch series solves the VMD power issues
present on the ASUS ROG M16 (GU603) laptop range (PCI dev ID = 467f).

The difference is quite drastic.
  
David E. Box Dec. 8, 2022, 2:40 a.m. UTC | #5
On Wed, 2022-12-07 at 22:05 +1300, Luke Jones wrote:
> On Wed, 2022-11-02 at 19:18 -0700, David E. Box wrote:
> > This series adds a work around for enabling PCIe ASPM and for setting
> > PCIe
> > LTR values on VMD reserved root ports on select platforms. While
> > configuration of these capabilities is usually done by BIOS, on these
> > platforms these capabilities will not be configured because the ports
> > are
> > not visible to BIOS. This was part of an initial design that expected
> > the
> > driver to completely handle the ports, including power management.
> > However
> > on Linux those ports are still managed by the PCIe core, which has
> > the
> > expectation that they adhere to device standards including BIOS
> > configuration, leading to this problem.
> > 
> > The target platforms are Tiger Lake, Alder Lake, and Raptor Lake
> > though the
> > latter has already implemented support for configuring the LTR
> > values.
> > Meteor Lake is expected add BIOS ASPM support, eliminating the future
> > need
> > for this work around.
> > 
> > Note, the driver programs the LTRs because BIOS would also normally
> > do this
> > for devices that do not set them by default. Without this, SoC power
> > management would be blocked on those platform. This SoC specific
> > value is
> > the maximum latency required to allow the SoC to enter the deepest
> > power
> > state.
> > 
> > This patch addresses the following open bugzillas on VMD enabled
> > laptops
> > that cannot enter low power states.
> > 
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=212355
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215063
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=213717
> > 
> > David E. Box (3):
> >   PCI: vmd: Use PCI_VDEVICE in device list
> >   PCI: vmd: Create feature grouping for client products
> >   PCI: vmd: Add quirk to configure PCIe ASPM and LTR
> > 
> > Michael Bottini (1):
> >   PCI/ASPM: Add pci_enable_link_state()
> > 
> >  drivers/pci/controller/vmd.c | 96 ++++++++++++++++++++++++++--------
> > --
> >  drivers/pci/pcie/aspm.c      | 54 ++++++++++++++++++++
> >  include/linux/pci.h          |  7 +++
> >  3 files changed, 131 insertions(+), 26 deletions(-)
> > 
> > 
> > base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740
> 
> I'd like to confirm that this patch series solves the VMD power issues
> present on the ASUS ROG M16 (GU603) laptop range (PCI dev ID = 467f).
> 
> The difference is quite drastic.
> 

Thanks for testing this Luke.

David