Skip to contentSkip to conversation

Require libfdt for arm/microblaze/ppc softmmu targets

PATCH In review Peter Maydell 4 participants 11 messages May 24, 2013 – May 28, 2013

lore
Share & tools
lore
#0 lore raw

cover Require libfdt for arm/microblaze/ppc softmmu targets

This patchset makes libfdt mandatory for building the ARM, MicroBlaze and PPC softmmu targets. These architectures need libfdt for at least some of their board models to be usefully functional, so now that we have an in-tree version of libfdt it's better to insist on using it rather than allowing users to build less-than-useful binaries.

NB: I have tested the ARM change, but only compile-tested PPC and MicroBlaze.

Peter Maydell (4):
configure: Require libfdt for arm, ppc, microblaze softmmu targets
arm: Remove CONFIG_FDT conditionals
microblaze: Remove CONFIG_FDT conditionals
ppc: Remove CONFIG_FDT conditionals

 configure                          |   20 ++++++++++++++++++++
 default-configs/ppc-softmmu.mak    |    2 +-
 default-configs/ppc64-softmmu.mak  |    4 ++--
 default-configs/ppcemb-softmmu.mak |    2 +-
 hw/arm/boot.c                      |    7 -------
 hw/microblaze/boot.c               |   12 ------------
 hw/ppc/ppc440_bamboo.c             |    2 --
 hw/ppc/spapr_vio.c                 |    6 ------
 hw/ppc/virtex_ml507.c              |   18 ------------------
 9 files changed, 24 insertions(+), 49 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 configure: Require libfdt for arm, ppc, microblaze softmmu targets

A number of our softmmu targets (PPC, ARM, Microblaze) now more or less require flattened device tree support for various board models to work correctly. Make libfdt mandatory if the target list includes these, rather than building unhelpful half-functional binaries.

---
 configure |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
configure +20 -0
index 5ae7e4a..708c010 100755
@@ -2518,6 +2518,26 @@ fi
 
 ##########################################
 # fdt probe
+# fdt support is mandatory for at least some target architectures,
+# so insist on it if we're building those system emulators.
+fdt_required=no
+for target in $target_list; do
+  case $target in
+    arm*softmmu|ppc*softmmu|microblaze*softmmu)
+      fdt_required=yes
+    ;;
+  esac
+done
+
+if test "$fdt_required" = "yes"; then
+  if test "$fdt" = "no"; then
+    error_exit "fdt disabled but some requested targets require it." \
+      "You can turn off fdt only if you also disable all the system emulation" \
+      "targets which need it (by specifying a cut down --target-list)."
+  fi
+  fdt=yes
+fi
+
 if test "$fdt" != "no" ; then
   fdt_libs="-lfdt"
   cat > $TMPC << EOF
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/4
#2 lore raw

Re: [Qemu-devel] [PATCH 1/4] configure: Require libfdt for arm, ppc, microblaze softmmu targets

Quoted 6 lines · Peter Maydell

A number of our softmmu targets (PPC, ARM, Microblaze) now more or less require flattened device tree support for various board models to work correctly. Make libfdt mandatory if the target list includes these, rather than building unhelpful half-functional binaries.

Quoted 39 lines
---
 configure |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
configure +20 -1
index 5ae7e4a..708c010 100755
@@ -2518,6 +2518,26 @@ fi
 
 ##########################################
 # fdt probe
+# fdt support is mandatory for at least some target architectures,
+# so insist on it if we're building those system emulators.
+fdt_required=no
+for target in $target_list; do
+  case $target in
+    arm*softmmu|ppc*softmmu|microblaze*softmmu)
+      fdt_required=yes
+    ;;
+  esac
+done
+
+if test "$fdt_required" = "yes"; then
+  if test "$fdt" = "no"; then
+    error_exit "fdt disabled but some requested targets require it." \
+      "You can turn off fdt only if you also disable all the system emulation" \
+      "targets which need it (by specifying a cut down --target-list)."
+  fi
+  fdt=yes
+fi
+
 if test "$fdt" != "no" ; then
   fdt_libs="-lfdt"
   cat > $TMPC << EOF
--

1.7.9.5

#3 lore raw

Re: [Qemu-devel] [PATCH 1/4] configure: Require libfdt for arm, ppc, microblaze softmmu targets

In reply to Peter Maydell

Am 24.05.2013 17:26, schrieb Peter Maydell:

Quoted 15 lines

A number of our softmmu targets (PPC, ARM, Microblaze) now more or less require flattened device tree support for various board models to work correctly. Make libfdt mandatory if the target list includes these, rather than building unhelpful half-functional binaries.

