[PATCH 0/2] qdev,accel-system: allow Accel type globals

Daniel Henrique Barboza posted 2 patches 5 months, 4 weeks ago
accel/accel-system.c         |  3 +++
hw/core/qdev-properties.c    | 39 +++++++++++++++++++++++-------------
hw/core/qdev.c               |  2 +-
include/hw/qdev-properties.h |  2 +-
4 files changed, 30 insertions(+), 16 deletions(-)
[PATCH 0/2] qdev,accel-system: allow Accel type globals
Posted by Daniel Henrique Barboza 5 months, 4 weeks ago
Hi,

This is another approach of the problem we tried to fix with [1]. It was
suggested by Paolo during the review.

In the current handling of '-accel' only the first instance is parsed.
All other instances (aside from a 'helper' command that triggers the
help text and exits) is ignored. So this command line:

qemu-system-riscv64 -accel kvm -accel kvm,riscv-aia=hwaccel

Won't change 'riscv-aia' to 'hwaccel'. 

This is affecting at least one use case we have with libvirt and RISC-V:
we can't set 'riscv-aia' by appending '-accel kvm,riscv-aia=val'
via <qemu:cmdline> in the domain XML. libvirt will add a leading
'-accel kvm' in the regular command line and ignore the second. We'll
add official libvirt support for this KVM property in the near future
(we're still discussing if this prop should be a bool instead), but
for now a QEMU side change would unlock this RISC-V KVM use case in
libvirt.

With this series we'll be able to set 'riscv-aia' using globals as
follows:

qemu-system-riscv64 -accel kvm -global kvm-accel.riscv-aia=hwaccel

This change benefit all archs (not just RISC-V) and will allow globals
to be used with all accelerators, not just KVM.

[1] https://lore.kernel.org/qemu-devel/20240701133038.1489043-1-dbarboza@ventanamicro.com/

Daniel Henrique Barboza (2):
  qdev: change qdev_prop_set_globals() to use Object*
  qdev, accel-system: add support to Accel globals

 accel/accel-system.c         |  3 +++
 hw/core/qdev-properties.c    | 39 +++++++++++++++++++++++-------------
 hw/core/qdev.c               |  2 +-
 include/hw/qdev-properties.h |  2 +-
 4 files changed, 30 insertions(+), 16 deletions(-)

-- 
2.45.2