Received: from eggs.gnu.org ([2001:4830:134:3::10]:50783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vfmng-0006Cq-Og for qemu-devel@nongnu.org; Mon, 11 Nov 2013 03:24:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vfmna-0008RC-Io for qemu-devel@nongnu.org; Mon, 11 Nov 2013 03:24:48 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:34389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vfmna-0008R4-C5 for qemu-devel@nongnu.org; Mon, 11 Nov 2013 03:24:42 -0500 Received: by mail-pd0-f180.google.com with SMTP id v10so791866pde.39 for ; Mon, 11 Nov 2013 00:24:40 -0800 (PST) Sender: Peter Crosthwaite From: peter.crosthwaite@xilinx.com Date: Mon, 11 Nov 2013 18:14:00 +1000 Message-Id: Subject: [Qemu-devel] [PATCH v2 0/3] Device tree cleanups List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, edgar.iglesias@gmail.com, agraf@suse.de, afaerber@suse.de, david@gibson.dropbear.id.au From: Peter Crosthwaite 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: --- a/libfdt/fdt_rw.c +++ b/libfdt/fdt_rw.c @@ -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 #include "libfdt_env.h" #include @@ -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(-) -- 1.8.3.rc1.44.gb387c77.dirty