---
 configure |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
configure +0 -0
index 5ae7e4a..708c010 100755

configure fi · line 2526

Quoted 9 lines
configure +6 -0
@@ -2518,6 +2518,26 @@ fi
 
 ##########################################
 # fdt probe
+# fdt support is mandatory for at least some target architectures,
+# so insist on it if we're building those system emulators.
+fdt_required=no
+for target in $target_list; do
+  case $target in
+    arm*softmmu|ppc*softmmu|microblaze*softmmu)

Assuming you'll apply this through your tree, it would be more self-explanatory to use foo*-softmmu despite no practical difference.

I'm guessing arm* is in preparation for a future armeb-softmmu?

Otherwise looks good; still have testing pseries on my TODO list.

Andreas

Quoted 17 lines
configure +14 -0
+      fdt_required=yes
+    ;;
+  esac
+done
+
+if test "$fdt_required" = "yes"; then
+  if test "$fdt" = "no"; then
+    error_exit "fdt disabled but some requested targets require it." \
+      "You can turn off fdt only if you also disable all the system emulation" \
+      "targets which need it (by specifying a cut down --target-list)."
+  fi
+  fdt=yes
+fi
+
 if test "$fdt" != "no" ; then
   fdt_libs="-lfdt"
   cat > $TMPC << EOF
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw

Re: [Qemu-devel] [PATCH 1/4] configure: Require libfdt for arm, ppc, microblaze softmmu targets

Quoted 10 lines · Andreas Färber

Am 24.05.2013 17:26, schrieb Peter Maydell:

configure fi · line 2526

Quoted 6 lines
configure +6 -0
+# fdt support is mandatory for at least some target architectures,
+# so insist on it if we're building those system emulators.
+fdt_required=no
+for target in $target_list; do
+  case $target in
+    arm*softmmu|ppc*softmmu|microblaze*softmmu)

Assuming you'll apply this through your tree, it would be more self-explanatory to use foo*-softmmu despite no practical difference.

Agreed.

Quoted 1 line

I'm guessing arm* is in preparation for a future armeb-softmmu?

Yes, also for consistency with ppc.

-- PMM

#5 lore raw

PATCH 2/4 arm: Remove CONFIG_FDT conditionals

In reply to Peter Maydell

Now that we know we're compiling with libfdt, we can remove the CONFIG_FDT conditionals.

---
 hw/arm/boot.c |    7 -------
 1 file changed, 7 deletions(-)
hw/arm/boot.c +0 -7
index f451529..defcf15 100644
@@ -227,7 +227,6 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
 
 static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo)
 {
-#ifdef CONFIG_FDT
     uint32_t *mem_reg_property;
     uint32_t mem_reg_propsize;
     void *fdt = NULL;
@@ -308,12 +307,6 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo)
     cpu_physical_memory_write(addr, fdt, size);
 
     return 0;
-
-#else
-    fprintf(stderr, "Device tree requested, "
-                "but qemu was compiled without fdt support\n");
-    return -1;
-#endif
 }
 
 static void do_cpu_reset(void *opaque)
Signature · 1 line
1.7.9.5
Reviewed-by on v1 2/4
#6 lore raw

Re: [Qemu-devel] [PATCH 2/4] arm: Remove CONFIG_FDT conditionals

Quoted 4 lines · Peter Maydell

Now that we know we're compiling with libfdt, we can remove the CONFIG_FDT conditionals.

Quoted 33 lines
---
 hw/arm/boot.c |    7 -------
 1 file changed, 7 deletions(-)
hw/arm/boot.c +0 -8
index f451529..defcf15 100644
@@ -227,7 +227,6 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
 
 static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo)
 {
-#ifdef CONFIG_FDT
     uint32_t *mem_reg_property;
     uint32_t mem_reg_propsize;
     void *fdt = NULL;
@@ -308,12 +307,6 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo)
     cpu_physical_memory_write(addr, fdt, size);
 
     return 0;
-
-#else
-    fprintf(stderr, "Device tree requested, "
-                "but qemu was compiled without fdt support\n");
-    return -1;
-#endif
 }
 
 static void do_cpu_reset(void *opaque)
--

1.7.9.5

#7 lore raw

PATCH 3/4 microblaze: Remove CONFIG_FDT conditionals

In reply to Peter Maydell

Now that we know we're compiling with libfdt we can remove the CONFIG_FDT conditionals.

