From nobody Tue Feb 10 12:57:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507579713096895.7517728850081; Mon, 9 Oct 2017 13:08:33 -0700 (PDT) Received: from localhost ([::1]:59619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1eLU-00089p-Nz for importer@patchew.org; Mon, 09 Oct 2017 16:08:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1e5j-0003nV-67 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 15:51:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1e5f-0006gl-2Q for qemu-devel@nongnu.org; Mon, 09 Oct 2017 15:51:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43026) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1e5e-0006g4-Qr; Mon, 09 Oct 2017 15:51:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B2C8F61478; Mon, 9 Oct 2017 19:51:49 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 643CD60604; Mon, 9 Oct 2017 19:51:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B2C8F61478 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 9 Oct 2017 21:51:09 +0200 Message-Id: <1507578671-158758-23-git-send-email-imammedo@redhat.com> In-Reply-To: <1507578671-158758-1-git-send-email-imammedo@redhat.com> References: <1507578671-158758-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 09 Oct 2017 19:51:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 22/24] ppc: pnv: define core types statically X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:ppce500" , "Edgar E. Iglesias" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" pnv core type definition doesn't have any fields that require it to be defined at runtime. So replace code that fills in TypeInfo at runtime with static TypeInfo array that does the same at complie time. Signed-off-by: Igor Mammedov Reviewed-by: C=C3=A9dric Le Goater Acked-by: David Gibson --- hw/ppc/pnv_core.c | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index bd7f2c9..438dbd1 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -225,38 +225,30 @@ static void pnv_core_class_init(ObjectClass *oc, void= *data) dc->props =3D pnv_core_properties; } =20 -static const TypeInfo pnv_core_info =3D { - .name =3D TYPE_PNV_CORE, - .parent =3D TYPE_CPU_CORE, - .instance_size =3D sizeof(PnvCore), - .class_size =3D sizeof(PnvCoreClass), - .class_init =3D pnv_core_class_init, - .abstract =3D true, -}; - -static const char *pnv_core_models[] =3D { - "power8e_v2.1", "power8_v2.0", "power8nvl_v1.0", "power9_v1.0" -}; - -static void pnv_core_register_types(void) -{ - int i ; - - type_register_static(&pnv_core_info); - for (i =3D 0; i < ARRAY_SIZE(pnv_core_models); ++i) { - TypeInfo ti =3D { - .parent =3D TYPE_PNV_CORE, - .instance_size =3D sizeof(PnvCore), - }; - ti.name =3D pnv_core_typename(pnv_core_models[i]); - type_register(&ti); - g_free((void *)ti.name); +#define DEFINE_PNV_CORE_TYPE(cpu_model) \ + { \ + .parent =3D TYPE_PNV_CORE, \ + .name =3D PNV_CORE_TYPE_NAME(cpu_model), \ } -} =20 -type_init(pnv_core_register_types) +static const TypeInfo pnv_core_infos[] =3D { + { + .name =3D TYPE_PNV_CORE, + .parent =3D TYPE_CPU_CORE, + .instance_size =3D sizeof(PnvCore), + .class_size =3D sizeof(PnvCoreClass), + .class_init =3D pnv_core_class_init, + .abstract =3D true, + }, + DEFINE_PNV_CORE_TYPE("power8e_v2.1"), + DEFINE_PNV_CORE_TYPE("power8_v2.0"), + DEFINE_PNV_CORE_TYPE("power8nvl_v1.0"), + DEFINE_PNV_CORE_TYPE("power9_v1.0"), +}; =20 char *pnv_core_typename(const char *model) { return g_strdup_printf(PNV_CORE_TYPE_NAME("%s"), model); } + +DEFINE_TYPES(pnv_core_infos) --=20 2.7.4