From: Zhao Liu <zhao1.liu@linux.intel.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
qemu-riscv@nongnu.org, "Anton Johansson" <anjo@rev.ng>,
qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Claudio Fontana" <cfontana@suse.de>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
qemu-arm@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>
Subject: Re: [PATCH-for-9.1 06/21] target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types
Date: Mon, 18 Mar 2024 16:47:59 +0800 [thread overview]
Message-ID: <Zff/v7aK182oxbM2@intel.com> (raw)
In-Reply-To: <20240315130910.15750-7-philmd@linaro.org>
Hi Philippe,
On Fri, Mar 15, 2024 at 02:08:54PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 15 Mar 2024 14:08:54 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH-for-9.1 06/21] target/i386: Make X86_CPU common to new
> I386_CPU / X86_64_CPU types
> X-Mailer: git-send-email 2.41.0
>
> "target/foo/cpu-qom.h" can not use any target specific definitions.
>
> Currently "target/i386/cpu-qom.h" defines TYPE_X86_CPU depending
> on the i386/x86_64 build type. This doesn't scale in a heterogeneous
> context where we need to access both types concurrently.
Does this mean that there would be a TCG case contains both 64-bit and
32-bit i386 core? ;-)
> In order to do that, introduce the new I386_CPU / X86_64_CPU
> types, both inheriting a common TYPE_X86_CPU base type.
>
> Keep the current "base" and "max" CPU types as 32 or 64-bit,
> depending on the binary built.
>
> Adapt the cpu-plug-test, since the 'base' architecture is now
> common to both 32/64-bit x86 targets.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Acked-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/i386/cpu-qom.h | 16 ++++++++++------
> target/i386/cpu.c | 20 ++++++++++++++++++--
> tests/qtest/cpu-plug-test.c | 2 +-
> 3 files changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/target/i386/cpu-qom.h b/target/i386/cpu-qom.h
> index d4e216d000..de28d7ea20 100644
> --- a/target/i386/cpu-qom.h
> +++ b/target/i386/cpu-qom.h
> @@ -1,5 +1,5 @@
> /*
> - * QEMU x86 CPU
> + * QEMU x86 CPU QOM header (target agnostic)
> *
> * Copyright (c) 2012 SUSE LINUX Products GmbH
> *
> @@ -22,14 +22,18 @@
>
> #include "hw/core/cpu.h"
>
> -#ifdef TARGET_X86_64
> -#define TYPE_X86_CPU "x86_64-cpu"
> -#else
> -#define TYPE_X86_CPU "i386-cpu"
> -#endif
> +#define TYPE_X86_CPU "x86-cpu"
> +#define TYPE_I386_CPU "i386-cpu"
> +#define TYPE_X86_64_CPU "x86_64-cpu"
>
> OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU)
>
> +OBJECT_DECLARE_CPU_TYPE(I386CPU, X86CPUClass, I386_CPU)
> +OBJECT_DECLARE_CPU_TYPE(X86_64CPU, X86CPUClass, X86_64_CPU)
> +
> +#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU
> +#define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX)
> +
X86_CPU_TYPE_NAME seems to be duplicated because the following line is
the existing X86_CPU_TYPE_NAME definition.
> #define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU
> #define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index ebf555f50f..07f64c1ea5 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -8057,12 +8057,28 @@ static const TypeInfo x86_cpu_types[] = {
> .class_size = sizeof(X86CPUClass),
> .class_init = x86_cpu_common_class_init,
> }, {
> - .name = X86_CPU_TYPE_NAME("base"),
> + .name = TYPE_I386_CPU,
> .parent = TYPE_X86_CPU,
> + .abstract = true,
> + }, {
> + .name = TYPE_X86_64_CPU,
> + .parent = TYPE_X86_CPU,
> + .abstract = true,
> + }, {
Should TYPE_I386_CPU/TYPE_X86_64_CPU be also wrapped with TARGET_X86_64?
Otherwise, we would keep the 32-bit CPU type definition of TYPE_I386_CPU
in the 64-bit case.
> + .name = X86_CPU_TYPE_NAME("base"),
> +#ifdef TARGET_X86_64
> + .parent = TYPE_X86_64_CPU,
> +#else
> + .parent = TYPE_I386_CPU,
> +#endif
> .class_init = x86_cpu_base_class_init,
> }, {
> .name = X86_CPU_TYPE_NAME("max"),
> - .parent = TYPE_X86_CPU,
> +#ifdef TARGET_X86_64
> + .parent = TYPE_X86_64_CPU,
> +#else
> + .parent = TYPE_I386_CPU,
> +#endif
> .instance_init = max_x86_cpu_initfn,
> .class_init = max_x86_cpu_class_init,
> }
next prev parent reply other threads:[~2024-03-18 8:35 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 13:08 [RFC PATCH-for-9.1 00/21] qapi: Make @query-cpu-definitions command target-agnostic Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 01/21] target/i386: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 02/21] target/mips: " Philippe Mathieu-Daudé
2024-03-18 8:13 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 03/21] target/ppc: " Philippe Mathieu-Daudé
2024-03-18 8:15 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 04/21] target/sparc: " Philippe Mathieu-Daudé
2024-03-18 8:16 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 05/21] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE() Philippe Mathieu-Daudé
2024-03-18 8:31 ` Zhao Liu
2024-03-15 13:08 ` [PATCH-for-9.1 06/21] target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types Philippe Mathieu-Daudé
2024-03-18 8:47 ` Zhao Liu [this message]
2024-03-26 10:57 ` Markus Armbruster
2024-03-26 12:17 ` Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 07/21] target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types Philippe Mathieu-Daudé
2024-03-19 18:12 ` Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 08/21] target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU types Philippe Mathieu-Daudé
2024-03-15 13:08 ` [PATCH-for-9.1 09/21] qapi: Merge machine-common.json with qapi/machine.json Philippe Mathieu-Daudé
2024-03-26 12:12 ` Markus Armbruster
2024-03-15 13:08 ` [PATCH-for-9.1 10/21] qapi: Make CpuModel* definitions target agnostic Philippe Mathieu-Daudé
2024-03-20 8:49 ` Philippe Mathieu-Daudé
2024-03-26 12:16 ` Markus Armbruster
2024-03-15 13:08 ` [PATCH-for-9.1 11/21] qapi: Make CpuDefinitionInfo " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [PATCH-for-9.1 12/21] system: Introduce QemuArchBit enum Philippe Mathieu-Daudé
2024-03-15 13:09 ` [PATCH-for-9.1 13/21] system: Introduce cpu_typename_by_arch_bit() Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 14/21] system: Introduce QMP generic_query_cpu_definitions() Philippe Mathieu-Daudé
2024-03-26 12:54 ` Markus Armbruster
2024-03-26 13:28 ` Markus Armbruster
2024-03-29 13:03 ` Philippe Mathieu-Daudé
2024-04-02 9:37 ` Markus Armbruster
2024-03-15 13:09 ` [RFC PATCH-for-9.1 15/21] target/arm: Use " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 16/21] target/loongarch: " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 17/21] target/riscv: " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 18/21] target/i386: " Philippe Mathieu-Daudé
2024-03-15 13:09 ` [PATCH-for-9.1 19/21] target/ppc: Factor ppc_add_alias_definitions() out Philippe Mathieu-Daudé
2024-03-20 5:07 ` Nicholas Piggin
2024-03-15 13:09 ` [RFC PATCH-for-9.1 20/21] target/ppc: Use QMP generic_query_cpu_definitions() Philippe Mathieu-Daudé
2024-03-15 13:09 ` [RFC PATCH-for-9.1 21/21] qapi: Make @query-cpu-definitions target-agnostic Philippe Mathieu-Daudé
2024-03-26 13:32 ` Markus Armbruster
2024-03-26 10:18 ` [RFC PATCH-for-9.1 00/21] qapi: Make @query-cpu-definitions command target-agnostic Markus Armbruster
2024-03-26 13:37 ` Markus Armbruster
2025-03-11 7:56 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zff/v7aK182oxbM2@intel.com \
--to=zhao1.liu@linux.intel.com \
--cc=alex.bennee@linaro.org \
--cc=anjo@rev.ng \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=cfontana@suse.de \
--cc=eduardo@habkost.net \
--cc=lvivier@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.