From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.47]) by mx.groups.io with SMTP id smtpd.web11.89618.1674774662931890220 for ; Thu, 26 Jan 2023 15:11:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZuEkY/aA; 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.220.47, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RYBgIFgWixrsg1Y+ihrpE4XiRrwxHbE4pu6EGWNx5NcT9k/mAwc19Ycygtp6aJDU2waVquhpYyd0Bt2mQXsv2B7VcSPzhdUeOjfqeETImRkqo3sIN587X2efB/hFG/lWu16hPLSsi9z+DVmX6scFCRYQz6p5PvDt3WPZOMLnjilkFcThaiWU0H9M2W6B7GTrSekgfpe9DcAx43k1lKtHEnQBMcTdfZV8NMX5PZbe4oxuybBLqA1/WaUCoLDLWOswkwTm8QPn8JLXMwNHuEBonJjTcSmbl3g8C2byP1FvmLCjkvHEX0RCSol3Y42jB+EDOY9FgpI1n47ucSA5N9W5Sw== 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=T6+cEIULhg0VjrB4g2CZotwGxzOsVU25bfxV36RdHEU=; b=Da5S1+wLAOaq3ZGDu4vEhKxqp+w6leuSs0vUC2TAFkIlHMjXKwAuPjnjVHS6CQ7L9nNcjf85JHrdMAtkqzTGgIUG+o/pgmUFoBnhG39BD4oh7PofuSqOuz1JUlDjYdPbQrHaiHknmVOeH5xY3xKi+lf0cu0W15RHpR+o+G+4q5ZAOWDuuon7midS4VGL37CgJN/pdmatgy4Xv7+xLer3citJrc7AarTB22QoA4Vnj1rtDHtNFmlqL6zFe1WIzyyucl5oagA4O7k4T4yBiu2kjHVeSkNFQ/D46XfAIoOQBOgQ4s0+qt8KG7+BadNfYLQhUn4PC3kfVA5Jlts0P6CqHA== 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=T6+cEIULhg0VjrB4g2CZotwGxzOsVU25bfxV36RdHEU=; b=ZuEkY/aA4MUa1+PgJhkNtECp1627Fuu6ZtxpXSSjMKgtym5IBd2aXT9citEdNVrJSdIwJIuaeKOkIOal51P7vrFPw8sTXvOzCelXJDosVi+HkrPLWhwVsiSlPzWMpuYUmV5Zy3852+JpeMRBf57Zc436bN4xVdhH9Voxiw/2Cqk= 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 IA1PR12MB8285.namprd12.prod.outlook.com (2603:10b6:208:3f6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Thu, 26 Jan 2023 23:11:00 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::6cc0:9c7a:bd00:441c]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::6cc0:9c7a:bd00:441c%7]) with mapi id 15.20.6043.022; Thu, 26 Jan 2023 23:10:59 +0000 Message-ID: Date: Thu, 26 Jan 2023 17:10:57 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v11 2/4] MdePkg: Introduce the SevMemoryAcceptance protocol To: Dionna Glaze , devel@edk2.groups.io Cc: Gerd Hoffmann , James Bottomley , Jiewen Yao , Ard Biesheuvel , "Min M. Xu" , Andrew Fish , "Michael D. Kinney" References: <20230126211740.3235408-1-dionnaglaze@google.com> <20230126211740.3235408-3-dionnaglaze@google.com> From: "Lendacky, Thomas" In-Reply-To: <20230126211740.3235408-3-dionnaglaze@google.com> X-ClientProxiedBy: CH2PR11CA0024.namprd11.prod.outlook.com (2603:10b6:610:54::34) 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_|IA1PR12MB8285:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fbac121-e331-4d58-5018-08dafff29663 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S4F19a5CyMrg0GRjDcg7IQnH7OJW6fS/6FvKRL7ed37jDAZXSivuxv/rG1t7MjzECQ/lYXkGCeUifhlapAucxWgzDe2DMW83A61uCUp76DhLkwV0FvawHX601iNQOvTNGEGWCwHenYgcLF8SfnGu6fxS2XVUrPRseQ+jcUaiwjftmEXyWl8RpoVxTUny+s2NLOdblVKswfr7jNO7Mn8iza/QNhZSi1E0/Yx9XdQBW14vlvp1Rr+NFVXBvWdiE5bApUQJMo6AtZNVibzr0qk5ttQqyx3ri08lDCkGesoH08s6hYVSubUCHYNln6dnNmEwV3vWcBTEmcfrZYsTNo9q7IpVvmaTuT/m/BG6KJjIvmBHaJ01jwkfQlmLKCzi6XmEFtVyJj9H3dvRSHarBmepVza19wRoY//mCai0BSH46mLhgP8Tq5CfZLB9uv8t6jQOhsnEecL31rgKqNvVyWA2ICCukvfgv/JCOEx2+4pOw1U+jUfhhrsxTXzMTt6Hd1GxvoRuaYv1n7cNGlkiD/TkStaYfjQaS2mbS+1QE6G9SMbXWi+xxtNgNPaUNHfpRhq83DDqxnaFK2Kf8jEydoGRnd+mCS4YAit82/0GCINnMk4oXMK5q2yEWG6ZkEE/en/shUlLBXQ+h0Dly6/lUOzpqFNzpDJG6W+4y6Sk9Uc5W+eO/7jxHM980TPQ5SFMBTw93q9iUh7AmuHxzYn6wKh3Vc9Yb3Hq5sp6G9ePASxVKGs= 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:(13230025)(4636009)(39860400002)(366004)(396003)(346002)(376002)(136003)(451199018)(4326008)(316002)(66476007)(66556008)(86362001)(66946007)(8676002)(36756003)(53546011)(19627235002)(54906003)(6512007)(26005)(2616005)(8936002)(478600001)(186003)(31686004)(5660300002)(2906002)(6486002)(6506007)(31696002)(41300700001)(38100700002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cDNVVllPMW9rYUtyeVNTa2N4TG5nY0VvcCtrL2txU1BlRlExcXNLQWIwNlhZ?= =?utf-8?B?c0pCSWRYeDRUTEc3Q2NUNmRiSmFhNFl1TGtyY01UMWpHT2IvTy9vSHAySm1k?= =?utf-8?B?RnVQY3dCQysyUU1PSEt5ajFBYTl3V2YrczNONDRPcllNa3R5clRhYUZYRGto?= =?utf-8?B?a0Y1cHhVa29kSjFmdzkzT0tUSTMzaDJxMm94aURyTWZxZk9nSGY3M1ZxV0Z2?= =?utf-8?B?VWhieDJTQWZ2OHZLUy9HWnZhRmJrK0UvdU1EdXFYVFF1YXlkYVRlbHZPYTVx?= =?utf-8?B?YzN0T09nZUdsK2l1LzBseDRocVhwejFUakp5Z3JJV2dqTVhwZzF3eDRmZjRa?= =?ut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-MS-Exchange-CrossTenant-Network-Message-Id: 0fbac121-e331-4d58-5018-08dafff29663 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 23:10:59.8480 (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: wTVNaou5Pf3IyQLpW4rWN6lQU8gAxC5Bvx82XdsTHtmjkJDOlWLkS9stfLjSAMOylkGPmhdxhbaPsqo01QXKlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8285 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Might want to fix up the commit title from MdePkg to OvmfPkg before committing. Thanks, Tom On 1/26/23 15:17, Dionna Glaze wrote: > The default behavior for unaccepted memory in SEV-SNP is to accept all > memory when ExitBootServices is called. An OS loader can use this > protocol to disable this behavior to assume responsibility for memory > acceptance and to affirm that the OS can handle the unaccepted memory > type. > > Cc: Gerd Hoffmann > Cc: James Bottomley > Cc: Jiewen Yao > Cc: Tom Lendacky > Cc: Ard Biesheuvel > Cc: "Min M. Xu" > Cc: Andrew Fish > Cc: "Michael D. Kinney" > > Signed-off-by: Dionna Glaze > --- > OvmfPkg/Include/Protocol/SevMemoryAcceptance.h | 42 ++++++++++++++++++++ > OvmfPkg/OvmfPkg.dec | 1 + > 2 files changed, 43 insertions(+) > > diff --git a/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h b/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h > new file mode 100644 > index 0000000000..c45b499006 > --- /dev/null > +++ b/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h > @@ -0,0 +1,42 @@ > +/** @file > + The file provides the protocol that disables the behavior that all memory > + gets accepted at ExitBootServices(). This protocol is only meant to be called > + by the OS loader, and not EDK2 itself. The SEV naming is due to the coincidence > + that only SEV-SNP needs this protocol, since SEV-SNP kernel support released > + before kernel support for unaccepted memory. The technology enablement thus > + does not strictly imply support for the unaccepted memory type. > + > + Copyright (c) 2023, Google LLC. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef SEV_MEMORY_ACCEPTANCE_H_ > +#define SEV_MEMORY_ACCEPTANCE_H_ > + > +#define OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL_GUID \ > + {0xc5a010fe, \ > + 0x38a7, \ > + 0x4531, \ > + {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} > + > +typedef struct _OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL > + OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL; > + > +/** > + @param This A pointer to a OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL. > +**/ > +typedef > + EFI_STATUS > +(EFIAPI *OVMF_SEV_ALLOW_UNACCEPTED_MEMORY)( > + IN OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL *This > + ); > + > +/// > +/// The OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL allows the OS loader to > +/// indicate to EDK2 that ExitBootServices should not accept all memory. > +/// > +struct _OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL { > + OVMF_SEV_ALLOW_UNACCEPTED_MEMORY AllowUnacceptedMemory; > +}; > + > +#endif > diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec > index 1b521f2604..a22eb246c6 100644 > --- a/OvmfPkg/OvmfPkg.dec > +++ b/OvmfPkg/OvmfPkg.dec > @@ -184,6 +184,7 @@ > gEfiLegacyInterruptProtocolGuid = {0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}} > gEfiVgaMiniPortProtocolGuid = {0xc7735a2f, 0x88f5, 0x4882, {0xae, 0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3}} > gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}} > + gOvmfSevMemoryAcceptanceProtocolGuid = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} > gQemuAcpiTableNotifyProtocolGuid = {0x928939b2, 0x4235, 0x462f, {0x95, 0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}} > gEfiMpInitLibMpDepProtocolGuid = {0xbb00a5ca, 0x8ce, 0x462f, {0xa5, 0x37, 0x43, 0xc7, 0x4a, 0x82, 0x5c, 0xa4}} > gEfiMpInitLibUpDepProtocolGuid = {0xa9e7cef1, 0x5682, 0x42cc, {0xb1, 0x23, 0x99, 0x30, 0x97, 0x3f, 0x4a, 0x9f}}