qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 3/8] QEMUMachine: finalize_dt function


From: Alvise Rigo
Subject: [Qemu-devel] [RFC PATCH 3/8] QEMUMachine: finalize_dt function
Date: Fri, 11 Jul 2014 09:21:05 +0200

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 <address@hidden>
---
 include/hw/boards.h | 4 ++++
 vl.c                | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 2d2e2be..40dd003 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -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);
 
diff --git a/vl.c b/vl.c
index ac0e3d7..550a377 100644
--- a/vl.c
+++ b/vl.c
@@ -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();
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]