Re: [RFC PATCH v2 04/16] softmmu/qdev-monitor: add error handling in qdev_set_id

2021-10-13 Thread Damien Hedde
On 10/13/21 09:10, Alistair Francis wrote: On Thu, Sep 23, 2021 at 2:29 AM Damien Hedde wrote: qdev_set_id() is mostly used when the user adds a device (using -device cli option or device_add qmp command). This commit adds an error parameter to handle the case where the given id is already

Re: [RFC PATCH v2 00/16] Initial support for machine creation via QMP

2021-10-04 Thread Damien Hedde
e 2. -> about enabling using device_add QMP commands during this phase 3. -> about the sysbus device case (some of the patches are even independent) Thanks, Damien On 9/22/21 18:13, Damien Hedde wrote: Hi, The goal of this work is to bring dynamic machine creation to QEMU: we wa

Re: [RFC PATCH v2 10/16] qdev-monitor: allow adding any sysbus device before machine is ready

2021-09-23 Thread Damien Hedde
On 9/23/21 13:55, Ani Sinha wrote: On Thu, 23 Sep 2021, Ani Sinha wrote: On Wed, 22 Sep 2021, Damien Hedde wrote: Skip the sysbus device type per-machine allow-list check before the MACHINE_INIT_PHASE_READY phase. This patch permits adding any sysbus device (it still needs to be

Re: [RFC PATCH v2 07/16] hw/core/machine: add machine_class_is_dynamic_sysbus_dev_allowed

2021-09-23 Thread Damien Hedde
On 9/23/21 12:51, Ani Sinha wrote: On Wed, 22 Sep 2021, Damien Hedde wrote: Right now the allowance check for adding a sysbus device using -device cli option (or device_add qmp command) is done well after the device has been created. It is done during the machine init done notifier

Re: [RFC PATCH v2 02/16] qapi: Implement query-machine-phase QMP command

2021-09-23 Thread Damien Hedde
On 9/22/21 19:37, Philippe Mathieu-Daudé wrote: On 9/22/21 18:13, Damien Hedde wrote: From: Mirela Grujic The command returns current machine initialization phase.  From now on, the MachineInitPhase enum is generated from the QAPI schema. Signed-off-by: Mirela Grujic Missing your S-o-b

Re: [RFC PATCH v2 00/16] Initial support for machine creation via QMP

2021-09-23 Thread Damien Hedde
On 9/22/21 19:50, Philippe Mathieu-Daudé wrote: Hi Damien, On 9/22/21 18:13, Damien Hedde wrote: The goal of this work is to bring dynamic machine creation to QEMU: we want to setup a machine without compiling a specific machine C code. It would ease supporting highly configurable

[RFC PATCH v2 06/16] qapi: Allow device_add to execute in machine initialized phase

2021-09-22 Thread Damien Hedde
From: Mirela Grujic To configure a machine using QMP we need the device_add command to execute at machine initialized phase. Note: for device_add command in qdev.json adding the 'allow-init-config' option has no effect because the command appears to bypass QAPI (see TODO at qapi/qdev.json:61). T

[RFC PATCH v2 10/16] qdev-monitor: allow adding any sysbus device before machine is ready

2021-09-22 Thread Damien Hedde
Skip the sysbus device type per-machine allow-list check before the MACHINE_INIT_PHASE_READY phase. This patch permits adding any sysbus device (it still needs to be user_creatable) when using the -preconfig experimental option. Signed-off-by: Damien Hedde --- This commit is RFC. Depending on

[RFC PATCH v2 04/16] softmmu/qdev-monitor: add error handling in qdev_set_id

2021-09-22 Thread Damien Hedde
evice" QemuOptsList where the id is used as key. This addition is a preparation for a future commit which will relax the uniqueness. Signed-off-by: Damien Hedde --- include/monitor/qdev.h | 25 +++- hw/xen/xen-legacy-backend.c | 3 ++- softmmu/qdev-monitor.c

[RFC PATCH v2 12/16] add x-sysbus-mmio-map qmp command

2021-09-22 Thread Damien Hedde
but also multiple mapping of one mmio. For some devices, one mmio is mapped several times at different addresses on the bus (which is not supported by sysbus_mmio_map() function and requires the use of memory region aliases). Signed-off-by: Damien Hedde --- Note: this qmp command is required to

[RFC PATCH v2 02/16] qapi: Implement query-machine-phase QMP command

2021-09-22 Thread Damien Hedde
From: Mirela Grujic The command returns current machine initialization phase. >From now on, the MachineInitPhase enum is generated from the QAPI schema. Signed-off-by: Mirela Grujic --- qapi/machine.json | 56 ++ include/hw/qdev-core.h | 30 ++--

[RFC PATCH v2 09/16] hw/core/machine: Remove the dynamic sysbus devices type check

2021-09-22 Thread Damien Hedde
seem to appear apart from hw/xen/xen-legacy-backend.c (it uses qdev_set_id() and in this case, not for a sysbus device, so it's ok). Signed-off-by: Damien Hedde --- include/hw/boards.h | 1 - hw/core/machine.c | 27 --- 2 files changed, 28 deletions(-) diff --

[RFC PATCH v2 13/16] hw/mem/system-memory: add a memory sysbus device

2021-09-22 Thread Damien Hedde
This device can be used to create some memories using standard device_add qmp command. This device has one property 'readonly' which allows to choose between a ram or a rom. The device holds the adequate memory region and can be put on the sysbus. Signed-off-by: Damien Hedde --- Sho

[RFC PATCH v2 11/16] softmmu/memory: add memory_region_try_add_subregion function

2021-09-22 Thread Damien Hedde
priority parameter to 0. This commit is a preparation to further use this function in the context of qmp command which needs error handling support. Signed-off-by: Damien Hedde --- Adding a new function is obviously not ideal. But there is ~900 occurrences of memory_region_add_subregion[_overlap

[RFC PATCH v2 05/16] qdev-monitor: prevent conflicts between qmp/device_add and cli/-device

2021-09-22 Thread Damien Hedde
order to avoid the cli -device code to try to create the device again. This commit preserves the opts behavior regarding the devices added in 'ready' phase by the QMP command device_add. Signed-off-by: Damien Hedde --- Although we keep the original behavior for QMP commands issue

[RFC PATCH v2 03/16] qapi: Implement x-machine-init QMP command

2021-09-22 Thread Damien Hedde
From: Mirela Grujic The x-machine-init QMP command is available only if the -preconfig option is used and the current machine initialization phase is accel-created. The command triggers QEMU to enter machine initialized phase and wait for the QMP configuration. In future commits, we will add the

[RFC PATCH v2 15/16] hw/char/ibex_uart: set user_creatable

2021-09-22 Thread Damien Hedde
This patch allows to create the device using device_add using -preconfig mode. This sysbus device still needs to be allowed by a machine to be created after preconfig is done. Signed-off-by: Damien Hedde --- Depending on chosen condition for a device to be added, this commit may change. --- hw

[RFC PATCH v2 08/16] qdev-monitor: Check sysbus device type before creating it

2021-09-22 Thread Damien Hedde
notifier). We can now report the error right away. Signed-off-by: Damien Hedde --- softmmu/qdev-monitor.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 47ccd90be8..f1c9242855 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev

[RFC PATCH v2 01/16] rename MachineInitPhase enum constants for QAPI compatibility

2021-09-22 Thread Damien Hedde
From: Mirela Grujic This commit is a preparation to switch to a QAPI definition of the MachineInitPhase enum. QAPI will generate enumeration constants prefixed with the MACHINE_INIT_PHASE_, so rename values accordingly. Signed-off-by: Mirela Grujic --- include/hw/qdev-core.h | 10 +---

[RFC PATCH v2 07/16] hw/core/machine: add machine_class_is_dynamic_sysbus_dev_allowed

2021-09-22 Thread Damien Hedde
sysbus device type is allowed to be dynamically created by the machine during the device creation time. Also make device_is_dynamic_sysbus() use the new function. Signed-off-by: Damien Hedde --- In the context of our series, we need to be able to do the check at device creation time to allow

[RFC PATCH v2 14/16] docs/system: add doc about the initialized machine phase and an example

2021-09-22 Thread Damien Hedde
Signed-off-by: Damien Hedde --- docs/system/managed-startup.rst | 77 + 1 file changed, 77 insertions(+) diff --git a/docs/system/managed-startup.rst b/docs/system/managed-startup.rst index 9bcf98ea79..af12a10d27 100644 --- a/docs/system/managed-startup.rst +++ b

[RFC PATCH v2 16/16] hw/intc/ibex_plic: set user_creatable

2021-09-22 Thread Damien Hedde
This patch allows to create the device using device_add using -preconfig mode. This sysbus device still needs to be allowed by a machine to be created after preconfig is done. Signed-off-by: Damien Hedde --- Depending on chosen condition for a device to be added, this commit may change. --- hw

[RFC PATCH v2 00/16] Initial support for machine creation via QMP

2021-09-22 Thread Damien Hedde
tches 1 to 3 add qmp support to stop QEMU at an early phase to populate the machine with devices. - Patches 4 to 6 prepare and allow issuing device_add during this phase. - Patches 7 to 10 prepare and allow creating sysbus device during this phase. - Patches 11 and 12 add the x-sysbus-mmio-map QM