Otherwise, vmlaunch fails. Also, skip PAT tests altogether if save/load PAT is completely unsupported. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- x86/vmx_tests.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 2104fe9..184fafc 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -236,10 +236,19 @@ static int test_ctrl_pat_init() u64 ctrl_exi; msr_bmp_init(); + if (!(ctrl_exit_rev.clr & EXI_SAVE_PAT) && + !(ctrl_exit_rev.clr & EXI_LOAD_PAT) && + !(ctrl_enter_rev.clr & ENT_LOAD_PAT)) { + printf("\tSave/load PAT is not supported\n"); + return 1; + } + ctrl_ent = vmcs_read(ENT_CONTROLS); ctrl_exi = vmcs_read(EXI_CONTROLS); - vmcs_write(ENT_CONTROLS, ctrl_ent | ENT_LOAD_PAT); - vmcs_write(EXI_CONTROLS, ctrl_exi | (EXI_SAVE_PAT | EXI_LOAD_PAT)); + ctrl_ent |= ctrl_enter_rev.clr & ENT_LOAD_PAT; + ctrl_exi |= ctrl_exit_rev.clr & (EXI_SAVE_PAT | EXI_LOAD_PAT); + vmcs_write(ENT_CONTROLS, ctrl_ent); + vmcs_write(EXI_CONTROLS, ctrl_exi); ia32_pat = rdmsr(MSR_IA32_CR_PAT); vmcs_write(GUEST_PAT, 0x0); vmcs_write(HOST_PAT, ia32_pat); -- 1.8.3.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