qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-7.1 1/4] target/loongarch: Only allow short -cpu argument


From: Richard Henderson
Subject: Re: [PATCH for-7.1 1/4] target/loongarch: Only allow short -cpu arguments without type name suffix
Date: Sun, 14 Aug 2022 15:44:53 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 8/14/22 09:55, WANG Xuerui wrote:
From: WANG Xuerui <git@xen0n.name>

Previously both "foo" and "foo-loongarch-cpu" are accepted for the -cpu
command-line option, the latter of which being excessively long and
redundant, hence unwanted. Remove support for consistency with other
targets and simpler code.

Signed-off-by: WANG Xuerui <git@xen0n.name>

This breaks testing, iirc, which is why both were accepted in the last change to this code. You could allow just the short name so long as you don't try to provide the long name in hw/loongarch/virt.c.


r~


---
  target/loongarch/cpu.c | 11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 941e2772bc..dc233ee209 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -573,14 +573,11 @@ static ObjectClass *loongarch_cpu_class_by_name(const 
char *cpu_model)
  {
      ObjectClass *oc;
- oc = object_class_by_name(cpu_model);
+    g_autofree char *typename = g_strdup_printf(LOONGARCH_CPU_TYPE_NAME("%s"),
+                                                cpu_model);
+    oc = object_class_by_name(typename);
      if (!oc) {
-        g_autofree char *typename
-            = g_strdup_printf(LOONGARCH_CPU_TYPE_NAME("%s"), cpu_model);
-        oc = object_class_by_name(typename);
-        if (!oc) {
-            return NULL;
-        }
+        return NULL;
      }
if (object_class_dynamic_cast(oc, TYPE_LOONGARCH_CPU)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]