public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Nirmal Patel <nirmal.patel@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	linux-pci@vger.kernel.org,
	"Jonathan Derrick" <jonathan.derrick@linux.dev>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH v3 2/3] PCI: vmd: Disable MSI remapping bypass under Xen
Date: Mon, 3 Mar 2025 15:16:39 +0100	[thread overview]
Message-ID: <Z8W5x73El3aUOs5i@macbook.local> (raw)
In-Reply-To: <20250219092059.90850-3-roger.pau@citrix.com>

Hello Nirmal,

Can I please get an Ack or a request for changes on the patch below
for the VMD controller code?

Thanks, Roger.

On Wed, Feb 19, 2025 at 10:20:56AM +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@citrix.com>
> ---
> Changes since v2:
>  - Adjust patch subject.
>  - Adjust code comment.
> 
> Changes since v1:
>  - Add xen header.
>  - Expand comment.
> ---
>  drivers/pci/controller/vmd.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 9d9596947350..e619accca49d 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
> @@ -970,6 +972,24 @@ 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 Xen is the entity that manages the host
> +		 * 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;
> +	}
> +
>  	if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20))
>  		return -ENOMEM;
>  
> -- 
> 2.46.0
> 

  reply	other threads:[~2025-03-03 14:16 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  9:20 [PATCH v3 0/3] xen: Fix usage of devices behind a VMD bridge Roger Pau Monne
2025-02-19  9:20 ` [PATCH v3 1/3] xen/pci: Do not register devices with segments >= 0x10000 Roger Pau Monne
2025-02-19  9:20 ` [PATCH v3 2/3] PCI: vmd: Disable MSI remapping bypass under Xen Roger Pau Monne
2025-03-03 14:16   ` Roger Pau Monné [this message]
2025-03-20 21:06   ` Bjorn Helgaas
2025-02-19  9:20 ` [PATCH v3 3/3] PCI/MSI: Convert pci_msi_ignore_mask to per MSI domain flag Roger Pau Monne
2025-03-20 21:07   ` Bjorn Helgaas
2025-03-21  8:00     ` Jürgen Groß
2025-03-24 14:29       ` Daniel Gomez
2025-03-24 17:51         ` Roger Pau Monné
2025-03-24 18:58           ` Daniel Gomez
2025-03-24 19:18             ` Roger Pau Monné
2025-03-24 20:45               ` Daniel Gomez
2025-03-25  8:11               ` Thomas Gleixner
2025-03-25  9:20                 ` Thomas Gleixner
2025-03-25  9:47                   ` Daniel Gomez
2025-03-25 10:22                   ` Roger Pau Monné
2025-03-25 10:27                     ` Thomas Gleixner
2025-03-25 10:55                       ` Roger Pau Monné
2025-03-26  8:14                         ` Thomas Gleixner
2025-03-26  8:10                   ` Roger Pau Monné
2025-03-26 11:26                   ` Marek Szyprowski
2025-03-26 12:05                   ` [PATCH] PCI/MSI: Handle the NOMASK flag correctly for all PCI/MSI backends Thomas Gleixner
2025-03-26 12:09                     ` Jürgen Groß
2025-03-26 12:46                       ` Thomas Gleixner
2025-03-26 12:16                     ` Juergen Gross
2025-03-26 14:39                     ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2025-03-30 14:57                   ` [PATCH] " Bert Karwatzki
2025-03-26 11:04   ` [PATCH v3 3/3] PCI/MSI: Convert pci_msi_ignore_mask to per MSI domain flag Borislav Petkov
2025-03-26 11:14     ` Roger Pau Monné
2025-03-26 11:21       ` Borislav Petkov
2025-03-06  8:48 ` [PATCH v3 0/3] xen: Fix usage of devices behind a VMD bridge Roger Pau Monné
2025-03-20 16:21   ` Roger Pau Monné

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=Z8W5x73El3aUOs5i@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=bhelgaas@google.com \
    --cc=jonathan.derrick@linux.dev \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=nirmal.patel@linux.intel.com \
    --cc=robh@kernel.org \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox