From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8rU3-0002JL-9z for qemu-devel@nongnu.org; Fri, 03 Jun 2016 11:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8rU0-00025V-3t for qemu-devel@nongnu.org; Fri, 03 Jun 2016 11:58:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8rTz-00023N-UW for qemu-devel@nongnu.org; Fri, 03 Jun 2016 11:58:00 -0400 Date: Fri, 3 Jun 2016 17:57:53 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20160603155753.GA15222@potion> References: <20160603060944.17373-1-haozhong.zhang@intel.com> <20160603060944.17373-2-haozhong.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160603060944.17373-2-haozhong.zhang@intel.com> Subject: Re: [Qemu-devel] [PATCH v3 1/2] target-i386: KVM: add basic Intel LMCE support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Haozhong Zhang Cc: qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcelo Tosatti , "Michael S . Tsirkin" , kvm@vger.kernel.org, Boris Petkov , Tony Luck , Andi Kleen , Ashok Raj 2016-06-03 14:09+0800, Haozhong Zhang: > This patch adds the support to inject SRAR and SRAO as LMCE, i.e. they > will be injected to only one VCPU rather than broadcast to all > VCPUs. As KVM reports LMCE support on Intel platforms, this features is > only available on Intel platforms. > > Signed-off-by: Ashok Raj > Signed-off-by: Haozhong Zhang > --- > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > @@ -2786,6 +2798,20 @@ static void mce_init(X86CPU *cpu) > && (cenv->features[FEAT_1_EDX] & (CPUID_MCE | CPUID_MCA)) == > (CPUID_MCE | CPUID_MCA)) { > cenv->mcg_cap = MCE_CAP_DEF | MCE_BANKS_DEF; > + > + if (cpu->enable_lmce) { > + if (lmce_supported()) { > + cenv->mcg_cap |= MCG_LMCE_P; > + cenv->msr_ia32_feature_control |= > + MSR_IA32_FEATURE_CONTROL_LMCE | > + MSR_IA32_FEATURE_CONTROL_LOCKED; Locking right from the start breaks nested KVM, because nested relies on setting VMXON feature from inside of the guest. Do we keep it unlocked, or move everything into QEMU? (The latter seems simpler.) > + } else { > + error_report("Warning: KVM unavailable or not support LMCE, " > + "LMCE disabled"); > + cpu->enable_lmce = false; > + } > + } > + > cenv->mcg_ctl = ~(uint64_t)0; > for (bank = 0; bank < MCE_BANKS_DEF; bank++) { > cenv->mce_banks[bank * 4] = ~(uint64_t)0;