On Sun, Apr 14, 2013 at 12:44:09PM +0200, Jan Kiszka wrote: > From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> > > As we may emulate the loading of EFER on VM-entry and VM-exit, implement > the checks that VMX performs on the guest and host values on vmlaunch/ > vmresume. Factor out kvm_valid_efer for this purpose which checks for > set reserved bits. > > Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> > --- > arch/x86/include/asm/kvm_host.h | 1 + > arch/x86/kvm/vmx.c | 38 ++++++++++++++++++++++++++++++++++++++ > arch/x86/kvm/x86.c | 29 +++++++++++++++++++---------- > 3 files changed, 58 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index b2c7263..28a458f 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -805,6 +805,7 @@ static inline int emulate_instruction(struct kvm_vcpu *vcpu, > } > > void kvm_enable_efer_bits(u64); > +bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer); > int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); > int kvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr); > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index cc2ba55..0d13b29 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -7257,6 +7257,44 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) > } > > /* > + * If the “load IA32_EFER” VM-entry control is 1, the following checks > + * are performed on the field for the IA32_EFER MSR: > + * - Bits reserved in the IA32_EFER MSR must be 0. > + * - Bit 10 (corresponding to IA32_EFER.LMA) must equal the value of > + * the IA-32e mode guest VM-exit control. It must also be identical > + * to bit 8 (LME) if bit 31 in the CR0 field (corresponding to > + * CR0.PG) is 1.1 ^^^ Typo? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html