[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 0/6] QAPI support for device cold-plug
From: |
Damien Hedde |
Subject: |
[PATCH v5 0/6] QAPI support for device cold-plug |
Date: |
Thu, 19 May 2022 17:33:56 +0200 |
Hi all,
As of now dynamic cold plug of device is only possible using the CLI
"-device" option. This series add support for device cold-plug using QAPI.
Patches 2, 5 and 6 are not reviewed yet.
It relies on the use of the "preconfig" mode (only way to stop QEMU
early enough) and requires more control on the machine phase than we had
before.
This work is part of our work towards to build a machine from scratch
using QAPI (see v4 or [1]).
But this is an independent part which can already be used to add
devices on any machine using QAPI instead of having to use the CLI to
pass some options.
For example, in this command the network interface could be added using qapi:
> $ qemu-system-aarch64 -display none -M virt -cpu cortex-a53 \
> -drive file=./images/rootfs.ext4,if=none,format=raw,id=hd0 \
> -device virtio-blk-device,drive=hd0 \
> -kernel ./images/Image -append "rootwait root=/dev/vda console=ttyAMA0" \
> -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 \
> -serial stdio
By using the following command line:
> $ qemu-system-aarch64 -display none -M virt -cpu cortex-a53 \
> -drive file=./images/rootfs.ext4,if=none,format=raw,id=hd0 \
> -device virtio-blk-device,drive=hd0 \
> -kernel ./images/Image -append "rootwait root=/dev/vda console=ttyAMA0" \
> -serial stdio -preconfig -qmp socket,path=./qmpsocket,server
and then qmp-shell (or any other qmp tool) to add the network interface and
device:
> $ qmp-shell ./qmpsocket
> (QEMU) netdev_add type=user id=eth0
> {"return": {}}
> (QEMU) device_add driver=virtio-net-device netdev=eth0
> {"return": {}}
> (QEMU) x-exit-preconfig
> {"return": {}}
Thanks,
--
Damien
v5:
+ refactor patch 2 to avoid indentation changes
v4:
https://lore.kernel.org/qemu-devel/20220223090706.4888-1-damien.hedde@greensocs.com/
[1]: https://github.com/GreenSocs/qemu-qmp-machines
Damien Hedde (5):
machine: add phase_get() and document phase_check()/advance()
machine&vl: introduce phase_until() to handle phase transitions
vl: support machine-initialized target in phase_until()
qapi/device_add: compute is_hotplug flag
RFC qapi/device_add: handle the rom_order_override when cold-plugging
Mirela Grujic (1):
qapi/device_add: Allow execution in machine initialized phase
qapi/qdev.json | 3 +-
include/hw/qdev-core.h | 33 +++++++++++++++++++
hw/core/qdev.c | 5 +++
monitor/misc.c | 2 +-
softmmu/qdev-monitor.c | 20 ++++++++++--
softmmu/vl.c | 72 ++++++++++++++++++++++++++++++++++++++----
hmp-commands.hx | 1 +
7 files changed, 126 insertions(+), 10 deletions(-)
--
2.36.1
- [PATCH v5 0/6] QAPI support for device cold-plug,
Damien Hedde <=
- [PATCH v5 3/6] vl: support machine-initialized target in phase_until(), Damien Hedde, 2022/05/19
- [PATCH v5 2/6] machine&vl: introduce phase_until() to handle phase transitions, Damien Hedde, 2022/05/19
- [PATCH v5 1/6] machine: add phase_get() and document phase_check()/advance(), Damien Hedde, 2022/05/19
- [PATCH v5 6/6] qapi/device_add: Allow execution in machine initialized phase, Damien Hedde, 2022/05/19
- [PATCH v5 4/6] qapi/device_add: compute is_hotplug flag, Damien Hedde, 2022/05/19