The first read will fill the nested page table, the second will find a reserved bit set. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- x86/svm.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/x86/svm.c b/x86/svm.c index cb4c736..1e6908a 100644 --- a/x86/svm.c +++ b/x86/svm.c @@ -802,20 +802,23 @@ static void npt_l1mmio_prepare(struct test *test) vmcb_ident(test->vmcb); } -u32 nested_apic_version; +u32 nested_apic_version1; +u32 nested_apic_version2; static void npt_l1mmio_test(struct test *test) { - u32 *data = (void*)(0xfee00030UL); + volatile u32 *data = (volatile void*)(0xfee00030UL); - nested_apic_version = *data; + nested_apic_version1 = *data; + nested_apic_version2 = *data; } static bool npt_l1mmio_check(struct test *test) { - u32 *data = (void*)(0xfee00030); + volatile u32 *data = (volatile void*)(0xfee00030); + u32 lvr = *data; - return (nested_apic_version == *data); + return nested_apic_version1 == lvr && nested_apic_version2 == lvr; } static void latency_prepare(struct test *test) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html