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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJYPDVpAAoJEDwlJe0UNgze/WIQAKctEMKR/ct7S8AuEqzW6917
 3x0lObOiEsogQAZX2kqo49/9d5H74/T1qVSgMAKRotcGdos3a2igj3dNOy+/mrvk
 s2fsKLZri95tNSlHGS8A2E+SCUvynzpzG52vI/S+oAcx0/zKpD/GAUCcRDatQP7o
 va/eMlbditeAG6Y8qaHafgrfgxlm0kQpywtli2ZMaaJz7kMmid8dfGqPm1sJFk8S
 lxIJVsy5e/g8sQn/bR2i5RcE5Q+e6VAnwYifzi3YKPNPl+YHy0P8J99mXQ6kAPke
 uxybd60c2isvqxRzGceNRNkVmati2wyHHH0lXY4p2Mf25FqkcWyCZHqg1/kNX1Ox
 YBmYl01YQCCgTRCbw1qyjGq9F2R6RZbJdmtwiiVwUz/hbK/KHclrGeUVNh1Dqde+
 xVqvxb9dVb02BM/X9k1u/u4AZHYffGJDHQWo2xSBHn8C/R6uVtXlDQ4h56XiU9Ij
 eShVv5NiWK1VCSMltU0skzKZkBmLI9sddqBPywWdtgyjabFhq4vmW5MGBHIPIY+B
 UKkP+K5sTHd8rjMd9KcTtGj2Q83XLkKTUJQXVQp1ti1wUSHdkqJt0sptxWOEIlaW
 QXWHX4FiLniYU+fqj7V1EGld1I9SXncjexgxSKbvxWBEY0eX6eVo/nt19QqHzwcI
 EBXbQHZifiSeWtGhKxVP
 =7F5K
 -----END PGP SIGNATURE-----

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: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2016-11-29 09:28:24 +00:00
commit 517dcb8785
2 changed files with 23 additions and 1 deletions

View File

@ -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);

View File

@ -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) {