[PATCH for-6.0] accel: Wire accel to /machine

Roman Bolshakov r.bolshakov at yadro.com
Mon Dec 7 08:46:22 UTC 2020


There's no generic way to query current accel and its properties via QOM
because there's no link between an accel and current machine.

The change adds the link, i.e. if HVF is enabled the following will be
available in QOM:

  (qemu) qom-get /machine/accel type
  "hvf-accel"

Suggested-by: Markus Armbruster <armbru at redhat.com>
Suggested-by: Paolo Bonzini <pbonzini at redhat.com>
Signed-off-by: Roman Bolshakov <r.bolshakov at yadro.com>
---

Hi,

this is a follow up patch that deprecates earlier series [1].

An outstanding issue is whether management applications can rely on the
value of /machine/accel/type and output of qom-list-types command [2][3]
to get current and present accels?

i.e. would it be ok if libvirt assumes that everything up to the first
dash in the accel type is the name of the accel (as specified via -M
accel=ACCEL flag) when it performs QEMU probing?

Also, Eduardo and Claudio earlier had ideas to provide cpu-specific
accel subclasses [4][5].

1. https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg03944.html
2. https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg04212.html
3. https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg07062.html
4. https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg06513.html
5. https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg06741.html

Thanks,
Roman

 accel/accel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/accel/accel.c b/accel/accel.c
index cb555e3b06..45c5bf87b1 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -56,10 +56,11 @@ int accel_init_machine(AccelState *accel, MachineState *ms)
     if (ret < 0) {
         ms->accelerator = NULL;
         *(acc->allowed) = false;
-        object_unref(OBJECT(accel));
     } else {
         object_set_accelerator_compat_props(acc->compat_props);
+        object_property_add_child(OBJECT(ms), "accel", OBJECT(accel));
     }
+    object_unref(OBJECT(accel));
     return ret;
 }
 
-- 
2.29.2





More information about the libvir-list mailing list