qemu-devel
[Top][All Lists]
Advanced

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

[PATCH] qapi: Add 'acpi' field to 'query-machines' output


From: Peter Krempa
Subject: [PATCH] qapi: Add 'acpi' field to 'query-machines' output
Date: Mon, 27 Feb 2023 16:31:39 +0100

Report which machine types support ACPI so that management applications
can properly use the 'acpi' property even on platforms such as ARM where
support for ACPI depends on the machine type and thus checking presence
of '-machine acpi=' in 'query-command-line-options' is insufficient.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---

Libvirt intends to use this information to unbreak configs of ARM
machines with machine type which doesn't support ACPI. Historically
we'd use '-no-acpi' as the default was to enable ACPI. Conversion
to the modern equivalent '-machine acpi=' unfortunately didn't really
allow to fix the logic for this specific case whithout additional
information.

Libvirt patches are posted as:
https://listman.redhat.com/archives/libvir-list/2023-February/238153.html

 hw/core/machine-qmp-cmds.c | 1 +
 include/hw/boards.h        | 3 +++
 qapi/machine.json          | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 2d904747c0..b98ff15089 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -102,6 +102,7 @@ MachineInfoList *qmp_query_machines(Error **errp)
         info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
         info->numa_mem_supported = mc->numa_mem_supported;
         info->deprecated = !!mc->deprecation_reason;
+        info->acpi = !!object_class_property_find(OBJECT_CLASS(mc), "acpi");
         if (mc->default_cpu_type) {
             info->default_cpu_type = g_strdup(mc->default_cpu_type);
         }
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 6fbbfd56c8..c18b444bef 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -174,6 +174,8 @@ typedef struct {
  *    index @idx in @ms->possible_cpus[]
  * @has_hotpluggable_cpus:
  *    If true, board supports CPUs creation with -device/device_add.
+ * @has_acpi:
+ *    Machine type has support for ACPI.
  * @default_cpu_type:
  *    specifies default CPU_TYPE, which will be used for parsing target
  *    specific features and for creating CPUs if CPU name wasn't provided
@@ -262,6 +264,7 @@ struct MachineClass {
     bool rom_file_has_mr;
     int minimum_page_bits;
     bool has_hotpluggable_cpus;
+    bool has_acpi;
     bool ignore_memory_transaction_failures;
     int numa_mem_align_shift;
     const char **valid_cpu_types;
diff --git a/qapi/machine.json b/qapi/machine.json
index b9228a5e46..f82a00963b 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -155,6 +155,8 @@
 #
 # @default-ram-id: the default ID of initial RAM memory backend (since 5.2)
 #
+# @acpi: machine type supports acpi (since 8.0)
+#
 # Since: 1.2
 ##
 { 'struct': 'MachineInfo',
@@ -162,7 +164,7 @@
             '*is-default': 'bool', 'cpu-max': 'int',
             'hotpluggable-cpus': 'bool',  'numa-mem-supported': 'bool',
             'deprecated': 'bool', '*default-cpu-type': 'str',
-            '*default-ram-id': 'str' } }
+            '*default-ram-id': 'str', 'acpi': 'bool' } }

 ##
 # @query-machines:
-- 
2.39.2




reply via email to

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