QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: qemu-devel@nongnu.org, richard.henderson@linaro.org
Subject: [PULL 01/12] target/sparc/cpu: Rename the CPU models with a "+" in their names
Date: Mon,  6 May 2024 12:44:40 +0100	[thread overview]
Message-ID: <20240506114451.331311-2-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20240506114451.331311-1-mark.cave-ayland@ilande.co.uk>

From: Thomas Huth <thuth@redhat.com>

Commit b447378e12 ("qom/object: Limit type names to alphanumerical ...")
cut down the amount of allowed characters for QOM types to a saner set.
The "+" character was meant to be included in this set, so we had to
add a hack there to still allow the legacy names of POWER and Sparc64
CPUs. However, instead of putting such a hack in the common QOM code,
there is a much better place to do this: The sparc_cpu_class_by_name()
function which is used to look up the names of all Sparc CPUs.
Thus let's finally get rid of the "+" in the Sparc CPU names, and provide
backward compatibility for the old names via some simple checks in the
sparc_cpu_class_by_name() function.

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240419084812.504779-2-thuth@redhat.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 qom/object.c       |  8 --------
 target/sparc/cpu.c | 14 ++++++++++++--
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index 44ec8f6460..157a45c5f8 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -157,14 +157,6 @@ static bool type_name_is_valid(const char *name)
                         "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                         "0123456789-_.");
 
-    /* Allow some legacy names with '+' in it for compatibility reasons */
-    if (name[plen] == '+') {
-        if (plen >= 17 && g_str_has_prefix(name, "Sun-UltraSparc-I")) {
-            /* Allow "Sun-UltraSparc-IV+" and "Sun-UltraSparc-IIIi+" */
-            return true;
-        }
-    }
-
     return plen == slen;
 }
 
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 485d416925..7487ae034d 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -314,7 +314,7 @@ static const sparc_def_t sparc_defs[] = {
         .features = CPU_DEFAULT_FEATURES,
     },
     {
-        .name = "Sun UltraSparc IV+",
+        .name = "Sun UltraSparc IV plus",
         .iu_version = ((0x3eULL << 48) | (0x19ULL << 32) | (0x22ULL << 24)),
         .fpu_version = 0x00000000,
         .mmu_version = mmu_us_12,
@@ -323,7 +323,7 @@ static const sparc_def_t sparc_defs[] = {
         .features = CPU_DEFAULT_FEATURES | CPU_FEATURE_CMT,
     },
     {
-        .name = "Sun UltraSparc IIIi+",
+        .name = "Sun UltraSparc IIIi plus",
         .iu_version = ((0x3eULL << 48) | (0x22ULL << 32) | (0ULL << 24)),
         .fpu_version = 0x00000000,
         .mmu_version = mmu_us_3,
@@ -762,6 +762,16 @@ static ObjectClass *sparc_cpu_class_by_name(const char *cpu_model)
     char *typename;
 
     typename = sparc_cpu_type_name(cpu_model);
+
+    /* Fix up legacy names with '+' in it */
+    if (g_str_equal(typename, SPARC_CPU_TYPE_NAME("Sun-UltraSparc-IV+"))) {
+        g_free(typename);
+        typename = g_strdup(SPARC_CPU_TYPE_NAME("Sun-UltraSparc-IV-plus"));
+    } else if (g_str_equal(typename, SPARC_CPU_TYPE_NAME("Sun-UltraSparc-IIIi+"))) {
+        g_free(typename);
+        typename = g_strdup(SPARC_CPU_TYPE_NAME("Sun-UltraSparc-IIIi-plus"));
+    }
+
     oc = object_class_by_name(typename);
     g_free(typename);
     return oc;
-- 
2.39.2



  reply	other threads:[~2024-05-06 11:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 11:44 [PULL 00/12] qemu-sparc queue 20240506 Mark Cave-Ayland
2024-05-06 11:44 ` Mark Cave-Ayland [this message]
2024-05-06 11:44 ` [PULL 02/12] target/sparc/cpu: Avoid spaces by default in the CPU names Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 03/12] docs/system/target-sparc: Improve the Sparc documentation Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 04/12] docs/about: Deprecate the old "UltraSparc" CPU names that contain a "+" Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 05/12] hw/sparc64: set iommu_platform=on for virtio devices attached to the sun4u machine Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 06/12] linux-user/sparc: Add more hwcap bits for sparc64 Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 07/12] target/sparc: Fix FEXPAND Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 08/12] target/sparc: Fix FMUL8x16 Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 09/12] target/sparc: Fix FMUL8x16A{U,L} Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 10/12] target/sparc: Fix FMULD8*X16 Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 11/12] target/sparc: Fix FPMERGE Mark Cave-Ayland
2024-05-06 11:44 ` [PULL 12/12] target/sparc: Split out do_ms16b Mark Cave-Ayland
2024-05-06 14:50 ` [PULL 00/12] qemu-sparc queue 20240506 Michael Tokarev
2024-05-06 15:40   ` Philippe Mathieu-Daudé
2024-05-06 19:59 ` Richard Henderson

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=20240506114451.331311-2-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).