[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] VT-d: constrain IGD check


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Feb 2023 10:51:47 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/pdlyHaH4pBbO9XFUj7diphk7rtBCqFO2Dob1yEyk74=; b=Ul0wC7jWKvzkXwqQFZn6Nboc5muU96GNJ/Ncj5LwqfSzsu+PhoNn8qzS8GJKzii1xzNKTD3IQzXdSURPW8dKTjjoQdukaHLcj0jG/HyHbq2KQsSzICVpgwtplniCC0vH+6DDnCmmnlV9kedKWwtKZ7oKm7v0UN4MMb78p4yy2fJovzcZkJDnC9H8p8oIiXhjaKyLGSLEKhxBFfNoLjRJwMxYeE+t0b/yExivsXymB+0OtRelAYVdIdoSczn3EPQqnZaJBR+8ChJY4higZb01cYMJx1zp7Whbhlmz6a9PKivSVPhSaZfTdLARItmT3kralP7w4m8r06qrmrd2K8MnOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MtlhpHPrV79o3YLAdv2k8BVo5reblpiAg6ep61gfjvHgfToahqHD7eWgwWp1nmcSFudaV89t3zkt2Y7cE4u3jBqauBHb3SCdIDHNv2+0Lo3J1ErNzEe8q+TNMWAjKUxJZsS8RNYwEWTvcyGnAZQx2EKaqAy3QV8JTHcVR5ZnFWGWHwGVLRSLSxzxl4bReIVxFTHvGJSoQVDEabRxsAvHlosojQSD+78MX2dc+JC/Ix9QgFxD/FKjEW6SUjLv42p2PeSwAlNmGuRwD2OJOMUI4Mwzw6tdePmLnEqKcgC1PyMGU5KKqDj0nnCcWMvSCLeMPhhG1pHIBNHbuMkh5C0m8w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Kevin Tian <kevin.tian@xxxxxxxxx>, Marek Marczykowski <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 28 Feb 2023 09:52:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <jbeulich@xxxxxxxx>
---
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.

--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -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;



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.