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

[PATCH 4/5] x86/tboot: correct IOMMU (VT-d) interaction


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 6 Dec 2022 14:56:03 +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=8k9Cg9eVliAtip8iorn3Xux77iG61ZlTqy6/GtyMv9o=; b=YJG0Qxd5BfLvxYyhoUZosTVrQVtFoLqstzghpboucA1i9PQC7mqygASANApNw2TKXpnuXQPERR65Zpxcz+HbPpFpmyfWWqlObERgsoILvPYuzKzmo9NVjT5CpESq+ZWGPg94Ac87gyczLI4kl3rdV/xzTAMkZAodIEDL3ljUgy4zIkPlvb8mS5pRmcq8RLwrfujiDZP6u1KaWqKzdMgaqd6R3+aenH/ip2iE7aCP2/ZikIC/FySmYtWRpw/ImJGlsvQK5plA/X4kB8mvlnK2z6U+2MPQUvRPgdAerkd+F3975HXd2aBOKDEr5pVPFIUlhjzfEjQNV/g7vD1XpXmNMA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hyPlGV8dX/tnNGnoMmJYL9xDZbKyE4moXoTdRMWBfihBxXtIYJAxdltot3faedhjh62SOII5LvpYYThvWm5HyKxRy59K2eygNUaQZ4wM0Dc492RMvNzHYcXejeWkCkBkedwDkHsYucuXekZrciHWTih5tFlL7tlBg/7I81xCy4IibOuy5ngsCQ+ot11emGolqAyov/qSZGOleyVq75j75ymFBpTU5v+I8wMoUQ3CZO4QITrSi2TyDSX5ZXXfCWZ2JPyCpMIkKPsICujygDQ7HZMmAFGgiImBURALvoc+VBAgpIwXu2j5go6gqvyeTqkx+G2LViv4kmBgi/z5TCRoFg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Lukasz Hawrylko <lukasz@xxxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Mateusz Mówka <mateusz.mowka@xxxxxxxxx>
  • Delivery-date: Tue, 06 Dec 2022 13:56:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

First of all using is_idle_domain() on the subject domain in the body of
for_each_domain() is pointless. Replace that conditional by one checking
that a domain actually has IOMMU support enabled for it, and that we're
actually on a VT-d system (both are largely cosmetic / documentary with
how things work elsewhere, but still).

Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -31,6 +31,8 @@ static vmac_t frametable_mac; /* MAC for
 static uint64_t __initdata txt_heap_base, __initdata txt_heap_size;
 static uint64_t __initdata sinit_base, __initdata sinit_size;
 
+static bool __ro_after_init is_vtd;
+
 /*
  * TXT configuration registers (offsets from TXT_{PUB, PRIV}_CONFIG_REGS_BASE)
  */
@@ -201,7 +203,7 @@ static void tboot_gen_domain_integrity(c
         }
         spin_unlock(&d->page_alloc_lock);
 
-        if ( !is_idle_domain(d) )
+        if ( is_iommu_enabled(d) && is_vtd )
         {
             const struct domain_iommu *dio = dom_iommu(d);
 
@@ -444,6 +446,8 @@ int __init cf_check tboot_parse_dmar_tab
     if ( txt_heap_base == 0 )
         return 1;
 
+    is_vtd = true;
+
     /* walk heap to SinitMleData */
     pa = txt_heap_base;
     /* skip BiosData */




 


Rackspace

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