From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com>, aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 5/7] microblaze: Fix latent bug with default DTB lookup
Date: Thu, 4 Jul 2013 15:09:21 +0200 [thread overview]
Message-ID: <1372943363-24081-6-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1372943363-24081-1-git-send-email-armbru@redhat.com>
microblaze_load_kernel() fails to call
qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename) when no -machine
options are given. This can't normally happen, because -machine
option kernel is mandatory for this target. Fix it anyway, by using
qemu_get_machine_opts().
Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/microblaze/boot.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index 3f1d70e..5b057f7 100644
--- a/hw/microblaze/boot.c
+++ b/hw/microblaze/boot.c
@@ -28,6 +28,7 @@
#include "qemu/config-file.h"
#include "qemu-common.h"
#include "sysemu/device_tree.h"
+#include "sysemu/sysemu.h"
#include "hw/loader.h"
#include "elf.h"
@@ -93,20 +94,18 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,
void (*machine_cpu_reset)(MicroBlazeCPU *))
{
QemuOpts *machine_opts;
- const char *kernel_filename = NULL;
- const char *kernel_cmdline = NULL;
-
- machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
- if (machine_opts) {
- const char *dtb_arg;
- kernel_filename = qemu_opt_get(machine_opts, "kernel");
- kernel_cmdline = qemu_opt_get(machine_opts, "append");
- dtb_arg = qemu_opt_get(machine_opts, "dtb");
- if (dtb_arg) { /* Preference a -dtb argument */
- dtb_filename = dtb_arg;
- } else { /* default to pcbios dtb as passed by machine_init */
- dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
- }
+ const char *kernel_filename;
+ const char *kernel_cmdline;
+ const char *dtb_arg;
+
+ machine_opts = qemu_get_machine_opts();
+ kernel_filename = qemu_opt_get(machine_opts, "kernel");
+ kernel_cmdline = qemu_opt_get(machine_opts, "append");
+ dtb_arg = qemu_opt_get(machine_opts, "dtb");
+ if (dtb_arg) { /* Preference a -dtb argument */
+ dtb_filename = dtb_arg;
+ } else { /* default to pcbios dtb as passed by machine_init */
+ dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
}
boot_info.machine_cpu_reset = machine_cpu_reset;
--
1.7.11.7
next prev parent reply other threads:[~2013-07-04 13:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-04 13:09 [Qemu-devel] [PATCH 0/7] Fixes around -machine Markus Armbruster
2013-07-04 13:09 ` [Qemu-devel] [PATCH 1/7] qemu-option: Fix qemu_opts_find() for null id arguments Markus Armbruster
2013-07-04 14:40 ` Peter Maydell
2013-07-04 13:09 ` [Qemu-devel] [PATCH 2/7] qemu-option: Fix qemu_opts_set_defaults() for corner cases Markus Armbruster
2013-07-04 14:34 ` Peter Maydell
2013-07-04 15:28 ` Markus Armbruster
2013-07-04 15:53 ` Peter Maydell
2013-07-04 13:09 ` [Qemu-devel] [PATCH 3/7] vl: New qemu_get_machine_opts() Markus Armbruster
2013-07-04 14:38 ` Peter Maydell
2013-07-04 15:03 ` Markus Armbruster
2013-07-04 15:11 ` Peter Maydell
2013-07-04 16:11 ` Markus Armbruster
2013-07-04 16:46 ` Peter Maydell
2013-07-04 15:14 ` Andreas Färber
2013-07-04 13:09 ` [Qemu-devel] [PATCH 4/7] Fix -machine options accel, kernel_irqchip, kvm_shadow_mem Markus Armbruster
2013-07-04 14:42 ` Peter Maydell
2013-07-04 15:58 ` Markus Armbruster
2013-07-04 16:03 ` Peter Maydell
2013-07-04 16:50 ` Markus Armbruster
2013-07-04 13:09 ` Markus Armbruster [this message]
2013-07-10 3:05 ` [Qemu-devel] [PATCH 5/7] microblaze: Fix latent bug with default DTB lookup Peter Crosthwaite
2013-07-04 13:09 ` [Qemu-devel] [PATCH 6/7] Simplify -machine option queries with qemu_get_machine_opts() Markus Armbruster
2013-07-04 13:09 ` [Qemu-devel] [PATCH 7/7] vl: Tighten parsing of -machine option phandle_start Markus Armbruster
2013-07-04 13:31 ` Alexander Graf
2013-07-04 15:01 ` Markus Armbruster
2013-07-04 23:21 ` Alexander Graf
2013-07-10 19:33 ` [Qemu-devel] [PATCH 0/7] Fixes around -machine Anthony Liguori
2013-07-11 6:45 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372943363-24081-6-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=peter.crosthwaite@petalogix.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).