[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAAPnDGC8ED=aky=vjaQf6=pv9kKXHbB8m-uEsuzhxgSN0oZZw@mail.gmail.com>
Date: Thu, 3 Sep 2020 12:31:43 -0700
From: Aaron Lewis <aaronlewis@...gle.com>
To: Alexander Graf <graf@...zon.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Jonathan Corbet <corbet@....net>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
KarimAllah Raslan <karahmed@...zon.de>,
Dan Carpenter <dan.carpenter@...cle.com>,
kvm list <kvm@...r.kernel.org>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 7/7] KVM: selftests: Add test for user space MSR handling
> +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;
Powered by blists - more mailing lists