From: Jim Mattson <jmattson@google.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
kvm@vger.kernel.org
Cc: Jim Mattson <jmattson@google.com>
Subject: [kvm-unit-tests PATCH] x86: Test disabled local APIC
Date: Mon, 14 Nov 2016 10:14:03 -0800 [thread overview]
Message-ID: <1479147243-26864-1-git-send-email-jmattson@google.com> (raw)
In-Reply-To: <b3a9fb01-c990-87d2-65f6-0d4b1fac67dc@redhat.com>
This test disables and re-enables the local APIC and ensures that
CPUID.1H:EDX.APIC[bit 9] mirrors IA32_APIC_BASE[11].
Signed-off-by: Jim Mattson <jmattson@google.com>
---
x86/apic.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/x86/apic.c b/x86/apic.c
index eff9a11..39c7fd1 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -104,6 +104,28 @@ void test_enable_x2apic(void)
}
}
+static void test_apic_disable(void)
+{
+ u64 orig_apicbase = rdmsr(MSR_IA32_APICBASE);
+
+ report_prefix_push("apic_disable");
+
+ report("Local apic enabled", orig_apicbase & APIC_EN);
+ report("CPUID.1H:EDX.APIC[bit 9] is set", cpuid(1).d & (1 << 9));
+
+ wrmsr(MSR_IA32_APICBASE, orig_apicbase & ~(APIC_EN | APIC_EXTD));
+ report("Local apic disabled", !(rdmsr(MSR_IA32_APICBASE) & APIC_EN));
+ report("CPUID.1H:EDX.APIC[bit 9] is clear", !(cpuid(1).d & (1 << 9)));
+
+ wrmsr(MSR_IA32_APICBASE, orig_apicbase & ~APIC_EXTD);
+ wrmsr(MSR_IA32_APICBASE, orig_apicbase);
+ apic_write(APIC_SPIV, 0x1ff);
+ report("Local apic enabled", rdmsr(MSR_IA32_APICBASE) & APIC_EN);
+ report("CPUID.1H:EDX.APIC[bit 9] is set", cpuid(1).d & (1 << 9));
+
+ report_prefix_pop();
+}
+
#define ALTERNATE_APIC_BASE 0x42000000
static void test_apicbase(void)
@@ -398,6 +420,7 @@ int main()
mask_pic_interrupts();
test_apic_id();
+ test_apic_disable();
test_enable_x2apic();
test_apicbase();
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-11-14 18:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 22:00 [PATCH] kvm: nVMX: CPUID.01H:EDX.APIC[bit 9] should mirror IA32_APIC_BASE[11] Jim Mattson
2016-11-08 16:33 ` Radim Krčmář
2016-11-09 16:53 ` Jim Mattson
2016-11-09 17:04 ` [PATCH v2] " Jim Mattson
2016-11-09 17:14 ` Paolo Bonzini
2016-11-09 17:28 ` Jim Mattson
2016-11-09 17:37 ` Paolo Bonzini
2016-11-09 17:41 ` Jim Mattson
2016-11-09 17:43 ` Paolo Bonzini
[not found] ` <CALMp9eRek+NYZJYfT5TwCR+w=1hdS6e-O+Hm_RzF5MCykOHtWA@mail.gmail.com>
2016-11-10 17:18 ` Paolo Bonzini
2016-11-14 18:14 ` Jim Mattson [this message]
2016-11-22 13:55 ` [kvm-unit-tests PATCH] x86: Test disabled local APIC Radim Krčmář
2016-11-09 17:50 ` [PATCH v3] kvm: nVMX: CPUID.01H:EDX.APIC[bit 9] should mirror IA32_APIC_BASE[11] Jim Mattson
2016-11-22 13:53 ` Radim Krčmář
2016-11-09 17:15 ` [PATCH v2] " Igor Mammedov
2016-11-09 17:37 ` Eduardo Habkost
2016-11-09 17:42 ` Paolo Bonzini
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=1479147243-26864-1-git-send-email-jmattson@google.com \
--to=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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;
as well as URLs for NNTP newsgroup(s).