From: Bjorn Helgaas <helgaas@kernel.org>
To: "David E. Box" <david.e.box@linux.intel.com>
Cc: nirmal.patel@linux.intel.com, jonathan.derrick@linux.dev,
lorenzo.pieralisi@arm.com, hch@infradead.org, kw@linux.com,
robh@kernel.org, bhelgaas@google.com,
michael.a.bottini@linux.intel.com, rafael@kernel.org,
me@adhityamohan.in, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, Rajat Jain <rajatja@google.com>
Subject: Re: [PATCH V4 2/2] PCI: vmd: Override ASPM on TGL/ADL VMD devices
Date: Mon, 20 Dec 2021 11:28:48 -0600 [thread overview]
Message-ID: <20211220172848.GA1006510@bhelgaas> (raw)
In-Reply-To: <5432c30fd597a68feaa935054205da90519a769f.camel@linux.intel.com>
On Thu, Dec 16, 2021 at 01:24:00PM -0800, David E. Box wrote:
> On Thu, 2021-12-16 at 11:26 -0600, Bjorn Helgaas wrote:
> > On Wed, Dec 15, 2021 at 09:56:00PM -0800, David E. Box wrote:
> > > From: Michael Bottini <michael.a.bottini@linux.intel.com>
> > >
> > > On Tiger Lake and Alder Lake platforms, VMD controllers do not have ASPM
> > > enabled nor LTR values set by BIOS. This leads high power consumption on
> > > these platforms when VMD is enabled as reported in bugzilla [1]. Enable
> > > these features in the VMD driver using pcie_aspm_policy_override() to set
> > > the ASPM policy for the root ports.
> > > ...
> > > To do this, add an additional flag in VMD features to specify
> > > devices that must have their respective policies overridden.
> >
> > I'm not clear on why you want this to apply to only certain VMDs
> > and not others. Do some BIOSes configure ASPM for devices below
> > some VMDs?
>
> Not currently. But the plan is for future devices to move back to
> having BIOS do the programming.
Since this is apparently a BIOS design choice, it seems wrong to base
the functionality on the Device ID instead of some signal that tells
us what the BIOS is doing.
> > > + * Override the BIOS ASPM policy and set the LTR value for PCI storage
> > > + * devices on the VMD bride.
> >
> > I don't think there's any BIOS "policy" here. At this point BIOS
> > is no longer involved at all, so all that's left is whatever ASPM
> > config the BIOS did or did not do.
> >
> > Why only storage?
>
> Only storage devices will be on these root ports.
How do you know this? You say below that there's an M.2 slot, so
surely the slot could contain a non-storage device? Couldn't somebody
build a platform with a VMD root port connected to a regular PCIe x4
slot? Couldn't such a slot support hotplug?
It would be very unusual to hard-code topology knowledge like this
into the kernel, since plug-and-play has always been a major goal of
PCI.
> > > +static int vmd_enable_aspm(struct pci_dev *pdev, void *userdata)
> > > +{
> > > + int features = *(int *)userdata, pos;
> > > +
> > > + if (!(features & VMD_FEAT_QUIRK_OVERRIDE_ASPM) ||
> > > + pdev->class != PCI_CLASS_STORAGE_EXPRESS)
> > > + return 0;
> > > + pci_write_config_word(pdev, pos + PCI_LTR_MAX_SNOOP_LAT, 0x1003);
> > > + pci_write_config_word(pdev, pos + PCI_LTR_MAX_NOSNOOP_LAT, 0x1003);
> >
> > 1) Where did this magic 0x1003 value come from? Does that depend
> > on the VMD device? The endpoint? The circuit design? The path
> > between endpoint and VMD? What if there are switches in the path?
>
> The number comes from the BIOS team. They are tied to the SoC. I
> don't believe there can be switches in the path but Nirmal and
> Jonathan should know for sure. From what I've seen these root ports
> are wired directly to M.2 slots on boards that are intended for
> storage devices.
I guess you're saying that 0x1003 is determined by the SoC. If so, I
think this value should be in your .driver_data (which would mean
converting it from a scalar to a struct, as many other drivers do).
The current code suggests that 0x1003 is the correct value for *all*
VMDs and all configurations.
I don't understand LTR well enough to be convinced that this static
value would be the correct value for all possible hierarchies and
devices that could appear below a VMD root port. I would love to be
educated about this.
Bjorn
next prev parent reply other threads:[~2021-12-20 17:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 5:55 [PATCH V4 1/2] PCI/ASPM: Add ASPM BIOS override function David E. Box
2021-12-16 5:56 ` [PATCH V4 2/2] PCI: vmd: Override ASPM on TGL/ADL VMD devices David E. Box
2021-12-16 17:26 ` Bjorn Helgaas
2021-12-16 21:24 ` David E. Box
2021-12-20 17:28 ` Bjorn Helgaas [this message]
2021-12-20 23:06 ` David E. Box
2021-12-21 2:14 ` Rajat Jain
2021-12-21 21:11 ` David E. Box
2021-12-22 7:50 ` Christoph Hellwig
2021-12-21 1:52 ` Rajat Jain
2021-12-16 17:06 ` [PATCH V4 1/2] PCI/ASPM: Add ASPM BIOS override function Bjorn Helgaas
2021-12-16 18:33 ` David E. Box
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211220172848.GA1006510@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=david.e.box@linux.intel.com \
--cc=hch@infradead.org \
--cc=jonathan.derrick@linux.dev \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=me@adhityamohan.in \
--cc=michael.a.bottini@linux.intel.com \
--cc=nirmal.patel@linux.intel.com \
--cc=rafael@kernel.org \
--cc=rajatja@google.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.