From nobody Tue Feb 10 01:35:22 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504867960478132.42208750396082; Fri, 8 Sep 2017 03:52:40 -0700 (PDT) Received: from localhost ([::1]:44523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqGtq-0000Gd-Uy for importer@patchew.org; Fri, 08 Sep 2017 06:52:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqGeD-0002FK-MF for qemu-devel@nongnu.org; Fri, 08 Sep 2017 06:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqGe5-0003LK-NR for qemu-devel@nongnu.org; Fri, 08 Sep 2017 06:36:29 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:47577) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dqGe5-0003IX-Co; Fri, 08 Sep 2017 06:36:21 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xpYdQ0QyNz9t5V; Fri, 8 Sep 2017 20:36:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1504866970; bh=7OMgoMbsff61zNAX6hx4PYUI3leeOBieZZnQQ5KfJfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAYQYbD8o0W97wmiNoilgXAJ3odQF+krQdP/zoaIqsf9mX7FLnr9YiHmNj6ElLLSy 2qJyeKxEBUuR6X40yZjQImZX8WLcqHVmEG0I1TSTKp+i2sRmTpInWY4JYb9dhkVeJr AxuR1ju42hf0zRc/Cjl1WC2wW+/Q+rYmMiZw4H34= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 8 Sep 2017 20:35:51 +1000 Message-Id: <20170908103558.31632-34-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908103558.31632-1-david@gibson.dropbear.id.au> References: <20170908103558.31632-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 33/40] ppc: use macros to make cpu type name from string literal 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: qemu-devel@nongnu.org, aik@ozlabs.ru, agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, imammedo@redhat.com, sam.bobroff@au1.ibm.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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Replace "-" TYPE_POWERPC_CPU when composing cpu type name from cpu model string literal and the same pattern in format strings with POWERPC_CPU_TYPE_SUFFIX and POWERPC_CPU_TYPE_NAME(model) macroses like we do in x86. Later POWERPC_CPU_TYPE_NAME() will be used to define default cpu type per machine type and as bonus it will be consistent and easy grep-able pattern across all other targets that I'm plannig to treat the same way. Signed-off-by: Igor Mammedov Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/cpu-models.c | 2 +- target/ppc/cpu.h | 3 +++ target/ppc/kvm.c | 2 +- target/ppc/kvm_ppc.h | 2 +- target/ppc/translate_init.c | 6 +++--- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c index e0d9faf848..782977425b 100644 --- a/target/ppc/cpu-models.c +++ b/target/ppc/cpu-models.c @@ -51,7 +51,7 @@ = \ static const TypeInfo = \ glue(POWERPC_DEF_PREFIX(_pvr, _svr, _type), _cpu_type_info) =3D { = \ - .name =3D _name "-" TYPE_POWERPC_CPU, = \ + .name =3D POWERPC_CPU_TYPE_NAME(_name), = \ .parent =3D stringify(_type) "-family-" TYPE_POWERPC_CPU, = \ .class_init =3D = \ glue(POWERPC_DEF_PREFIX(_pvr, _svr, _type), _cpu_class_init), = \ diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 042372c5ad..c9d3ffa89b 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1354,6 +1354,9 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint= 32_t val); =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_POWERPC_CPU, cpu_model) =20 +#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU +#define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX + #define cpu_signal_handler cpu_ppc_signal_handler #define cpu_list ppc_cpu_list =20 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index b6bd0fa7a6..abcfe13b8a 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2529,7 +2529,7 @@ static int kvm_ppc_register_host_cpu_type(void) char *suffix; =20 ppc_cpu_aliases[i].model =3D g_strdup(object_class_get_name(oc= )); - suffix =3D strstr(ppc_cpu_aliases[i].model, "-"TYPE_POWERPC_CP= U); + suffix =3D strstr(ppc_cpu_aliases[i].model, POWERPC_CPU_TYPE_S= UFFIX); if (suffix) { *suffix =3D 0; } diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index e6711fc2b7..f780e6ec7b 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -9,7 +9,7 @@ #ifndef KVM_PPC_H #define KVM_PPC_H =20 -#define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU +#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") =20 #ifdef CONFIG_KVM =20 diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 703ea12f2a..ee42c56288 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -10261,7 +10261,7 @@ static gint ppc_cpu_compare_class_name(gconstpointe= r a, gconstpointer b) if (strncasecmp(name, object_class_get_name(oc), strlen(name)) =3D=3D = 0 && ppc_cpu_is_valid(pcc) && strcmp(object_class_get_name(oc) + strlen(name), - "-" TYPE_POWERPC_CPU) =3D=3D 0) { + POWERPC_CPU_TYPE_SUFFIX) =3D=3D 0) { return 0; } return -1; @@ -10403,7 +10403,7 @@ static void ppc_cpu_list_entry(gpointer data, gpoin= ter user_data) } =20 name =3D g_strndup(typename, - strlen(typename) - strlen("-" TYPE_POWERPC_CPU)); + strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX)); (*s->cpu_fprintf)(s->file, "PowerPC %-16s PVR %08x\n", name, pcc->pvr); for (i =3D 0; ppc_cpu_aliases[i].alias !=3D NULL; i++) { @@ -10464,7 +10464,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpoin= ter user_data) typename =3D object_class_get_name(oc); info =3D g_malloc0(sizeof(*info)); info->name =3D g_strndup(typename, - strlen(typename) - strlen("-" TYPE_POWERPC_CPU)= ); + strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFF= IX)); =20 entry =3D g_malloc0(sizeof(*entry)); entry->value =3D info; --=20 2.13.5