From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpyCm-0007QQ-3c for qemu-devel@nongnu.org; Fri, 30 Sep 2016 09:50:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpyCg-0002xb-Kr for qemu-devel@nongnu.org; Fri, 30 Sep 2016 09:50:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpyCg-0002wr-Ec for qemu-devel@nongnu.org; Fri, 30 Sep 2016 09:50:18 -0400 Date: Fri, 30 Sep 2016 15:50:13 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20160930135013.GA18006@potion> References: <20160929112329.2408-1-rkrcmar@redhat.com> <20160929112329.2408-6-rkrcmar@redhat.com> <20160930051320.GM11134@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160930051320.GM11134@pxdev.xzpeter.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 5/7] intel-iommu: add OnOffAuto intr_eim as "eim" property 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:13+0800, Peter Xu: > On Thu, Sep 29, 2016 at 01:23:27PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: >> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c >> @@ -2466,6 +2472,18 @@ static void vtd_realize(DeviceState *dev, Error= **errp) >> exit(1); >> } >> =20 >> + if (s->intr_eim =3D=3D ON_OFF_AUTO_ON && !x86_iommu->intr_support= ed) { >> + error_report("intel-iommu,eim=3Don cannot be selected without= " >> + "intremap=3Don."); >> + exit(1); >> + } >> + 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) { >> + s->intr_eim =3D ON_OFF_AUTO_ON; >> + } >=20 > A single if() instead of above two might be nicer: >=20 > if (s->intr_eim =3D=3D ON_OFF_AUTO_AUTO) { > e->intr_eim =3D x86_iommu->intr_supported ? > ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF; > } Hm, it'll end up looking like if (s->intr_eim =3D=3D ON_OFF_AUTO_AUTO) { e->intr_eim =3D (x86_iommu->intr_supported && kvm_irqchip_in_kern= el()) || pcmc->buggy_intel_iommu_eim ? ON_OFF_AUTO_ON : ON_OFF_AUT= O_OFF; } It's harder to read, but less LOC ... I'll use it, thanks.