From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id A6C19D8065A for ; Thu, 1 Feb 2024 15:44:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=gJpTdl2+7eVIB3Etc8krUooOUQj2QEXi/5ndcP4POP0=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Message-ID:Date:User-Agent:Subject:To:Cc:References:From:Autocrypt:In-Reply-To:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706802297; v=1; b=s8HRLbbqzj3Xm1XxeHvwuC+ipUEn7FfxoouGnFKkOiIfRMcPCYc1BWxtiy9NDf68f6/mZuHU 7LP0nEBB0NkqMPKamMzMVr7E3vjZN+G/1L84iHb3MLlUXlU3GA156/jFBWl8o4hWfCMR9R9epHu aw5TuEUnmvDNloXgbAifPBoY= X-Received: by 127.0.0.2 with SMTP id 3MQmYY7687511xS6RQuEeWK6; Thu, 01 Feb 2024 07:44:57 -0800 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.48]) by mx.groups.io with SMTP id smtpd.web10.18723.1706802291270377028 for ; Thu, 01 Feb 2024 07:44:51 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j05Q8UGjieuFNEHpowkxM3Sqv8B/xxZdgXiCpkgD7Biul6sT6rjrzRuDYq/cv37TLML1d3l6m5pN9JA+tuUKd9nbIhabQYfRb0ZJ/xxlqJA3wqcrEqkmNME7GNGLX1kIQID2UAJnjg3fR526v4M5zp7xRA2tShxQWjMwHAWRx3dgJV76j9rTxHnzcyqmmvs5GL5j8flaOBhZKijQiuFxolSfwvmT3Th0zZE++QzWFWNDY7ImhbF1msijDg+QyxFEgZC+IPiQAzaG0dRY/saEsAp6yV9TPFVaFACEn8GfQ5g7+j9HXEtvFQoAp/BW1+Tspxqnp8btJ3RWYbnDcBNI+g== 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=QnOrH9l68ovrhC2B/hfKuM8eH9zd/iZ1xErr01RRoqg=; b=ip3AqCFlTxCGqCyoLe45vyfHSMzCy7vOSOFuCluhdJBFHr6fFxkNXmYqTjCUpiSQb2XvMUdoKPjpcpelbTTPYhbDHh2eLLtNgWZaOUA+T4nt4dRcFQJYazyMcm+towPyZxuzWUECQd9xPnGapJ/p7keD6otRYI371kY3GTyj4+jjPsKzjcArG9rpotg/bOBeyQS8GZTnk101pZGj3ql2NPY24QI+6OHwzfLXhkxK/MforiEKE+dEXGW18bXZBPJMztrMBd5wuGrL0MzXkHS/nJ956X2kQIfVnzVYQ7Tw7gW+uYgNPr8JQ1ESd5tzwFWpbQe4ap5ZJXObV2Kku2k2jQ== 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 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) by MN2PR12MB4519.namprd12.prod.outlook.com (2603:10b6:208:262::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.35; Thu, 1 Feb 2024 15:44:47 +0000 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::200:c1d0:b9aa:e16c]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::200:c1d0:b9aa:e16c%4]) with mapi id 15.20.7270.009; Thu, 1 Feb 2024 15:44:47 +0000 Message-ID: Date: Thu, 1 Feb 2024 09:44:45 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v2 4/5] OvmfPkg/ResetVector: add 5-level paging support To: Gerd Hoffmann , devel@edk2.groups.io Cc: Erdem Aktas , Oliver Steffen , Jiewen Yao , Ard Biesheuvel , Min Xu , Michael Roth , Liming Gao , Laszlo Ersek References: <20240130123204.764453-1-kraxel@redhat.com> <20240130123204.764453-5-kraxel@redhat.com> From: "Lendacky, Thomas via groups.io" Autocrypt: addr=thomas.lendacky@amd.com; keydata= xsFNBFaNZYkBEADxg5OW/ajpUG7zgnUQPsMqWPjeAxtu4YH3lCUjWWcbUgc2qDGAijsLTFv1 kEbaJdblwYs28z3chM7QkfCGMSM29JWR1fSwPH18WyAA84YtxfPD8bfb1Exwo0CRw1RLRScn 6aJhsZJFLKyVeaPO1eequEsFQurRhLyAfgaH9iazmOVZZmxsGiNRJkQv4YnM2rZYi+4vWnxN 1ebHf4S1puN0xzQsULhG3rUyV2uIsqBFtlxZ8/r9MwOJ2mvyTXHzHdJBViOalZAUo7VFt3Fb aNkR5OR65eTL0ViQiRgFfPDBgkFCSlaxZvc7qSOcrhol160bK87qn0SbYLfplwiXZY/b/+ez 0zBtIt+uhZJ38HnOLWdda/8kuLX3qhGL5aNz1AeqcE5TW4D8v9ndYeAXFhQI7kbOhr0ruUpA udREH98EmVJsADuq0RBcIEkojnme4wVDoFt1EG93YOnqMuif76YGEl3iv9tYcESEeLNruDN6 LDbE8blkR3151tdg8IkgREJ+dK+q0p9UsGfdd+H7pni6Jjcxz8mjKCx6wAuzvArA0Ciq+Scg hfIgoiYQegZjh2vF2lCUzWWatXJoy7IzeAB5LDl/E9vz72cVD8CwQZoEx4PCsHslVpW6A/6U NRAz6ShU77jkoYoI4hoGC7qZcwy84mmJqRygFnb8dOjHI1KxqQARAQABzSZUb20gTGVuZGFj a3kgPHRob21hcy5sZW5kYWNreUB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1Wruafmyxnn5W3rhJy06etmP0pzL6frN y46PmDPicLjX/srgemvLtHoeVRplL9ATAkmQ7yxXc6wBSwf1BYs9gAiwXbU1vMod0AXXRBym 0qhojoaSdRP5XTShfvOYdDozraaKx5Wx8X+oZvvjbbHhHGPL2seq97fp3nZ9h8TIQXRhO+aY vFkWitqCJg== In-Reply-To: <20240130123204.764453-5-kraxel@redhat.com> X-ClientProxiedBy: SA1PR03CA0022.namprd03.prod.outlook.com (2603:10b6:806:2d3::27) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|MN2PR12MB4519:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a6abfca-162a-4d8f-4cac-08dc233cb832 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 2WrvEqtknZnFn+GujQylOl55EaS2ucBWUSYdvO44L2pqovQ28j1Y6gK65R1YQPbzMFkox7Tg1AbMjspd0rs8+scffZw04MIjEGezmCtAPRAW2muhmLiX++O3tMpT5haftaRZC3bqYNr6na/wgUVYw/uea3FrTt0MeWTrqTf1kVdtkiCQUB48AFOAr/Jk7QIOst6T/wM5xrcopECTHc4ECv76ZBcFpM0QPKeTNgFsYnVP9VYq3RvMq0cF9rMMl27D2ZCdlF7AzrYPaK4D7OaQ5HaXuax/zo+8ohpECdZGaXxBrLhgKdwoi69aEAvlpX121su1eNZG+4Wu6J28syFOd2JexkyPuk/PQ5NeJKg2BuPxDXmSVmLKVBiG9xCujYshrp3wxRt+lbTdC59u6ZxrQJTC1zafkUuDtVNFLB47FnhD3gnlyjjyOWPUlslXYa/Y9z8sS+ZawtNt8EJNUeEjdHo9r+ZlNsHMEq+z6PTr2bLQP8h1ZR1B6xJcN9foi4QPL2EuwsoHZE06DqoRmoIgOFKA9xNjmR5+Zv5TRVy+CsjZAM5pSY1+uO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Sk1lTVQ1Sk0yZ0xWWldpZm1WM200QW9G?= =?utf-8?B?Zlh3TDd2aDVHR2ZKVjkrTWQ3cDEzMXdPczNmY0trT2hxdjBLdVlxRkRuTzVW?= =?utf-8?B?c2F6R0VGSWR4YWM5VHZTQ1krMlc1Y0RpZmJ1SElVaFcrMzdMamtJZGFobnF2?= =?utf-8?B?TUo2OHlOeFFoblpweEY4bzg0MDBGTmExZTlYSnp4aC9rWFpyVWttTlNjV0x1?= =?utf-8?B?dGFBK3Z0TGRadTFEbHNSdGxDcDgwOE1jZmZ0VnphcXorM1BIMlVpaTZNQU52?= =?utf-8?B?K2RqNkxYeEJRdWp4aUxNdmg2WkFkRGNlbjhtbC9zSnpsL1NVd0hUM0RvZnJ5?= =?utf-8?B?ZTVkZEFWS0J5aERZRTNPcDhkdXZoSVE0cVRNL2gvT2IzZlhGUWVqWHk5NllC?= =?utf-8?B?bitRSjdRT0xGdGFCK1M2TUp1WmpHNzlEcno5dWorOGsyb1dyMWQ2b1BRM0Zw?= =?utf-8?Q?xDa/6Pz1a4vVh+Mpo96KBJxH3?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a6abfca-162a-4d8f-4cac-08dc233cb832 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 15:44:47.6279 (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: pOaQZCD7zKyUpFlYwE7jZtVMk5Zwy3wpq3tzzb0m24MYQivc4MCVY4uB/+MyqZTTF57Nz9qdauIph55NM+ct5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4519 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Tknw2hHqbHR5rqg8DS0kYvlqx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=s8HRLbbq; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") On 1/30/24 06:32, Gerd Hoffmann wrote: > Compile the OVMF ResetVector with 5-level paging support in case > PcdUse5LevelPageTable is TRUE. >=20 > When enabled the ResetVector will check at runtime whenever support for > 5-level paging and gigabyte pages is available. In case both features > are supported it will run OVMF in 5-level paging mode, otherwise > fallback to 4-level paging. >=20 > Gigabyte pages are required to make sure we can fit the page tables into > the available space. We have six pages available, with gigabyte pages > we need three of them, with 2M pages we would need seven. >=20 > Signed-off-by: Gerd Hoffmann > --- > OvmfPkg/ResetVector/ResetVector.inf | 1 + > OvmfPkg/ResetVector/Ia32/PageTables64.asm | 77 +++++++++++++++++++++++ > OvmfPkg/ResetVector/ResetVector.nasmb | 1 + > 3 files changed, 79 insertions(+) >=20 > diff --git a/OvmfPkg/ResetVector/ResetVector.inf b/OvmfPkg/ResetVector/Re= setVector.inf > index a4154ca90c28..65f71b05a02e 100644 > --- a/OvmfPkg/ResetVector/ResetVector.inf > +++ b/OvmfPkg/ResetVector/ResetVector.inf > @@ -64,3 +64,4 @@ [FixedPcd] > gUefiOvmfPkgTokenSpaceGuid.PcdQemuHashTableSize > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize > + gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable > diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVec= tor/Ia32/PageTables64.asm > index 6fec6f2beeea..cf64c88b6cda 100644 > --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm > +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm > @@ -86,6 +86,82 @@ clearPageTablesMemoryLoop: > mov dword[ecx * 4 + PT_ADDR (0) - 4], eax > loop clearPageTablesMemoryLoop > =20 > +%if PG_5_LEVEL > + > + ; save GetSevCBitMaskAbove31 result (cpuid changes edx) > + mov edi, edx > + > + ; check for cpuid leaf 0x07 > + mov eax, 0x00 > + cpuid Because of these CPUID instructions, this won't work for SEV-ES / SEV-SNP.= =20 To use these we'll need to have a (special 32-bit) #VC handler in place.=20 Currently that is done in only in OvmfPkg/ResetVector/Ia32/AmdSev.asm for= =20 the CheckSevFeatures function, where the #VC handler is established at the= =20 beginning of the function, but it is removed when leaving the function. The SEV support in general needs looking into in order to support 5-level= =20 paging. At the time the SEV support was developed, there wasn't a page=20 table library and so there is some 4-level page table manipulation support= =20 in the BaseMemEncryptSevLib that really needs to be converted to use the=20 page table library. I don't have an objection to the series, as long as PcdUse5LevelPageTable= =20 is not set to TRUE by default for the Ovmf packages. Thanks, Tom > + cmp eax, 0x07 > + jb Paging4Lvl > + > + ; check for la57 (aka 5-level paging) > + mov eax, 0x07 > + mov ecx, 0x00 > + cpuid > + bt ecx, 16 > + jnc Paging4Lvl > + > + ; check for cpuid leaf 0x80000001 > + mov eax, 0x80000000 > + cpuid > + cmp eax, 0x80000001 > + jb Paging4Lvl > + > + ; check for 1g pages > + mov eax, 0x80000001 > + cpuid > + bt edx, 26 > + jnc Paging4Lvl > + > + ; > + ; Use 5-level paging with gigabyte pages. > + ; > + ; We have 6 pages available for the early page tables, > + ; due to the use of gigabyte pages we need three pages > + ; and everything fits in. > + ; > + debugShowPostCode 0x51 ; 5-level paging > + > + ; restore GetSevCBitMaskAbove31 result > + mov edx, edi > + > + ; level 5 > + mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDE_DIRECTORY_AT= TR > + mov dword[PT_ADDR (4)], edx > + > + ; level 4 > + mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDE_DIRECTO= RY_ATTR > + mov dword[PT_ADDR (0x1004)], edx > + > + ; level 3 (four 1GB pages for the lowest 4G) > + mov dword[PT_ADDR (0x2000)], (0 << 30) + PAGE_PDE_LARGEPAGE_ATTR > + mov dword[PT_ADDR (0x2004)], edx > + mov dword[PT_ADDR (0x2008)], (1 << 30) + PAGE_PDE_LARGEPAGE_ATTR > + mov dword[PT_ADDR (0x200c)], edx > + mov dword[PT_ADDR (0x2010)], (2 << 30) + PAGE_PDE_LARGEPAGE_ATTR > + mov dword[PT_ADDR (0x2014)], edx > + mov dword[PT_ADDR (0x2018)], (3 << 30) + PAGE_PDE_LARGEPAGE_ATTR > + mov dword[PT_ADDR (0x201c)], edx > + > + ; set la57 bit in cr4 > + mov eax, cr4 > + bts eax, 12 > + mov cr4, eax > + > + ; done > + jmp PageTablesReady > + > +Paging4Lvl: > + debugShowPostCode 0x41 ; 4-level paging > + > + ; restore GetSevCBitMaskAbove31 result > + mov edx, edi > + > +%endif ; PG_5_LEVEL > + > ; > ; Top level Page Directory Pointers (1 * 512GB entry) > ; > @@ -117,6 +193,7 @@ pageTableEntriesLoop: > mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx > loop pageTableEntriesLoop > =20 > +PageTablesReady: > ; Clear the C-bit from the GHCB page if the SEV-ES is enabled. > OneTimeCall SevClearPageEncMaskForGhcbPage > =20 > diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/= ResetVector.nasmb > index 5832aaa8abf7..16b3eee57671 100644 > --- a/OvmfPkg/ResetVector/ResetVector.nasmb > +++ b/OvmfPkg/ResetVector/ResetVector.nasmb > @@ -49,6 +49,7 @@ > =20 > %define WORK_AREA_GUEST_TYPE (FixedPcdGet32 (PcdOvmfWorkAreaBa= se)) > %define PT_ADDR(Offset) (FixedPcdGet32 (PcdOvmfSecPageTab= lesBase) + (Offset)) > +%define PG_5_LEVEL (FixedPcdGetBool (PcdUse5LevelPage= Table)) > =20 > %define GHCB_PT_ADDR (FixedPcdGet32 (PcdOvmfSecGhcbPag= eTableBase)) > %define GHCB_BASE (FixedPcdGet32 (PcdOvmfSecGhcbBas= e)) -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114949): https://edk2.groups.io/g/devel/message/114949 Mute This Topic: https://groups.io/mt/104052208/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-