[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y35JLYD8uU2x7OpG@google.com>
Date: Wed, 23 Nov 2022 16:24:13 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: "Wang, Lei" <lei4.wang@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Andrew Jones <drjones@...hat.com>,
David Matlack <dmatlack@...gle.com>,
Ben Gardon <bgardon@...gle.com>,
Oliver Upton <oupton@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 036/144] KVM: selftest: Add proper helpers for
x86-specific save/restore ioctls
On Wed, Nov 23, 2022, Wang, Lei wrote:
>
> On 6/3/2022 8:41 AM, Sean Christopherson wrote:
> > Add helpers for the various one-off helpers used by x86's vCPU state
> > save/restore helpers, and convert the other open coded ioctl()s to use
> > existing helpers.
> >
> > Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> > ---
> > .../selftests/kvm/include/x86_64/processor.h | 54 ++++++++
> > .../selftests/kvm/lib/x86_64/processor.c | 126 +++++-------------
> > 2 files changed, 91 insertions(+), 89 deletions(-)
> >
> > diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> > index e4268432cfe8..1d46d60bb480 100644
> > --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> > +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> > @@ -432,6 +432,60 @@ const struct kvm_msr_list *kvm_get_feature_msr_index_list(void);
> > bool kvm_msr_is_in_save_restore_list(uint32_t msr_index);
> > uint64_t kvm_get_feature_msr(uint64_t msr_index);
> >
> > +static inline void vcpu_msrs_get(struct kvm_vm *vm, uint32_t vcpuid,
> > + struct kvm_msrs *msrs)
> > +{
> > + int r = __vcpu_ioctl(vm, vcpuid, KVM_GET_MSRS, msrs);
> > +
> > + TEST_ASSERT(r == msrs->nmsrs,
> > + "KVM_GET_MSRS failed, r: %i (failed on MSR %x)",
> > + r, r < 0 || r >= msrs->nmsrs ? -1 : msrs->entries[r].index);
> > +}
> > +static inline void vcpu_msrs_set(struct kvm_vm *vm, uint32_t vcpuid,
> > + struct kvm_msrs *msrs)
> > +{
> > + int r = __vcpu_ioctl(vm, vcpuid, KVM_SET_MSRS, msrs);
> > +
> > + TEST_ASSERT(r == msrs->nmsrs,
> > + "KVM_GET_MSRS failed, r: %i (failed on MSR %x)",
>
> Hi, Sean, this should be the "KVM_SET_MSRS failed", right?
Yep. I wish I could say I was cleverly justifying use of macro magic, but it was
just a copy+paste goof.
Powered by blists - more mailing lists