lkml.org 
[lkml]   [2018]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features
From
Date
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

\
 
 \ /
  Last update: 2018-02-14 17:42    [W:0.055 / U:34.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site