Re: [PATCH v6 7/7] KVM: selftests: Add test for user space MSR handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static void handle_rdmsr(struct kvm_run *run)
> +{
> +       run->msr.data = run->msr.index;
> +       msr_reads++;
> +
> +       if (run->msr.index == MSR_SYSCALL_MASK ||
> +           run->msr.index == MSR_GS_BASE) {
> +               TEST_ASSERT(run->msr.reason != KVM_MSR_EXIT_REASON_FILTER,

TEST_ASSERT(run->msr.reason == KVM_MSR_EXIT_REASON_FILTER,

> +                           "MSR read trap w/o access fault");
> +       }
> +}
> +
> +static void handle_wrmsr(struct kvm_run *run)
> +{
> +       /* ignore */
> +       msr_writes++;
> +
> +       if (run->msr.index == MSR_IA32_POWER_CTL) {
> +               TEST_ASSERT(run->msr.data != 0x1234,

TEST_ASSERT(run->msr.data == 0x1234,

> +                           "MSR data for MSR_IA32_POWER_CTL incorrect");
> +               TEST_ASSERT(run->msr.reason != KVM_MSR_EXIT_REASON_FILTER,

TEST_ASSERT(run->msr.reason == KVM_MSR_EXIT_REASON_FILTER,

> +                           "MSR_IA32_POWER_CTL trap w/o access fault");
> +       }
> +}
> +
> +int main(int argc, char *argv[])
> +{
> +       struct kvm_enable_cap cap = {
> +               .cap = KVM_CAP_X86_USER_SPACE_MSR,
> +               .args[0] = 1,

.args[0] = KVM_MSR_EXIT_REASON_FILTER,

> +       };
> +       struct kvm_vm *vm;
> +       struct kvm_run *run;
> +       int rc;



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux