All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCH kvm-unit-tests] vmx: do not XFAIL for virtual-APIC address beyond RAM
Date: Mon, 15 Apr 2019 15:10:16 +0200	[thread overview]
Message-ID: <1555333816-17181-1-git-send-email-pbonzini@redhat.com> (raw)

We will allow this behavior for KVM in some specific cases
(CR8 load/store exits enabled, virtualize APIC accesses
disabled).  Ensure these specific values of the controls
are there in the VMCS, and remove the XFAIL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/vmx_tests.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index ab7e8cc..0ca5363 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3669,9 +3669,17 @@ static void test_msr_bitmap(void)
  */
 static void test_apic_virt_addr(void)
 {
+	/*
+	 * Ensure the processor will never use the virtual-APIC page, since
+	 * we will point it to invalid RAM.  Otherwise KVM is puzzled about
+	 * what we're trying to achieve and fails vmentry.
+	 */
+	u32 cpu_ctrls0 = vmcs_read(CPU_EXEC_CTRL0);
+	vmcs_write(CPU_EXEC_CTRL0, cpu_ctrls0 | CPU_CR8_LOAD | CPU_CR8_STORE);
 	test_vmcs_addr_reference(CPU_TPR_SHADOW, APIC_VIRT_ADDR,
 				 "virtual-APIC address", "Use TPR shadow",
-				 PAGE_SIZE, true, true);
+				 PAGE_SIZE, false, true);
+	vmcs_write(CPU_EXEC_CTRL0, cpu_ctrls0);
 }
 
 /*
-- 
1.8.3.1


             reply	other threads:[~2019-04-15 13:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 13:10 Paolo Bonzini [this message]
2019-04-17  0:11 ` [PATCH kvm-unit-tests] vmx: do not XFAIL for virtual-APIC address beyond RAM Krish Sadhukhan
2019-04-17 12:00   ` Paolo Bonzini
2019-04-17 23:07     ` Krish Sadhukhan

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=1555333816-17181-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.