From: Paolo Bonzini <pbonzini@redhat.com>
To: Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org
Cc: "Joerg Roedel" <joro@8bytes.org>,
"Borislav Petkov" <bp@alien8.de>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features
Date: Wed, 14 Feb 2018 17:41:06 +0100 [thread overview]
Message-ID: <8f76fafc-ce4a-8460-261e-93480e694609@redhat.com> (raw)
In-Reply-To: <79f0ea64-6634-4b1c-7ac6-82f6798c680b@amd.com>
On 14/02/2018 05:42, Tom Lendacky wrote:
>>> +bool kvm_valid_msr_feature(u32 msr, u64 data)
>>> +{
>>> + unsigned int i;
>>> +
>>> + for (i = 0; i < num_msr_based_features; i++) {
>>> + struct kvm_msr_based_features *m = msr_based_features + i;
>>> +
>>> + if (msr != m->msr)
>>> + continue;
>>> +
>>> + /* Make sure not trying to change unsupported bits */
>>> + return (data & ~m->mask) ? false : true;
>>> + }
>>> +
>>> + return false;
>>> +}
>>> +EXPORT_SYMBOL_GPL(kvm_valid_msr_feature);
>>> +
>>
>> This is probably unnecessary too (the allowed values are a bit more
>> complicated for, you just guessed it, VMX capability MSRs) and you can
>> just check bits other than LFENCE in svm_set_msr.
>
> The whole routine or just the bit checking? I can see still needing the
> check to be sure the "feature" is present.
You can return the MSR unconditionally from KVM_GET_MSR_INDEX_LIST.
Then KVM_GET_MSR would return 0 or 1 depending on whether the feature is
present.
Paolo
next prev parent reply other threads:[~2018-02-14 16:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 22:58 [RFC PATCH 0/2] KVM: " Tom Lendacky
2018-02-08 22:58 ` [RFC PATCH 1/2] KVM: x86: Add a framework for supporting " Tom Lendacky
2018-02-13 16:21 ` Paolo Bonzini
2018-02-14 4:23 ` Tom Lendacky
2018-02-13 16:25 ` Paolo Bonzini
2018-02-14 4:42 ` Tom Lendacky
2018-02-14 16:41 ` Paolo Bonzini [this message]
2018-02-14 16:44 ` Borislav Petkov
2018-02-14 16:58 ` Paolo Bonzini
2018-02-08 22:58 ` [RFC PATCH 2/2] KVM: SVM: Add MSR feature support for serializing LFENCE Tom Lendacky
2018-02-13 16:22 ` Paolo Bonzini
2018-02-14 4:39 ` Tom Lendacky
2018-02-14 10:08 ` Paolo Bonzini
2018-02-08 23:03 ` [RFC PATCH 0/2] KVM: MSR-based features Tom Lendacky
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=8f76fafc-ce4a-8460-261e-93480e694609@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®