From: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
To: qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org,
"David Gibson" <david@gibson.dropbear.id.au>,
mopsfelder@gmail.com,
"Murilo Opsfelder Araujo" <muriloo@linux.ibm.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Greg Kurz" <groug@kaod.org>,
"Matheus K . Ferst" <matheus.ferst@eldorado.org.br>,
"Thomas Huth" <thuth@redhat.com>,
"Fabiano Rosas" <farosas@linux.ibm.com>
Subject: [PATCH v2] target/ppc: Return default CPU for max CPU
Date: Tue, 28 Jun 2022 17:55:13 -0300 [thread overview]
Message-ID: <20220628205513.81917-1-muriloo@linux.ibm.com> (raw)
All ppc CPUs represent hardware that exists in the real world, i.e.: we
do not have a "max" CPU with all possible emulated features enabled.
Return the default CPU type for the machine because that has greater
chance of being useful as the "max" CPU.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1038
Cc: Cédric Le Goater <clg@kaod.org>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Greg Kurz <groug@kaod.org>
Cc: Matheus K. Ferst <matheus.ferst@eldorado.org.br>
Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
v2:
- Return the default CPU of the machine instead of hard-coded alias.
v1: https://lore.kernel.org/qemu-devel/20220531172711.94564-1-muriloo@linux.ibm.com/
target/ppc/cpu-models.c | 1 -
target/ppc/cpu_init.c | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
index 976be5e0d1..05589eb21d 100644
--- a/target/ppc/cpu-models.c
+++ b/target/ppc/cpu-models.c
@@ -879,7 +879,6 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
{ "755", "755_v2.8" },
{ "goldfinger", "755_v2.8" },
{ "7400", "7400_v2.9" },
- { "max", "7400_v2.9" },
{ "g4", "7400_v2.9" },
{ "7410", "7410_v1.4" },
{ "nitro", "7410_v1.4" },
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index c16cb8dbe7..8ee0b7c785 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -47,6 +47,10 @@
#include "spr_common.h"
#include "power8-pmu.h"
+#ifndef CONFIG_USER_ONLY
+#include "hw/boards.h"
+#endif
+
/* #define PPC_DEBUG_SPR */
/* #define USE_APPLE_GDB */
@@ -6963,6 +6967,21 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
}
}
+ /*
+ * All ppc CPUs represent hardware that exists in the real world, i.e.: we
+ * do not have a "max" CPU with all possible emulated features enabled.
+ * Return the default CPU type for the machine because that has greater
+ * chance of being useful as the "max" CPU.
+ */
+#if !defined(CONFIG_USER_ONLY)
+ if (strcmp(name, "max") == 0) {
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+ if (mc) {
+ return object_class_by_name(mc->default_cpu_type);
+ }
+ }
+#endif
+
cpu_model = g_ascii_strdown(name, -1);
p = ppc_cpu_lookup_alias(cpu_model);
if (p) {
--
2.36.1
next reply other threads:[~2022-06-28 20:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 20:55 Murilo Opsfelder Araujo [this message]
2022-06-30 20:58 ` [PATCH v2] target/ppc: Return default CPU for max CPU Víctor Colombo
2022-07-02 13:28 ` Daniel Henrique Barboza
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=20220628205513.81917-1-muriloo@linux.ibm.com \
--to=muriloo@linux.ibm.com \
--cc=berrange@redhat.com \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=farosas@linux.ibm.com \
--cc=groug@kaod.org \
--cc=matheus.ferst@eldorado.org.br \
--cc=mopsfelder@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).