From patchwork Fri Jan 15 22:38:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 8044841 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7D053BEEED for ; Fri, 15 Jan 2016 22:40:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1FEC20379 for ; Fri, 15 Jan 2016 22:40:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 366C72037F for ; Fri, 15 Jan 2016 22:40:51 +0000 (UTC) Received: from localhost ([::1]:49222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKD34-0001hE-LD for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jan 2016 17:40:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKD2u-0001fS-8v for qemu-devel@nongnu.org; Fri, 15 Jan 2016 17:40:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKD2r-0007Bv-24 for qemu-devel@nongnu.org; Fri, 15 Jan 2016 17:40:40 -0500 Received: from mail-sn1nam02on0060.outbound.protection.outlook.com ([104.47.36.60]:18336 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKD2q-0007Bn-SC for qemu-devel@nongnu.org; Fri, 15 Jan 2016 17:40:36 -0500 Received: from SN1NAM02FT003.eop-nam02.prod.protection.outlook.com (10.152.72.58) by SN1NAM02HT035.eop-nam02.prod.protection.outlook.com (10.152.72.193) with Microsoft SMTP Server (TLS) id 15.1.355.15; Fri, 15 Jan 2016 22:40:35 +0000 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=xilinx.com; linaro.org; dkim=none (message not signed) header.d=none; linaro.org; dmarc=none action=none header.from=xilinx.com; Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 149.199.60.96 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.96; helo=xsj-tvapsmtpgw01; Received: from xsj-tvapsmtpgw01 (149.199.60.96) by SN1NAM02FT003.mail.protection.outlook.com (10.152.73.29) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Fri, 15 Jan 2016 22:40:34 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:55739 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1aKD2o-0006Pu-3i; Fri, 15 Jan 2016 14:40:34 -0800 Received: from [127.0.0.1] (port=34725 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1aKD2n-0007pe-Uf; Fri, 15 Jan 2016 14:40:33 -0800 Received: from xsj-tvapsmtp02 (xsj-tvapsmtp02.xilinx.com [172.16.1.203]) by tsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u0FMZ2Q5031346; Fri, 15 Jan 2016 14:35:02 -0800 Received: from [172.19.74.182] (port=49646 helo=xsjalistai50.xlnx.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1aKD2n-0007pb-8u; Fri, 15 Jan 2016 14:40:33 -0800 From: Alistair Francis To: Date: Fri, 15 Jan 2016 14:38:10 -0800 Message-ID: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22054.006 X-TM-AS-Result: No--0.435-7.0-31-10 X-imss-scan-details: No--0.435-7.0-31-10 X-TMASE-MatchedRID: jW2Old1ajwCPo+6vQMop+pY9D0/NRxoqCt59Uh3p/NXfN5Mc7zStJHox AQNegkez8w+Ie/GWeQfr+IdVHZwx8NrgBEMq06gYTuctSpiuWyXmKoHzZOAizW3D6f6IpbLIeIZ b6JSBOuD52CLgn1ohCJ6L+ns2sG+EGs5li5ONWllWdBPqAOaXVVi5Oyh475wklPH7Ysio2a2ST8 CG+ScoF+LzNWBegCW2wgn7iDBesS0nRE+fI6etkrq5GlSFb8KBp/aFzGPebRj6Blf1E5nGtzVt4 s7syiyH1K+eyjY+TpuEs71pdZeeW7y9z1/3OVl9P/J9rCypozbiYCrSYj64j0u/kTKv9giuqwOH O1Fdn0Kb4tj0DvxRUIs9ro6z1cfchCFNTbTJJtE= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.96; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(85426001)(5003600100002)(19580395003)(48376002)(64026002)(1096002)(50226001)(71366001)(76176999)(1220700001)(50986999)(47776003)(92566002)(586003)(5003940100001)(105606002)(6806005)(87936001)(5008740100001)(106466001)(86362001)(50466002)(77096005)(4326007)(110136002)(2950100001)(189998001)(229853001)(36756003)(33646002)(118296001)(5001960100002)(2351001)(19580405001)(81156007)(2906002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1NAM02HT035; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; PTR:unknown-60-96.xilinx.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 11d7c440-de8f-4e67-f7ed-08d31dfce1c9 X-Exchange-Antispam-Report-Test: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM02HT035; UriScan:(192813158149592); X-Microsoft-Antispam-PRVS: <47d3e4f116e646c6bee6e3a496ee6657@SN1NAM02HT035.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(13017025)(13018025)(13015025)(3002001)(10201501046); SRVR:SN1NAM02HT035; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM02HT035; X-Forefront-PRVS: 08220FA8D6 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2016 22:40:34.4726 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.96]; Helo=[xsj-tvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT035 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.60 Cc: peter.maydell@linaro.org, crosthwaitepeter@gmail.com, alistair.francis@xilinx.com Subject: [Qemu-devel] [PATCH v7 1/6] qdev: get_child_bus(): Use QOM lookup if available X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Crosthwaite qbus_realize() adds busses as a QOM child of the device in addition to adding it to the qdev bus list. Change get_child_bus() to use the QOM child if it is available. This takes priority over the bus-list, but the child object is checked for type correctness. This prepares support for aliasing of buses. The use case is SoCs, where a SoC container needs to present buses to the board level, but the buses are implemented by controller IP we already model as self contained qbus-containing devices. Signed-off-by: Peter Crosthwaite Acked-by: Alistair Francis Signed-off-by: Alistair Francis --- hw/core/qdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 2c7101d..75d1227 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -580,6 +580,12 @@ void qdev_pass_gpios(DeviceState *dev, DeviceState *container, BusState *qdev_get_child_bus(DeviceState *dev, const char *name) { BusState *bus; + Object *child = object_resolve_path_component(OBJECT(dev), name); + + bus = (BusState *)object_dynamic_cast(child, TYPE_BUS); + if (bus) { + return bus; + } QLIST_FOREACH(bus, &dev->child_bus, sibling) { if (strcmp(name, bus->name) == 0) {