From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpyIJ-0001ES-Ft for qemu-devel@nongnu.org; Fri, 30 Sep 2016 09:56:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpyID-00061M-Kg for qemu-devel@nongnu.org; Fri, 30 Sep 2016 09:56:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpyID-00060q-EJ for qemu-devel@nongnu.org; Fri, 30 Sep 2016 09:56:01 -0400 Date: Fri, 30 Sep 2016 15:55:56 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20160930135555.GB18006@potion> References: <20160929112329.2408-1-rkrcmar@redhat.com> <20160929112329.2408-8-rkrcmar@redhat.com> <20160930054011.GN11134@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160930054011.GN11134@pxdev.xzpeter.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 7/7] intel-iommu: keep buggy EIM enabled in 2.7 machine type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: qemu-devel@nongnu.org, Igor Mammedov , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" 2016-09-30 13:40+0800, Peter Xu: > On Thu, Sep 29, 2016 at 01:23:29PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: >=20 > [...] >=20 >> @@ -2481,11 +2482,14 @@ static void vtd_realize(DeviceState *dev, Erro= r **errp) >> if (s->intr_eim =3D=3D ON_OFF_AUTO_AUTO && !x86_iommu->intr_suppo= rted) { >> s->intr_eim =3D ON_OFF_AUTO_OFF; >> } >> + if (s->intr_eim =3D=3D ON_OFF_AUTO_AUTO && pcmc->buggy_intel_iomm= u_eim) { >> + s->intr_eim =3D ON_OFF_AUTO_ON; >> + } >> if (s->intr_eim =3D=3D ON_OFF_AUTO_AUTO) { >> s->intr_eim =3D kvm_irqchip_in_kernel() ? ON_OFF_AUTO_ON >> : ON_OFF_AUTO_OFF; >> } >> - if (s->intr_eim =3D=3D ON_OFF_AUTO_ON) { >> + if (s->intr_eim =3D=3D ON_OFF_AUTO_ON && !pcmc->buggy_intel_iommu= _eim) { >> if (kvm_irqchip_in_kernel() && !kvm_enable_x2apic()) { >> error_report("intel-iommu,eim=3Don requires support on th= e KVM side " >> "(X2APIC_API, first shipped in v4.7)."); >=20 > No matter how we would treat this patch, I see that we are stacking up > if clauses here. So IMHO maybe it's time to award EIM a new routine: >=20 > int vtd_eim_detect(IntelIOMMUState *, Error **errp); >=20 > And squash all these conditions in. Then in vtd_realize(): >=20 > if (vtd_eim_detect(s, errp)) { > return; > } Yeah, thanks.