From: Nirmal Patel <nirmal.patel@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci@vger.kernel.org, paul.m.stillwell.jr@intel.com,
Jim Harris <james.r.harris@intel.com>
Subject: Re: [PATCH] PCI: fixup PCI_INTERRUPT_LINE for VMD downstream devices
Date: Mon, 29 Jul 2024 13:10:15 -0700 [thread overview]
Message-ID: <20240729131015.000000b9@linux.intel.com> (raw)
In-Reply-To: <20240724191030.GA806685@bhelgaas>
On Wed, 24 Jul 2024 14:10:30 -0500
Bjorn Helgaas <helgaas@kernel.org> wrote:
> On Wed, Jul 24, 2024 at 10:00:40AM -0700, Nirmal Patel wrote:
> > VMD does not support legacy interrupts for devices downstream from a
> > VMD endpoint. So initialize the PCI_INTERRUPT_LINE to 0 for these
> > devices to ensure we don't try to set up a legacy irq for them.
>
> s/legacy interrupts/INTx/
> s/legacy irq/INTx/
>
> > Note: This patch was proposed by Jim, I am trying to upstream it.
> >
> > Signed-off-by: Jim Harris <james.r.harris@intel.com>
> > Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
> > ---
> > arch/x86/pci/fixup.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
> > index b33afb240601..a3b34a256e7f 100644
> > --- a/arch/x86/pci/fixup.c
> > +++ b/arch/x86/pci/fixup.c
> > @@ -653,6 +653,20 @@ static void quirk_no_aersid(struct pci_dev
> > *pdev) DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL,
> > PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, 8, quirk_no_aersid);
> >
> > +#if IS_ENABLED(CONFIG_VMD)
> > +/*
> > + * VMD does not support legacy interrupts for downstream devices.
> > + * So PCI_INTERRPUT_LINE needs to be initialized to 0 to ensure OS
> > + * doesn't try to configure a legacy irq.
>
> s/legacy interrupts/INTx/
> s/PCI_INTERRPUT_LINE/PCI_INTERRUPT_LINE/
>
> > + */
> > +static void quirk_vmd_interrupt_line(struct pci_dev *dev)
> > +{
> > + if (is_vmd(dev->bus))
> > + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 0);
> > +}
> > +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID,
> > quirk_vmd_interrupt_line);
>
> A quirk for every PCI device, even on systems without VMD, seems like
> kind of a clumsy way to deal with this.
>
> Conceptually, I would expect a host bridge driver (VMD acts like a
> host bridge in this case) to know whether it supports INTx, and if the
> driver knows it doesn't support INTx or it has no _PRT or DT
> description of INTx routing to use, an attempt to configure INTx
> should just fail naturally.
>
> I don't claim this is how host bridge drivers actually work; I just
> think it's the way they *should* work.
For VMD as a host bridge, pci_host_bridge::map_irq is null. Even all
VMD rootports' PCI_INTERRUPT_LINE registers are set to 0. Since VMD
doesn't explicitly set PCI_INTERRUPT_LINE register to 0 for all of its
sub-devices (i.e. NVMe), if some NVMes has non-zero value set for
PCI_INTERRUPT_LINE (i.e. 0xff) then some software like SPDK can read
it and make wrong assumption about INTx support.
Based your suggestion, it might be better if VMD sets
PCI_INTERRUPT_LINE register to 0 for all of its sub-devices during
VMD enumeration.
-nirmal.
>
> > +#endif
> > +
> > static void quirk_intel_th_dnv(struct pci_dev *dev)
> > {
> > struct resource *r = &dev->resource[4];
> > --
> > 2.39.1
> >
prev parent reply other threads:[~2024-07-29 20:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 17:00 [PATCH] PCI: fixup PCI_INTERRUPT_LINE for VMD downstream devices Nirmal Patel
2024-07-24 18:36 ` Christoph Hellwig
2024-07-31 19:21 ` Nirmal Patel
2024-07-24 19:10 ` Bjorn Helgaas
2024-07-25 4:10 ` Manivannan Sadhasivam
2024-07-25 21:22 ` Nirmal Patel
2024-07-29 20:08 ` Nirmal Patel
2024-07-30 5:28 ` Manivannan Sadhasivam
2024-07-30 17:51 ` Nirmal Patel
2024-07-31 3:07 ` Manivannan Sadhasivam
2024-08-01 18:57 ` Nirmal Patel
2024-07-29 20:10 ` Nirmal Patel [this message]
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=20240729131015.000000b9@linux.intel.com \
--to=nirmal.patel@linux.intel.com \
--cc=helgaas@kernel.org \
--cc=james.r.harris@intel.com \
--cc=linux-pci@vger.kernel.org \
--cc=paul.m.stillwell.jr@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 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.