From: Ackerley Tng <ackerleytng@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
Sean Christopherson <seanjc@google.com>,
David Matlack <dmatlack@google.com>,
Wei Wang <wei.w.wang@intel.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
Ackerley Tng <ackerleytng@google.com>
Subject: [PATCH 1/2] KVM: selftests: Fix initialization of GDT limit
Date: Sat, 14 Jan 2023 16:15:56 +0000 [thread overview]
Message-ID: <20230114161557.499685-2-ackerleytng@google.com> (raw)
In-Reply-To: <20230114161557.499685-1-ackerleytng@google.com>
Subtract 1 to initialize GDT limit according to spec.
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
---
tools/testing/selftests/kvm/lib/x86_64/processor.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index acfa1d01e7df..33ca7f5232a4 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -502,7 +502,12 @@ static void kvm_setup_gdt(struct kvm_vm *vm, struct kvm_dtable *dt)
vm->gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
dt->base = vm->gdt;
- dt->limit = getpagesize();
+
+ /*
+ * Intel SDM Volume 3, 3.5.1: "the GDT limit should always be one less
+ * than an integral multiple of eight"
+ */
+ dt->limit = getpagesize() - 1;
}
static void kvm_setup_tss_64bit(struct kvm_vm *vm, struct kvm_segment *segp,
--
2.39.0.314.g84b9a713c41-goog
next prev parent reply other threads:[~2023-01-14 16:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-14 16:15 [PATCH 0/2] Fix kvm_setup_gdt and reuse in vcpu_init_descriptor_tables Ackerley Tng
2023-01-14 16:15 ` Ackerley Tng [this message]
2023-01-18 18:03 ` [PATCH 1/2] KVM: selftests: Fix initialization of GDT limit Sean Christopherson
2023-01-18 19:02 ` Sean Christopherson
2023-01-14 16:15 ` [PATCH 2/2] KVM: selftests: Reuse kvm_setup_gdt in vcpu_init_descriptor_tables Ackerley Tng
2023-01-18 19:01 ` Sean Christopherson
2023-01-18 19:15 ` David Matlack
2023-01-18 19:36 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230114161557.499685-2-ackerleytng@google.com \
--to=ackerleytng@google.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=wei.w.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox