From: Lukas Wunner <lukas@wunner.de>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v2] PCI/PTM: Do not enable PTM solely based on the capability existense
Date: Wed, 29 Oct 2025 11:53:49 +0100 [thread overview]
Message-ID: <aQHyPWYNSVTeOdYs@wunner.de> (raw)
In-Reply-To: <20251029053354.GV2912318@black.igk.intel.com>
On Wed, Oct 29, 2025 at 06:33:54AM +0100, Mika Westerberg wrote:
> On Tue, Oct 28, 2025 at 12:06:39PM -0500, Bjorn Helgaas wrote:
> > On Tue, Oct 28, 2025 at 07:04:27AM +0100, Mika Westerberg wrote:
> > > @@ -125,7 +140,7 @@ static int __pci_enable_ptm(struct pci_dev *dev)
> > > {
> > > u16 ptm = dev->ptm_cap;
> > > struct pci_dev *ups;
> > > - u32 ctrl;
> > > + u32 cap, ctrl;
> > >
> > > if (!ptm)
> > > return -EINVAL;
> > > @@ -144,6 +159,14 @@ static int __pci_enable_ptm(struct pci_dev *dev)
> > > return -EINVAL;
> > > }
> > >
> > > + /*
> > > + * PCIe Endpoint must declare Requester Capable before we can
> > > + * enable PTM for it.
> > > + */
> > > + pci_read_config_dword(dev, ptm + PCI_PTM_CAP, &cap);
> > > + if (!(cap & PCI_PTM_CAP_REQ))
> > > + return -EINVAL;
> >
> > Isn't this going to prevent enabling PTM on Root Ports?
>
> Isn't this function called only for Endpoints? Root Ports and Switch Ports
> are enabled in pci_ptm_init() instead.
The function is also called for Root Ports:
pci_ptm_init()
pci_enable_ptm()
__pci_enable_ptm()
So I guess you need to constrain this to:
PCI_EXP_TYPE_ENDPOINT
PCI_EXP_TYPE_LEG_END
Sorry for missing that during review!
Lukas
next prev parent reply other threads:[~2025-10-29 10:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 6:04 [PATCH v2] PCI/PTM: Do not enable PTM solely based on the capability existense Mika Westerberg
2025-10-28 9:53 ` Lukas Wunner
2025-10-28 17:06 ` Bjorn Helgaas
2025-10-29 5:33 ` Mika Westerberg
2025-10-29 10:53 ` Lukas Wunner [this message]
2025-10-29 11:20 ` Mika Westerberg
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=aQHyPWYNSVTeOdYs@wunner.de \
--to=lukas@wunner.de \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox