qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
@ 2008-12-16 10:43 Aurelien Jarno
  2008-12-16 12:30 ` Paul Brook
  0 siblings, 1 reply; 11+ messages in thread
From: Aurelien Jarno @ 2008-12-16 10:43 UTC (permalink / raw)
  To: qemu-devel

Revision: 6064
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6064
Author:   aurel32
Date:     2008-12-16 10:43:48 +0000 (Tue, 16 Dec 2008)

Log Message:
-----------
Implement device tree support needed for Bamboo emulation

To implement the -kernel, -initrd, and -append options, 4xx board emulation
must load the guest kernel as if firmware had loaded it. Where u-boot would be
the firmware, we must load the flat device tree into memory and set key fields
such as /chosen/bootargs.

This patch introduces a dependency on libfdt for flat device tree support.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/Makefile.target
    trunk/configure

Added Paths:
-----------
    trunk/device_tree.c
    trunk/device_tree.h
    trunk/libfdt_env.h

Modified: trunk/Makefile.target
===================================================================
--- trunk/Makefile.target	2008-12-15 23:15:56 UTC (rev 6063)
+++ trunk/Makefile.target	2008-12-16 10:43:48 UTC (rev 6064)
@@ -655,6 +655,10 @@
 OBJS+= unin_pci.o ppc_chrp.o
 # PowerPC 4xx boards
 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
+ifdef FDT_LIBS
+OBJS+= device_tree.o
+LIBS+= $(FDT_LIBS)
+endif
 # virtio support
 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
 endif

Modified: trunk/configure
===================================================================
--- trunk/configure	2008-12-15 23:15:56 UTC (rev 6063)
+++ trunk/configure	2008-12-16 10:43:48 UTC (rev 6064)
@@ -119,6 +119,7 @@
 kerneldir=""
 aix="no"
 blobs="yes"
+fdt="yes"
 
 # OS specific
 targetos=`uname -s`
@@ -966,6 +967,18 @@
   iovec=yes
 fi
 
+##########################################
+# fdt probe
+if test "$fdt" = "yes" ; then
+    fdt=no
+    cat > $TMPC << EOF
+int main(void) { return 0; }
+EOF
+  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
+    fdt=yes
+  fi
+fi
+
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html 2>/dev/null`" ] && \
    [ -x "`which pod2man 2>/dev/null`" ]; then
@@ -1061,6 +1074,7 @@
 echo "AIO support       $aio"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
+echo "fdt support       $fdt"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1350,6 +1364,10 @@
 if test "$iovec" = "yes" ; then
   echo "#define HAVE_IOVEC 1" >> $config_h
 fi
+if test "$fdt" = "yes" ; then
+  echo "#define HAVE_FDT 1" >> $config_h
+  echo "FDT_LIBS=-lfdt" >> $config_mak
+fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then

Added: trunk/device_tree.c
===================================================================
--- trunk/device_tree.c	                        (rev 0)
+++ trunk/device_tree.c	2008-12-16 10:43:48 UTC (rev 6064)
@@ -0,0 +1,114 @@
+/*
+ * Functions to help device tree manipulation using libfdt.
+ * It also provides functions to read entries from device tree proc
+ * interface.
+ *
+ * Copyright 2008 IBM Corporation.
+ * Authors: Jerone Young <jyoung5@us.ibm.com>
+ *          Hollis Blanchard <hollisb@us.ibm.com>
+ *
+ * This work is licensed under the GNU GPL license version 2 or later.
+ *
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "device_tree.h"
+
+#include <libfdt.h>
+
+void *load_device_tree(const char *filename_path, void *load_addr)
+{
+    int dt_file_size;
+    int dt_file_load_size;
+    int new_dt_size;
+    int ret;
+    void *dt_file = NULL;
+    void *fdt;
+
+    dt_file_size = get_image_size(filename_path);
+    if (dt_file_size < 0) {
+        printf("Unable to get size of device tree file '%s'\n",
+            filename_path);
+        goto fail;
+    }
+
+    /* First allocate space in qemu for device tree */
+    dt_file = qemu_mallocz(dt_file_size);
+    if (dt_file == NULL) {
+        printf("Unable to allocate memory in qemu for device tree\n");
+        goto fail;
+    }
+
+    dt_file_load_size = load_image(filename_path, dt_file);
+
+    /* Second we place new copy of 2x size in guest memory
+     * This give us enough room for manipulation.
+     */
+    new_dt_size = dt_file_size * 2;
+
+    fdt = load_addr;
+    ret = fdt_open_into(dt_file, fdt, new_dt_size);
+    if (ret) {
+        printf("Unable to copy device tree in memory\n");
+        goto fail;
+    }
+
+    /* Check sanity of device tree */
+    if (fdt_check_header(fdt)) {
+        printf ("Device tree file loaded into memory is invalid: %s\n",
+            filename_path);
+        goto fail;
+    }
+    /* free qemu memory with old device tree */
+    qemu_free(dt_file);
+    return fdt;
+
+fail:
+    qemu_free(dt_file);
+    return NULL;
+}
+
+int qemu_devtree_setprop(void *fdt, const char *node_path,
+                         const char *property, uint32_t *val_array, int size)
+{
+    int offset;
+
+    offset = fdt_path_offset(fdt, node_path);
+    if (offset < 0)
+        return offset;
+
+    return fdt_setprop(fdt, offset, property, val_array, size);
+}
+
+int qemu_devtree_setprop_cell(void *fdt, const char *node_path,
+                              const char *property, uint32_t val)
+{
+    int offset;
+
+    offset = fdt_path_offset(fdt, node_path);
+    if (offset < 0)
+        return offset;
+
+    return fdt_setprop_cell(fdt, offset, property, val);
+}
+
+int qemu_devtree_setprop_string(void *fdt, const char *node_path,
+                                const char *property, const char *string)
+{
+    int offset;
+
+    offset = fdt_path_offset(fdt, node_path);
+    if (offset < 0)
+        return offset;
+
+    return fdt_setprop_string(fdt, offset, property, string);
+}

Added: trunk/device_tree.h
===================================================================
--- trunk/device_tree.h	                        (rev 0)
+++ trunk/device_tree.h	2008-12-16 10:43:48 UTC (rev 6064)
@@ -0,0 +1,26 @@
+/*
+ * Header with function prototypes to help device tree manipulation using
+ * libfdt. It also provides functions to read entries from device tree proc
+ * interface.
+ *
+ * Copyright 2008 IBM Corporation.
+ * Authors: Jerone Young <jyoung5@us.ibm.com>
+ *          Hollis Blanchard <hollisb@us.ibm.com>
+ *
+ * This work is licensed under the GNU GPL license version 2 or later.
+ *
+ */
+
+#ifndef __DEVICE_TREE_H__
+#define __DEVICE_TREE_H__
+
+void *load_device_tree(const char *filename_path, void *load_addr);
+
+int qemu_devtree_setprop(void *fdt, const char *node_path,
+                         const char *property, uint32_t *val_array, int size);
+int qemu_devtree_setprop_cell(void *fdt, const char *node_path,
+                              const char *property, uint32_t val);
+int qemu_devtree_setprop_string(void *fdt, const char *node_path,
+                                const char *property, const char *string);
+
+#endif /* __DEVICE_TREE_H__ */

Added: trunk/libfdt_env.h
===================================================================
--- trunk/libfdt_env.h	                        (rev 0)
+++ trunk/libfdt_env.h	2008-12-16 10:43:48 UTC (rev 6064)
@@ -0,0 +1,41 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2008
+ * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+ *
+ */
+
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include <endian.h>
+#include <byteswap.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define fdt32_to_cpu(x)		(x)
+#define cpu_to_fdt32(x)		(x)
+#define fdt64_to_cpu(x)		(x)
+#define cpu_to_fdt64(x)		(x)
+#else
+#define fdt32_to_cpu(x)		(bswap_32((x)))
+#define cpu_to_fdt32(x)		(bswap_32((x)))
+#define fdt64_to_cpu(x)		(bswap_64((x)))
+#define cpu_to_fdt64(x)		(bswap_64((x)))
+#endif
+
+#endif /* _LIBFDT_ENV_H */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 10:43 [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation Aurelien Jarno
@ 2008-12-16 12:30 ` Paul Brook
  2008-12-16 15:09   ` Hollis Blanchard
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Brook @ 2008-12-16 12:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hollis Blanchard, Aurelien Jarno

> To implement the -kernel, -initrd, and -append options, 4xx board emulation
> must load the guest kernel as if firmware had loaded it. Where u-boot would
> be the firmware, we must load the flat device tree into memory and set key
> fields such as /chosen/bootargs.

Then why is it optional?

> This patch introduces a dependency on libfdt for flat device tree support.

I don't like the way this is done.

AFAIK libfdt isn't present in any of the major distros. I thought the 
conclusion was that we should import libfdt into qemu.

Certainly adding libfdt_env.h, which is never used, seems very wrong. I'm 
pretty sure this won't build on win32 either.

Paul

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 12:30 ` Paul Brook
@ 2008-12-16 15:09   ` Hollis Blanchard
  2008-12-16 16:17     ` Anthony Liguori
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-12-16 15:09 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel, Aurelien Jarno

On Tue, 2008-12-16 at 12:30 +0000, Paul Brook wrote:
> > To implement the -kernel, -initrd, and -append options, 4xx board emulation
> > must load the guest kernel as if firmware had loaded it. Where u-boot would
> > be the firmware, we must load the flat device tree into memory and set key
> > fields such as /chosen/bootargs.
> 
> Then why is it optional?

As you mention below, libfdt isn't generally available yet, and since
it's possible to make a real firmware work in this environment (in which
case -kernel isn't needed), the code can still be useful.

If you'd prefer to make libfdt mandatory, I'm fine with that.

> > This patch introduces a dependency on libfdt for flat device tree support.
> 
> I don't like the way this is done.
> 
> AFAIK libfdt isn't present in any of the major distros. I thought the 
> conclusion was that we should import libfdt into qemu.

That was our conclusion, but Anthony never agreed.

FWIW, I have requested that Fedora and Debian package libfdt, and they
agreed in principle, but it's still missing in Fedora 10 for example.

Is the existence of distribution packages a requirement for use, or
should we say "install it by hand into /usr/local"? If it is a
requirement, which versions of which distributions?

> Certainly adding libfdt_env.h, which is never used, seems very wrong. I'm 
> pretty sure this won't build on win32 either.

Oops, that was a holdover from when we *were* importing libfdt source. I
can remove that, or if we want to import a copy of libfdt, I can leave
it.

I doubt anyone has tried to build libfdt on Windows...

-- 
Hollis Blanchard
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 15:09   ` Hollis Blanchard
@ 2008-12-16 16:17     ` Anthony Liguori
  2008-12-16 16:34       ` Paul Brook
  2008-12-16 16:31     ` Paul Brook
  2008-12-16 16:46     ` Daniel P. Berrange
  2 siblings, 1 reply; 11+ messages in thread
From: Anthony Liguori @ 2008-12-16 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Brook, Aurelien Jarno

Hollis Blanchard wrote:
> If you'd prefer to make libfdt mandatory, I'm fine with that.
>   

No, it shouldn't be mandatory :-)

>>> This patch introduces a dependency on libfdt for flat device tree support.
>>>       
>> I don't like the way this is done.
>>
>> AFAIK libfdt isn't present in any of the major distros. I thought the 
>> conclusion was that we should import libfdt into qemu.
>>     
>
> That was our conclusion, but Anthony never agreed.
>   

Because it's better to let the distros maintain this.   That way, they 
can deal with security issues, etc.

> FWIW, I have requested that Fedora and Debian package libfdt, and they
> agreed in principle, but it's still missing in Fedora 10 for example.
>   

As long as it's heading toward distros, it should be fine.  If we decide 
to use libfdt for core QEMU functionality (like config file), we should 
revisit this though.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 15:09   ` Hollis Blanchard
  2008-12-16 16:17     ` Anthony Liguori
@ 2008-12-16 16:31     ` Paul Brook
  2008-12-16 16:46     ` Daniel P. Berrange
  2 siblings, 0 replies; 11+ messages in thread
From: Paul Brook @ 2008-12-16 16:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno, Hollis Blanchard

[-- Attachment #1: Type: text/plain, Size: 2374 bytes --]

> > Then why is it optional?
>
> As you mention below, libfdt isn't generally available yet, and since
> it's possible to make a real firmware work in this environment (in which
> case -kernel isn't needed), the code can still be useful.
>
> If you'd prefer to make libfdt mandatory, I'm fine with that.

Well, from your description it sounds like your ppc bits are fairly useless 
without it. History has shown that if it's possible for people to build 
something incorrectly, they usually will. Even more so if the required 
libraries are even vaguely standard.

> > AFAIK libfdt isn't present in any of the major distros. I thought the
> > conclusion was that we should import libfdt into qemu.
>
> That was our conclusion, but Anthony never agreed.
>
> FWIW, I have requested that Fedora and Debian package libfdt, and they
> agreed in principle, but it's still missing in Fedora 10 for example.
>
> Is the existence of distribution packages a requirement for use, or
> should we say "install it by hand into /usr/local"? If it is a
> requirement, which versions of which distributions?

I'm extremely reluctant to require an external library that everyone has to go 
fetch and build themselves. IIRC The libfdt docs say it's expected that 
people will include it in their projects.

I can say from experience that it drops in pretty easily. It's a 4-line qemu 
patch, plus make libfdt_env.h use the qemu byteswap routines.

> I doubt anyone has tried to build libfdt on Windows...

I have (well, technically a cross build from linux, but same difference).

Signed-off-by: Paul Brook <paul@codesourcery.com>

Index: Makefile
===================================================================
--- Makefile	(revision 6069)
+++ Makefile	(working copy)
@@ -5,7 +5,7 @@ include config-host.mak
 .PHONY: all clean cscope distclean dvi html info install install-doc \
 	recurse-all speed tar tarbin test
 
-VPATH=$(SRC_PATH):$(SRC_PATH)/hw
+VPATH=$(SRC_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/libfdt
 
 CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
 LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
@@ -68,7 +68,11 @@ endif
 # system emulation, i.e. a single QEMU executable should support all
 # CPUs and machines.
 
+include $(SRC_PATH)/libfdt/Makefile.libfdt
+$(LIBFDT_OBJS): CPPFLAGS += -I$(SRC_PATH)/libfdt
+
 OBJS=$(BLOCK_OBJS)
+OBJS+=$(LIBFDT_OBJS)
 OBJS+=readline.o console.o
 
 OBJS+=irq.o

[-- Attachment #2: patch.libfdt --]
[-- Type: text/x-diff, Size: 588 bytes --]

Minor changes are required to get libfdt to build as part of qemu.
The patch below records modifications relative to upstream dtc-v1.2.0.

Index: libfdt_env.h
===================================================================
--- libfdt_env.h	(revision 230023)
+++ libfdt_env.h	(working copy)
@@ -4,10 +4,9 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <string.h>
-#include <endian.h>
-#include <byteswap.h>
+#include "bswap.h"
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
 #define fdt32_to_cpu(x)		(x)
 #define cpu_to_fdt32(x)		(x)
 #define fdt64_to_cpu(x)		(x)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 16:17     ` Anthony Liguori
@ 2008-12-16 16:34       ` Paul Brook
  2008-12-16 17:03         ` Blue Swirl
  2008-12-16 20:34         ` Thiemo Seufer
  0 siblings, 2 replies; 11+ messages in thread
From: Paul Brook @ 2008-12-16 16:34 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel, Aurelien Jarno

On Tuesday 16 December 2008, Anthony Liguori wrote:
> Hollis Blanchard wrote:
> > If you'd prefer to make libfdt mandatory, I'm fine with that.
>
> No, it shouldn't be mandatory :-)
>
> >>> This patch introduces a dependency on libfdt for flat device tree
> >>> support.
> >>
> >> I don't like the way this is done.
> >>
> >> AFAIK libfdt isn't present in any of the major distros. I thought the
> >> conclusion was that we should import libfdt into qemu.
> >
> > That was our conclusion, but Anthony never agreed.
>
> Because it's better to let the distros maintain this.   That way, they
> can deal with security issues, etc.

That's fine in theory. In practice it means we can't realistically use libfdt 
for anything important for at least another 12 months or so. I'm also rather 
sceptical about the stability of the libfdt API.

> > FWIW, I have requested that Fedora and Debian package libfdt, and they
> > agreed in principle, but it's still missing in Fedora 10 for example.
>
> As long as it's heading toward distros, it should be fine.  If we decide
> to use libfdt for core QEMU functionality (like config file), we should
> revisit this though.

That's likely to happen fairly soon. And IIUC it's already fairly critical for 
the new PPC boards.

Paul

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 15:09   ` Hollis Blanchard
  2008-12-16 16:17     ` Anthony Liguori
  2008-12-16 16:31     ` Paul Brook
@ 2008-12-16 16:46     ` Daniel P. Berrange
  2008-12-16 17:15       ` Hollis Blanchard
  2 siblings, 1 reply; 11+ messages in thread
From: Daniel P. Berrange @ 2008-12-16 16:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Brook, Aurelien Jarno

On Tue, Dec 16, 2008 at 03:09:47PM +0000, Hollis Blanchard wrote:
> On Tue, 2008-12-16 at 12:30 +0000, Paul Brook wrote:
> > > To implement the -kernel, -initrd, and -append options, 4xx board emulation
> > > must load the guest kernel as if firmware had loaded it. Where u-boot would
> > > be the firmware, we must load the flat device tree into memory and set key
> > > fields such as /chosen/bootargs.
> > 
> > Then why is it optional?
> 
> As you mention below, libfdt isn't generally available yet, and since
> it's possible to make a real firmware work in this environment (in which
> case -kernel isn't needed), the code can still be useful.
> 
> If you'd prefer to make libfdt mandatory, I'm fine with that.
> 
> > > This patch introduces a dependency on libfdt for flat device tree support.
> > 
> > I don't like the way this is done.
> > 
> > AFAIK libfdt isn't present in any of the major distros. I thought the 
> > conclusion was that we should import libfdt into qemu.
> 
> That was our conclusion, but Anthony never agreed.
> 
> FWIW, I have requested that Fedora and Debian package libfdt, and they
> agreed in principle, but it's still missing in Fedora 10 for example.

If you've got a package review ticket open against Fedora for libfdt
inclusion, let me know the bug number and I'm happy to do the review,
so it is not unduely delayed on its path into Fedora repositories. 

I far far prefer to see this kind of thing properly packaged, than 
copied into the source tree. Indeed if any application copies another 
library's code into their source tree, then when we package that app 
for Fedora we typically try to reverse this and make it link against 
a proper separately packaged shared library. Copy+paste of libraries 
into other apps's source tree is a maintenance disaster, particularly
for security updates.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 16:34       ` Paul Brook
@ 2008-12-16 17:03         ` Blue Swirl
  2008-12-16 20:34         ` Thiemo Seufer
  1 sibling, 0 replies; 11+ messages in thread
From: Blue Swirl @ 2008-12-16 17:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

On 12/16/08, Paul Brook <paul@codesourcery.com> wrote:
> On Tuesday 16 December 2008, Anthony Liguori wrote:
>  > Hollis Blanchard wrote:
>  > > If you'd prefer to make libfdt mandatory, I'm fine with that.
>  >
>  > No, it shouldn't be mandatory :-)
>  >
>  > >>> This patch introduces a dependency on libfdt for flat device tree
>  > >>> support.
>  > >>
>  > >> I don't like the way this is done.
>  > >>
>  > >> AFAIK libfdt isn't present in any of the major distros. I thought the
>  > >> conclusion was that we should import libfdt into qemu.
>  > >
>  > > That was our conclusion, but Anthony never agreed.
>  >
>  > Because it's better to let the distros maintain this.   That way, they
>  > can deal with security issues, etc.
>
>
> That's fine in theory. In practice it means we can't realistically use libfdt
>  for anything important for at least another 12 months or so. I'm also rather
>  sceptical about the stability of the libfdt API.

I also vote for importing libfdt for now, it should be useful for Sparc too.

If one day the major distros (think also about BSDs, Solaris etc.)
have libfdt, we can remove ours.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 16:46     ` Daniel P. Berrange
@ 2008-12-16 17:15       ` Hollis Blanchard
  2008-12-16 18:15         ` Josh Boyer
  0 siblings, 1 reply; 11+ messages in thread
From: Hollis Blanchard @ 2008-12-16 17:15 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: Josh Boyer, Paul Brook, Aurelien Jarno

On Tue, 2008-12-16 at 16:46 +0000, Daniel P. Berrange wrote:
> On Tue, Dec 16, 2008 at 03:09:47PM +0000, Hollis Blanchard wrote:
> > On Tue, 2008-12-16 at 12:30 +0000, Paul Brook wrote:
> > > > To implement the -kernel, -initrd, and -append options, 4xx board emulation
> > > > must load the guest kernel as if firmware had loaded it. Where u-boot would
> > > > be the firmware, we must load the flat device tree into memory and set key
> > > > fields such as /chosen/bootargs.
> > > 
> > > Then why is it optional?
> > 
> > As you mention below, libfdt isn't generally available yet, and since
> > it's possible to make a real firmware work in this environment (in which
> > case -kernel isn't needed), the code can still be useful.
> > 
> > If you'd prefer to make libfdt mandatory, I'm fine with that.
> > 
> > > > This patch introduces a dependency on libfdt for flat device tree support.
> > > 
> > > I don't like the way this is done.
> > > 
> > > AFAIK libfdt isn't present in any of the major distros. I thought the 
> > > conclusion was that we should import libfdt into qemu.
> > 
> > That was our conclusion, but Anthony never agreed.
> > 
> > FWIW, I have requested that Fedora and Debian package libfdt, and they
> > agreed in principle, but it's still missing in Fedora 10 for example.
> 
> If you've got a package review ticket open against Fedora for libfdt
> inclusion, let me know the bug number and I'm happy to do the review,
> so it is not unduely delayed on its path into Fedora repositories. 

https://bugzilla.redhat.com/show_bug.cgi?id=443882

IIRC Josh Boyer looked into this beyond what's reflected in the bug
report, but I don't remember the current status.

-- 
Hollis Blanchard
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 17:15       ` Hollis Blanchard
@ 2008-12-16 18:15         ` Josh Boyer
  0 siblings, 0 replies; 11+ messages in thread
From: Josh Boyer @ 2008-12-16 18:15 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: qemu-devel, Aurelien Jarno, Paul Brook

On Tue, Dec 16, 2008 at 11:15:52AM -0600, Hollis Blanchard wrote:
>> > FWIW, I have requested that Fedora and Debian package libfdt, and they
>> > agreed in principle, but it's still missing in Fedora 10 for example.
>> 
>> If you've got a package review ticket open against Fedora for libfdt
>> inclusion, let me know the bug number and I'm happy to do the review,
>> so it is not unduely delayed on its path into Fedora repositories. 
>
>https://bugzilla.redhat.com/show_bug.cgi?id=443882
>
>IIRC Josh Boyer looked into this beyond what's reflected in the bug
>report, but I don't remember the current status.

I did.  I submitted a patch and had a couple comments come back on it.  I
think I need to fixup the testsuite in dtc to link against and use the
.so that is created and it should be OK for inclusion.

josh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation
  2008-12-16 16:34       ` Paul Brook
  2008-12-16 17:03         ` Blue Swirl
@ 2008-12-16 20:34         ` Thiemo Seufer
  1 sibling, 0 replies; 11+ messages in thread
From: Thiemo Seufer @ 2008-12-16 20:34 UTC (permalink / raw)
  To: Paul Brook; +Cc: Aurelien Jarno, qemu-devel

Paul Brook wrote:
> On Tuesday 16 December 2008, Anthony Liguori wrote:
> > Hollis Blanchard wrote:
> > > If you'd prefer to make libfdt mandatory, I'm fine with that.
> >
> > No, it shouldn't be mandatory :-)
> >
> > >>> This patch introduces a dependency on libfdt for flat device tree
> > >>> support.
> > >>
> > >> I don't like the way this is done.
> > >>
> > >> AFAIK libfdt isn't present in any of the major distros. I thought the
> > >> conclusion was that we should import libfdt into qemu.
> > >
> > > That was our conclusion, but Anthony never agreed.
> >
> > Because it's better to let the distros maintain this.   That way, they
> > can deal with security issues, etc.
> 
> That's fine in theory. In practice it means we can't realistically use libfdt 
> for anything important for at least another 12 months or so. I'm also rather 
> sceptical about the stability of the libfdt API.

An approach commonly taken is to try to link against a system-provided
(dynamic) library, and fall back to the in-tree version if this fails.
(This assumes a system will only provide libfdt once its API/ABI is
stable enough.)


Thiemo

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-16 20:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-16 10:43 [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation Aurelien Jarno
2008-12-16 12:30 ` Paul Brook
2008-12-16 15:09   ` Hollis Blanchard
2008-12-16 16:17     ` Anthony Liguori
2008-12-16 16:34       ` Paul Brook
2008-12-16 17:03         ` Blue Swirl
2008-12-16 20:34         ` Thiemo Seufer
2008-12-16 16:31     ` Paul Brook
2008-12-16 16:46     ` Daniel P. Berrange
2008-12-16 17:15       ` Hollis Blanchard
2008-12-16 18:15         ` Josh Boyer

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).