From: Peter Xu <peterx@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
peterx@redhat.com, Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: [PATCH 2/2] KVM: X86: Do the same ignore_msrs check for feature msrs
Date: Mon, 22 Jun 2020 18:04:42 -0400 [thread overview]
Message-ID: <20200622220442.21998-3-peterx@redhat.com> (raw)
In-Reply-To: <20200622220442.21998-1-peterx@redhat.com>
Logically the ignore_msrs and report_ignored_msrs should also apply to feature
MSRs. Add them in.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
arch/x86/kvm/svm/svm.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 2 +-
arch/x86/kvm/x86.c | 10 ++++++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index a862c768fd54..8fae61d71d6b 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -2346,7 +2346,7 @@ static int svm_get_msr_feature(struct kvm_msr_entry *msr)
msr->data |= MSR_F10H_DECFG_LFENCE_SERIALIZE;
break;
default:
- return 1;
+ return KVM_MSR_RET_INVALID;
}
return 0;
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 89c766fad889..42dbb3d0a2bd 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1772,7 +1772,7 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
return 1;
return vmx_get_vmx_msr(&vmcs_config.nested, msr->index, &msr->data);
default:
- return 1;
+ return KVM_MSR_RET_INVALID;
}
}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b49eaf8a2ce5..1af37794377e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1392,8 +1392,7 @@ static int kvm_get_msr_feature(struct kvm_msr_entry *msr)
rdmsrl_safe(msr->index, &msr->data);
break;
default:
- if (kvm_x86_ops.get_msr_feature(msr))
- return 1;
+ return kvm_x86_ops.get_msr_feature(msr);
}
return 0;
}
@@ -1405,6 +1404,13 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
msr.index = index;
r = kvm_get_msr_feature(&msr);
+
+ if (r == KVM_MSR_RET_INVALID) {
+ /* Unconditionally clear the output for simplicity */
+ *data = 0;
+ r = kvm_msr_ignored_check(vcpu, index, 0, false);
+ }
+
if (r)
return r;
--
2.26.2
prev parent reply other threads:[~2020-06-22 22:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 22:04 [PATCH 0/2] KVM: X86: A few fixes around ignore_msrs Peter Xu
2020-06-22 22:04 ` [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack Peter Xu
2020-06-25 6:15 ` Sean Christopherson
2020-06-25 8:09 ` Paolo Bonzini
2020-06-25 16:25 ` Sean Christopherson
2020-06-25 17:45 ` Sean Christopherson
2020-06-25 18:44 ` Paolo Bonzini
2020-06-26 15:56 ` Sean Christopherson
2020-06-26 17:37 ` Peter Xu
2020-06-26 17:46 ` Sean Christopherson
2020-06-26 18:07 ` Peter Xu
2020-06-26 18:18 ` Sean Christopherson
2020-06-26 19:11 ` Peter Xu
2020-06-27 14:24 ` Paolo Bonzini
2020-06-30 15:47 ` Sean Christopherson
2020-07-09 18:22 ` Peter Xu
2020-07-09 18:24 ` Paolo Bonzini
2020-07-09 18:34 ` Peter Xu
2020-07-09 19:24 ` Sean Christopherson
2020-07-09 21:09 ` Peter Xu
2020-07-09 21:26 ` Sean Christopherson
2020-07-09 21:50 ` Peter Xu
2020-07-09 22:11 ` Paolo Bonzini
2020-07-10 4:58 ` Sean Christopherson
2020-06-22 22:04 ` Peter Xu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200622220442.21998-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).