Re: [PATCH 07/12] KVM: x86: stubs for SMM support

From: Radim KrÄmÃÅ
Date: Thu May 21 2015 - 10:55:57 EST


2015-05-08 13:20+0200, Paolo Bonzini:
> This patch adds the interface between x86.c and the emulator: the
> SMBASE register, a new emulator flag, the RSM instruction. It also
> adds a new request bit that will be used by the KVM_SMI ioctl.
>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> --
> RFC->v1: make SMBASE host-readable only
> add support for latching an SMI
> do not reset SMBASE on INIT
> ---
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> @@ -367,6 +367,7 @@ struct kvm_vcpu_arch {
> int32_t apic_arb_prio;
> int mp_state;
> u64 ia32_misc_enable_msr;
> + u64 smbase;

smbase is u32 in hardware.

> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> @@ -2504,7 +2504,7 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
> vmx->nested.nested_vmx_misc_low &= VMX_MISC_SAVE_EFER_LMA;
> vmx->nested.nested_vmx_misc_low |=
> VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE |
> - VMX_MISC_ACTIVITY_HLT;
> + VMX_MISC_ACTIVITY_HLT | VMX_MISC_IA32_SMBASE_MSR;

No need to expose this feature when the MSR isn't readable.

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> @@ -2220,6 +2221,11 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> + case MSR_IA32_SMBASE:
> + if (!msr_info->host_initiated)
> + return 1;
> + vcpu->arch.smbase = data;
> + break;
> @@ -2615,6 +2621,11 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> + case MSR_IA32_SMBASE:
> + if (!msr_info->host_initiated)
> + return 1;
> + msr_info->data = vcpu->arch.smbase;
> + break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/