[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <79f0ea64-6634-4b1c-7ac6-82f6798c680b@amd.com>
Date: Tue, 13 Feb 2018 22:42:00 -0600
From: Tom Lendacky <thomas.lendacky@....com>
To: Paolo Bonzini <pbonzini@...hat.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: Joerg Roedel <joro@...tes.org>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Radim Krčmář <rkrcmar@...hat.com>
Subject: Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting
MSR-based features
On 2/13/2018 10:25 AM, Paolo Bonzini wrote:
> On 08/02/2018 23:58, 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.
Thanks,
Tom
>
> Paolo
>
Powered by blists - more mailing lists