Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752026AbbEDRvM (ORCPT ); Mon, 4 May 2015 13:51:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41348 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbbEDRvI (ORCPT ); Mon, 4 May 2015 13:51:08 -0400 Date: Mon, 4 May 2015 19:51:02 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, bsd@redhat.com, guangrong.xiao@linux.intel.com, Yang Zhang , wanpeng.li@linux.intel.com Subject: Re: [PATCH 08/13] KVM: x86: stubs for SMM support Message-ID: <20150504175102.GC11234@potion.brq.redhat.com> References: <1430393772-27208-1-git-send-email-pbonzini@redhat.com> <1430393772-27208-9-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1430393772-27208-9-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2387 Lines: 61 2015-04-30 13:36+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 > --- > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > @@ -2505,7 +2505,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; > vmx->nested.nested_vmx_misc_high = 0; > } > > bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer) > @@ -2217,6 +2218,11 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > case MSR_IA32_MISC_ENABLE: > vcpu->arch.ia32_misc_enable_msr = data; > break; > + case MSR_IA32_SMBASE: > + if (!msr_info->host_initiated) > + return 1; > + vcpu->arch.smbase = data; > + break; > case MSR_KVM_WALL_CLOCK_NEW: > case MSR_KVM_WALL_CLOCK: > vcpu->kvm->arch.wall_clock = data; > @@ -2612,6 +2618,11 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > case MSR_IA32_MISC_ENABLE: > msr_info->data = vcpu->arch.ia32_misc_enable_msr; > break; > + case MSR_IA32_SMBASE: > + if (!msr_info->host_initiated && !is_smm(vcpu)) > + return 1; > + msr_info->data = vcpu->arch.smbase; > + break; (I'm not sure if this is supported if IA32_VMX_BASIC[49] = 0. 34.15.6.4 Saving Guest State The SMM-transfer monitor (STM) can also discover the current value of the SMBASE register by using the RDMSR but it's not possible to get into STM without having a support for it noted in IA32_VMX_BASIC[49] and more magic we also don't emulate to actually enable it.) > @@ -7208,6 +7240,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu) > vcpu->arch.regs_avail = ~0; > vcpu->arch.regs_dirty = ~0; > > + vcpu->arch.smbase = 0x30000; It's not reset on INIT, only on RESET. (34.11 SMBASE RELOCATION) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/