From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.61]) by mx.groups.io with SMTP id smtpd.web10.9647.1621004070117911237 for ; Fri, 14 May 2021 07:54:30 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=XbsariQd; 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.236.61, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OUazVdhG4Cwiq8CUupOy7tyfoEHkAUpFndyVfpTy6UnL53OajJCJ1auYnpbpfNt3g2C0jiHbb3bHutc1EA3pMC3l1VVoir2W8uEboFPxz4p/GeCmNInHz/g3Vs8SZ9hTsChI8qBWco914gAWsiGOxXb1JQyYy/aQsK5UxNTlZE19yfocTBAFbXE3FG25AykxHMuVYSq6K9XE1TYSGdoHedo8mqRrQ5ufYdf5uFk0MU7hwYZpWKapmwvx/uraRLEjuerk3BtPyaGMKXACy01nDddzi37Eg4NN8SGUvpCdWZxC31ZXDHU7fwPdsInzDfGbi9u4SKw8zazTpWXbMnA6mg== 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-SenderADCheck; bh=VAQnHrTJyNpZJPyl9xtup8A7ru9HMoyLDhb7EQiZYY0=; b=JRSYHxY9le1hOaefAa3lD8Ns7Xf7GNakTUtHeHBeBRGxWlGrWTsrM8zW1b24/btyr5sdSM+NepaTrpt7C+uxli91i/wvbrkZpWgkfmMCHF8bBIOTb9PKfJS2lIxfyu2b4biWu4SY6Fxu7JL6BS5l2UkK8fk1OMqbdMi3ebtYjVCqLaFuGJSyiJqLIjtZDpjHY81sYHGfhk1neklBqX7geREu3lxJLpE4w0uq4NAf0/oC6ABfh5QGZ1FuYC/LFTFE02ws3PKZUM7M7EQsdxP84Pj3nP4eKTtb5o63jIAzSni0eyyygdtNF2HtYVC+UqXkGz16MDMyZ70mGQsPjPC+gw== 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=VAQnHrTJyNpZJPyl9xtup8A7ru9HMoyLDhb7EQiZYY0=; b=XbsariQdrxU1r1U4s6kTmHkUUP31d9gSF8I9KpvtkuncvLL/aCodOI4liB3ho6mwNHpzYMEvE1xmuFe4wJOLrTnYH3JN7DuO0/0f+IYcPLZNOMcMAgQHBQsehha5bpTYpmOQwEtxJEScLQd25FC6CXxZk+7MNP7yLLdjHaTHtSo= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR12MB1868.namprd12.prod.outlook.com (2603:10b6:3:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Fri, 14 May 2021 14:54:26 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::b914:4704:ad6f:aba9]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::b914:4704:ad6f:aba9%12]) with mapi id 15.20.4129.025; Fri, 14 May 2021 14:54:26 +0000 Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Allocate a separate SEV-ES AP reset stack area From: "Lendacky, Thomas" To: Laszlo Ersek , devel@edk2.groups.io Cc: Brijesh Singh , Eric Dong , Ray Ni , Rahul Kumar References: <1162d1f4fe09048aaafba6f6ea3046bebd34fc2b.1620766224.git.thomas.lendacky@amd.com> <0ac5ccbf-98ce-5288-e6d4-d692b4855272@redhat.com> <5d7133d0-d933-a5d3-af0c-e21275d78176@amd.com> Message-ID: <4b3d5b75-f020-59ca-37c5-50b754831007@amd.com> Date: Fri, 14 May 2021 09:54:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 In-Reply-To: <5d7133d0-d933-a5d3-af0c-e21275d78176@amd.com> X-Originating-IP: [67.79.209.213] X-ClientProxiedBy: SN6PR2101CA0004.namprd21.prod.outlook.com (2603:10b6:805:106::14) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from office-linux.texastahm.com (67.79.209.213) by SN6PR2101CA0004.namprd21.prod.outlook.com (2603:10b6:805:106::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.3 via Frontend Transport; Fri, 14 May 2021 14:54:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af26062f-6b9a-4e70-ced0-08d916e82acf X-MS-TrafficTypeDiagnostic: DM5PR12MB1868: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +559J2/CUIw4EcCpszeuLHD4Jzo/pUAUT8tGQakrSWXVz98+K4KIecv2qPEtzbonHegmEVqyxRxq/BGJdE/qdEJUE/y2+QRVgkJ6DnWnNdi8ak/3UsJx3HKK9ftcJbQopeko2es8D1fik+UKTDFiw28V2D5f0JlH1R7/pE2UCmHbd+qiKfOwFrlMMvlZmNPf173U6f8BrNGFIsrzzNY4DpXMz+6m/aAScCZr3IzmP4N39Xb8GKDcWHF1PBTlY8adlKHHJq81wTH3Mi0IMVmnmqWHpD6jP9bmKla29bfpfs9zchvz54OzJgYIjgn/GqwOHTAXAW8WJ7tjCEY5OpBsBMMRGfzkYQf/omdpxhYzUsd8TNndM9x8PBeIQ2Y0GwFIq3wSVJz6Jm27BUpf8ja1tleh+VslC//eIOrQ9MpRv+hykf4bB76lzcwEewzdtAhUPlAXXnUmEN4xW42NtGPkNnDt92UQcq/w319mOVpS31SwVyw+sTnTqN8sE1VqNyL9EYa+/iiswHJpRM5U4xWBa/3GmvhywnniKWUSrky0JyF6kOS+nmHZ5gUpMPm4DT4CcpbEwiYMVfgJz346UEoPf20lvMFsgWe4O4DkfELs6ybsCfe9IWtctmKw57Lw6WIAgaMAYSNF5jZ/dtwYkNsixnFxS2KnWMKRBmqOny835f+MeryKDK4MhDF8eXPTmAKHVqLHaMziomBzV2MG8E4l0Izf2TmcP6G82rElp4xDWyrT15mIpHL6sN95vb6BRvoY6Xcc4npoIfkwzjUPCpTzOg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(366004)(376002)(396003)(39860400002)(136003)(346002)(2616005)(956004)(86362001)(6486002)(31686004)(186003)(316002)(6512007)(45080400002)(16526019)(8936002)(966005)(38100700002)(8676002)(54906003)(66556008)(66476007)(4326008)(5660300002)(66946007)(478600001)(83380400001)(31696002)(2906002)(53546011)(6506007)(36756003)(26005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?TmVYVVN3ODIxSmFpRmNETTBiMlVqa1RQaUQrUjJVY1lmUEx6VDJ1R2I0MTZj?= =?utf-8?B?bmZTc1Q0YjV1dVh4WDFtOXc4bVIrWStidnFIZkpuS0p6RVhhRkpFeGZzckQ1?= =?utf-8?B?RHp4Nmc3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f-8?B?VXJCNlZETlVMdUdNcXp6WEt0YXJ6OWtXUTd3SmcvTjdPbnVNbkR4MGZQZVY4?= =?utf-8?B?UmZXZzRvUDJqVjRiaVZmZVJEZkJXdDk0STRnUlBzclNKZmU5Z0d2d0kyL3lI?= =?utf-8?B?TlBCb3hkdTZNMXY3ZzdqNnJyK1NEUTd3MzZsUkQyUzkzYi8vakVxall6TjZh?= =?utf-8?B?WHU5cVZWQ3NIL0QrSEtvZTdqMkNhK2kvZGRlK3RNQzJ0QXJOeUpzSDdsWEd5?= =?utf-8?B?QmFBZzBNMk5uY0Z4c3UvZGZKSVNvTDl0ejVxMmNnMHNWY2JBYnBDTm9Oczhk?= =?utf-8?B?ZFEzMXFLaXBORHZjNFBaZmRDSWdTZHNjU045dHVyYjNodjkrUHFqNE9CaEtN?= =?utf-8?B?T0NpdUIvbGJBU0hLTTdmMjBLZFd6cTZndE5LTXM0VXNiSU9COWFqckpjVUts?= =?utf-8?B?Si8xRTFlM0RaNUpVQXdlT1dldDhwWVJYeEFOLzVzdFdtMkQ3dTg2LzdUTmFI?= =?utf-8?B?aVpnZlV0WWZtZU4wdzlLMWJ2dXF2QjE3OW5JVXZ4T0JyclNUbWRrMzNnMDM5?= =?utf-8?B?NEtRNlZoNER3ZVUvQnJ2Qkt2TlBoaE9qMm5BTzNkVExhaVA3SlYrVlVOckFO?= =?utf-8?B?U3JIcFJacFZWRjU4c2hnNjh6WnVBdDlNSE1iMStoVmRQdXAySEUvam5FRysz?= =?utf-8?B?YWp1SUpTUHh4a1YwRzhaYVRwdXhPSkd6ZDdCdGhJWXlvVi8wRjY4SkxnMkZw?= =?utf-8?Q?BKM7ZZlkzVU2ubhVRUabTqWoOtbk3jk2dx7HoPD?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: af26062f-6b9a-4e70-ced0-08d916e82acf X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2021 14:54:25.8470 (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: XCTkAFHNOpYw2+EiX8IWjvxcYE78k4AcZaFvAisLxD/q0ct5QD/aDHXKwIbFGxVaJgKcsqt2oF0j81zDINT/2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1868 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 5/14/21 8:33 AM, Tom Lendacky wrote: > On 5/14/21 4:14 AM, Laszlo Ersek wrote: >> On 05/11/21 22:50, Lendacky, Thomas wrote: >>> BZ: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3324&data=04%7C01%7Cthomas.lendacky%40amd.com%7C7c28b41e27cc4b9a8b9508d916b8a955%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637565804655837525%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ixw2PdtFLryJs9KHplJ8bvomtaqjBJF8KuDdWO5ERdw%3D&reserved=0 >>> ... >> >>> @@ -220,11 +222,11 @@ GetWakeupBuffer ( >>> // Need memory under 1MB to be collected here >>> // >>> WakeupBufferEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength; >>> - if (WakeupBufferEnd > BASE_1MB) { >>> + if (WakeupBufferEnd > mWakeupBuffer) { >>> // >>> - // Wakeup buffer should be under 1MB >>> + // Wakeup buffer should be under 1MB and under the previous one >>> // >>> - WakeupBufferEnd = BASE_1MB; >>> + WakeupBufferEnd = mWakeupBuffer; >>> } >>> while (WakeupBufferEnd > WakeupBufferSize) { >>> // >> >> (7) Can we use a WakeupBufferLimit helper variable here, and set it like >> "StartAddress" under (2)? > > Will do. Actually, WakeupBufferEnd is like a helper variable here, so probably best to just do: if (PcdGetBool (PcdSevEsIsEnabled) && WakeupBufferEnd > mSevEsPeiWakeupBuffer) { // // SEV-ES Wakeup buffer should be under 1MB and under any previous one // WakeupBufferEnd = mSevEsPeiWakeupBuffer; } else if (WakeupBufferEnd > BASE_1MB) { // // Wakeup buffer should be under 1MB // WakeupBufferEnd = BASE_1MB; } which makes for a nice diff: @@ -220,7 +222,13 @@ GetWakeupBuffer ( // Need memory under 1MB to be collected here // WakeupBufferEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength; - if (WakeupBufferEnd > BASE_1MB) { + if (PcdGetBool (PcdSevEsIsEnabled) && + WakeupBufferEnd > mSevEsPeiWakeupBuffer) { + // + // SEV-ES Wakeup buffer should be under 1MB and under any previous one + // + WakeupBufferEnd = mSevEsPeiWakeupBuffer; + } else if (WakeupBufferEnd > BASE_1MB) { // // Wakeup buffer should be under 1MB // Thanks, Tom > >>