From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.57]) by mx.groups.io with SMTP id smtpd.web09.151.1663953591731808642 for ; Fri, 23 Sep 2022 10:19:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=0txNYk2J; 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.94.57, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oSp3rNeYdyGsPHhf/P4vNF3m3xGALWVkXOWvealvx6s8/8l43B3AEupxLrcylI4rAwX1SpNaPCxCiyGfw6jVIkE7cN3tCCUmry5dnjmm30/L4jEfh73gte4BhCl6dMo+vtZAGk02eUQeE8+Tek5ONNJj9FrOvDJRCeIgXbqXlOw3QiCnJVOhsLIgFU+Nd6tIJFhEvCwZ9l3Aly3fwHQN97iudh/KMAnXsgLOFr99fV8Vx8M/uc7vj54FEYJ+ZM2+O+vE8seOz2MRJEhEwDw4q2w5E3k9bmG2hGM3OtUwWphwr1Qf/PHROT8Izo2h0kaccmBglC72C50xOS3bc7mkpA== 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=F3HcBbvpMuTJJbqCECSPX3dpAXIzQCy7n5NOVzsu3Yw=; b=bfgGY7GAqlfSeeyVfHzY4JJwkrHHcGe+kEFLO6Ag4FIkik7vH+H2QlZkX/+1xTtsiCWHNbGGn/ZTKu9lrJVPJE5vwjWmoNWf1/ab2hHH6u14nhi6okiVYhJCVzqKCyU6pr9u0fADjkg3wPYdwcedF/M3q1jD32aZIul25j2nP8sWhQJlnv6QGQpA+kzXurcJ43W50zL64BdkMiI6eByUvpZDu9TKiuusT6j2ySnI77qkPRJSE2BJ512D760ShrTD7jC5I8OpMBwBWI4xhh3MOfISKa0I4TpaqMkbeeBDg5Je5FYtGUlpLp8sA/YGlMh8Mv0KnqQqcXRpNr5xEnXM3A== 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=F3HcBbvpMuTJJbqCECSPX3dpAXIzQCy7n5NOVzsu3Yw=; b=0txNYk2JSYF9poc0eEFazNfSNjNDeRp/CQXw13nfXIVm+5s0k2Jw104e7eHlRGg+SVNq4cqlZ3namQ+ZByJvbWMOSh3kMCX5YFDJMUoVB6jfBZ7ksbInjH9LNR5PDI6prMDNIVxLWOre+FwTmTbzWBaF968E7gAcdvGREAa+f10= 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 MN2PR12MB4486.namprd12.prod.outlook.com (2603:10b6:208:263::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.22; Fri, 23 Sep 2022 17:19:49 +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 17:19:49 +0000 Message-ID: Date: Fri, 23 Sep 2022 12:19:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 0/3] Add safe unaccepted memory behavior To: Dionna Glaze , devel@edk2.groups.io Cc: Ard Biescheuvel , "Min M. Xu" , Gerd Hoffmann , James Bottomley , Jiewen Yao , Erdem Aktas References: <20220922205052.1198237-1-dionnaglaze@google.com> From: "Lendacky, Thomas" In-Reply-To: <20220922205052.1198237-1-dionnaglaze@google.com> X-ClientProxiedBy: SA1PR05CA0018.namprd05.prod.outlook.com (2603:10b6:806:2d2::18) 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_|MN2PR12MB4486:EE_ X-MS-Office365-Filtering-Correlation-Id: dfe724dd-bc6b-4d23-1b1b-08da9d87d1f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9YBs6EG7ZcL0OONFd6rq6xNoHUS7yJ5yPYbvElNcP4zIcMXCvzYfWgCf4yHQ2rtE9VnU/d5lXpS/t/XTtMvg15ukRkZtO+E8brKtY4kKNDpvK4UZ47mFLeAtVc6SM2MqWmMhXIskM3i+DiwslIbdj7BFEqVVJWWNN/g4IzCNfYfh6l+Ai7dTP5yOL3t0bwdRK6+kKKnpoZIT5zsanZg5fDXcJiNxWpRtU4+4LgykBkpZcCKkAOYCsdfKMYKfJjror0n487HP+ppmNPAOim9/RGjuzuE7XoRqZERUyjQVHp90yX+Et5r9wVZzaCI+0OQS81GSrB5hg1SCRe0g1WX3OhLJOkSaXaFs1kDClitlEqqNXNwywSAHc6TfGqf9R/6Jz+J9gyIrcYl65vcrA8Fvb/tTM2u2zh4zXzbAnlX8UIbHEG60RCf5G3Vh4ZKGS5uE0m47TODPwYf3zm8R56PSWMlIvuOXDwobVYxxJ1cYPd+VTegzV2RLgbn3rDkT/6w3/u4w/A3L1KRUZYfeKe68aRzThxELIDASwuqdL4KMWcQlCHVB0IVYI7/JONhb23XlMQ9eNQW9hYw4G7TpgeoCes21sFVK0qbRZ2328W3fd4vsSypQe4vfRDSDmE5+6dzVSj7WCnBPMojgW0tQtaYvA7dFf8SxG1wRAHXlLuH7BYK5nL7uLTz4nWebuvTttEdzWLG0lZah5wNUG1HNoFDUm7Sew6HbbProDCnxmo6eKrAly576NhaSOim5LzpB4dJtZ+AhPzPVv11o+vn5as5M4FICQ/StJg7yrw30CUOx/eM= 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)(366004)(376002)(346002)(136003)(39860400002)(396003)(451199015)(38100700002)(478600001)(31686004)(41300700001)(6486002)(54906003)(66556008)(2906002)(53546011)(66476007)(36756003)(4326008)(19627235002)(8676002)(316002)(66946007)(26005)(6512007)(8936002)(2616005)(5660300002)(83380400001)(31696002)(6506007)(186003)(86362001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RjQ0QWdUSkZCcy9GVWc2K2JMeWpnODc3cjV3SjBSUUp4MEt3ZEQwSVNyT1Mx?= =?utf-8?B?Z0pHN04rTU5DblJWTWRVM2RabHkvcEVoamlaenBNeThFT2ttYmx4RzhsNVF0?= =?utf-8?B?MENUZHZZdlJEOStKTVl5bldBNFVSNHNVZmZHVEYyM2Q5SkIyQ081WUUxMFEy?= =?utf-8?B?U1AxbTBYMTNRd2hDS21FczJkVmtVZDczb2lMVm5kWUxxWlFxWEl3ejdFaXVC?= =?utf-8?B?MkVRQkdHMitYQVV3UFhKVEE5TDJGTkpja0FMejBCc1Zmemt3OHFlZ1VFck9R?= =?utf-8?B?djEyMVoyZjBUSTdkTkt3b3J6bDd6UVdNQThsUDNYUjBmTFF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?utf-8?Q?BHxM6UniIkXiq7vHanNV5ZoFc?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfe724dd-bc6b-4d23-1b1b-08da9d87d1f8 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 17:19:49.6128 (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: /WlrDvgHkR8vx/RdyvGdUy4PJsVBrNuQUxuhFTPBh14KVJlmxjILUbSN3Rxma0zuYMrLZXpwlH3Hs8TdRifG5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4486 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/22/22 15:50, Dionna Glaze wrote: > These three patches build on the lazy-accept patch series > > "Introduce Lazy-accept for Tdx guest" > > by adding SEV-SNP support for the MemoryAccept protocol, and > importantly making eager memory acceptance the default behavior. > > For unaccepted memory to be enabled, we must know that the booted image > supports the unaccepted memory type. We add a trivial protocol that sets > a dynamic Pcd to true when called in order for the booted image to > signal its support for unaccepted memory. This does not need to be an > OsIndications bit because it does not need to be persisted. > > We use the Pcd to disable a new ExitBootServices notification that > accepts all unaccepted memory, removes the unaccepted memory entries in > the memory space map, and then add the same memory ranges back as > conventional memory. > > All images that support unaccepted memory must now locate and call this > new ENABLE_UNACCEPTED_MEMORY_PROTOCOL. This seems to be missing the creation of unaccepted memory under SEV-SNP. Is that going to be part of a separate patch (to update PlatformAddMemoryBaseSizeHob () and mark anything above 4GB as unaccepted)? Thanks, Tom > > Cc: Ard Biescheuvel > Cc: "Min M. Xu" > Cc: Gerd Hoffmann > Cc: James Bottomley > Cc: Tom Lendacky > Cc: Jiewen Yao > Cc: Erdem Aktas > > Signed-off-by: Dionna Glaze > > Dionna Glaze (3): > OvmfPkg: Realize EfiMemoryAcceptProtocol in AmdSevDxe > DxeMain accepts all memory at EBS if needed > MdeModulePkg: add EnableUnacceptedMemoryProtocol > > MdeModulePkg/Core/Dxe/DxeMain.h | 32 +++++ > MdeModulePkg/Core/Dxe/DxeMain.inf | 3 + > MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 19 ++- > MdeModulePkg/Core/Dxe/Mem/Page.c | 122 ++++++++++++++++++ > MdeModulePkg/MdeModulePkg.dec | 9 ++ > MdeModulePkg/MdeModulePkg.uni | 6 + > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/AmdSevDxe/AmdSevDxe.c | 27 ++++ > OvmfPkg/AmdSevDxe/AmdSevDxe.inf | 3 + > OvmfPkg/Bhyve/BhyveX64.dsc | 2 + > OvmfPkg/CloudHv/CloudHvX64.dsc | 2 + > OvmfPkg/Include/Library/MemEncryptSevLib.h | 14 ++ > OvmfPkg/IntelTdx/IntelTdxX64.dsc | 2 + > .../Ia32/MemEncryptSevLib.c | 17 +++ > .../X64/DxeSnpSystemRamValidate.c | 35 +++++ > .../X64/PeiSnpSystemRamValidate.c | 17 +++ > .../X64/SecSnpSystemRamValidate.c | 18 +++ > OvmfPkg/OvmfPkgIa32X64.dsc | 2 + > OvmfPkg/OvmfPkgX64.dsc | 2 + > OvmfPkg/OvmfXen.dsc | 2 + > 20 files changed, 334 insertions(+), 1 deletion(-) >