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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 18 Jun 2021 17:32:40 +0100
  • 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-SenderADCheck; bh=IUzAvpRI63xrXKeWz2La8gOULHzD47Sn7nma0MKN2lY=; b=oQOnpDNQHTuB/W2IueboM2XqARgZp6xR+gCa6OfHk0BhT7FanYCMMVxiR6ss49y4qlFYShp7UdD0aP3W9jtAUOfp6bTBx67gSEdeK177Hum/MgEXF0vef4703pGdhV7DpMY/l9/BD5qrBvEuDyXg5mCBbNUoHG1qGzR7a3ipjoUcYAm30byJl1IhEREmV56m55DPcg94Y9Q4Ahax8ojGXvmeuYzci81NBxsmaqUMJ/T00NpxI7xGz1ArZW2u0t34jtFRgaEhzCwxjpHTE7MaJobEiVgDlokysL3Yx2imZ9OY6VxDKJ24+B+vbUQWL9ImKfIZ3J+9N1PiISzAmUG+jQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HlOhcWqabsv5zjy3NnxHNg4KCvoFmRC42h5DvR/RzyX5/3Y3eqJi2pM6sA5zBc+eqlVQ963TxtPz7Mvbx3JZmbl02sayRCs1qcXePi0q+oRWZyXgPinJZWQFEYjvDe1X6/QfF/PYKvIJihVc+y6qnepYEqn1Nhl6rO4xZZNvXccU7I1Zg+n7KPYgImldoPr8aanWaKQPKObCHi+u1FGP6E0kixC41g4mubItrvXLL3KbMGK9A4qHwmsUUXPw7mbgPOW2JGECf/yPJI5L1TfM00TB46QoMIGzyq06As/LaLL+TR59nB93WrJ7hOSGoiTcWGrljRnT/fOQdnf6GVhnkA==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
  • Delivery-date: Fri, 18 Jun 2021 16:33:00 +0000
  • Ironport-hdrordr: A9a23:95bMk6BG45vN+S3lHehOsceALOsnbusQ8zAXPh9KJiC9I/b1qy nxppkmPH/P6Qr4WBkb6LW90dq7MAzhHPlOkPUs1NaZLXTbUQ6TQr2KgrGSuwEIdxeOkdK1kJ 0QCZSWa+eAfmSS7/yKmTVQeuxIqLLskNHK9JLjJjVWPGVXgslbnndE422gYytLrWd9dPgE/d anl7F6T23KQwVnUi33PAhLY8Hz4/nw0L72ax8PABAqrCGIkDOT8bb/VzyVxA0XXT9jyaortT GtqX252oyT99WAjjPM3W7a6Jpb3PPn19t4HcSJzuwYMC/lhAqEbJloH5eCoDc2iuey70tCqq iDnz4Qe+BIr1/BdGC8phXgnyP61iw11nPkwViExVP+vM3QXlsBeoh8rLMcViGcx1srvdl63q 4O9XmerYBrARTJmzm4z8TUVittilG/rRMZ4K0uZkRkIM8jgYJq3MsiFBs/KuZHIMu60vFmLA BWNrCY2B4MGmnqNkww1wJUsa6RtndaJGbNfqFNgL3M79D69EoJhnfw//Zv6UvowqhNAKWs19 60RpiAq4s+OPP+TZgNSdvpEvHHRlAkf3r3QSqvyAPcZd860jT22sXK3Ik=
  • Ironport-sdr: jRHSwYPqHe5dyAdq8r2iZRqfnKbD3kBCFPVwqNwxLjfM1UyqNnR3VGhZalkGFIibMVhDGYa3Jw auTDUMm21T5N0d97bvdOtHPzUgY5axwt65Y11QPxy8YeFbna67R/OrHly2h3MgUNcllPMbQUvA 1YzHsY5xMNnYWYdXUTACb7vIlXkxJlDadqMyeJBb4glKp6JF9V58Re1znqqQB3dS4a3rhXlzvN Ud6cAUnbLAE5DBjjmsN8A5FhUZbbtDPmK1yMBur94vAPeH5KnDqVMnLQbMNY7NLm8M+2lQ+dJ3 Zow=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18/06/2021 17:00, 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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Really, this ought to be reported by Igor.  He did all the hard work.

Also, I'd like to get something more formal out of AMD if possible.

> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -349,13 +349,17 @@ 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;
> +
> +             paddr_bits = (eax & 0xff) - ((ebx >> 6) & 0x3f);

While I can see the attraction of editing paddr_bits, I think it will
break the emulated pagewalk (at least).

With SME active, the address space reduction is only physical addresses
only, not guest physical.  An HVM guest still needs to see the original
paddr_bits, and the emulated pagewalk needs to use this for reserved bit
calculations.

i.e. under NPT, you can still have a working 2^48 guest physical address
space despite the host physical address space is limited to 2^43 by
encryption being active.

~Andrew




 


Rackspace

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