~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to debian/patches/arm-virt/0001-hw-arm-boot-allow-boards-to-provide-an-fdt-blob

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
commit d572248c13788feeac12f46f2c1b17255619af3a
 
2
Author: John Rigby <john.rigby@linaro.org>
 
3
Date:   Fri Aug 9 17:07:20 2013 +0100
 
4
 
 
5
    hw/arm/boot: Allow boards to provide an fdt blob
 
6
    
 
7
    If no fdt is provided on command line and the new field
 
8
    get_dtb in struct arm_boot_info is set then call it to
 
9
    get a device tree blob.
 
10
    
 
11
    Signed-off-by: John Rigby <john.rigby@linaro.org>
 
12
    [PMM: minor tweaks and cleanup]
 
13
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
 
14
 
 
15
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
 
16
index 2cbeefd..9d790b7 100644
 
17
--- a/hw/arm/boot.c
 
18
+++ b/hw/arm/boot.c
 
19
@@ -228,23 +228,31 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
 
20
 static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo)
 
21
 {
 
22
     void *fdt = NULL;
 
23
-    char *filename;
 
24
     int size, rc;
 
25
     uint32_t acells, scells;
 
26
 
 
27
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, binfo->dtb_filename);
 
28
-    if (!filename) {
 
29
-        fprintf(stderr, "Couldn't open dtb file %s\n", binfo->dtb_filename);
 
30
-        goto fail;
 
31
-    }
 
32
+    if (binfo->dtb_filename) {
 
33
+        char *filename;
 
34
+        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, binfo->dtb_filename);
 
35
+        if (!filename) {
 
36
+            fprintf(stderr, "Couldn't open dtb file %s\n", binfo->dtb_filename);
 
37
+            goto fail;
 
38
+        }
 
39
 
 
40
-    fdt = load_device_tree(filename, &size);
 
41
-    if (!fdt) {
 
42
-        fprintf(stderr, "Couldn't open dtb file %s\n", filename);
 
43
+        fdt = load_device_tree(filename, &size);
 
44
+        if (!fdt) {
 
45
+            fprintf(stderr, "Couldn't open dtb file %s\n", filename);
 
46
+            g_free(filename);
 
47
+            goto fail;
 
48
+        }
 
49
         g_free(filename);
 
50
-        goto fail;
 
51
+    } else if (binfo->get_dtb) {
 
52
+        fdt = binfo->get_dtb(binfo, &size);
 
53
+        if (!fdt) {
 
54
+            fprintf(stderr, "Board was unable to create a dtb blob\n");
 
55
+            goto fail;
 
56
+        }
 
57
     }
 
58
-    g_free(filename);
 
59
 
 
60
     acells = qemu_devtree_getprop_cell(fdt, "/", "#address-cells");
 
61
     scells = qemu_devtree_getprop_cell(fdt, "/", "#size-cells");
 
62
@@ -436,7 +444,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
 
63
         /* for device tree boot, we pass the DTB directly in r2. Otherwise
 
64
          * we point to the kernel args.
 
65
          */
 
66
-        if (info->dtb_filename) {
 
67
+        if (info->dtb_filename || info->get_dtb) {
 
68
             /* Place the DTB after the initrd in memory. Note that some
 
69
              * kernels will trash anything in the 4K page the initrd
 
70
              * ends in, so make sure the DTB isn't caught up in that.
 
71
diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h
 
72
index bae87c6..4e51a9e 100644
 
73
--- a/include/hw/arm/arm.h
 
74
+++ b/include/hw/arm/arm.h
 
75
@@ -55,6 +55,13 @@ struct arm_boot_info {
 
76
                                  const struct arm_boot_info *info);
 
77
     void (*secondary_cpu_reset_hook)(ARMCPU *cpu,
 
78
                                      const struct arm_boot_info *info);
 
79
+    /* if a board is able to create a dtb without a dtb file then it
 
80
+     * sets get_dtb. This will only be used if no dtb file is provided
 
81
+     * by the user. On success, sets *size to the length of the created
 
82
+     * dtb, and returns a pointer to it. (The caller must free this memory
 
83
+     * with g_free() when it has finished with it.) On failure, returns NULL.
 
84
+     */
 
85
+    void *(*get_dtb)(const struct arm_boot_info *info, int *size);
 
86
     /* if a board needs to be able to modify a device tree provided by
 
87
      * the user it should implement this hook.
 
88
      */