VT-d: constrain IGD check
PATCH 1/1 VT-d: constrain IGD check
Marking a DRHD as controlling an IGD isn't very sensible without checking that at the very least it's a graphics device that lives at 0000:00:02.0. Re-use the reading of the class-code to control both the clearing of "gfx_only" and the setting of "igd_drhd_address".
---
This way we also read the class code when we don't really need it, but I think that's tolerable, and the simpler logic is preferable. The more that with Marek's proposed patch, adjusted as suggested, we'd read vendor and device IDs unconditionally for all devices (enumerated for a DRHD) anyway.
xen/drivers/passthrough/vtd/dmar.c +3 -6
@@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(if ( drhd ) { -if ( (seg ==0 ) && (bus ==0 ) && (path->dev ==2 ) && - (path->fn ==0 ) ) - igd_drhd_address = drhd->address; - -if ( gfx_only && -pci_conf_read8 (PCI_SBDF (seg, bus, path->dev, path->fn), +if (pci_conf_read8 (PCI_SBDF (seg, bus, path->dev, path->fn),PCI_CLASS_DEVICE +1 ) !=0x03 /* PCI_BASE_CLASS_DISPLAY */ ) gfx_only = false; +else if ( !seg && !bus && path->dev ==2 && !path->fn ) + igd_drhd_address = drhd->address; }break ;
Ping: [PATCH] VT-d: constrain IGD check
Quoted 6 lines · Jan Beulich
Marking a DRHD as controlling an IGD isn't very sensible without checking that at the very least it's a graphics device that lives at 0000:00:02.0. Re-use the reading of the class-code to control both the clearing of "
gfx_only" and the setting of "igd_drhd_address".Signed-off-by Jan Beulich <[email protected]>
Kevin?
Thanks, Jan
Quoted 28 lines
---
This way we also read the class code when we don't really need it, but I think that's tolerable, and the simpler logic is preferable. The more that with Marek's proposed patch, adjusted as suggested, we'd read vendor and device IDs unconditionally for all devices (enumerated for a DRHD) anyway.xen/drivers/passthrough/vtd/dmar.c +3
-6@@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(if ( drhd ) { -if ( (seg ==0 ) && (bus ==0 ) && (path->dev ==2 ) && - (path->fn ==0 ) ) - igd_drhd_address = drhd->address; - -if ( gfx_only && -pci_conf_read8 (PCI_SBDF (seg, bus, path->dev, path->fn), +if (pci_conf_read8 (PCI_SBDF (seg, bus, path->dev, path->fn),PCI_CLASS_DEVICE +1 ) !=0x03 /* PCI_BASE_CLASS_DISPLAY */ ) gfx_only = false; +else if ( !seg && !bus && path->dev ==2 && !path->fn ) + igd_drhd_address = drhd->address; }break ;
Quoted 9 lines
From: Jan Beulich <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 PMMarking a DRHD as controlling an IGD isn't very sensible without checking that at the very least it's a graphics device that lives at 0000:00:02.0. Re-use the reading of the class-code to control both the clearing of "
gfx_only" and the setting of "igd_drhd_address".Signed-off-by Jan Beulich <[email protected]>