All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS.
@ 2026-07-10 20:05 Nirmal Patel
  2026-07-10 20:15 ` sashiko-bot
  2026-07-12 12:30 ` Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Nirmal Patel @ 2026-07-10 20:05 UTC (permalink / raw)
  To: linux-pci
  Cc: bhelgaas, kwilczynski, mani, robh, lpieralisi, Nirmal Patel,
	Nirmal Patel, Andy Shevchenko

Copy valid OSC flags from root bridge only when OS can provide correct
values. In virtual machine, all of the control features are disabled as
hypervisor will not passthrough root bridge information to VM.

Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
v2 : Added descriptive boolean and removed period from commit message.
---
 drivers/pci/controller/vmd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index d4ae250d4bc6..760dfb4d9480 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -782,6 +782,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 	resource_size_t membar2_offset = 0x2000;
 	struct pci_bus *child;
 	struct pci_dev *dev;
+	bool vmd_in_guest;
 	int ret;

 	/*
@@ -862,14 +863,15 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 		.parent = res,
 	};

+	/* Non-zero offset means guest/direct assign view. */
+	vmd_in_guest = offset[0] || offset[1];
 	/*
 	 * Currently MSI remapping must be enabled in guest passthrough mode
 	 * due to some missing interrupt remapping plumbing. This is probably
 	 * acceptable because the guest is usually CPU-limited and MSI
 	 * remapping doesn't become a performance bottleneck.
 	 */
-	if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) ||
-	    offset[0] || offset[1]) {
+	if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) || vmd_in_guest) {
 		ret = vmd_alloc_irqs(vmd);
 		if (ret)
 			return ret;
@@ -910,8 +912,10 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 		return -ENODEV;
 	}

-	vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
-				   to_pci_host_bridge(vmd->bus->bridge));
+	/* Don't copy OSC control flags in VM, it disables features.*/
+	if (!vmd_in_guest)
+		vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
+					 to_pci_host_bridge(vmd->bus->bridge));

 	vmd_attach_resources(vmd);
 	if (vmd->irq_domain)
--
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS.
  2026-07-10 20:05 [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS Nirmal Patel
@ 2026-07-10 20:15 ` sashiko-bot
  2026-07-12 12:30 ` Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-07-10 20:15 UTC (permalink / raw)
  To: Nirmal Patel; +Cc: linux-pci

> Copy valid OSC flags from root bridge only when OS can provide correct
> values. In virtual machine, all of the control features are disabled as
> hypervisor will not passthrough root bridge information to VM.
> 
> Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710200558.499434-1-nirmal.patel@intel.com?part=1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS.
  2026-07-10 20:05 [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS Nirmal Patel
  2026-07-10 20:15 ` sashiko-bot
@ 2026-07-12 12:30 ` Andy Shevchenko
  2026-07-13 18:14   ` Nirmal Patel
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-07-12 12:30 UTC (permalink / raw)
  To: Nirmal Patel
  Cc: linux-pci, bhelgaas, kwilczynski, mani, robh, lpieralisi,
	Nirmal Patel

On Fri, Jul 10, 2026 at 08:05:58PM +0000, Nirmal Patel wrote:
> Copy valid OSC flags from root bridge only when OS can provide correct
> values. In virtual machine, all of the control features are disabled as
> hypervisor will not passthrough root bridge information to VM.

...

> v2 : Added descriptive boolean and removed period from commit message.

It's still in the $Subject. You probably misinterpreted the comment(s).

...

> +	/* Non-zero offset means guest/direct assign view. */
> +	vmd_in_guest = offset[0] || offset[1];

+ Blank line?

>  	/*
>  	 * Currently MSI remapping must be enabled in guest passthrough mode
>  	 * due to some missing interrupt remapping plumbing. This is probably
>  	 * acceptable because the guest is usually CPU-limited and MSI
>  	 * remapping doesn't become a performance bottleneck.
>  	 */
> -	if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) ||
> -	    offset[0] || offset[1]) {
> +	if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) || vmd_in_guest) {
>  		ret = vmd_alloc_irqs(vmd);
>  		if (ret)
>  			return ret;

...

> -	vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
> -				   to_pci_host_bridge(vmd->bus->bridge));
> +	/* Don't copy OSC control flags in VM, it disables features.*/

Missing space before */.

> +	if (!vmd_in_guest)
> +		vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
> +					 to_pci_host_bridge(vmd->bus->bridge));

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS.
  2026-07-12 12:30 ` Andy Shevchenko
@ 2026-07-13 18:14   ` Nirmal Patel
  2026-07-13 21:09     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Nirmal Patel @ 2026-07-13 18:14 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Nirmal Patel, linux-pci, bhelgaas, kwilczynski, mani, robh,
	lpieralisi

On Sun, 12 Jul 2026 15:30:01 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Jul 10, 2026 at 08:05:58PM +0000, Nirmal Patel wrote:
> > Copy valid OSC flags from root bridge only when OS can provide
> > correct values. In virtual machine, all of the control features are
> > disabled as hypervisor will not passthrough root bridge information
> > to VM.  
> 
> ...
> 
> > v2 : Added descriptive boolean and removed period from commit
> > message.  
> 
> It's still in the $Subject. You probably misinterpreted the
> comment(s).
My bad, i removed (_). Let me correct. Is (_OSC) in subject okay?
> 
> ...
> 
> > +	/* Non-zero offset means guest/direct assign view. */
> > +	vmd_in_guest = offset[0] || offset[1];  
> 
> + Blank line?
Ack.
> 
> >  	/*
> >  	 * Currently MSI remapping must be enabled in guest
> > passthrough mode
> >  	 * due to some missing interrupt remapping plumbing. This
> > is probably
> >  	 * acceptable because the guest is usually CPU-limited and
> > MSI
> >  	 * remapping doesn't become a performance bottleneck.
> >  	 */
> > -	if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) ||
> > -	    offset[0] || offset[1]) {
> > +	if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) ||
> > vmd_in_guest) { ret = vmd_alloc_irqs(vmd);
> >  		if (ret)
> >  			return ret;  
> 
> ...
> 
> > -
> > vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
> > -
> > to_pci_host_bridge(vmd->bus->bridge));
> > +	/* Don't copy OSC control flags in VM, it disables
> > features.*/  
> 
> Missing space before */.
Ack.
> 
> > +	if (!vmd_in_guest)
> > +
> > vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
> > +
> > to_pci_host_bridge(vmd->bus->bridge));  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS.
  2026-07-13 18:14   ` Nirmal Patel
@ 2026-07-13 21:09     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2026-07-13 21:09 UTC (permalink / raw)
  To: Nirmal Patel
  Cc: Nirmal Patel, linux-pci, bhelgaas, kwilczynski, mani, robh,
	lpieralisi

On Mon, Jul 13, 2026 at 11:14:57AM -0700, Nirmal Patel wrote:
> On Sun, 12 Jul 2026 15:30:01 +0300
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > On Fri, Jul 10, 2026 at 08:05:58PM +0000, Nirmal Patel wrote:

...

> > > v2 : Added descriptive boolean and removed period from commit
> > > message.  
> > 
> > It's still in the $Subject. You probably misinterpreted the
> > comment(s).
> My bad, i removed (_). Let me correct. Is (_OSC) in subject okay?

I believe so.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-13 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 20:05 [PATCH v2] PCI: vmd: Only assign OSC features in bare metal OS Nirmal Patel
2026-07-10 20:15 ` sashiko-bot
2026-07-12 12:30 ` Andy Shevchenko
2026-07-13 18:14   ` Nirmal Patel
2026-07-13 21:09     ` Andy Shevchenko

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.