From nobody Fri Nov 15 12:34:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95803+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95803+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1667279666; cv=none; d=zohomail.com; s=zohoarc; b=AHEVawwpLIvuDPpa+xm+ffv1SKFwFTOhgUNqTO+SO2x5sUxm6nvYksNZmADP8aV1pDInWHZYYVKFXuXzFSk/lR+HQWCoz5iTcP62ZN4n1uHtXFgVBp1Y2as3uiC9nBqXiVkvW8uvFXoadps8XMuUhbPbBhqQvhWESxFHnKvGa/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667279666; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=plqsQor2yTyoJbPpDRPMCt7esIAXybutVsAii5QiJ2g=; b=ncNcmbr3l9ryabwt0YIOpIx/VxNDe3ToXAT2miWQ1zdKCZU4k6Y/MVOjeKQ/0zyUEc381FrrgDVn2JFDRvhFTKey/+ZfkG1BYrGIqYpdfDqYlT1BUREHubJ26bt75SZTTGTFV6wM42YCepRoiU83nOvJHdbvcMZBz8sjvZn+IvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95803+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1667279666354741.3290876774531; Mon, 31 Oct 2022 22:14:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hXHUYY1788612xdPBMKDDHAv; Mon, 31 Oct 2022 22:14:26 -0700 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.2818.1667279643333273629 for ; Mon, 31 Oct 2022 22:14:25 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="310162827" X-IronPort-AV: E=Sophos;i="5.95,229,1661842800"; d="scan'208";a="310162827" X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 22:14:24 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="878985579" X-IronPort-AV: E=Sophos;i="5.95,229,1661842800"; d="scan'208";a="878985579" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.119]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 22:14:22 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky Subject: [edk2-devel] [PATCH V5 10/10] OvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages Date: Tue, 1 Nov 2022 13:13:49 +0800 Message-Id: <20221101051349.13-11-min.m.xu@intel.com> In-Reply-To: <20221101051349.13-1-min.m.xu@intel.com> References: <20221101051349.13-1-min.m.xu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: cQJNLVoR2rQ3nXyTUwZCkMA0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1667279666; bh=WrP3/Yn24MPE5X5gSnjSG3QPm+amIYR8pTgCLl+YwuU=; h=Cc:Date:From:Reply-To:Subject:To; b=Z65LYnxd8OpQNyb+ovuMCX5xEUZV3lC6ylR3uCsC6xt8mXJo4gTfbKSNKSF2ZfGhpN7 OFI+GdyApORzfbWDnmh93OiyNAvtuZZrwzfCyPCvp0K8nQ3rVPO1/A746HWbpvuJvb6vW gA8x3pfFSncvEbFINGws0gjsC6SzCaHENv8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1667279666517100005 Content-Type: text/plain; charset="utf-8" From: Min M Xu RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3937 After EdkiiMemoryAcceptProtocol is implemented in TdxDxe driver, we can call it to accept pages in DXE phase. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Acked-by: Gerd Hoffmann Signed-off-by: Min Xu --- .../BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf | 3 +++ .../Library/BaseMemEncryptTdxLib/MemoryEncryption.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf = b/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf index a8abfec12fa3..11768825f8ca 100644 --- a/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf +++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf @@ -42,3 +42,6 @@ =20 [Pcd] gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr + +[Protocols] + gEdkiiMemoryAcceptProtocolGuid diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c b/Ovmf= Pkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c index 9d11c6e4df72..503f626d75c6 100644 --- a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c +++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c @@ -27,6 +27,8 @@ #include "VirtualMemory.h" #include #include +#include +#include #include =20 typedef enum { @@ -517,8 +519,9 @@ SetOrClearSharedBit ( IN UINT64 Length ) { - UINT64 AddressEncMask; - UINT64 Status; + UINT64 AddressEncMask; + UINT64 Status; + EDKII_MEMORY_ACCEPT_PROTOCOL *MemoryAcceptProtocol; =20 AddressEncMask =3D GetMemEncryptionAddressMask (); =20 @@ -539,7 +542,10 @@ SetOrClearSharedBit ( // If changing shared to private, must accept-page again // if (Mode =3D=3D ClearSharedBit) { - TdAcceptPages (PhysicalAddress, Length / EFI_PAGE_SIZE, EFI_PAGE_SIZE); + Status =3D gBS->LocateProtocol (&gEdkiiMemoryAcceptProtocolGuid, NULL,= (VOID **)&MemoryAcceptProtocol); + ASSERT (!EFI_ERROR (Status)); + Status =3D MemoryAcceptProtocol->AcceptMemory (MemoryAcceptProtocol, P= hysicalAddress, Length); + ASSERT (!EFI_ERROR (Status)); } =20 DEBUG (( --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95803): https://edk2.groups.io/g/devel/message/95803 Mute This Topic: https://groups.io/mt/94703267/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-