On 23/11/19 02:40, Nadav Amit wrote: > > >> On Sep 25, 2019, at 9:14 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: >> >> Extend the tests to cover the host address size bit. >> >> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> >> --- >> x86/vmx_tests.c | 126 +++++++++++++++++++++++++++++++++----------------------- >> 1 file changed, 74 insertions(+), 52 deletions(-) > > I get the following results with this test on Skylake bare-metal: > > PASS: HOST_EFER EFER_LMA bit turned off, controls off: vmlaunch succeeds > PASS: HOST_EFER EFER_LMA bit turned on, controls off: vmlaunch succeeds > PASS: HOST_EFER EFER_LMA bit turned off, controls on: vmlaunch fails > PASS: HOST_EFER EFER_LMA bit turned off, controls on: VMX inst error is 8 (actual 8) > PASS: HOST_EFER EFER_LMA bit turned on, controls on: vmlaunch succeeds > PASS: HOST_EFER EFER_LME bit turned off, controls off: vmlaunch succeeds > PASS: HOST_EFER EFER_LME bit turned on, controls off: vmlaunch succeeds > PASS: HOST_EFER EFER_LME bit turned off, controls on: vmlaunch fails > PASS: HOST_EFER EFER_LME bit turned off, controls on: VMX inst error is 8 (actual 8) > PASS: HOST_EFER EFER_LME bit turned on, controls on: vmlaunch succeeds > PASS: HOST_EFER EFER_LMA bit turned off, controls off: vmlaunch fails > FAIL: HOST_EFER EFER_LMA bit turned off, controls off: VMX inst error is 8 (actual 7) > PASS: HOST_EFER EFER_LMA bit turned on, controls off: vmlaunch fails > FAIL: HOST_EFER EFER_LMA bit turned on, controls off: VMX inst error is 8 (actual 7) > PASS: HOST_EFER EFER_LMA bit turned off, controls on: vmlaunch fails > PASS: HOST_EFER EFER_LMA bit turned off, controls on: VMX inst error is 8 (actual 8) > PASS: HOST_EFER EFER_LMA bit turned on, controls on: vmlaunch succeeds > PASS: HOST_EFER EFER_LME bit turned off, controls off: vmlaunch fails > FAIL: HOST_EFER EFER_LME bit turned off, controls off: VMX inst error is 8 (actual 7) > PASS: HOST_EFER EFER_LME bit turned on, controls off: vmlaunch fails > FAIL: HOST_EFER EFER_LME bit turned on, controls off: VMX inst error is 8 (actual 7) > PASS: HOST_EFER EFER_LME bit turned off, controls on: vmlaunch fails > PASS: HOST_EFER EFER_LME bit turned off, controls on: VMX inst error is 8 (actual 8) > PASS: HOST_EFER EFER_LME bit turned on, controls on: vmlaunch succeeds > > Apparently, turning the controls off, causes some “VM entry with invalid > control field” (7) instead of “VM-entry with invalid host-state field”. > > According to the SDM, checks of control fields and host field are not ordered. > But I do not know what exactly causes the failure. The failure happens when checking the VM-exit host address size bit against EFER.LMA. 26.2.2 puts that check under "Checks on Host Control Registers and MSRs", so technically it would be wrong to return error 7 instead of 8. However we can relax the test, it's not a big deal. Paolo