|
@@ -19,6 +19,7 @@
|
|
#include "qemu/error-report.h"
|
|
#include "qemu/error-report.h"
|
|
#include "qapi/error.h"
|
|
#include "qapi/error.h"
|
|
#include "qapi/qapi-visit-machine.h"
|
|
#include "qapi/qapi-visit-machine.h"
|
|
|
|
+#include "qapi/qapi-commands-machine.h"
|
|
#include "qemu/madvise.h"
|
|
#include "qemu/madvise.h"
|
|
#include "qom/object_interfaces.h"
|
|
#include "qom/object_interfaces.h"
|
|
#include "system/cpus.h"
|
|
#include "system/cpus.h"
|
|
@@ -1696,6 +1697,24 @@ void qemu_remove_machine_init_done_notifier(Notifier *notify)
|
|
notifier_remove(notify);
|
|
notifier_remove(notify);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void handle_machine_dumpdtb(MachineState *ms)
|
|
|
|
+{
|
|
|
|
+ if (!ms->dumpdtb) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!ms->fdt) {
|
|
|
|
+ /* Silently ignore dumpdtb option if there is nothing to dump */
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+#ifdef CONFIG_FDT
|
|
|
|
+ qmp_dumpdtb(ms->dumpdtb, &error_fatal);
|
|
|
|
+ exit(0);
|
|
|
|
+#else
|
|
|
|
+ error_report("This machine doesn't have an FDT");
|
|
|
|
+ exit(1);
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+
|
|
void qdev_machine_creation_done(void)
|
|
void qdev_machine_creation_done(void)
|
|
{
|
|
{
|
|
cpu_synchronize_all_post_init();
|
|
cpu_synchronize_all_post_init();
|
|
@@ -1712,6 +1731,12 @@ void qdev_machine_creation_done(void)
|
|
phase_advance(PHASE_MACHINE_READY);
|
|
phase_advance(PHASE_MACHINE_READY);
|
|
qdev_assert_realized_properly();
|
|
qdev_assert_realized_properly();
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * If the user used -machine dumpdtb=file.dtb to request that we
|
|
|
|
+ * dump the DTB to a file, do it now, and exit.
|
|
|
|
+ */
|
|
|
|
+ handle_machine_dumpdtb(current_machine);
|
|
|
|
+
|
|
/* TODO: once all bus devices are qdevified, this should be done
|
|
/* TODO: once all bus devices are qdevified, this should be done
|
|
* when bus is created by qdev.c */
|
|
* when bus is created by qdev.c */
|
|
/*
|
|
/*
|