OSDN Git Service

KVM: x86: ensure all MSRs can always be KVM_GET/SET_MSR'd
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 26 Jul 2018 11:01:52 +0000 (13:01 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Aug 2018 15:32:01 +0000 (17:32 +0200)
commit44883f01fe6ae436a8604c47d8435276fef369b0
treed2339b15742e5f66afb5ea7bf1e825710ac175dd
parentcf81a7e580ac0d598d3e7e9c06864168b2b4073d
KVM: x86: ensure all MSRs can always be KVM_GET/SET_MSR'd

Some of the MSRs returned by GET_MSR_INDEX_LIST currently cannot be sent back
to KVM_GET_MSR and/or KVM_SET_MSR; either they can never be sent back, or you
they are only accepted under special conditions.  This makes the API a pain to
use.

To avoid this pain, this patch makes it so that the result of the get-list
ioctl can always be used for host-initiated get and set.  Since we don't have
a separate way to check for read-only MSRs, this means some Hyper-V MSRs are
ignored when written.  Arguably they should not even be in the result of
GET_MSR_INDEX_LIST, but I am leaving there in case userspace is using the
outcome of GET_MSR_INDEX_LIST to derive the support for the corresponding
Hyper-V feature.

Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/hyperv.c
arch/x86/kvm/hyperv.h
arch/x86/kvm/x86.c