From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bosRP-0002xK-Dx for qemu-devel@nongnu.org; Tue, 27 Sep 2016 09:29:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bosRM-0000L4-9O for qemu-devel@nongnu.org; Tue, 27 Sep 2016 09:28:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bosRM-0000Kx-3G for qemu-devel@nongnu.org; Tue, 27 Sep 2016 09:28:56 -0400 Date: Tue, 27 Sep 2016 15:28:51 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20160927132851.GA26148@potion> References: <20160922210432.18680-1-rkrcmar@redhat.com> <20160922210432.18680-2-rkrcmar@redhat.com> <20160923091749.GA29144@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160923091749.GA29144@pxdev.xzpeter.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/5] apic: add global apic_get_class() 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-23 17:17+0800, Peter Xu: > On Thu, Sep 22, 2016 at 11:04:28PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: >> Every configuration has only up to one APIC class and we'll be extendi= ng >> the class with a function that can be called without an instanced >> object, so a direct access to the class is convenient. >>=20 >> Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 >> --- >> diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c >> @@ -306,6 +314,12 @@ static void apic_common_realize(DeviceState *dev,= Error **errp) >> info =3D APIC_COMMON_GET_CLASS(s); >> info->realize(dev, errp); >> =20 >> + if (apic_class && apic_class !=3D info) { >> + error_report("All APICs must be of the same class."); >> + exit(1); >> + } >=20 > Can user trigger this error? If not, I'd prefer: Shouldn't be able to. > assert(!apic_class || apic_class =3D=3D info); I'll use that, thanks.