[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210805105423.412878-1-pbonzini@redhat.com>
Date: Thu, 5 Aug 2021 06:54:23 -0400
From: Paolo Bonzini <pbonzini@...hat.com>
To: linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: stable@...r.kernel.org, David Matlack <dmatlack@...gle.com>,
Maxim Levitsky <mlevitsk@...hat.com>
Subject: [PATCH] selftests: KVM: avoid failures due to reserved HyperTransport region
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)
--
2.27.0
Powered by blists - more mailing lists