---
 hw/microblaze/boot.c |   12 ------------
 1 file changed, 12 deletions(-)
hw/microblaze/boot.c +0 -12
index e543d88..3f1d70e 100644
@@ -61,7 +61,6 @@ static int microblaze_load_dtb(hwaddr addr,
                                       const char *dtb_filename)
 {
     int fdt_size;
-#ifdef CONFIG_FDT
     void *fdt = NULL;
     int r;
 
@@ -81,17 +80,6 @@ static int microblaze_load_dtb(hwaddr addr,
     }
 
     cpu_physical_memory_write(addr, fdt, fdt_size);
-#else
-    /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob
-       to the kernel.  */
-    if (dtb_filename) {
-        fdt_size = load_image_targphys(dtb_filename, addr, 0x10000);
-    }
-    if (kernel_cmdline) {
-        fprintf(stderr,
-                "Warning: missing libfdt, cannot pass cmdline to kernel!\n");
-    }
-#endif
     return fdt_size;
 }
 
Signature · 1 line
1.7.9.5
Reviewed-by on v1 3/4
#8 lore raw

Re: [Qemu-devel] [PATCH 3/4] microblaze: Remove CONFIG_FDT conditionals

Quoted 4 lines · Peter Maydell

Now that we know we're compiling with libfdt we can remove the CONFIG_FDT conditionals.

Quoted 38 lines
---
 hw/microblaze/boot.c |   12 ------------
 1 file changed, 12 deletions(-)
hw/microblaze/boot.c +0 -13
index e543d88..3f1d70e 100644
@@ -61,7 +61,6 @@ static int microblaze_load_dtb(hwaddr addr,
                                       const char *dtb_filename)
 {
     int fdt_size;
-#ifdef CONFIG_FDT
     void *fdt = NULL;
     int r;
 
@@ -81,17 +80,6 @@ static int microblaze_load_dtb(hwaddr addr,
     }
 
     cpu_physical_memory_write(addr, fdt, fdt_size);
-#else
-    /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob
-       to the kernel.  */
-    if (dtb_filename) {
-        fdt_size = load_image_targphys(dtb_filename, addr, 0x10000);
-    }
-    if (kernel_cmdline) {
-        fprintf(stderr,
-                "Warning: missing libfdt, cannot pass cmdline to kernel!\n");
-    }
-#endif
     return fdt_size;
 }
 
--

1.7.9.5

#9 lore raw

PATCH 4/4 ppc: Remove CONFIG_FDT conditionals

In reply to Peter Maydell

Now that we know we're compiling with libfdt we can remove the CONFIG_FDT conditionals.

---
 default-configs/ppc-softmmu.mak    |    2 +-
 default-configs/ppc64-softmmu.mak  |    4 ++--
 default-configs/ppcemb-softmmu.mak |    2 +-
 hw/ppc/ppc440_bamboo.c             |    2 --
 hw/ppc/spapr_vio.c                 |    6 ------
 hw/ppc/virtex_ml507.c              |   18 ------------------
 6 files changed, 4 insertions(+), 30 deletions(-)
default-configs/ppc-softmmu.mak +1 -1
index cc3587f..bcaa52f 100644
@@ -42,6 +42,6 @@ CONFIG_I8259=y
 CONFIG_XILINX=y
 CONFIG_XILINX_ETHLITE=y
 CONFIG_OPENPIC=y
-CONFIG_E500=$(CONFIG_FDT)
+CONFIG_E500=y
 # For PReP
 CONFIG_MC146818RTC=y
default-configs/ppc64-softmmu.mak +2 -2
index 884ea8a..8b7874e 100644
@@ -42,8 +42,8 @@ CONFIG_I8259=y
 CONFIG_XILINX=y
 CONFIG_XILINX_ETHLITE=y
 CONFIG_OPENPIC=y
-CONFIG_PSERIES=$(CONFIG_FDT)
-CONFIG_E500=$(CONFIG_FDT)
+CONFIG_PSERIES=y
+CONFIG_E500=y
 # For pSeries
 CONFIG_PCI_HOTPLUG=y
 # For PReP
default-configs/ppcemb-softmmu.mak +1 -1
index be93e03..61920ff 100644
@@ -37,6 +37,6 @@ CONFIG_I8259=y
 CONFIG_XILINX=y
 CONFIG_XILINX_ETHLITE=y
 CONFIG_OPENPIC=y
-CONFIG_E500=$(CONFIG_FDT)
+CONFIG_E500=y
 # For PReP
 CONFIG_MC146818RTC=y
