[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250214172324.GA157438@bhelgaas>
Date: Fri, 14 Feb 2025 11:23:24 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Roger Pau Monne <roger.pau@...rix.com>
Cc: linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org,
linux-pci@...r.kernel.org,
Nirmal Patel <nirmal.patel@...ux.intel.com>,
Jonathan Derrick <jonathan.derrick@...ux.dev>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Rob Herring <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v2 2/3] vmd: disable MSI remapping bypass under Xen
The subject line convention for this file is:
PCI: vmd: Disable MSI remapping ...
On Tue, Jan 14, 2025 at 11:33:12AM +0100, Roger Pau Monne wrote:
> MSI remapping bypass (directly configuring MSI entries for devices on the
> VMD bus) won't work under Xen, as Xen is not aware of devices in such bus,
> and hence cannot configure the entries using the pIRQ interface in the PV
> case, and in the PVH case traps won't be setup for MSI entries for such
> devices.
>
> Until Xen is aware of devices in the VMD bus prevent the
> VMD_FEAT_CAN_BYPASS_MSI_REMAP capability from being used when running as
> any kind of Xen guest.
>
> The MSI remapping bypass is an optional feature of VMD bridges, and hence
> when running under Xen it will be masked and devices will be forced to
> redirect its interrupts from the VMD bridge. That mode of operation must
> always be supported by VMD bridges and works when Xen is not aware of
> devices behind the VMD bridge.
>
> Signed-off-by: Roger Pau Monné <roger.pau@...rix.com>
> ---
> Changes since v1:
> - Add xen header.
> - Expand comment.
> ---
> drivers/pci/controller/vmd.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 264a180403a0..33c9514bd926 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -17,6 +17,8 @@
> #include <linux/rculist.h>
> #include <linux/rcupdate.h>
>
> +#include <xen/xen.h>
> +
> #include <asm/irqdomain.h>
>
> #define VMD_CFGBAR 0
> @@ -965,6 +967,23 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
> struct vmd_dev *vmd;
> int err;
>
> + if (xen_domain())
> + /*
> + * Xen doesn't have knowledge about devices in the VMD bus
> + * because the config space of devices behind the VMD bridge is
> + * not known to Xen, and hence Xen cannot discover or configure
> + * them in any way.
> + *
> + * Bypass of MSI remapping won't work in that case as direct
> + * write by Linux to the MSI entries won't result in functional
> + * interrupts, as it's Xen the entity that manages the host
"... as Xen is the entity that ..." ?
> + * interrupt controller and must configure interrupts.
> + * However multiplexing of interrupts by the VMD bridge will
> + * work under Xen, so force the usage of that mode which must
> + * always be supported by VMD bridges.
> + */
> + features &= ~VMD_FEAT_CAN_BYPASS_MSI_REMAP;
Since the comment is so long, I would add braces even though it's only
a single statement. Or maybe moving the comment above the "if" would
make more sense.
> if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20))
> return -ENOMEM;
>
> --
> 2.46.0
>
Powered by blists - more mailing lists