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 EEE5DAC1640 for ; Thu, 22 Feb 2024 15:44:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=JinlneWjNuCBNBuS4TOKwvRfPowTFZ86kzpf6k1qKX0=; 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=1708616673; v=1; b=hluH8UaFZD2cfikJxJ6rzOT302k9DMBwYNkRBv/RHz31sbmOknnMWsJVt8xT59h574B07MWF 6g1CZR1exOpaOylDCznIwInHT5O0rfhM26wby1Lo23hCGO942lmt0FAoWvQ6pKoDOA09dPl3XuG dB3x82iQluinICBrYWsEg+Hk= X-Received: by 127.0.0.2 with SMTP id us1xYY7687511xn6ga3rbzBT; Thu, 22 Feb 2024 07:44:33 -0800 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web11.15826.1708616672856369572 for ; Thu, 22 Feb 2024 07:44:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E2pPdTvbX2YxWkw8cP/raoopYUpeVpNbFw+19RRrcLd+HwvpNkfWrLgpwWAGiYMKYXcj/MHkKRcllAT9pwTCjAFgoLsjbbpAfJiuP1rGyvSZ6bYu6tMb9tlYxL9XAibykx0cPYU8tzrWLw0ZPCO5PJKr/souGk6+Ft7lXLfKQWgGvlaB5FWIpOtOhxHnT+dja/V9No1sQgO85Rdm78H4P0LzNd3ZgWwWPkoucqYLWEThST08jnzDuMu0KN9svtOj0S8xnPlsn+7M4XE2uwYLzRnvRj+yAbS+lG8S1qWk0jOMSxXfR9TnmpJz4ELrT7Mssy5+5G4Tql/GU2EOzdq9sg== 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=C4RBhikkHa39qPJh174UjZ6IW0EdxCtp5Y9GAR4+knU=; b=XyO0XXze88WN+07NrUMXwjCz2/jKdphin3vI7IVTuCRjxzzhRtLgyUwqjFFUls75Ef3Lzp/GYE3A5F3uGA86jtbAm3YaTtMa7uk7+1ONgCDyc/HTA1sBiApjpiHBA90HrRxrOLOvPT1dwST5iBNlaxztFZGgbuLOunPYCO9bJy6AAbTt42iX3q+v/9Q86aBGmaofrroCbuh1qSUmcT9UstxGprOi/Elc0u/krWcnXIHmXhaHC/srH5miSV44xBlSC9VasC0BzB1wg4wq5WJsNrLQoloE9S519ivVV0ph+4v0Ivl5c9ll366dStS08PodYDOF71iffF2+DkMb1YO2Tg== 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 MN2PR12MB4582.namprd12.prod.outlook.com (2603:10b6:208:26b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.26; Thu, 22 Feb 2024 15:44:30 +0000 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::db9b:a5f:5d0a:2a42]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::db9b:a5f:5d0a:2a42%4]) with mapi id 15.20.7316.018; Thu, 22 Feb 2024 15:44:30 +0000 Message-ID: Date: Thu, 22 Feb 2024 09:44:28 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] GuestPhysAddrSize questions To: Gerd Hoffmann , devel@edk2.groups.io, Paolo Bonzini CC: Michael Roth , Jiewen Yao , Liming Gao , Laszlo Ersek , Paolo Bonzini , Ard Biesheuvel , Min Xu , Erdem Aktas , Oliver Steffen , Ard Biesheuvel References: <20240222105407.75735-1-kraxel@redhat.com> <20240222105407.75735-4-kraxel@redhat.com> <32oty4asp3xrecjruatwm77fbevcaizswovjc5jqct5bdofwiq@sgff2gzgau7o> 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 NRAz6ShU77jkoYoI4hoGC7qZcwy84mmJqRygFnb8dOjHI1KxqQARAQ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DjJr NdQdtvYxECabwtPaShqnRIE7HhQPu8Xr9adirnDw1Wruafmyxnn5W3rhJy06etmP0pzL6frN y46PmDPicLjX/srgemvLtHoeVRplL9ATAkmQ7yxXc6wBSwf1BYs9gAiwXbU1vMod0AXXRBym 0qhojoaSdRP5XTShfvOYdDozraaKx5Wx8X+oZvvjbbHhHGPL2seq97fp3nZ9h8TIQXRhO+aY vFkWitqCJg== In-Reply-To: <32oty4asp3xrecjruatwm77fbevcaizswovjc5jqct5bdofwiq@sgff2gzgau7o> X-ClientProxiedBy: SA1P222CA0083.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:35e::21) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|MN2PR12MB4582:EE_ X-MS-Office365-Filtering-Correlation-Id: 040f12fb-f07c-4aa5-bedc-08dc33bd289d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Hkl+IRVbVkGBUwcnCO8Llu4ews2LA05UWjIUzO2dNZQq+yJ5ps1r0z/uTG1GnrC9RWpnPsqduqzCPzN3Bdece0UrWH6/1NNVS8/P7Nhg9ye0KC9+eMWOQXAnUHm3qJUZwYrHORnF2n1+3oH7tiISHM6bIwt1+p8Bk9oK/ZR3k1CDhVFbYMN3vrH2F3gRkTnXy3Q1hukOnytin7eFtZ5v1s6+yYQF6ZozAl/amnhwhMZGg7Z/sWJMlEx75cfANlFHOhFcdGZV6NvOFTVBlAltZDPUg0Ky6ycdfwN+HovSCJuzhNpyvM3+6Y0hljcatdKteA7NWdf0nVBwCQz+mV83Dapx3LCYc4NA5EexVJCr+aNXyPlA3jaTInnd12OLc9/yuI5n+IHUfIKAJvYnU1Cror1tkOZcsBjrOLbb1HAQuN+D565oC3qL1vNDwpf0AwCYnBxKs0EaEOut087DeV2uag0pWawug3ep+Pya2DdjaU3oNOK+QFCO2nRrG+H1YVdiB160O2n685+oGA49FI4snnrl6D36bRrAhppzPqpB5N0= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?iPOpT6oufODXXyev0VpugXFXOyL8MkRvsZDAKM9nJvsjbi0Hc2hg0WgMiaCX?= =?us-ascii?Q?b/M5x83844BXBkKLV1k01aAdooL4Vr51PcoUXdNJNIJ4HMncyq3TU8P8EigR?= =?us-ascii?Q?g1rLFSM4IOctRYrNEmlTjncwWENPoM/6WtdQ+1olJv8n8F0eAYCDk8TZPQea?= =?us-ascii?Q?DSRJRfg56jEIttjrlFJGvO5w2jBPnQZ47h6TFPIKTrIsi9MhCxzvVc0Q3MrE?= =?us-ascii?Q?ZLbrXnPn/Y1AiVa3DiQIP1J96trkt46MtkYi/ZirZjgWVxibuNfJM6OH9b5k?= =?us-ascii?Q?pccXc+oWIAs/q3K++RD5i4f5iqCrmhZxqyXJ05X+S1IL5z0OMPsziR/pE7D3?= =?us-ascii?Q?9yheL8a6o3qlva9yyNg8LRIDmAniD9N8uud77IqR4aPP6IFTDkCz9AEPKmLJ?= =?us-ascii?Q?o0sWTggWSUzq7eT8rNQRlzUEWV+YOQTLwq61mo+6D41g9hdqok+GZgIkpBVZ?= =?us-ascii?Q?w9oexhFJtOajDTsX5Dp7h5/yIAYo4wCXh4KmP1AUvdjhKLk4C9meOwL7aXW0?= =?us-ascii?Q?LDA57OB5nkVlL2ic3b11tlYYCELkNR3AlIPhr4cI1vy3WgH6O1EIgIYGh8wP?= =?us-ascii?Q?5ckpSgo99igU7A6xQdEi+i2AfSWsn3U9MMJDyl5F4nE7d8eMtV6BKu5wgs+F?= =?us-ascii?Q?xTeLG9jIB1LnI+Tx+lLuK/JRGhClmVTORMUwofGyQ4/623Ryvwr8uEX7GaEs?= =?us-ascii?Q?1YqCOPXKDs+TxYUQFwiQDB9blNaRNLI7eVeTdeilhr7GF1eS+eOmF4ofsN69?= =?us-ascii?Q?eHy5G/DREln6WLESvJNpCZoGbITzF4XkT+xm60dvVDhPXOB2Y5XtPyAPpgVY?= =?us-ascii?Q?OdtA31KWE9dyAmmpSkBPB/6oufK+aItvJQMFpXLDcvwdlMem2jKjTsERGQmO?= =?us-ascii?Q?o2J4egDHW/cbAe0RwQGtme4Ow+UvTu5Dl9czuHOSwxSa8VRu2POOpUJXRu4+?= =?us-ascii?Q?3isBBtP9gVzmLD2S4WAoIDV6AY4I8dVnrhBIgPi8umiHiGnUpQwudye4jK6h?= =?us-ascii?Q?1xEPUKpw+cv86Wo79vQO+KZdSDGFYaI3DtUDagPePUQXXvNGf9xCnVETFW8H?= =?us-ascii?Q?tRS3hjrbtD2JpBxgv+g7f3kM7gFpLKf93mrYT5fRd0WqqRg+NEYCrkcZIBEy?= =?us-ascii?Q?Ytv2WwcrTJUFWdBgBAWuOaoBonVh2UXIfsWnSp81ux3o7cVxPo06likQ9Rg7?= =?us-ascii?Q?t4p4ijvUo5bSsu9x8QEESUfoMANBWy3iMV8DgSt86qAti8YG9CPdXzbvw1zn?= =?us-ascii?Q?VazkWSnbnkpAdxjY1snKc3/iws44yWjMUgh5+hQulJKGIitC2HsmHN6Ef7iS?= =?us-ascii?Q?xmNNEzh/fZIxFIl40xjMhcRLR7HxDUOxG5790BOIhryHdkJO85RPpa2JjMs2?= =?us-ascii?Q?tjzz7jlnsmYmj0n1+9YFGp1SiO2Mnv+bMlpaLPSCdLBLSRDuXL0vTCcZhSue?= =?us-ascii?Q?RnQgnOZJRMbjf/o44b7IjRMCkE2SoOssHRwwUF6HeU7uyPaAi6TxDDqoNHyH?= =?us-ascii?Q?HdJJA65KpaeJmU1yOsEVvqPhXQyZmoLSJRx0FYl10qcOHYWPq2iY1k2iFmbT?= =?us-ascii?Q?iJGhwZDMOD4gKJT0TDZLljL3NZ2wSL014T/r/JVR?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 040f12fb-f07c-4aa5-bedc-08dc33bd289d X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2024 15:44:30.4371 (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: 20rCqiBDBbFHgx4XuFj2nG7Pz67iJ+nguNl8FULfQZbV9kB7rkPCZocoDfaggvqblGXcNVqM70Ng/lc3FV0GoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4582 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: XpiD1ld6IeLO3sbYNlGfO1rnx7686176AA= 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=hluH8UaF; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/22/24 05:24, Gerd Hoffmann wrote: > Hi, >=20 >> + if (Cr4.Bits.LA57) { >> + if (PhysBits > 48) { >> + /* >> + * Some Intel CPUs support 5-level paging, have more than 48 >> + * phys-bits but support only 4-level EPT, which effectively >> + * limits guest phys-bits to 48. >> + * >> + * AMD Processors have a different but somewhat related >> + * problem: They can handle guest phys-bits larger than 48 >> + * only in case the host runs in 5-level paging mode. >> + * >> + * Until we have some way to communicate that kind of >> + * limitations from hypervisor to guest, limit phys-bits >> + * to 48 unconditionally. >> + */ >=20 > So I'm looking for some communication path. One option would be to use > some bits in the KVM cpuid leaves. Another possible candidate is cpuid > leaf 0x80000008. >=20 > From the AMD APM (revision 3.35): >=20 > CPUID Fn8000_0008_EAX Long Mode Size Identifiers > ------------------------------------------------ >=20 > The value returned in EAX provides information about the maximum host > and guest physical and linear address width (in bits) supported by the > processor. >=20 > Bits FieldName Description >=20 > 31:24 =E2=80=94 Reserved >=20 > 23:16 GuestPhysAddrSize Maximum guest physical address size in bits. > This number applies only to guests using neste= d > paging. When this field is zero, refer to the > PhysAddrSize field for the maximum guest > physical address size. See =E2=80=9CSecure Vir= tual > Machine=E2=80=9D in APM Volume 2. >=20 > 15:8 LinAddrSize Maximum linear address size in bits. >=20 > 7:0 PhysAddrSize Maximum physical address size in bits. When > GuestPhysAddrSize is zero, this field also > indicates the maximum guest physical address > size. >=20 > The description of the GuestPhysAddrSize is somewhat vague. Is this a > value the hypervisor should use to figure how much address space it can > give to guests? Or is this a value the hypervisor can set to inform the > guest about the available address space (which would be a solution to > the problem outlined in the comment above)? Or both? I believe the main purpose of GuestPhysAddrSize was for software use (for= =20 nested virtualization) and that the hardware itself has always returned=20 zero for that value. So you should be able to use that field. Adding=20 @Paolo for his thoughts. Thanks, Tom >=20 > In case GuestPhysAddrSize should not be used this way: Is it possible > allocate the currently reserved bits 31:24 for that purpose? >=20 > Tom? Michael? >=20 > thanks & take care, > Gerd >=20 -=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 (#115824): https://edk2.groups.io/g/devel/message/115824 Mute This Topic: https://groups.io/mt/104510523/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-