hw/ppc/ppc440_bamboo.c +0 -2
index a55e717..b0c1c02 100644
@@ -58,7 +58,6 @@ static int bamboo_load_device_tree(hwaddr addr,
                                      const char *kernel_cmdline)
 {
     int ret = -1;
-#ifdef CONFIG_FDT
     uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(ramsize) };
     char *filename;
     int fdt_size;
@@ -115,7 +114,6 @@ static int bamboo_load_device_tree(hwaddr addr,
     g_free(fdt);
 
 out:
-#endif
 
     return ret;
 }
hw/ppc/spapr_vio.c +0 -6
index 1405c32..304f316 100644
@@ -34,9 +34,7 @@
 #include "hw/ppc/spapr_vio.h"
 #include "hw/ppc/xics.h"
 
-#ifdef CONFIG_FDT
 #include <libfdt.h>
-#endif /* CONFIG_FDT */
 
 /* #define DEBUG_SPAPR */
 
@@ -94,7 +92,6 @@ VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg)
     return NULL;
 }
 
-#ifdef CONFIG_FDT
 static int vio_make_devnode(VIOsPAPRDevice *dev,
                             void *fdt)
 {
@@ -159,7 +156,6 @@ static int vio_make_devnode(VIOsPAPRDevice *dev,
 
     return node_off;
 }
-#endif /* CONFIG_FDT */
 
 /*
  * CRQ handling
@@ -570,7 +566,6 @@ static void spapr_vio_register_types(void)
 
 type_init(spapr_vio_register_types)
 
-#ifdef CONFIG_FDT
 static int compare_reg(const void *p1, const void *p2)
 {
     VIOsPAPRDevice const *dev1, *dev2;
@@ -655,4 +650,3 @@ int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus)
 
     return ret;
 }
-#endif /* CONFIG_FDT */
hw/ppc/virtex_ml507.c +0 -18
index 1b4ce76..709a707 100644
@@ -141,7 +141,6 @@ static int xilinx_load_device_tree(hwaddr addr,
 {
     char *path;
     int fdt_size;
-#ifdef CONFIG_FDT
     void *fdt;
     int r;
 
@@ -162,23 +161,6 @@ static int xilinx_load_device_tree(hwaddr addr,
     if (r < 0)
         fprintf(stderr, "couldn't set /chosen/bootargs\n");
     cpu_physical_memory_write(addr, fdt, fdt_size);
-#else
-    /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob
-       to the kernel.  */
-    fdt_size = load_image_targphys("ppc.dtb", addr, 0x10000);
-    if (fdt_size < 0) {
-        path = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
-        if (path) {
-            fdt_size = load_image_targphys(path, addr, 0x10000);
-            g_free(path);
-        }
-    }
-
-    if (kernel_cmdline) {
-        fprintf(stderr,
-                "Warning: missing libfdt, cannot pass cmdline to kernel!\n");
-    }
-#endif
     return fdt_size;
 }
 
Signature · 1 line
1.7.9.5
Tested-by Reviewed-by on the v1 series
#10 lore raw
In reply to Peter Maydell
Quoted 9 lines · Peter Maydell

This patchset makes libfdt mandatory for building the ARM, MicroBlaze and PPC softmmu targets. These architectures need libfdt for at least some of their board models to be usefully functional, so now that we have an in-tree version of libfdt it's better to insist on using it rather than allowing users to build less-than-useful binaries.

NB: I have tested the ARM change, but only compile-tested PPC and MicroBlaze.

Hi,

I test ran the ppc virtex-ml507 and microblaze petalogix s3adsp images, works ok.

Cheers,
Edgar

Quoted 21 lines

Peter Maydell (4):
configure: Require libfdt for arm, ppc, microblaze softmmu targets
arm: Remove CONFIG_FDT conditionals
microblaze: Remove CONFIG_FDT conditionals
ppc: Remove CONFIG_FDT conditionals

 configure                          |   20 ++++++++++++++++++++
 default-configs/ppc-softmmu.mak    |    2 +-
 default-configs/ppc64-softmmu.mak  |    4 ++--
 default-configs/ppcemb-softmmu.mak |    2 +-
 hw/arm/boot.c                      |    7 -------
 hw/microblaze/boot.c               |   12 ------------
 hw/ppc/ppc440_bamboo.c             |    2 --
 hw/ppc/spapr_vio.c                 |    6 ------
 hw/ppc/virtex_ml507.c              |   18 ------------------
 9 files changed, 24 insertions(+), 49 deletions(-)
Signature · 1 line
1.7.9.5