From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDTwj-0007G3-6O for qemu-devel@nongnu.org; Thu, 16 Jun 2016 05:50:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDTwh-0000b8-E9 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 05:50:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDTwh-0000b3-8I for qemu-devel@nongnu.org; Thu, 16 Jun 2016 05:50:43 -0400 References: <20160616060621.30422-1-haozhong.zhang@intel.com> <20160616060621.30422-2-haozhong.zhang@intel.com> From: Paolo Bonzini Message-ID: <91a4203b-ceaa-3a0f-2a36-b7ae5b96fc42@redhat.com> Date: Thu, 16 Jun 2016 11:50:36 +0200 MIME-Version: 1.0 In-Reply-To: <20160616060621.30422-2-haozhong.zhang@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 1/3] target-i386: KVM: add basic Intel LMCE support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Haozhong Zhang , qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcelo Tosatti , kvm@vger.kernel.org, Boris Petkov , Tony Luck , Andi Kleen , rkrcmar@redhat.com, Ashok Raj On 16/06/2016 08:06, Haozhong Zhang wrote: > + if (!lmce_supported()) { > + error_setg(&local_err, "KVM unavailable or LMCE not su= pported"); > + error_propagate(&error_abort, local_err); > + } Aborts should never be triggered by user input. The error instead should propagate from mce_init to its caller with a new errp argument (i.e. error_setg(errp, "KVM unavailable or LMCE not supported")). x86_cpu_realizefn can pass &local_err and check the outcome through local_err !=3D NULL. See the existing call to x86_cpu_apic_create, right above the call to mce_init. > @@ -878,7 +891,12 @@ int kvm_arch_init_vcpu(CPUState *cs) > c =3D cpuid_find_entry(&cpuid_data.cpuid, 1, 0); > if (c) { > has_msr_feature_control =3D !!(c->ecx & CPUID_EXT_VMX) || > - !!(c->ecx & CPUID_EXT_SMX); > + !!(c->ecx & CPUID_EXT_SMX) || > + !!(env->mcg_cap & MCG_LMCE_P); This part is wrong; env->mcg_cap is independent from CPUID[1].ECX. > + } > + > + if (has_msr_feature_control && (env->mcg_cap & MCG_LMCE_P)) { Don't test has_msr_feature_control here, instead set it to true inside the "if". > + has_msr_mcg_ext_ctl =3D true; > } > =20 > c =3D cpuid_find_entry(&cpuid_data.cpuid, 0x80000007, 0); Which silicon has LMCE? We may want to enable the property for some CPU models. Apart from this, the patch is pretty much okay. Paolo