From nobody Wed Feb 11 02:54:48 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; dkim=fail; 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508215549744397.48241268348715; Mon, 16 Oct 2017 21:45:49 -0700 (PDT) Received: from localhost ([::1]:36463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Jl4-0003Rq-7B for importer@patchew.org; Tue, 17 Oct 2017 00:45:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4JOe-0008U3-5b for qemu-devel@nongnu.org; Tue, 17 Oct 2017 00:22:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4JOb-0007Co-Pc for qemu-devel@nongnu.org; Tue, 17 Oct 2017 00:22:28 -0400 Received: from ozlabs.org ([103.22.144.67]:52765) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4JOb-00079P-Bj; Tue, 17 Oct 2017 00:22:25 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3yGMTy0s9Hz9t6K; Tue, 17 Oct 2017 15:22:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1508214134; bh=4Lhm7YWj30R2S0jojQcw3nPESTBiDdsjGn44ukHIVuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p2qRyZnIk8026ORFLTsyEDijON38ccmAjE3bZNgpgcJibMVI0C4Zf+50rbtc8KFrg ClK65YZhzr57YLZG/zUY63udVA5L+wdlWJiqrhuMEAO7q+PBY1a+51q7w560iZ0CtL aqHkHbypo3tbUVyax1p+aUi5H0sHf5GCvii9iC3Q= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 17 Oct 2017 15:21:47 +1100 Message-Id: <20171017042152.29443-30-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017042152.29443-1-david@gibson.dropbear.id.au> References: <20171017042152.29443-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 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: 103.22.144.67 Subject: [Qemu-devel] [PULL 29/34] 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: agraf@suse.de, ehabkost@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, imammedo@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Igor Mammedov 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 Signed-off-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 135d3fa29f..350394fdb5 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_v2.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_v2.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.13.6