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

[PATCH] VT-d: fix !HVM build


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 22 Apr 2022 11:58:58 +0200
  • 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=gfLEJWB8dYg/5ByFirWLKx4TpYb2Ys2tqREAkfOhScg=; b=ev3zs7mr4fLd6PG4QVP2/dTS3yW182p09URhVzEbiF2cJRrhwXKrqfXe7zkebxQ8JT8C3dsi8xb5t5IoIaEnoQoExEn/edIcHnl228E15GlP6FfkWjV+3nROqbHp9eokP1GufoC8GgFPJg6QudpbefE7iyguozYeUBqloVDfI8kt4y7Y9cwEy7U22L0z8PfWL2jE8/9yOPoSJTAXvBkdx3zRd+CQXgVoRAUnlPj/FnNXNBCQMYkuIu01sqXYbttxrsNCLjR7GWBW3rhPVnbxUb53lwXpU6ocVfJBw+voecwWA9BqCOWFt0mDSQxxiQSOo73mLH+w6hhMTMDTFIKy8Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OVUu5E7UQ+vfn6de5xu7ZJ2A/f5xDXBY31el1rzdzJ2oq1iuSkt1JX/9bqEkdlhVWMJz9QX8s02d9WWNLeYzrK0Nv70PZHGt9MO+uLHmugPJsHbobyT8/Q0KhUGNrr2y92cA/CMLKjtvUaWaOmXg/555I+tsw3uSK0XeqSK6HYH6RNuZHVddAGJ8Mh/ekKmlBvlFfo5yyPrKg6GKGTgsvbTLm962U3vPcBReSj4TfNF8R8+2wOeyqIGKcxfvWJv4VPrLq+bY4DGEzlvXNFmbpe6lRC/6bnYSfJP0J6V1+76xoFe15bilrU/u+7sHA3F+b5PS9q9JMRwqtNwffHpSkw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Kevin Tian <kevin.tian@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Fri, 22 Apr 2022 09:59:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

EPT is of no interest when !HVM. While I'm observing gcc11 to fully
eliminate the function, older gcc's DCE looks to not be as good. Aid the
compiler in eliminating the accesses of opt_hap_{2mb,1gb}, which
otherwise cause undefined symbol errors when linking.

While there adjust types.

Fixes: c479415610f0 ("x86/P2M: p2m.c is HVM-only")
Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2155,14 +2155,17 @@ static int cf_check intel_iommu_lookup_p
     return 0;
 }
 
-static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
+static bool __init vtd_ept_page_compatible(const struct vtd_iommu *iommu)
 {
-    u64 ept_cap, vtd_cap = iommu->cap;
+    uint64_t ept_cap, vtd_cap = iommu->cap;
+
+    if ( !IS_ENABLED(CONFIG_HVM) )
+        return false;
 
     /* EPT is not initialised yet, so we must check the capability in
      * the MSR explicitly rather than use cpu_has_vmx_ept_*() */
     if ( rdmsr_safe(MSR_IA32_VMX_EPT_VPID_CAP, ept_cap) != 0 ) 
-        return 0;
+        return false;
 
     return (ept_has_2mb(ept_cap) && opt_hap_2mb) <= cap_sps_2mb(vtd_cap) &&
            (ept_has_1gb(ept_cap) && opt_hap_1gb) <= cap_sps_1gb(vtd_cap);




 


Rackspace

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