From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.4865.1650437871578426759 for ; Tue, 19 Apr 2022 23:57:51 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=C1tnM0Qg; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650437871; x=1681973871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WT5B+ELMRQEZNrKlFWJgGzCHT0k0+/cVRTLXx0UDODQ=; b=C1tnM0Qg2k9ZWW2l8RuhcXiTb5loGN5AP4quj+Yayfw2GeHHn/sTLZhy rvhxqtE9/EWCX5nJf/5hnqVPkC1jlkNwC+tjU17JromRFGmzGw2Jo7As6 VQurWzfZsBAOamxAZ7VcMPpUoirmNMGTMYTE6k3aGQIc1XAzQwYQlAvoG XCeVG2qbc8ohwR5TVkO/NibYk/hX/XzvW0gUPMFCv7WhobaiC8b0CTUQO Eaqx3HdNvw8G8bInkopdcgGFDW/ZdaUMHP2BOnXWWl16p4PYPrrF1nGfk OIu/gu5576hZ3eCL3jw/Be/JnK2Qn6UETh2f5ApiBOnVZ/LtR5ODiYadx w==; X-IronPort-AV: E=McAfee;i="6400,9594,10322"; a="263419677" X-IronPort-AV: E=Sophos;i="5.90,274,1643702400"; d="scan'208";a="263419677" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 23:57:50 -0700 X-IronPort-AV: E=Sophos;i="5.90,274,1643702400"; d="scan'208";a="529628636" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.116]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 23:57:47 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: [PATCH V2 1/1] OvmfPkg/OvmfPkgX64: Adjust load sequence of TdxDxe and AmdSevDxe driver Date: Wed, 20 Apr 2022 14:57:29 +0800 Message-Id: <7e208d15ca88fa07c6aca4714e32eb62c67248e9.1650437719.git.min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3904 TdxDxe driver is introduced for Intel TDX feature. Unfortunately, this driver also breaks boot process in SEV-ES guest. The root cause is in the PciLib which is imported by TdxDxe driver. In a SEV-ES guest the AmdSevDxe driver performs a MemEncryptSevClearMmioPageEncMask() call against the PcdPciExpressBaseAddress range to mark it shared/unencrypted. However, the TdxDxe driver is loaded before the AmdSevDxe driver, and the PciLib in TdxDxe is DxePciLibI440FxQ35 which will access the PcdPciExpressBaseAddress range. Since the range has not been marked shared/unencrypted, the #VC handler terminates the guest for trying to do MMIO to an encrypted region. Adjusting the load sequence of TdxDxe and AmdSevDxe can fix the issue. Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky SEV-Tested-by: Tom Lendacky TDX-Tested-by: Min Xu Signed-off-by: Min Xu --- OvmfPkg/OvmfPkgX64.fdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 71df28705ea8..1f9d0b3f5fcc 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -214,8 +214,8 @@ READ_LOCK_STATUS = TRUE APRIORI DXE { INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf - INF OvmfPkg/TdxDxe/TdxDxe.inf INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf + INF OvmfPkg/TdxDxe/TdxDxe.inf !if $(SMM_REQUIRE) == FALSE INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf !endif -- 2.29.2.windows.2