On 13/2/23 10:50, Zhao Liu wrote:
From: Zhao Liu <zhao1....@intel.com>

Since supported core types are architecture specific, we need this hook
to allow archs define its own parsing or validation method.

As the example, add the x86 core_type() which will be used in "-hybrid"
parameter parsing.

What would be a "core type" for other archs?

Signed-off-by: Zhao Liu <zhao1....@intel.com>
---
  hw/core/machine-topo.c | 14 ++++++++++++++
  hw/core/machine.c      |  1 +
  hw/i386/x86.c          | 15 +++++++++++++++
  include/hw/boards.h    |  7 +++++++
  4 files changed, 37 insertions(+)


index 9364c90d5f1a..34ec035b5c9f 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -36,6 +36,7 @@ void machine_set_cpu_numa_node(MachineState *machine,
                                 Error **errp);
  void machine_parse_smp_config(MachineState *ms,
                                const SMPConfiguration *config, Error **errp);
+int machine_parse_hybrid_core_type(MachineState *ms, const char *coretype);
/**
   * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
@@ -199,6 +200,11 @@ typedef struct {
   *    Return the type of KVM corresponding to the kvm-type string option or
   *    computed based on other criteria such as the host kernel capabilities.
   *    kvm-type may be NULL if it is not needed.
+ * @core_type:
+ *    Return the type of hybrid cores corresponding to the coretype string
+ *    option. The default hook only accept "none" or "" since the most generic
+ *    core topology should not specify any specific core type. Each arch can
+ *    define its own core_type() hook to override the default one.
   * @numa_mem_supported:
   *    true if '--numa node.mem' option is supported and false otherwise
   * @hotplug_allowed:
@@ -237,6 +243,7 @@ struct MachineClass {
      void (*reset)(MachineState *state, ShutdownCause reason);
      void (*wakeup)(MachineState *state);
      int (*kvm_type)(MachineState *machine, const char *arg);
+    int (*core_type)(MachineState *state, const char *type);
BlockInterfaceType block_default_type;
      int units_per_default_bus;


Reply via email to