On Tue, Aug 11, 2020 at 3:26 PM Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> wrote: > > According to section "Canonicalization and Consistency Checks" in APM vol. 2 > the following guest state combinations are illegal: > > * EFER.LME and CR0.PG are both set and CR4.PAE is zero. > * EFER.LME and CR0.PG are both non-zero and CR0.PE is zero. > * EFER.LME, CR0.PG, CR4.PAE, CS.L, and CS.D are all non-zero > > Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> As Nadav will point out, these tests should run on bare metal. Also, the repo is 'kvm-unit-tests', so maybe a better summary line is: SVM: Test illegal combinations of EFER.LME, CR0.PG, CR0.PE, and CR4.PAE in VMCB > @@ -1962,7 +1962,52 @@ static void test_efer(void) > SVM_TEST_REG_RESERVED_BITS(16, 63, 4, "EFER", vmcb->save.efer, > efer_saved, SVM_EFER_RESERVED_MASK); > > + /* > + * EFER.LME and CR0.PG are both set and CR4.PAE is zero. > + */ > + u64 cr0_saved = vmcb->save.cr0; > + u64 cr0; > + u64 cr4_saved = vmcb->save.cr4; > + u64 cr4; > + > + efer = efer_saved | EFER_LME; > + vmcb->save.efer = efer; > + cr0 = cr0_saved | X86_CR0_PG; > + cr0 = cr0 | X86_CR0_PE; Nit: Combine the two lines above. Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>