Re: [PATCH v3] selftests: KVM: avoid failures due to reserved HyperTransport region

From: Sean Christopherson
Date: Thu Dec 09 2021 - 17:49:09 EST


On Thu, Dec 09, 2021, Paolo Bonzini wrote:
> AMD proceessors define an address range that is reserved by HyperTransport
> and causes a failure if used for guest physical addresses. Avoid
> selftests failures by reserving those guest physical addresses; the
> rules are:
>
> - On parts with <40 bits, its fully hidden from software.
>
> - Before Fam17h, it was always 12G just below 1T, even if there was more
> RAM above this location. In this case we just not use any RAM above 1T.
>
> - On Fam17h and later, it is variable based on SME, and is either just
> below 2^48 (no encryption) or 2^43 (encryption).
>
> Fixes: ef4c9f4f6546 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()")
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: David Matlack <dmatlack@xxxxxxxxxx>
> Reported-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Message-Id: <20210805105423.412878-1-pbonzini@xxxxxxxxxx>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>

Reviewed-and-tested-by: Sean Christopherson <seanjc@xxxxxxxxxx>

> + /*
> + * Otherwise it's at the top of the physical address
> + * space, possibly reduced due to SME by bits 11:6 of
> + * CPUID[0x8000001f].EBX. Use the old conservative
> + * value if MAXPHYADDR is not enumerated.

It'd be nice to run these out to 80 chars when you apply.