[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7d6cd80f767791b67505bce005c7e73d94edda0.camel@redhat.com>
Date: Thu, 05 Aug 2021 14:23:19 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: stable@...r.kernel.org, David Matlack <dmatlack@...gle.com>
Subject: Re: [PATCH] selftests: KVM: avoid failures due to reserved
HyperTransport region
On Thu, 2021-08-05 at 06:54 -0400, Paolo Bonzini wrote:
> Accessing guest physical addresses at 0xFFFD_0000_0000 and above causes
> a failure on AMD processors because those addresses are reserved by
> HyperTransport (this is not documented). Avoid selftests failures
> by reserving those guest physical addresses.
>
> Fixes: ef4c9f4f6546 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()")
> Cc: stable@...r.kernel.org
> Cc: David Matlack <dmatlack@...gle.com>
> Reported-by: Maxim Levitsky <mlevitsk@...hat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
> tools/testing/selftests/kvm/lib/kvm_util.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index 10a8ed691c66..d995cc9836ee 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -309,6 +309,12 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
> /* Limit physical addresses to PA-bits. */
> vm->max_gfn = ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
>
> +#ifdef __x86_64__
> + /* Avoid reserved HyperTransport region on AMD processors. */
> + if (vm->pa_bits == 48)
> + vm->max_gfn = 0xfffcfffff;
> +#endif
> +
> /* Allocate and setup memory for guest. */
> vm->vpages_mapped = sparsebit_alloc();
> if (phy_pages != 0)
I probably would have restricted this workaround to AMD vendor string,
but I don't mind this to be like that as well at least for now.
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists