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

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


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 18 Oct 2021 10:13:41 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=xlvw/4hZx1tozqsc0YYpIF3EOF4lf9Rp0LuzwCZv2yQ=; b=RgDuqemzdys00wglV9NxqVCE7Fzci9yzMP1rm3/nMAR+mp+ku/xXK74etopq9mIu/RdQh5LSDuGM66wQJRycUbuIq3VZB89sTYChKqGzHbSFFEXWD8DTvb6AYuIj+WDP0knFqIw5P8ZDmJxoEnO4ItdvKxajdqc0O4ZLZiFwLGQJvGkbqm3ziQD/9eaHT9S4w/ycVNOsMwr1SMPi0ftwdzWpkY+ZZQVyz6jfJHKml4kx5qI+PmUR1ubAVEsyDT7QAhD8ERhomiZ260YB85jVDTGq17Cgay7wxINZBc7bn3jRYSCCD+TGQ445lSjCvBGsPUJHqpRwPIEBTIlV8/Bf3g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jRgIJ3bZz7KoCuGNicHZDKu+ihhn5/fFOosfN58T7Q69wnCJApAUWjw9rzcyYQsE2koUIbLZwX6isC2UUAp3Y1bMMvukbEbRLcCsatZLk50JbXM52D733UlySgGFW1Wtpz4RqOXiNHVWmJGdIl1IiTui0nzy8EUv2pSueFcaB0Wny/ShY0j3KqWQMjazhc4pTY70poAFuNoW6MOOuBau/lffxboj/U1ZHRVgE6/fOBFZg+wunyFDQvYRT4CaGP5MCPpc0nmsdeb7FrPsPIDPtuTGWpn5WRx6U4tOyUGLl39a9sITdGevQX+5KtHZ5qAVHvdoRQ6yKNA9hb4fNwbZIw==
  • Authentication-results: xenproject.org; dkim=none (message not signed) header.d=none;xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 18 Oct 2021 08:13:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.06.2021 13:48, 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>
> ---
> v2: Move adjustment last, to leave hap_paddr_bits unaffected. Add
>     comment.

If there are any further adjustments needed here (or if the whole
situation needs to be addressed differently altogether), could
respective requests please be voiced? Or else may I please ask for
an ack?

Jan

> --- 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;
>       }
>  
>       if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
> --- a/xen/arch/x86/dom0_build.c
> +++ b/xen/arch/x86/dom0_build.c
> @@ -524,8 +524,11 @@ int __init dom0_setup_permissions(struct
>                                           MSI_ADDR_DEST_ID_MASK));
>      /* HyperTransport range. */
>      if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
> -        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
> -                                paddr_to_pfn((1ULL << 40) - 1));
> +    {
> +        mfn = paddr_to_pfn(1UL <<
> +                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
> +        rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
> +    }
>  
>      /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
>      for ( i = 0; i < e820.nr_map; i++ )
> 
> 




 


Rackspace

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