Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp15284997lff; Mon, 30 Dec 2019 03:13:57 -0800 (PST) X-Google-Smtp-Source: APXvYqw8tYjCFRWnb/1wuzZ2XHL065MbcWWzcYn83m/cBTkDNl/xVCkkxivHAsgBz5CG97lQlNr+ X-Received: by 2002:a05:6830:1bf8:: with SMTP id k24mr58199616otb.215.1577704437266; Mon, 30 Dec 2019 03:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577704437; cv=none; d=google.com; s=arc-20160816; b=aLVujacxOKSahiPbYl9pWzmn2hX14GbBXW+6zved4ylzJdbsU4naC6KjT/K2arKKRl IOGR/LUsL+RDOEZlTkwUfZFvk/Dfu8H+6RVM/tBkaKPAqgXM/fSIhm9fMuCetFseS0jT ZbzGeKSXibGAjwLJzKA2ofXQn3FStI30eES5ACGEQqFJ9febqtxfcKatBIuwrDda/2yD L12t41z+28bqT2Wtb2nh8K/+2dQq71XVShfhnJEFA+2a3waRHR7+aoYFUU7j9MupbZqA TEp2rpvVsXV9jD3UJQOdmlsApCC8eey6VQgCM6iPkfxX3Y0aTAIZROOk9gQHlEJF0464 1hLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kbgM4Ne22SluUF47X/B01KZXKLPLegc6jsc8WwYNVxA=; b=Hqci/cdkUEFLlyZiABDAWgHNFzXZoYE0brZ4J37390ilq2iEsgK631CbCNt1gLFkxs ilvVq4UAWTQvjLuXc+8RyG7Vs1WP0iE8GPxrGvwuKnOiRZbvTIQ7k2ZfH0BERODwRU6H xY97aydC2qt2jIrIxzX59HYWCi4UzF7YH6YxMwutbaETf7w/OnSj2r35N7MkfMehS+lG 75ONE/It2Mo2otiZA2523q9rBeppT30qGENNYiCKLRic4veVdNqOyZOJXNqVvZXO4/JJ 7u/iTkq5PYDT9mfXLV0VcQEhoZ7IOyBy3fEcmhFfysLFTsoQakdV7oITlFE1QB13kLjZ Xa6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iFxQen8G; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o206si21042610oih.143.2019.12.30.03.13.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Dec 2019 03:13:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iFxQen8G; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:60498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilszk-0002lR-Aj for alex.bennee@linaro.org; Mon, 30 Dec 2019 06:13:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35425) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilsw5-0005hS-A2 for qemu-arm@nongnu.org; Mon, 30 Dec 2019 06:10:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilsw3-0003Hc-Rs for qemu-arm@nongnu.org; Mon, 30 Dec 2019 06:10:09 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:32841) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ilsw0-0003AP-Iv; Mon, 30 Dec 2019 06:10:04 -0500 Received: by mail-wm1-x344.google.com with SMTP id d139so11394629wmd.0; Mon, 30 Dec 2019 03:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kbgM4Ne22SluUF47X/B01KZXKLPLegc6jsc8WwYNVxA=; b=iFxQen8GL3YPwpoJG8jfad8Pivw/ogKUMe5HS2+mXB5dOeAeA7Jcj+qq9xJamU475f tl2FmaXARsXTOrRqIPwj2kP/lIBppt8taUs1LELwMbQgfpYxDtbmCm+qD0+MQNep8V3Z xIBAZF8U6mmZir5E/sP+ACBgsvGW+H3XCJrI2YpRJbCs1nEwhVd39GvwiTi4krQBpDKL 0alsKbhXOlRJLhV+TfvqpPg22A7slxxZo5hPUUojW4IKQFmxI2mZ6x1b/ep5ynK+wmND TaETZ6pjq0H8n+v9Rs4jTgUq/cWcbQW8DN30HyQLcFtjMJIAwDRz9Bk/Bgh5Gbuh815d C9QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kbgM4Ne22SluUF47X/B01KZXKLPLegc6jsc8WwYNVxA=; b=hQyT5p/kLL7gSq9j+05tv/095JDrzYMOKgg9ml0JqkeOBFQ8HlrCuKYyKnfCkS2mIs cH4tO3ES5/yJKcsX+25PMMoelo21XgN66hDhcFtts9lmzuH7zw8H4OrS3lzqVo+3TWk2 pXTxfQnI8qDTZxS8RXJQ1mP8khr7fmMkQ6CtbDocYbOwg2WiIYhK2DLduaF87ieh2fXt zMBlyslAaWj2AF5xoKNJSWgHiyrjhCP9q4JkJz0ETr/ikD7R/kPD5EoZnVWuzrbd43/B rPrrhSebuXVdir0xfotJWIqY4e3aZu7K3ClUjr6TYX4q7UNRGi4YBimlAgspMM8aZJ92 XoIw== X-Gm-Message-State: APjAAAVdtGyvsJs60JqpwQ8oorSOEOLA9j/Tl16puaoyHYK5b04oCg/p K+8LmHcTPimMd9t3WavCsSoO6gs9xpo= X-Received: by 2002:a1c:7715:: with SMTP id t21mr33497289wmi.149.1577704203142; Mon, 30 Dec 2019 03:10:03 -0800 (PST) Received: from x1w.redhat.com ([2a01:cb18:8372:6b00:691b:aac5:8837:d4da]) by smtp.gmail.com with ESMTPSA id p15sm20442738wma.40.2019.12.30.03.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 03:10:02 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Date: Mon, 30 Dec 2019 12:09:53 +0100 Message-Id: <20191230110953.25496-7-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191230110953.25496-1-f4bug@amsat.org> References: <20191230110953.25496-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beniamino Galvani , Niek Linnenbank , qemu-arm@nongnu.org, Willian Rampazzo , Cleber Rosa Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: 9zV5RTocwIaP We do not model the Sunxi Multipoint USB. The Linux kernel OOPS when booting: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 144 at drivers/usb/musb/sunxi.c:400 sunxi_musb_ep_offset+0x39/0x3c sunxi_musb_ep_offset called with non 0 offset Modules linked in: CPU: 0 PID: 144 Comm: kworker/0:2 Not tainted 4.20.7-sunxi #5.75 Hardware name: Allwinner sun4i/sun5i Families Workqueue: events deferred_probe_work_func [] (unwind_backtrace) from [] (show_stack+0x11/0x14) [] (show_stack) from [] (dump_stack+0x69/0x78) [] (dump_stack) from [] (__warn+0xa1/0xb4) [] (__warn) from [] (warn_slowpath_fmt+0x33/0x48) [] (warn_slowpath_fmt) from [] (sunxi_musb_ep_offset+0x39/0x3c) [] (sunxi_musb_ep_offset) from [] (ep_config_from_hw+0x99/0x104) [] (ep_config_from_hw) from [] (musb_probe+0x765/0xa0c) [] (musb_probe) from [] (platform_drv_probe+0x33/0x68) [] (platform_drv_probe) from [] (really_probe+0x16f/0x1e0) [] (really_probe) from [] (driver_probe_device+0x43/0x11c) [] (driver_probe_device) from [] (bus_for_each_drv+0x37/0x70) [] (bus_for_each_drv) from [] (__device_attach+0x83/0xc8) [] (__device_attach) from [] (bus_probe_device+0x5b/0x60) [] (bus_probe_device) from [] (device_add+0x2f5/0x474) [] (device_add) from [] (platform_device_add+0xb7/0x184) [] (platform_device_add) from [] (platform_device_register_full+0xb3/0xc4) [] (platform_device_register_full) from [] (sunxi_musb_probe+0x1d7/0x2f4) [] (sunxi_musb_probe) from [] (platform_drv_probe+0x33/0x68) [] (platform_drv_probe) from [] (really_probe+0x16f/0x1e0) [] (really_probe) from [] (driver_probe_device+0x43/0x11c) [] (driver_probe_device) from [] (bus_for_each_drv+0x37/0x70) [] (bus_for_each_drv) from [] (__device_attach+0x83/0xc8) [] (__device_attach) from [] (bus_probe_device+0x5b/0x60) [] (bus_probe_device) from [] (deferred_probe_work_func+0x4b/0x6c) [] (deferred_probe_work_func) from [] (process_one_work+0x167/0x384) [] (process_one_work) from [] (worker_thread+0x251/0x3fc) [] (worker_thread) from [] (kthread+0xfd/0x104) [] (kthread) from [] (ret_from_fork+0x11/0x38) Exception stack(0xc6999fb0 to 0xc6999ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace b309edbca98c7de2 ]--- musb-sunxi 1c13000.usb: Error unknown readb offset 128 musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22 musb-hdrc: probe of musb-hdrc.1.auto failed with error -22 This is not critical but confusing. To avoid the Linux kernel to probe this device, mark it disabled in the device tree blob. Signed-off-by: Philippe Mathieu-Daudé --- I'm not sure if this is a QEMU anti-pattern or bad practice. I know we prefer to be as close to the hardware as possible, but here the hardware is not changed, the dtb is. However this makes the guest behave differently. At least we don't have to manually edit the dts. If this is only annoying for acceptance testing, we might consider manually editing the dts in the tests setup(). --- hw/arm/cubieboard.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index 6dc2f1d6b6..dd10577696 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -22,10 +22,34 @@ #include "hw/sysbus.h" #include "hw/boards.h" #include "hw/arm/allwinner-a10.h" +#include + +static void cubieboard_modify_dtb(const struct arm_boot_info *info, void *fdt) +{ + static const char unsupported_compat[] = "allwinner,sun4i-a10-musb"; + char node_path[72]; + int offset; + + offset = fdt_node_offset_by_compatible(fdt, -1, unsupported_compat); + while (offset >= 0) { + int r = fdt_get_path(fdt, offset, node_path, sizeof(node_path)); + assert(r >= 0); + r = fdt_setprop_string(fdt, offset, "status", "disabled"); + if (r < 0) { + error_report("%s: Couldn't disable %s: %s", __func__, + unsupported_compat, fdt_strerror(r)); + exit(1); + } + warn_report("cubieboard: disabled unsupported node %s (%s) " + "in device tree", node_path, unsupported_compat); + offset = fdt_node_offset_by_compatible(fdt, offset, unsupported_compat); + } +} static struct arm_boot_info cubieboard_binfo = { .loader_start = AW_A10_SDRAM_BASE, .board_id = 0x1008, + .modify_dtb = cubieboard_modify_dtb, }; typedef struct CubieBoardState { -- 2.21.0