On Wed, Aug 28, 2019 at 4:41 PM Oliver Upton <oupton@xxxxxxxxxx> wrote: > > Tests to verify that KVM performs the correct checks on Host/Guest state > at VM-entry, as described in SDM 26.3.1.1 "Checks on Guest Control > Registers, Debug Registers, and MSRs" and SDM 26.2.2 "Checks on Host > Control Registers and MSRs". > > Test that KVM does the following: > > If the "load IA32_PERF_GLOBAL_CTRL" VM-entry control is 1, the > reserved bits of the IA32_PERF_GLOBAL_CTRL MSR must be 0 in the > GUEST_IA32_PERF_GLOBAL_CTRL VMCS field. Otherwise, the VM-entry > should fail with an exit reason of "VM-entry failure due to invalid > guest state" (33). > > If the "load IA32_PERF_GLOBAL_CTRL" VM-exit control is 1, the > reserved bits of the IA32_PERF_GLOBAL_CTRL MSR must be 0 in the > HOST_IA32_PERF_GLOBAL_CTRL VMCS field. Otherwise, the VM-entry > should fail with a VM-instruction error of "VM entry with invalid > host-state field(s)" (8). Could you add a simple functionality test as well? That is, after a successful nested VM-entry, the L2 guest should be able to observe the GUEST_IA32_PERF_GLOBAL_CTRL value when it reads the IA32_PERF_GLOBAL_CTRL MSR, and after a subsequent nested VM-exit, the L1 guest should be able to observe the HOST_IA32_PERF_GLOBAL_CTRL value when it reads the IA32_PERF_GLOBAL_CTRL MSR.