Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-14 Thread Paolo Bonzini
On 14/02/2018 17:44, Borislav Petkov wrote: > On Thu, Feb 08, 2018 at 04:58:46PM -0600, Tom Lendacky wrote: >> @@ -2681,11 +2731,15 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct >> kvm_msrs *msrs, >> { >> int i, idx; >> >> -idx = srcu_read_lock(>kvm->srcu); >> +if (vcpu) >>

Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-14 Thread Borislav Petkov
On Thu, Feb 08, 2018 at 04:58:46PM -0600, Tom Lendacky wrote: > @@ -2681,11 +2731,15 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct > kvm_msrs *msrs, > { > int i, idx; > > - idx = srcu_read_lock(>kvm->srcu); > + if (vcpu) > + idx = srcu_read_lock(>kvm->srcu); >

Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-14 Thread Paolo Bonzini
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 !=

Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-13 Thread Tom Lendacky
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 +

Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-13 Thread Tom Lendacky
On 2/13/2018 10:21 AM, Paolo Bonzini wrote: > On 08/02/2018 23:58, Tom Lendacky wrote: >> Provide a new KVM capability that allows bits within MSRs to be recognized >> as features. Two new ioctls are added to the VM ioctl routine to retrieve >> the list of these MSRs and their values. The MSR

Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-13 Thread Paolo Bonzini
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) > +

Re: [RFC PATCH 1/2] KVM: x86: Add a framework for supporting MSR-based features

2018-02-13 Thread Paolo Bonzini
On 08/02/2018 23:58, Tom Lendacky wrote: > Provide a new KVM capability that allows bits within MSRs to be recognized > as features. Two new ioctls are added to the VM ioctl routine to retrieve > the list of these MSRs and their values. The MSR features can optionally > be exposed based on a CPU