From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.67]) by mx.groups.io with SMTP id smtpd.web08.666.1663968656021533475 for ; Fri, 23 Sep 2022 14:30:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=09TBSA+i; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.93.67, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q8y9SXY5rWJx7CEqzSzTf0Lj7GNw1cHEEsBwOyjDMjeixv0GAL64mTDLHysTTfRhf37wITRaS8YwF4/LMgd/HE2LbLMrsYbpHC1ff89pC49r7KrfC7++wajZ9WOiPMj2j4dAn/9oEN9LlwrWU3JNxMIoMYlhBpLycD+ldTTdzB7RLwaokPdU1xJCBnqs4+gWb4qVSbMNy811lftifsHDrDCSxECEpvv0IFOXovyf0JqXIAxPjf3L1B5q4Q+EnGL86l0dEcNqy1qsNMUIpMWdiw+AUB/FZ08dfxGfIX6aDO0CrFnvl0JBci92ssv5eHUt4yu8OHZjhjHtlalJgabMoQ== 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=CizLluzoapU+HMUAWaApmgF03VGYfqj90ZzfJvGFQrA=; b=Pr24i05/FIgRp9018VWRjrTp8r+7Q0Zlt0N70jzpYtqCxMB5jubkH4/Y3+vldrgoQxNFK3Fzv74VXdV0VvKpL+qk0u7v5uSdgvZu38OrwaGXf3+/P2RCt34BhuuABgEvtbnrvttXMhjldpYVoWXRmlVQEAHeyDzcOqmo1pQjfo2aCrIkiWcWs/dhR/yPProm5MxZSmcfWkWK2nkaI41YXRZosPZMkbNRr7Fiksn8gl5bmxXT38Vv/qEYlxXqA13qG9BJjmJcBQSzGz/uGee7gOpQWriOBHpWI/cEIv/quXZWbSaz2xqPzmC9fzU3cL2D475a0ZqaoXoqskikAfCdJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CizLluzoapU+HMUAWaApmgF03VGYfqj90ZzfJvGFQrA=; b=09TBSA+iNQjItCetDU29L+mST2i0NK1YX/Z6KBmfAaxnD3DryTz1/pGyOOguKHvEZLavOk+qADhHsmOxZPBkeAJyK2TAyGlGSZwdES4b6s+Kp0fsOhIw7FPBPdMTNS0j31OW06csfnB8soCFvr5Oi6fCVUvrgcFcSE8kYc3UZYU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM4PR12MB6133.namprd12.prod.outlook.com (2603:10b6:8:ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 21:30:53 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::c175:4c:c0d:1396]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::c175:4c:c0d:1396%4]) with mapi id 15.20.5654.020; Fri, 23 Sep 2022 21:30:53 +0000 Message-ID: Date: Fri, 23 Sep 2022 16:30:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 1/4] OvmfPkg: Realize EfiMemoryAcceptProtocol in AmdSevDxe To: Dionna Glaze , devel@edk2.groups.io Cc: Gerd Hoffmann , James Bottomley , Jiewen Yao , Sophia Wolf References: <20220923203431.1428535-1-dionnaglaze@google.com> <20220923203431.1428535-2-dionnaglaze@google.com> From: "Lendacky, Thomas" In-Reply-To: <20220923203431.1428535-2-dionnaglaze@google.com> X-ClientProxiedBy: SN6PR04CA0097.namprd04.prod.outlook.com (2603:10b6:805:f2::38) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) Return-Path: Thomas.Lendacky@amd.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|DM4PR12MB6133:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b17c365-7323-4022-28bb-08da9daae4de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TynJeg9nWwnhR3h7f+RH6zqxounR29Gt4rZ53c6i+OnEqCo0FhX8WL31+EXfK5QO5TLZJv4+Lg6YDDxfemN8jBdEFAfwg5hXkeqClkalZfHGKJhf0pRoTMNZYff8+Awn9T9jT2qYQOZfusbAwM38+RTXtptCcXNoET6nULRVQjLh9SosWpOWNdxGVsjZmk7aIsII0tRbiiPITvd3sxztL5FLeKCoLL+IUlE70U9txiJwBd6FST9GopOBcc+MAsQZZwNs5uFUlw/ZzItiNznFEN2OdN+nv+IrEXAbt46y7UId8cTV4FUPKhJzwAPscqYYCAJUbuOG1FinTKQEOd12pAQrRlz89Z/S/ovbIMfORff0kteE3hUkbH0qp10DV5xXDS3lTrR+XGPMMcmRhnSY2Qf3oGaIb03pjMpztEzetpEeN0bK5ljo1eAwDqeT+OzdLMpn8O4zhnFSYd/K/gCtbTDOOA1SmNSY+Am2tdngZg0OcIT8tPF3n4AqDtQONUYtGZ4SILAeK3IZuZu4rPdielvfZa712jUo33NTABUpvd1LuRIhTqlJoFL8ZzOpY3OKtsTqZ5idTNi5XHR4EzCE7RvvFwP6+jCPVZsMIIaDMR6jCdrGwDXpB0a6ZAbo8Fftt7TnMx89kGLAMb1trKLlEPkkHFWRHke97HSpOkJaht7rXKpcmGYXjeiVVbj3v8JRJEPB6CfptKIN9s2nv2BPOoj4T5VGxKY2kaVEoeOdP6MYvqU7DaXtg50OdK1lcf/JxMs6wXIQvBk7DXK4MhSzPfKYCe0Dxko1qJ1Ku2bdOPc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(366004)(376002)(39860400002)(346002)(396003)(451199015)(54906003)(31686004)(83380400001)(19627235002)(316002)(6486002)(478600001)(8676002)(66946007)(86362001)(66476007)(4326008)(31696002)(66556008)(5660300002)(53546011)(8936002)(41300700001)(26005)(6512007)(36756003)(6506007)(186003)(38100700002)(2616005)(2906002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SWxVbHozeWs3QkpDTW1IaFd1YWhJRzJBQi9pVklNb0JWUi9TaERrZHg1K1hE?= =?utf-8?B?OG9QSUFka2ZQM0JBU21FUGIxeDU5cnhoMzZ2eU9WVzlTbXJscElOWVVZWThw?= =?utf-8?B?SkNuRUZOVkg5ZTZVS3ZFSVREUHVSMUM2VzBPKzVlV0sxeGNiejkwUWZsb09x?= =?utf-8?B?VTk1dTVNRy9rTi9lNU10Mms1Q0JSRys1anNJM0IwemZmV01EQjNQdnVuVmJo?= =?utf-8?B?bVBGZm5UblkrdHk0aFJ1U1Y3N256YWxrWkdEYU03TUhBZjUzbEd6RU55K2F0?= =?utf-8?B?YkJ5RG4rQlRzdHFodWQ5Y01GQUNJcnpRZDNMajFIZzJCTzc3M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k2kMibzLfIoUn?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b17c365-7323-4022-28bb-08da9daae4de X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 21:30:53.7517 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9cNRPyOruoyT4jhzjpe+7Ox8abHurWQk2w/tmDV5Y7N1FqUBV6DDAT10TcdrqVCQggabNjxClyIuqad2C+ViKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6133 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/23/22 15:34, Dionna Glaze wrote: > From: Sophia Wolf > > When a guest OS does not support unaccepted memory, the unaccepted > memory must be accepted before returning a memory map to the caller. > > EfiMemoryAcceptProtocol is defined in MdePkg and is implementated / > Installed in AmdSevDxe for AMD SEV-SNP memory acceptance. > Shouldn't this have a v2 in the subject (same goes for patch 2/4)? I didn't see an answer as to why you couldn't use the MemEncryptSevSnpPreValidateSystemRam() function in OvmfPkg/Library/BaseMemEncryptSevLib/X64/DxeSnpSystemRamValidate.c to accomplish this without introducing a whole new interface to the MemEncryptSevLib library. Also, to better see the paths in the diffstat, I recommend using: --diff-options "--stat=1000 --stat-graph-width=20" Thanks, Tom > Cc: Gerd Hoffmann > Cc: James Bottomley > Cc: Jiewen Yao > Cc: Tom Lendacky > > Signed-off-by: Sophia Wolf > --- > OvmfPkg/AmdSevDxe/AmdSevDxe.c | 34 ++++++++++++++++++ > OvmfPkg/AmdSevDxe/AmdSevDxe.inf | 3 ++ > OvmfPkg/Include/Library/MemEncryptSevLib.h | 14 ++++++++ > .../Ia32/MemEncryptSevLib.c | 17 +++++++++ > .../X64/DxeSnpSystemRamValidate.c | 35 +++++++++++++++++++ > .../X64/PeiSnpSystemRamValidate.c | 17 +++++++++ > .../X64/SecSnpSystemRamValidate.c | 18 ++++++++++ > 7 files changed, 138 insertions(+) > > diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c > index 662d3c4ccb..6e3a1fc7d7 100644 > --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c > +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > > STATIC CONFIDENTIAL_COMPUTING_SNP_BLOB_LOCATION mSnpBootDxeTable = { > SIGNATURE_32 ('A', 'M', 'D', 'E'), > @@ -31,6 +32,29 @@ STATIC CONFIDENTIAL_COMPUTING_SNP_BLOB_LOCATION mSnpBootDxeTable = { > FixedPcdGet32 (PcdOvmfCpuidSize), > }; > > +STATIC EFI_HANDLE mAmdSevDxeHandle = NULL; > + > +STATIC > +EFI_STATUS > +EFIAPI > +AmdSevMemoryAccept ( > + IN EFI_MEMORY_ACCEPT_PROTOCOL *This, > + IN EFI_PHYSICAL_ADDRESS StartAddress, > + IN UINTN Size > +) > +{ > + MemEncryptSnpAcceptPages ( > + StartAddress, > + EFI_SIZE_TO_PAGES (Size) > + ); > + > + return EFI_SUCCESS; > +} > + > +STATIC EFI_MEMORY_ACCEPT_PROTOCOL mMemoryAcceptProtocol = { > + AmdSevMemoryAccept > +}; > + > EFI_STATUS > EFIAPI > AmdSevDxeEntryPoint ( > @@ -147,6 +171,16 @@ AmdSevDxeEntryPoint ( > } > } > > + Status = gBS->InstallProtocolInterface ( > + &mAmdSevDxeHandle, > + &gEfiMemoryAcceptProtocolGuid, > + EFI_NATIVE_INTERFACE, > + &mMemoryAcceptProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Install EfiMemoryAcceptProtocol failed.\n")); > + } > + > // > // If its SEV-SNP active guest then install the CONFIDENTIAL_COMPUTING_SEV_SNP_BLOB. > // It contains the location for both the Secrets and CPUID page. > diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.inf b/OvmfPkg/AmdSevDxe/AmdSevDxe.inf > index 9acf860cf2..5ddddabc32 100644 > --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.inf > +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.inf > @@ -47,6 +47,9 @@ > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize > > +[Protocols] > + gEfiMemoryAcceptProtocolGuid > + > [Guids] > gConfidentialComputingSevSnpBlobGuid > > diff --git a/OvmfPkg/Include/Library/MemEncryptSevLib.h b/OvmfPkg/Include/Library/MemEncryptSevLib.h > index 4fa9c0d700..05ec10471d 100644 > --- a/OvmfPkg/Include/Library/MemEncryptSevLib.h > +++ b/OvmfPkg/Include/Library/MemEncryptSevLib.h > @@ -228,4 +228,18 @@ MemEncryptSevSnpPreValidateSystemRam ( > IN UINTN NumPages > ); > > +/** > + Accept pages system RAM when SEV-SNP is enabled in the guest VM. > + > + @param[in] BaseAddress Base address > + @param[in] NumPages Number of pages starting from the base address > + > +**/ > +VOID > +EFIAPI > +MemEncryptSnpAcceptPages ( > + IN PHYSICAL_ADDRESS BaseAddress, > + IN UINTN NumPages > + ); > + > #endif // _MEM_ENCRYPT_SEV_LIB_H_ > diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/Ia32/MemEncryptSevLib.c b/OvmfPkg/Library/BaseMemEncryptSevLib/Ia32/MemEncryptSevLib.c > index f92299fc77..f0747d792e 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/Ia32/MemEncryptSevLib.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/Ia32/MemEncryptSevLib.c > @@ -153,3 +153,20 @@ MemEncryptSevSnpPreValidateSystemRam ( > { > ASSERT (FALSE); > } > + > +/** > + Accept pages system RAM when SEV-SNP is enabled in the guest VM. > + > + @param[in] BaseAddress Base address > + @param[in] NumPages Number of pages starting from the base address > + > +**/ > +VOID > +EFIAPI > +MemEncryptSnpAcceptPages ( > + IN PHYSICAL_ADDRESS BaseAddress, > + IN UINTN NumPages > + ) > +{ > + ASSERT (FALSE); > +} > diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/DxeSnpSystemRamValidate.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/DxeSnpSystemRamValidate.c > index d3a95e4913..7693e0ca66 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/DxeSnpSystemRamValidate.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/DxeSnpSystemRamValidate.c > @@ -14,6 +14,7 @@ > #include > > #include "SnpPageStateChange.h" > +#include "VirtualMemory.h" > > /** > Pre-validate the system RAM when SEV-SNP is enabled in the guest VM. > @@ -38,3 +39,37 @@ MemEncryptSevSnpPreValidateSystemRam ( > // > ASSERT (FALSE); > } > + > +/** > + Accept pages system RAM when SEV-SNP is enabled in the guest VM. > + > + @param[in] BaseAddress Base address > + @param[in] NumPages Number of pages starting from the base address > + > +**/ > +VOID > +EFIAPI > +MemEncryptSnpAcceptPages ( > + IN PHYSICAL_ADDRESS BaseAddress, > + IN UINTN NumPages > + ) > +{ > + EFI_STATUS Status; > + > + if (!MemEncryptSevSnpIsEnabled ()) { > + return; > + } > + if (BaseAddress >= SIZE_4GB) { > + Status = InternalMemEncryptSevCreateIdentityMap1G ( > + 0, > + BaseAddress, > + EFI_PAGES_TO_SIZE (NumPages) > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (FALSE); > + CpuDeadLoop (); > + } > + } > + > + InternalSetPageState (BaseAddress, NumPages, SevSnpPagePrivate, TRUE); > +} > diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiSnpSystemRamValidate.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiSnpSystemRamValidate.c > index 4970165444..1c52bfe691 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiSnpSystemRamValidate.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiSnpSystemRamValidate.c > @@ -126,3 +126,20 @@ MemEncryptSevSnpPreValidateSystemRam ( > BaseAddress = EndAddress; > } > } > + > +/** > + Accept pages system RAM when SEV-SNP is enabled in the guest VM. > + > + @param[in] BaseAddress Base address > + @param[in] NumPages Number of pages starting from the base address > + > +**/ > +VOID > +EFIAPI > +MemEncryptSnpAcceptPages ( > + IN PHYSICAL_ADDRESS BaseAddress, > + IN UINTN NumPages > + ) > +{ > + ASSERT (FALSE); > +} > diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c > index 7797febb8a..edfebf6ef4 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c > @@ -10,6 +10,7 @@ > > #include > #include > +#include > #include > > #include "SnpPageStateChange.h" > @@ -80,3 +81,20 @@ MemEncryptSevSnpPreValidateSystemRam ( > > InternalSetPageState (BaseAddress, NumPages, SevSnpPagePrivate, TRUE); > } > + > +/** > + Accept pages system RAM when SEV-SNP is enabled in the guest VM. > + > + @param[in] BaseAddress Base address > + @param[in] NumPages Number of pages starting from the base address > + > +**/ > +VOID > +EFIAPI > +MemEncryptSnpAcceptPages ( > + IN PHYSICAL_ADDRESS BaseAddress, > + IN UINTN NumPages > + ) > +{ > + ASSERT(FALSE); > +}