From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.10632.1639400372217809539 for ; Mon, 13 Dec 2021 04:59:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.com header.s=intel header.b=IOSe2S7F; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639400375; x=1670936375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=udK4kKSRXk4lJQafTvO0HKg0XFaEYHp+39A/QF1sySc=; b=IOSe2S7FPrOTY+XT9pgFjzBgkpAR0+I3B+7XmdcISIXbbhFS+GJf/JGR mnVAXBbyel5JxC12Q3Dr8WMZ4gbkN2bABBD3jMbmLZJimsWFWPrWmtJDD u0ICejL/v9EmBY+D+yFaIasnex7lbiNfYhOxJU/tKygeZBGN83ycZ4eLK mTPot4Z1X3sGF9KF7zqecu/iNUxqAtWs1d0gqjyS7Oyp1vwB4IDOYWNQk Af8I2z2iYHiRZz4KMpZyFjLxwlQzmmaZmWvpDETRSf+g1EUtx9/VDUz8p BIMjztSt/DJfMP/O/6xM76PzrRz3UCD7Tv9y3kJ6OY2ofAZ0UtorOTGc7 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10196"; a="302106064" X-IronPort-AV: E=Sophos;i="5.88,202,1635231600"; d="scan'208";a="302106064" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2021 04:59:35 -0800 X-IronPort-AV: E=Sophos;i="5.88,202,1635231600"; d="scan'208";a="517739002" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.173.142]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2021 04:59:31 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [PATCH V4 26/31] OvmfPkg/QemuFwCfgLib: Support Tdx in QemuFwCfgDxe Date: Mon, 13 Dec 2021 20:56:57 +0800 Message-Id: <96bda5f54d7e68fc137a26da6c9e0c0e34a1d835.1639399598.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 RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 In the previous QemuFwCfgDxe only SEV is supported. This commit introduce TDX support in QemuFwCfgDxe. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c | 9 +++++---- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c index f5787cd24d38..6a810928a060 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "QemuFwCfgLibInternal.h" @@ -85,7 +86,7 @@ QemuFwCfgInitialize ( DEBUG ((DEBUG_INFO, "QemuFwCfg interface (DMA) is supported.\n")); } - if (mQemuFwCfgDmaSupported && MemEncryptSevIsEnabled ()) { + if (mQemuFwCfgDmaSupported && (MemEncryptSevIsEnabled () || (MemEncryptTdxIsEnabled ()))) { EFI_STATUS Status; // @@ -100,7 +101,7 @@ QemuFwCfgInitialize ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "QemuFwCfgSevDma %a:%a Failed to locate IOMMU protocol.\n", + "QemuFwCfgDma %a:%a Failed to locate IOMMU protocol.\n", gEfiCallerBaseName, __FUNCTION__ )); @@ -411,10 +412,10 @@ InternalQemuFwCfgDmaBytes ( DataBuffer = Buffer; // - // When SEV is enabled, map Buffer to DMA address before issuing the DMA + // When SEV or TDX is enabled, map Buffer to DMA address before issuing the DMA // request // - if (MemEncryptSevIsEnabled ()) { + if (MemEncryptSevIsEnabled () || MemEncryptTdxIsEnabled ()) { VOID *AccessBuffer; EFI_PHYSICAL_ADDRESS DataBufferAddress; diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf index 48899ff1236a..ce3eaa5ed8b4 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf @@ -43,6 +43,7 @@ IoLib MemoryAllocationLib MemEncryptSevLib + MemEncryptTdxLib [Protocols] gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES -- 2.29.2.windows.2