qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH v5 05/31] cpu: Add helper cpu_model_from_type()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v5 05/31] cpu: Add helper cpu_model_from_type()
Date: Thu, 16 Nov 2023 08:45:14 +0100
User-agent: Mozilla Thunderbird

On 15/11/23 00:56, Gavin Shan wrote:
Add helper cpu_model_from_type() to extract the CPU model name from
the CPU type name in two circumstances: (1) The CPU type name is the
combination of the CPU model name and suffix. (2) The CPU type name
is same to the CPU model name.

The helper will be used in the subsequent commits to conver the
CPU type name to the CPU model name.

Suggested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
  cpu-target.c          | 15 +++++++++++++++
  include/hw/core/cpu.h | 12 ++++++++++++
  2 files changed, 27 insertions(+)


diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index c0c8320413..57ceb46bc1 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -779,6 +779,18 @@ void cpu_reset(CPUState *cpu);
   */
  ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model);
+/**
+ * cpu_model_from_type:
+ * @typename: The CPU type name
+ *
+ * Extract the CPU model name from the CPU type name. The
+ * CPU type name is either the combination of the CPU model
+ * name and suffix, or same to the CPU model name.
+ *
+ * Returns: CPU model name or NULL if the CPU class doesn't exist

Worth adding:

    *          The user should g_free() the string once no longer
    *          needed.

+ */


Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

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