PCI: vmd: Only assign OSC features in bare metal OS.
Subsystems (3)
PATCH v2 1/1 PCI: vmd: Only assign OSC features in bare metal OS.
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.
--- drivers/pci/controller/vmd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/pci/controller/vmd.c +8 -4
@@ -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
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
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 <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 3 lines · Nirmal Patel
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.
...
Quoted 1 line
v2 : Added descriptive boolean and removed period from commit message.
It's still in the $Subject. You probably misinterpreted the comment(s).
...
drivers/pci/controller/vmd.c static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) · line 867
Quoted 2 lines
drivers/pci/controller/vmd.c +2
-0+/* Non-zero offset means guest/direct assign view. */ + vmd_in_guest = offset[0 ] || offset[1 ];
+ Blank line?
Quoted 12 lines
drivers/pci/controller/vmd.c +1
-2/* * 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;
...
drivers/pci/controller/vmd.c static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) · line 915
Quoted 3 lines
drivers/pci/controller/vmd.c +1
-2-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 */.
Quoted 3 lines
drivers/pci/controller/vmd.c +3
-0+if (!vmd_in_guest) +vmd_copy_host_bridge_flags (pci_find_host_bridge (vmd->dev->bus), +to_pci_host_bridge (vmd->bus->bridge));
Signature · 2 lines
With Best Regards, Andy Shevchenko
Nirmal Patel
maintainerQuoted 6 lines · On Sun, 12 Jul 2026 15:30:01 +0300 Andy Shevchenko…
Quoted 4 lines · Nirmal Patel
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.
Quoted 7 lines
...
Quoted 2 lines
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?
Quoted 7 lines
...
drivers/pci/controller/vmd.c static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) · line 867
Quoted 2 lines
drivers/pci/controller/vmd.c +2
-0+/* Non-zero offset means guest/direct assign view. */ + vmd_in_guest = offset[0 ] || offset[1 ];+ Blank line?
Ack.
Quoted 19 lines
Quoted 16 lines
(quoted diff) +0
-0/* * Currently MSI remapping must be enabled in guestpassthrough mode
* due to some missing interrupt remapping plumbing. This
is probably
* acceptable because the guest is usually CPU-limited and
MSIdrivers/pci/controller/vmd.c +1
-2* 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);drivers/pci/controller/vmd.c +0
-0if (ret)return ret;...
Quoted 8 lines
Quoted 6 lines
- vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus), -
to_pci_host_bridge(vmd->bus->bridge));(quoted diff) +1
-0+ /* Don't copy OSC control flags in VM, it disablesfeatures.*/
Missing space before */.
Ack.
Quoted 7 lines
Quoted 6 lines
(quoted diff) +2
-0+ if (!vmd_in_guest) +vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus), +
to_pci_host_bridge(vmd->bus->bridge));
Quoted 3 lines · Nirmal Patel
Quoted 1 line · On Sun, 12 Jul 2026 15:30:01 +0300 Andy Shevchenko…
On Fri, Jul 10, 2026 at 08:05:58PM +0000, Nirmal Patel wrote:
...
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
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.
Signature · 2 lines
With Best Regards, Andy Shevchenko