Skip to content

Device tree cleanups

[email protected] qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v1 RFC3 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3device_tree: s/qemu_devtree/qemu_fdt globallydevice_tree.c hw/arm/boot.c hw/arm/vexpress.c +8 more+232 -2310 replies
2/3device_tree: qemu_fdt_setprop: Rename val_array argdevice_tree.c include/sysemu/device_tree.h+3 -30 replies
3/3device_tree: qemu_fdt_setprop: Fixup error reportingdevice_tree.c hw/arm/boot.c hw/arm/vexpress.c +9 more+483 -3272 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/3] Device tree cleanups

From: Peter Crosthwaite <[email protected]>

Fix the name stem of the devicetree API (P1 - s/qemu_devtree/qemu_fdt) and cleanup error report (P3). Trivial patch P2 fixing an arugment name along the way.

Tested using:

1: Alex's e500 test vector.
2: Xilinx Zynq (tests arm/boot.c).

I have testing using Zynq with Mem > 4gb and a bogus dts (size cells = 1) to give that particular error path some exercise.

To give some exercise to the error paths, I hacked up my libfdt to throw errors randomly:

libfdt/fdt_rw.c +11 -0
@@ -48,6 +48,8 @@
  *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+#include <stdlib.h>
 #include "libfdt_env.h"
 
 #include <fdt.h>
@@ -279,6 +281,15 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
 
    FDT_RW_CHECK_HEADER(fdt);
 
+    static int seeded = 0;
+    if (!seeded) {
+        srand(time(NULL));
+        seeded = 1;
+    }
+    if (!(rand() & 0x7)) {
+        return -((rand() & 0x3) + 1);
+    }
+
 

Some sample outputs from e500 boot (Using the above tainted libfdt):

-----
qemu-system-ppc: qemu_fdt_setprop: Couldn't set /memory/reg: FDT_ERR_BADOFFSET

Aborted
-----
qemu-system-ppc: qemu_fdt_setprop_string: Couldn't set /soc@e0000000/device_type = soc: FDT_ERR_NOSPACE

Aborted
-----
qemu-system-ppc: qemu_fdt_setprop_cell: Couldn't set /soc@e0000000/#address-cells = 0x000001: FDT_ERR_NOSPACE

Aborted
-----

Peter Crosthwaite (3):
device_tree: s/qemu_devtree/qemu_fdt globally
device_tree: qemu_fdt_setprop: Rename val_array arg
device_tree: qemu_fdt_setprop: Fixup error reporting

 device_tree.c                | 230 +++++++++++++++++++++++++++--------------
 hw/arm/boot.c                |  51 ++++-----
 hw/arm/vexpress.c            |  23 +++--
 hw/microblaze/boot.c         |  17 ++-
 hw/ppc/e500.c                | 241 ++++++++++++++++++++++---------------------
 hw/ppc/e500.h                |   3 +-
 hw/ppc/e500plat.c            |   9 +-
 hw/ppc/mpc8544ds.c           |   9 +-
 hw/ppc/ppc440_bamboo.c       |  34 ++----
 hw/ppc/spapr_rtas.c          |  40 ++-----
 hw/ppc/virtex_ml507.c        |   5 +-
 include/sysemu/device_tree.h | 219 ++++++++++++++++++++++++++++++---------
 12 files changed, 519 insertions(+), 362 deletions(-)
Signature · 1 line
1.8.3.rc1.44.gb387c77.dirty