@@ -19,12 +19,15 @@ typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
+typedef void QEMUMachineFinalizeDtFunc(MachineState *ms);
+
struct QEMUMachine {
const char *name;
const char *alias;
const char *desc;
QEMUMachineInitFunc *init;
QEMUMachineResetFunc *reset;
+ QEMUMachineFinalizeDtFunc *finalize_dt;
QEMUMachineHotAddCPUFunc *hot_add_cpu;
QEMUMachineGetKvmtypeFunc *kvm_type;
BlockInterfaceType block_default_type;
@@ -73,6 +76,7 @@ struct MachineClass {
void (*init)(MachineState *state);
void (*reset)(void);
+ void (*finalize_dt)(MachineState *state);
void (*hot_add_cpu)(const int64_t id, Error **errp);
int (*kvm_type)(const char *arg);
@@ -1596,6 +1596,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
mc->alias = qm->alias;
mc->desc = qm->desc;
mc->init = qm->init;
+ mc->finalize_dt = qm->finalize_dt;
mc->reset = qm->reset;
mc->hot_add_cpu = qm->hot_add_cpu;
mc->kvm_type = qm->kvm_type;
@@ -4456,6 +4457,10 @@ int main(int argc, char **argv, char **envp)
if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0)
exit(1);
+ if (machine_class->finalize_dt) {
+ machine_class->finalize_dt(current_machine);
+ }
+
net_check_clients();
ds = init_displaystate();
Add a new function to be called after that the init of the generic devices is concluded. This will allow some platforms, like mach-virt, to conclude its device tree generation disposing of all the information about attached devices. Note: This idea accomplishes what is also done by the recent "[PATCH 0/7] machvirt dynamic sysbus device instantiation", as soon as those patches will be accepted, this work will be adapted making use of them. Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com> --- include/hw/boards.h | 4 ++++ vl.c | 5 +++++ 2 files changed, 9 insertions(+)