[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] x86/AMD: make HT range dynamic for Fam17 and up


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 18 Oct 2021 11:41:16 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=/EZ7TR51H6tjasY3n2u1K6w9xsMVySw6o5E290iSYYA=; b=TLEqjaSpWyNOOaQCQrt731dzWHX8Qk+TGLKdIOe2gSRYnfSJQ0Jw4CYsr0zLZWDHhUIOOxBYETms+s80+1YEmCGz5RRHtrdSPf6YNtQhKQoUw0tvNo80mj53tdfSqoXCwPQBiojeDwLBGpo7Ixku6ohaHakM606/Y7tmmKkyVFNV8F9skkz1mZhSWm2lA0BuYW28JWt2daiLIwibG4drxeN0nkKgi58bE+zTqHwN5d2A4KNz9k5sUTNKAS9hysFahwy9elFQknxSvDTQNWtnYdIO93SrG1T1dNuqGei7eWVuh4Zw6cYV/Y4Dde3ZA3/IvWdLDXghM8amtmIBzrNBCA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AsLyKfc5uZHc2pcLt28c7G8iUufiyjhWYO17Din8xdRR6lIN9/vr0BV0hwdywL+5MSLVNnNuk4eIyc7+HGxwiH9dL69lQ2uf3GhMcenM7TiSYoQbcNNYK/BzA7m6kFBHnfSUzT6UHKnPvXG2pjB/Mwg1mn5hCv6oTeQCPiHrhpLIRhFC+I+ojHArMTzfdyCTvxxRzYGBPnHDTgM8H2XsxEIZ1P1EQKY39xnsEtrrZUiaaVtfSLw0fxBFFxq8fNflEtf8OhS3D0dJA60UFrLkbJlQFZKN8c2WA48bwAS/4tvqQt+SMpNRVxgl6SfKuJZWl+bsL9Q0gsWDU0OglkL2Yg==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 18 Oct 2021 09:41:55 +0000
  • Ironport-data: A9a23:0t+KSa/RpMPoEX/YGvraDrUDW3mTJUtcMsCJ2f8bNWPcYEJGY0x3m jMZXmrSafiIMTPyL4txb4mw90JUvseBndc1SgplqXw8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhGGeIdA970Ug6wrZg0tYx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhvx oxM9oWRVDwqM5DOiv4TAyJ5Ln5HaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcFgWdp2JEUTZ4yY eIGRRFQYU6afyRRN3snIYBkw/WG2CHwJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tlaVo CfK8nr0BjkeNceD0nyV/3S0nOjNkCjnHoUIG9WQ9PRnnVmSzWw7EwANWB2wpvzRt6Klc4sBc QpOoHNo9PVsshzwJjXgY/GmiGCK5x9fQvtNKO431QOf0KSE2CekWVFRG1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KadZ/DDvysnB7o2yvhQdL3AYV0gj1XYDNu/yKDwGeOAsP+tBKH Pz3Lshm9L2Ek5nEPhTS0N1E9TrlpnurtbLcBQGDxko5E2nii6p0qfzF1y90g0FWz1C7L8++S yd+jaJqJmLgrWe8FvxxmXT55NZlJ/IzcZCPtWFjowwJi/3ggilSYx9U/mpvSwzosuo9FE2+e O87CsIDoBW0Tf8b2u1qRzi103J1ysv0WbrzRuijX7qsaXCNXkHIvsEobgcXgrS6kImst05+r lMxXilu51eCg6FtDjh5vDTPisa1XackD4Hq6o+nnZfWYwRZPt6tooE5n5YF58GAWbT9J0nKu 9zF8vRjcwmMW9yV0qp+1WH/ebcGkjaRny9Mw8/U42uonlrdUlCvgklLJd1pAZHyHo/I6M0r9 gsfJ4YzY2n46ctHNVA7dw6ML6K41r2MFvx2VKpUCba/Z48SgbwQr7Mkf8IDbKRCdE1JKVbou W2bLofjx9rR37T
  • Ironport-sdr: kHVfKkEb1ZUi+73+VjPLVcCHXGTsasS4CdjncJfOaHjniNyH7wVM1ar7kN2fb8+FVclzQUoRug nuS1TaZcgg3xW0dW2dL/b/1SUoposGwXgi8lZyu/kU1+9x6PKiahGe/UzhuK26eMVUNEIJJjMX 8HN4S6SwXXqBSTsJRHwjAMgQE9s8WIWlcHXcyxhdtLY4IiDOmH6ayEn5NLY/p6mNNgGYKWKfHY 71tP5bkH4N6WikmsFdqf6lE2S2c4XH4STWXC6x3yo6NClutA3pe86kTNtJRhjW8Qh/zuUmDnJd fb9jIuegPqk2q1E/oBbAov6K
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jun 28, 2021 at 01:48:53PM +0200, Jan Beulich wrote:
> At the time of d838ac2539cf ("x86: don't allow Dom0 access to the HT
> address range") documentation correctly stated that the range was
> completely fixed. For Fam17 and newer, it lives at the top of physical
> address space, though.
> 
> To correctly determine the top of physical address space, we need to
> account for their physical address reduction, hence the calculation of
> paddr_bits also gets adjusted.
> 
> While for paddr_bits < 40 the HT range is completely hidden, there's no
> need to suppress the range insertion in that case: It'll just have no
> real meaning.
> 
> Reported-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
> v2: Move adjustment last, to leave hap_paddr_bits unaffected. Add
>     comment.
> 
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -349,16 +349,23 @@ void __init early_cpu_init(void)
>  
>       eax = cpuid_eax(0x80000000);
>       if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
> +             ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
>               eax = cpuid_eax(0x80000008);
> +
>               paddr_bits = eax & 0xff;
>               if (paddr_bits > PADDR_BITS)
>                       paddr_bits = PADDR_BITS;
> +
>               vaddr_bits = (eax >> 8) & 0xff;
>               if (vaddr_bits > VADDR_BITS)
>                       vaddr_bits = VADDR_BITS;
> +
>               hap_paddr_bits = ((eax >> 16) & 0xff) ?: paddr_bits;
>               if (hap_paddr_bits > PADDR_BITS)
>                       hap_paddr_bits = PADDR_BITS;
> +
> +             /* Account for SME's physical address space reduction. */
> +             paddr_bits -= (ebx >> 6) & 0x3f;

Does it make sense to check for 0x8000001f[eax] bit 0 in order to
assert that there's support for SME, or assuming that the reduction is
!= 0 in the other cpuid leaf is enough.

It's possible for firmware vendors to disable advertising the SME
support bit and leave the physical address space reduction one in
place?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.