Introduce the vmx_state_area_test_data struct for sharing test expectation data with the nested VM. Signed-off-by: Oliver Upton <oupton@xxxxxxxxxx> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> --- x86/vmx_tests.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 1d8932fad12b..95c1c01d2966 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -5023,13 +5023,28 @@ static void test_entry_msr_load(void) test_vmx_valid_controls(); } +static struct vmx_state_area_test_data { + u32 msr; + u64 exp; + bool enabled; +} vmx_state_area_test_data; + static void guest_state_test_main(void) { + u64 obs; + struct vmx_state_area_test_data *data = &vmx_state_area_test_data; + while (1) { - if (vmx_get_test_stage() != 2) - vmcall(); - else + if (vmx_get_test_stage() == 2) break; + + if (data->enabled) { + obs = rdmsr(data->msr); + report("Guest state is 0x%lx (expected 0x%lx)", + data->exp == obs, obs, data->exp); + } + + vmcall(); } asm volatile("fnop"); -- 2.24.0.rc1.363.gb1bccd3e3d-goog