提交 517dcb87 编写于 作者: S Stefan Hajnoczi

Merge remote-tracking branch 'pm215/tags/pull-target-arm-20161128' into staging

target-arm queue:
 * hw/arm/boot: fix crash handling device trees with no /chosen
   or /memory nodes
 * generic-loader: only set PC if a CPU is specified

# gpg: Signature made Mon 28 Nov 2016 01:47:21 PM GMT
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* pm215/tags/pull-target-arm-20161128:
  arm: Create /chosen and /memory devicetree nodes if necessary
  generic-loader: file: Only set a PC if a CPU is specified

Message-id: 1480341071-5367-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
......@@ -9,6 +9,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include <libfdt.h>
#include "hw/hw.h"
#include "hw/arm/arm.h"
#include "hw/arm/linux-boot-if.h"
......@@ -486,6 +487,17 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
g_free(nodename);
}
} else {
Error *err = NULL;
rc = fdt_path_offset(fdt, "/memory");
if (rc < 0) {
qemu_fdt_add_subnode(fdt, "/memory");
}
if (!qemu_fdt_getprop(fdt, "/memory", "device_type", NULL, &err)) {
qemu_fdt_setprop_string(fdt, "/memory", "device_type", "memory");
}
rc = qemu_fdt_setprop_sized_cells(fdt, "/memory", "reg",
acells, binfo->loader_start,
scells, binfo->ram_size);
......@@ -495,6 +507,11 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
}
}
rc = fdt_path_offset(fdt, "/chosen");
if (rc < 0) {
qemu_fdt_add_subnode(fdt, "/chosen");
}
if (binfo->kernel_cmdline && *binfo->kernel_cmdline) {
rc = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
binfo->kernel_cmdline);
......
......@@ -93,7 +93,12 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
"image");
return;
}
s->set_pc = true;
/* The user specified a file, only set the PC if they also specified
* a CPU to use.
*/
if (s->cpu_num != CPU_NONE) {
s->set_pc = true;
}
} else if (s->addr) {
/* User is setting the PC */
if (s->data || s->data_len || s->data_be) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册