From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btcEh-0004HH-UE for qemu-devel@nongnu.org; Mon, 10 Oct 2016 11:11:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btcEe-00087d-JV for qemu-devel@nongnu.org; Mon, 10 Oct 2016 11:11:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btcEe-000876-Dg for qemu-devel@nongnu.org; Mon, 10 Oct 2016 11:11:24 -0400 Date: Mon, 10 Oct 2016 17:11:19 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20161010151119.GB30525@potion> References: <20161005130657.3399-1-rkrcmar@redhat.com> <20161005130657.3399-7-rkrcmar@redhat.com> <20161008072100.GJ3666@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161008072100.GJ3666@pxdev.xzpeter.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 6/8] intel_iommu: reject broken EIM 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-10-08 15:21+0800, Peter Xu: > On Wed, Oct 05, 2016 at 03:06:55PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: >=20 > [...] >=20 >> @@ -2472,10 +2473,22 @@ static bool vtd_decide_config(IntelIOMMUState = *s, Error **errp) >> } >> =20 >> if (s->intr_eim =3D=3D ON_OFF_AUTO_AUTO) { >> - s->intr_eim =3D x86_iommu->intr_supported ? >> + s->intr_eim =3D x86_iommu->intr_supported && kvm_irqchip_in_k= ernel() ? >> ON_OFF_AUTO_ON : ON_OFF= _AUTO_OFF; >> } >> =20 >> + if (s->intr_eim =3D=3D ON_OFF_AUTO_ON) { >> + if (kvm_irqchip_in_kernel() && !kvm_enable_x2apic()) { >> + error_setg(errp, "eim=3Don requires support on the KVM si= de" >> + "(X2APIC_API, first shipped in v4.7)"); >> + return false; >> + } >> + if (!kvm_irqchip_in_kernel()) { >> + error_setg(errp, "eim=3Don requires accel=3Dkvm,kernel-ir= qchip=3Dsplit"); >> + return false; >> + } >=20 > I would prefer: >=20 > if (kvm_irqchip_in_kernel()) { > if (!kvm_enable_x2apic()) { > error("enable x2apic failed"); > return false; > } > } else { > error("need split irqchip"); > return false; > } Yeah, it looks better, thanks. > But that's really a matter of taste. So: I'll currently go for an implicit else: (because 4 levels of indentation are getting helper-function worthy and it has less curly braces) if (!kvm_irqchip_in_kernel()) { error("need split irqchip"); return false; } if (!kvm_enable_x2apic()) { error("enable x2apic failed"); return false; } > Reviewed-by: Peter Xu I squashed [7/8] into this patch in v5 and the second one didn't have your r-b, so I made the change as I'd have to drop the r-b anyway.