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.43]) by mx.groups.io with SMTP id smtpd.web12.10685.1596381150572296775 for ; Sun, 02 Aug 2020 08:12:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=A6IESzyC; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.220.43, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fRNAP8Yk6wwoJl7OKHYWZLl0NPLSFA7bYPwL6cZu6Niimw5oFVM48YSDbEJo94XK0bB6LILI0xRK7bI7e7D5jvuM0gfwxwf8sMdL6GIZuieRwTs2gg3U/fxDI3RT9FNDVMnOfks5QJ7m2c82gNZuEcTSsP8VsWPDzM9qIbF//2uec77woUw0r8VzIdN41MydFaDdq4LGZnc+t8yiY5BAtRlFbz3VsCLo8AEwZ5fLkx2ZIBLgLVTKQJ+Hf2W+r+XJMuPCXKDcb1m8WK+46/DSYWVsNDTZ04a6XLf2IIyrttxRAIbeDPXHx3Ms0zrfzOkrYLPpjb5iKtEZlj20aMPO4Q== 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=T+Y85/zbT98EGu4R1UVge6YBwKIt6OmZB1cagmvwflU=; b=RrPPznH2PElbCgC+Bow1R4eVbmlyQLvGydwx9uQkGZN5Jit0v1xWjOJH8qPpthtcxhWZiLyKQDcCM9H/EWK8hNMvxPYp9cmVXpNkpv4dNl1vAmkLQVHWtKQ/KuRVtZQHbafyx/ysMfGUXQYs8P0H+x6+5CoyDcw/8xE/vyMkpeHLUGylNeIP8zxbAohCCrYgSazfi4o1CtnJWfY8taqiAcg/9G3YsRzT6GZPVwDGO4t+zdLXLPn1aH1uJ9VTwliUfmJbd07M6hZrqe8ZzmTDR2HzM+hRFJ2w73AzQL1qssYRZ3vWn8mBpBrN5YhlHngGq/zEg7rXugJIxdBQFOwhyA== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T+Y85/zbT98EGu4R1UVge6YBwKIt6OmZB1cagmvwflU=; b=A6IESzyCC6g4pSbg6L2APPAwBjISEJRiBNVidUxU1QQysGTDIrOtYJPEt06mmNiwzCuMSuWvU1BbKS+GcpnPnvJS0HPIi3/I/nAQ0jejaj3F2wCnCEXHBGHr3QUA2DcApHD1U87PkTvyQ0EK3DYu1h42pWyXfrOONz0qVXz9e/Q= 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 DM5PR12MB1259.namprd12.prod.outlook.com (2603:10b6:3:75::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20; Sun, 2 Aug 2020 15:12:26 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0%8]) with mapi id 15.20.3239.021; Sun, 2 Aug 2020 15:12:25 +0000 Subject: Re: [PATCH v13 45/46] UefiCpuPkg/MpInitLib: Prepare SEV-ES guest APs for OS use To: Laszlo Ersek , devel@edk2.groups.io CC: Brijesh Singh , Ard Biesheuvel , Eric Dong , Jordan Justen , Liming Gao , Michael D Kinney , Ray Ni References: <9d41b17caa823ab3f39f08464785afd0fd03578f.1596134638.git.thomas.lendacky@amd.com> <7be9efaf-3907-c29e-cfb4-52950104841f@redhat.com> <46286340-cc66-990f-a337-d807363d112e@amd.com> <83386de9-69e2-3a0c-8b32-6a14176ba64d@amd.com> <34390dd7-29d2-1619-ca9b-208b8e48aa30@redhat.com> <719f39f9-2997-3426-8bac-e5a5dfb4640b@redhat.com> From: "Lendacky, Thomas" Message-ID: Date: Sun, 2 Aug 2020 10:12:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <719f39f9-2997-3426-8bac-e5a5dfb4640b@redhat.com> X-ClientProxiedBy: SN1PR12CA0112.namprd12.prod.outlook.com (2603:10b6:802:21::47) 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 SN1PR12CA0112.namprd12.prod.outlook.com (2603:10b6:802:21::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Sun, 2 Aug 2020 15:12:24 +0000 X-Originating-IP: [67.79.209.213] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cb286360-df73-4f6f-3424-08d836f676aa X-MS-TrafficTypeDiagnostic: DM5PR12MB1259: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8obxZ+whWJlvfrjxz11Ni1UNYvjZUlNQxClMQ/MyzSHtJu33SNW4IFTduPERfFRAxUus2Wapwds56tcaiIvl3pCTbuyXyChdN4tnEjfMQKKFxKwFdwGtcHgo4D6OGD1POXaI3ulTf7wEx4gRexfVTSxwYa9ewAQwALmDzj3BozW/81pAi/FK/LfDo4DalQkoHvgEOy0cCRMIYA94IZmTxzadFkazbtggjzueMqZpU3Zds9GKd29uYRmRif8BOEE8QoaJARmcDWmyDbWYQrcsSK2p5bnCV8I0irXV7E8/OkZ2oNAPKDWFQTJpoXIWIcEkdeXHKTD4uF3BlkT0OCGnPEsELVWHheh4BrLoHZJXka0W4HuFNx9Lm4uu1EuLvu3WQ2Rruz3/RZ6CNRYt99m/YlOeEhC04qNp+F0eeeD0SCisE+yWlPr7pYGeOVkNmWbOqDc6kojOUNhwwFxZE9x63g== 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;SFTY:;SFS:(6029001)(4636009)(366004)(39860400002)(396003)(376002)(136003)(346002)(8676002)(4326008)(8936002)(5660300002)(30864003)(31696002)(956004)(86362001)(316002)(45080400002)(2616005)(2906002)(54906003)(19627235002)(31686004)(186003)(6512007)(6506007)(16526019)(53546011)(52116002)(26005)(36756003)(6486002)(966005)(83380400001)(478600001)(66556008)(66946007)(66476007)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zl0Cpl6W59r6OazYK5Sugxvxe3JXRVMG7k3LaOwljeab5kktngFLOyW1TILCDne365hTSv3r8wR4Y9qlsHiOFvGEcHTdl089/SDN0WBUtGe3iOhX0UpHvr4+0uf+0s0Uri7A8M2K8+1I7tOQdTYCnTV+hb4yxpyMbN0gd5quVHS+yrTxpLMmTTkyP7ZFJxgU2LAO8HZBIlqMVbliGx2EyE6BVNz3YfqeO3+WJbFnVdpn46H4hKkcIgYQRWDHAYkQRYo9SIJnmE5lVbTKoTivbIdd9RVZHEgfcrclt/3BRq0Etv7jcFiNPxoNItbk2rHJ3fiLAyi+t/JW6d8++NHfdcH9Tt1yhLy2IDyfCVshkQazTbX8n3BTTe6NGNWkqwuogcrZNYBRx32wJFnUWUQEOb76Nl84/Xi+r3fbg0FDGInCJbOjT0zwaCFL/3HxdHIeoTk/aJaIb56dTux4u56Xz+29DoU3RcLV7RtYYcRKa5fbnfpk1TetabMz5fLKGKAx+7D6B6qBKVJ4oEdJEHn+84VBIoFRmOhIJ1gntGOCS5EhhPYRZMNDSEiFldFw/irziOIqGll25PewrCPXvFBsbYBYTDkkfAlG/vis7+q3P1pPhstdtwTBwlao9ITPzl1f9Z6hLI01CeKyN9FDaumv6g== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb286360-df73-4f6f-3424-08d836f676aa X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2020 15:12:25.6994 (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: WPeZh01HiyGU4VOvmgYeuA4lXmE+6B7OzJSetSEPqqSZZU/GQoEKX5ja2WbHRqXpnJkONNNkciN//XcvZ9k+hA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1259 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/1/20 12:31 PM, Laszlo Ersek wrote: > On 07/31/20 23:38, Laszlo Ersek wrote: >> On 07/31/20 16:47, Tom Lendacky wrote: >>> On 7/31/20 9:44 AM, Tom Lendacky wrote: >>>> On 7/31/20 8:36 AM, Tom Lendacky wrote: >>>>> On 7/31/20 7:43 AM, Laszlo Ersek wrote: >>>>>> Hi Tom, >>>>> >>>>> Hi Laszlo, >>>> >>>> Hi Laszlo, >>>> >>>> Can you try this incremental patch to see if it fixes the issue you're >>>> seeing? If it does, I'll merge it into patch #45 and send out a v14. >>> >>> Looking at the formatting, I'm not sure if Thunderbird messed up the >>> diff. I'll send you another copy directly to you using git send-email >>> just in case. >> >> I got the separate copy; I'll report back sometime next week. >=20 > The update works fine; IA32 OVMF boots OK with it. Thanks for testing so quickly, Laszlo! >=20 > I agree with squashing the update into patch #45, but before sending > v14, maybe we should get some feedback for the MdeModulePkg patches too, > at long last. :/ Yup, I'll hold off on sending v14. Thanks, Tom >=20 > Thanks! > Laszlo >=20 >=20 >> >>>> diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>> b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>> index 7165bcf3124a..2c00d72ddefe 100644 >>>> --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>> +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>> @@ -365,9 +365,9 @@ RelocateApLoop ( >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MwaitSupport, >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData->ApTargetCState, >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData->PmCodeSegment, >>>> >>>> -=C2=A0=C2=A0=C2=A0 CpuMpData->Pm16CodeSegment, >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 StackStart - ProcessorNumber * AP_SAFE= _STACK_SIZE, >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (UINTN) &mNumberToFinish, >>>> >>>> +=C2=A0=C2=A0=C2=A0 CpuMpData->Pm16CodeSegment, >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData->SevEsAPBuffer, >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData->WakeupBuffer >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ); >>>> >>>> diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm >>>> b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm >>>> index 309d53bf3b37..7e81d24aa60f 100644 >>>> --- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm >>>> +++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm >>>> @@ -226,7 +226,10 @@ SwitchToRealProcStart: >>>> =C2=A0 SwitchToRealProcEnd: >>>> >>>> =20 >>>> =20 >>>> ;---------------------------------------------------------------------= ---------------- >>>> >>>> >>>> -;=C2=A0 AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegmen= t, >>>> TopOfApStack, CountTofinish); >>>> >>>> +;=C2=A0 AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegmen= t, >>>> TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, >>>> WakeupBuffer); >>>> >>>> +; >>>> >>>> +;=C2=A0 The last three parameters (Pm16CodeSegment, SevEsAPJumpTable = and >>>> WakeupBuffer) are >>>> >>>> +;=C2=A0 specific to SEV-ES support and are not applicable on IA32. >>>> >>>> =20 >>>> ;---------------------------------------------------------------------= ---------------- >>>> >>>> >>>> =C2=A0 global ASM_PFX(AsmRelocateApLoop) >>>> >>>> =C2=A0 ASM_PFX(AsmRelocateApLoop): >>>> >>>> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>> b/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>> index 267aa5201c50..02652eaae126 100644 >>>> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>> @@ -350,9 +350,9 @@ VOID >>>> =C2=A0=C2=A0=C2=A0 IN BOOLEAN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MwaitSupport, >>>> >>>> =C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ApTarget= CState, >>>> >>>> =C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PmCodeSe= gment, >>>> >>>> -=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Pm16CodeSegment, >>>> >>>> =C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 TopOfApS= tack, >>>> >>>> =C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 NumberTo= Finish, >>>> >>>> +=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Pm16CodeSegment, >>>> >>>> =C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SevEsAPJ= umpTable, >>>> >>>> =C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 WakeupBu= ffer >>>> >>>> =C2=A0=C2=A0=C2=A0 ); >>>> >>>> diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>> b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>> index 3b8ec477b8b3..5d30f35b201c 100644 >>>> --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>> +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>> @@ -491,13 +491,13 @@ PM16Mode: >>>> =C2=A0 SwitchToRealProcEnd: >>>> >>>> =20 >>>> =20 >>>> ;---------------------------------------------------------------------= ---------------- >>>> >>>> >>>> -;=C2=A0 AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegmen= t, >>>> Pm16CodeSegment, TopOfApStack, CountTofinish, SevEsAPJumpTable, >>>> WakeupBuffer); >>>> >>>> +;=C2=A0 AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegmen= t, >>>> TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, >>>> WakeupBuffer); >>>> >>>> =20 >>>> ;---------------------------------------------------------------------= ---------------- >>>> >>>> >>>> =C2=A0 global ASM_PFX(AsmRelocateApLoop) >>>> >>>> =C2=A0 ASM_PFX(AsmRelocateApLoop): >>>> >>>> =C2=A0 AsmRelocateApLoopStart: >>>> >>>> =C2=A0 BITS 64 >>>> >>>> -=C2=A0=C2=A0=C2=A0 cmp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qwor= d [rsp + 56], 0 >>>> >>>> +=C2=A0=C2=A0=C2=A0 cmp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qwor= d [rsp + 56], 0=C2=A0 ; SevEsAPJumpTable >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 je=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 NoSevEs >>>> >>>> =20 >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; >>>> >>>> @@ -539,16 +539,17 @@ BITS 64 >>>> =20 >>>> =C2=A0 NoSevEs: >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cli=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; Disable interrupt before >>>> switching to 32-bit mode >>>> >>>> -=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rax,= [rsp + 48]=C2=A0=C2=A0 ; CountTofinish >>>> >>>> +=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rax,= [rsp + 40]=C2=A0=C2=A0 ; CountTofinish >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 lock dec=C2=A0=C2=A0 dword [rax]=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; (*CountTofinish)-- >>>> >>>> =20 >>>> +=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r10,= [rsp + 48]=C2=A0=C2=A0 ; Pm16CodeSegment >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 rax, [rsp + 56]=C2=A0=C2=A0 ; SevEsAPJumpTable >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 rbx, [rsp + 64]=C2=A0=C2=A0 ; WakeupBuffer >>>> >>>> -=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rsp,= [rsp + 40]=C2=A0=C2=A0 ; TopOfApStack >>>> >>>> +=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rsp,= r9=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; TopOfApSt= ack >>>> >>>> =20 >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 push=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 rax=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ; Save SevEsAPJumpTable >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 push=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 rbx=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ; Save WakeupBuffer >>>> >>>> -=C2=A0=C2=A0=C2=A0 push=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r9=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ; Save Pm16CodeSegment >>>> >>>> +=C2=A0=C2=A0=C2=A0 push=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r10=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ; Save Pm16CodeSegment >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 push=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 rcx=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ; Save MwaitSupport >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 push=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 rdx=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ; Save ApTargetCState >>>> >>>> =20 >>>> >>>> >>>>> >>>>>> >>>>>> On 07/30/20 20:43, Tom Lendacky wrote: >>>>>>> From: Tom Lendacky >>>>>>> >>>>>>> BZ: >>>>>>> https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2= Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2198&data=3D02%7C01%7Ctho= mas.lendacky%40amd.com%7Cb7e0f534fe77439befe908d83640c55f%7C3dd8961fe4884e6= 08e11a82d994e183d%7C0%7C0%7C637318999104802062&sdata=3D32%2F36d1MHm4Jor= llRKyMz%2BmZaMfWceFsHK5PQA%2Fojqs%3D&reserved=3D0 >>>>>>> >>>>>>> >>>>>>> >>>>>>> Before UEFI transfers control to the OS, it must park the AP. This = is >>>>>>> done using the AsmRelocateApLoop function to transition into 32-bit >>>>>>> non-paging mode. For an SEV-ES guest, a few additional things must = be >>>>>>> done: >>>>>>> =C2=A0=C2=A0=C2=A0 - AsmRelocateApLoop must be updated to support = SEV-ES. This means >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 performing a VMGEXIT AP Reset Hold = instead of an MWAIT or HLT >>>>>>> loop. >>>>>>> =C2=A0=C2=A0=C2=A0 - Since the AP must transition to real mode, a = small routine is >>>>>>> copied >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to the WakeupBuffer area. Since the= WakeupBuffer will be used by >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 the AP during OS booting, it must b= e placed in reserved memory. >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Additionally, the AP stack must be = located where it can be >>>>>>> accessed >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 in real mode. >>>>>>> =C2=A0=C2=A0=C2=A0 - Once the AP is in real mode it will transfer = control to the >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 destination specified by the OS in = the SEV-ES AP Jump Table. The >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SEV-ES AP Jump Table address is sav= ed by the hypervisor for >>>>>>> the OS >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 using the GHCB VMGEXIT AP Jump Tabl= e exit code. >>>>>>> >>>>>>> Cc: Eric Dong >>>>>>> Cc: Ray Ni >>>>>>> Cc: Laszlo Ersek >>>>>>> Reviewed-by: Eric Dong >>>>>>> Signed-off-by: Tom Lendacky >>>>>>> --- >>>>>>> =C2=A0=C2=A0 UefiCpuPkg/Library/MpInitLib/MpLib.h=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 8 +- >>>>>>> =C2=A0=C2=A0 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 54 +++++++- >>>>>>> =C2=A0=C2=A0 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 131 >>>>>>> ++++++++++++++++-- >>>>>>> =C2=A0=C2=A0 3 files changed, 175 insertions(+), 18 deletions(-) >>>>>> >>>>>> Now that this series is almost ready to merge, I've done a bit of >>>>>> regression-testing. >>>>>> >>>>>> Unfortunately, this patch breaks booting with IA32 OVMF. >>>>>> >>>>>> More precisely, it breaks the IA32 version of DxeMpInitLib. >>>>> >>>>> Yeah, that's not good.=C2=A0 I will look into this based on your inpu= t below. >>>>> What's strange is that my system doesn't hang and successfully boots = all >>>>> APs (up to 64 is what I've tested with). >>>>> >>>>> But, yes, both call sites should be the same and I will make that >>>>> change. >>>>> >>>>>> >>>>>> The symptom is that just when the OS would be launched, the >>>>>> multiprocessor guest hangs. This is how the log terminates: >>>>>> >>>>>>> FSOpen: Open >>>>>>> '\370ac550dcaa48b88f1ca75ad903b0e7\4.16.7-100.fc26.i686\linux' >>>>>>> Success >>>>>>> [Security] 3rd party image[0] can be loaded after EndOfDxe: >>>>>>> PciRoot(0x0)/Pci(0x2,0x1)/Pci(0x0,0x0)/Scsi(0x0,0x0)/HD(1,GPT,D9F1F= BA5-E5D3-440A-B6A7-87B593E4FAB1,0x800,0x100000)/\370ac550dcaa48b88f1ca75ad9= 03b0e7\4.16.7-100.fc26.i686\linux. >>>>>>> >>>>>>> >>>>>>> InstallProtocolInterface: [EfiLoadedImageProtocol] 853A03A8 >>>>>>> Loading driver at 0x00083E72000 EntryPoint=3D0x00083E76680 >>>>>>> InstallProtocolInterface: [EfiLoadedImageDevicePathProtocol] 853A05= 10 >>>>>>> ProtectUefiImageCommon - 0x853A03A8 >>>>>>> =C2=A0=C2=A0=C2=A0 - 0x0000000083E72000 - 0x0000000000E75000 >>>>>>> FSOpen: Open >>>>>>> '370ac550dcaa48b88f1ca75ad903b0e7\4.16.7-100.fc26.i686\initrd' >>>>>>> Success >>>>>>> PixelBlueGreenRedReserved8BitPerColor >>>>>>> ConvertPages: range 400000 - 1274FFF covers multiple entries >>>>>>> SmmInstallProtocolInterface: [EdkiiSmmExitBootServicesProtocol] 0 >>>>>>> CpuDxe: 5-Level Paging =3D 0 >>>>>>> [HANG] >>>>>> >>>>>> Meanwhile some guest CPUs are pegged. >>>>>> >>>>>> Normally, when this series is not applied, the next log entry is (in >>>>>> place of [HANG]): >>>>>> >>>>>>> MpInitChangeApLoopCallback() done! >>>>>> >>>>>> I've identified this patch by bisection, after applying the series o= n >>>>>> current master (137c2c6eff67, "Revert "BaseTools/PatchCheck.py: Add >>>>>> LicenseCheck"", 2020-07-31). >>>>>> >>>>>> Here's the bisection log: >>>>>> >>>>>>> git bisect start >>>>>>> # good: [137c2c6eff67f4750d77e8e40af6683c412d3ed0] Revert >>>>>>> "BaseTools/PatchCheck.py: Add LicenseCheck" >>>>>>> git bisect good 137c2c6eff67f4750d77e8e40af6683c412d3ed0 >>>>>>> # bad: [d3f7971f4f70c9f39170b42af837e58e59435ad3] Maintainers.txt: = Add >>>>>>> reviewers for the OvmfPkg SEV-related files >>>>>>> git bisect bad d3f7971f4f70c9f39170b42af837e58e59435ad3 >>>>>>> # good: [9551e3fc61ba0c0ddf8e79b425a22aa7dd61cb8b] OvmfPkg/VmgExitL= ib: >>>>>>> Add support for RDTSCP NAE events >>>>>>> git bisect good 9551e3fc61ba0c0ddf8e79b425a22aa7dd61cb8b >>>>>>> # good: [10acf16b38522d8a1b538b3aa432daaa72c0e97b] OvmfPkg: Reserve= a >>>>>>> page in memory for the SEV-ES usage >>>>>>> git bisect good 10acf16b38522d8a1b538b3aa432daaa72c0e97b >>>>>>> # good: [ccb4267e76b6474657c41bef7e76a980930c22ea] UefiCpuPkg: Add = a >>>>>>> 16-bit protected mode code segment descriptor >>>>>>> git bisect good ccb4267e76b6474657c41bef7e76a980930c22ea >>>>>>> # good: [94e238ae37505cfb081f3b9b4632067e4a113cf9] OvmfPkg: Use the >>>>>>> SEV-ES work area for the SEV-ES AP reset vector >>>>>>> git bisect good 94e238ae37505cfb081f3b9b4632067e4a113cf9 >>>>>>> # bad: [16c21b9d10b032d66d4105dd4693fd9dc6e6ec18] >>>>>>> UefiCpuPkg/MpInitLib: >>>>>>> Prepare SEV-ES guest APs for OS use >>>>>>> git bisect bad 16c21b9d10b032d66d4105dd4693fd9dc6e6ec18 >>>>>>> # good: [49855596e383ab2aa6410fa060e22d4817d8e64e] OvmfPkg: Move th= e >>>>>>> GHCB allocations into reserved memory >>>>>>> git bisect good 49855596e383ab2aa6410fa060e22d4817d8e64e >>>>>>> # first bad commit: [16c21b9d10b032d66d4105dd4693fd9dc6e6ec18] >>>>>>> UefiCpuPkg/MpInitLib: Prepare SEV-ES guest APs for OS use >>>>>> >>>>>> So clearly we should be looking for an IA32-specific change, or >>>>>> IA32-specific *omission*, in this patch, that could cause the proble= m. >>>>>> >>>>>> The bug is the following: >>>>>> >>>>>> On 07/30/20 20:43, Tom Lendacky wrote: >>>>>>> >>>>>>> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>>>>> b/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>>>>> index b1a9d99cb3eb..267aa5201c50 100644 >>>>>>> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>>>>> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h >>>>>>> @@ -349,8 +350,11 @@ VOID >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 IN BOOLEAN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MwaitSup= port, >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ApTargetCState, >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= PmCodeSegment, >>>>>>> +=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Pm16CodeSegment, >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= TopOfApStack, >>>>>>> -=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 NumberToFinish >>>>>>> +=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 NumberToFinish, >>>>>>> +=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SevEsAPJumpTable, >>>>>>> +=C2=A0 IN UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 WakeupBuffer >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 ); >>>>>>> >>>>>>> =C2=A0=C2=A0 /** >>>>>> >>>>>> (1) This hunk modifies the parameter list of functions pointed-to by >>>>>> ASM_RELOCATE_AP_LOOP. >>>>>> >>>>>>> diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>>>>> b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>>>>> index 9115ff9e3e30..7165bcf3124a 100644 >>>>>>> --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>>>>> +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c >>>>>>> @@ -330,17 +350,26 @@ RelocateApLoop ( >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 BOOLEAN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MwaitSupport; >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 ASM_RELOCATE_AP_LOOP=C2=A0=C2=A0 AsmReloc= ateApLoopFunc; >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Processo= rNumber; >>>>>>> +=C2=A0 UINTN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 StackStart; >>>>>>> >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 MpInitLibWhoAmI (&ProcessorNumber); >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData=C2=A0=C2=A0=C2=A0 =3D GetCpuMpD= ata (); >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 MwaitSupport =3D IsMwaitSupport (); >>>>>>> +=C2=A0 if (CpuMpData->SevEsIsEnabled) { >>>>>>> +=C2=A0=C2=A0=C2=A0 StackStart =3D CpuMpData->SevEsAPResetStackStar= t; >>>>>>> +=C2=A0 } else { >>>>>>> +=C2=A0=C2=A0=C2=A0 StackStart =3D mReservedTopOfApStack; >>>>>>> +=C2=A0 } >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 AsmRelocateApLoopFunc =3D (ASM_RELOCATE_A= P_LOOP) (UINTN) >>>>>>> mReservedApLoopFunc; >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 AsmRelocateApLoopFunc ( >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MwaitSupport, >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData->ApTargetCState, >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CpuMpData->PmCodeSegment, >>>>>>> -=C2=A0=C2=A0=C2=A0 mReservedTopOfApStack - ProcessorNumber * AP_SA= FE_STACK_SIZE, >>>>>>> -=C2=A0=C2=A0=C2=A0 (UINTN) &mNumberToFinish >>>>>>> +=C2=A0=C2=A0=C2=A0 CpuMpData->Pm16CodeSegment, >>>>>>> +=C2=A0=C2=A0=C2=A0 StackStart - ProcessorNumber * AP_SAFE_STACK_SI= ZE, >>>>>>> +=C2=A0=C2=A0=C2=A0 (UINTN) &mNumberToFinish, >>>>>>> +=C2=A0=C2=A0=C2=A0 CpuMpData->SevEsAPBuffer, >>>>>>> +=C2=A0=C2=A0=C2=A0 CpuMpData->WakeupBuffer >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ); >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 // >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0 // It should never reach here >>>>>> >>>>>> (2) This hunk modifies the call site, in accordance with the prototy= pe >>>>>> change at (1). >>>>>> >>>>>>> diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>>>>> b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>>>>> index 6956b408d004..3b8ec477b8b3 100644 >>>>>>> --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>>>>> +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm >>>>>>> @@ -465,6 +465,10 @@ BITS 16 >>>>>> >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;=C2=A0=C2=A0=C2=A0=C2=A0 - I= P for Real Mode (two bytes) >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;=C2=A0=C2=A0=C2=A0=C2=A0 - C= S for Real Mode (two bytes) >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; >>>>>>> +=C2=A0=C2=A0=C2=A0 ; This label is also used with AsmRelocateApLoo= p. During MP >>>>>>> finalization, >>>>>>> +=C2=A0=C2=A0=C2=A0 ; the code from PM16Mode to SwitchToRealProcEnd= is copied to the >>>>>>> start of >>>>>>> +=C2=A0=C2=A0=C2=A0 ; the WakeupBuffer, allowing a parked AP to be = booted by an OS. >>>>>>> +=C2=A0=C2=A0=C2=A0 ; >>>>>>> =C2=A0=C2=A0 PM16Mode: >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mov=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 eax, cr0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; Read C= R0 >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 btr=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 eax, 0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ; Set PE=3D0 >>>>>>> @@ -487,32 +491,95 @@ PM16Mode: >>>>>>> =C2=A0=C2=A0 SwitchToRealProcEnd: >>>>>>> >>>>>>> =20 >>>>>>> ;------------------------------------------------------------------= ------------------- >>>>>>> >>>>>>> >>>>>>> -;=C2=A0 AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSeg= ment, >>>>>>> TopOfApStack, CountTofinish); >>>>>>> +;=C2=A0 AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSeg= ment, >>>>>>> Pm16CodeSegment, TopOfApStack, CountTofinish, SevEsAPJumpTable, >>>>>>> WakeupBuffer); >>>>>>> =20 >>>>>>> ;------------------------------------------------------------------= ------------------- >>>>>>> >>>>>>> >>>>>>> =C2=A0=C2=A0 global ASM_PFX(AsmRelocateApLoop) >>>>>>> =C2=A0=C2=A0 ASM_PFX(AsmRelocateApLoop): >>>>>>> =C2=A0=C2=A0 AsmRelocateApLoopStart: >>>>>>> =C2=A0=C2=A0 BITS 64 >>>>>> >>>>>> (3) Unfortunately, the patch only adapts the X64 implementation of t= he >>>>>> AsmRelocateApLoopStart() function to the new prototype; the IA32 >>>>>> implementation no longer matches the call site. >>>>>> >>>>>> (I'm not sure if the intent was for the IA32 version to simply ignor= e >>>>>> the new parameters, but even in that case, the "Pm16CodeSegment" >>>>>> parameter is inserted in the middle of the parameter list, likely >>>>>> offsetting the rest.) >>>>>> >>>>>> The problem is foreshadowed even by hunk (2). Namely, in hunk (2), t= he >>>>>> >>>>>> =C2=A0=C2=A0=C2=A0 s/mReservedTopOfApStack/StackStart/ >>>>>> >>>>>> replacement is *more difficult* to verify than necessary -- exactly >>>>>> because "CpuMpData->Pm16CodeSegment" is inserted *before* it. >>>>> >>>>> I can do one of two things here and just put the 3 new parameters at = the >>>>> end of the function call rather than keeping the code segment paramet= ers >>>>> together or update the IA32 call site. Let me see which looks best. B= ut >>>>> I'll likely update the IA32 call site no matter what with at least >>>>> comments about the parameters that aren't used, either way. >>>>> >>>>> Thanks, >>>>> Tom >>>>> >>>>>> >>>>>> Thanks >>>>>> Laszlo >>>>>> >>> >> >=20