From patchwork Wed May 2 11:31:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 156448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3A525B6FC2 for ; Wed, 2 May 2012 22:46:37 +1000 (EST) Received: from localhost ([::1]:45220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPXoU-0006NF-Ie for incoming@patchwork.ozlabs.org; Wed, 02 May 2012 07:33:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPXnS-000514-Pp for qemu-devel@nongnu.org; Wed, 02 May 2012 07:32:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPXnQ-0000QM-V2 for qemu-devel@nongnu.org; Wed, 02 May 2012 07:32:38 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:48124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPXnQ-0000FY-N5 for qemu-devel@nongnu.org; Wed, 02 May 2012 07:32:36 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so1148607pbb.4 for ; Wed, 02 May 2012 04:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=pYT/vhzzOBLgHHyOQ9fXq59shK5CkMQ4g2Dp5/A9jcI=; b=sZPeerNvYulB1WPl9ihcx3vnu9UiX4zmVJ7Nr8XSUe59/lCmiiGOQ7QWEL3yER+WIu qBsKbdqSZXrkzEbVIALO0SnK+C0R0OzjhF/RRXQhRDkkI+/eWxqfcpzxISGPlzVEvziA 9IzSzxTNEngGbWEJCyUkrDhxopFK+loUaGsgF6EwMU8uwORrzCrRHw7UacDs6IZ204bJ Mmi+EHBBAldeigQb4qtWTiAPAWrLIoh29YeIx6rAaFAtRH2LIYe5VTd2KihKllulfOYi QYGF2CiAlMyQnl+MD7RQp+LEQk+ETG3ECRI7iJj9NMaFvD7TJ4F66xEiI1p9dVeCv+4C gNrg== Received: by 10.68.237.163 with SMTP id vd3mr201144pbc.61.1335958355844; Wed, 02 May 2012 04:32:35 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-182-16.ip50.fastwebnet.it. [93.34.182.16]) by mx.google.com with ESMTPS id wp3sm946901pbc.38.2012.05.02.04.32.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 May 2012 04:32:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 2 May 2012 13:31:11 +0200 Message-Id: <1335958273-769-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.9.3 In-Reply-To: <1335958273-769-1-git-send-email-pbonzini@redhat.com> References: <1335958273-769-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, liwp@linux.vnet.ibm.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 19/21] qdev: connect busses with their parent devices 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony Liguori This makes sysbus part of the root hierarchy and all busses children of their respective parent DeviceState. Signed-off-by: Anthony Liguori Signed-off-by: Paolo Bonzini --- hw/qdev.c | 4 ++++ hw/sysbus.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/hw/qdev.c b/hw/qdev.c index b97ba00..decbcb1 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -404,6 +404,7 @@ static void do_qbus_create_inplace(BusState *bus, const char *typename, if (parent) { QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; + object_property_add_child(OBJECT(parent), bus->name, OBJECT(bus), NULL); } else if (bus != sysbus_get_default()) { /* TODO: once all bus devices are qdevified, only reset handler for main_system_bus should be registered here. */ @@ -651,6 +652,9 @@ static void device_initfn(Object *obj) class = object_class_get_parent(class); } while (class != object_class_by_name(TYPE_DEVICE)); qdev_prop_set_globals(dev); + + object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS, + (Object **)&dev->parent_bus, NULL); } /* Unlink device from bus and free the structure. */ diff --git a/hw/sysbus.c b/hw/sysbus.c index f10a7d1..417fbd4 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -275,6 +275,9 @@ static void main_system_bus_create(void) qbus_create_inplace(main_system_bus, TYPE_SYSTEM_BUS, NULL, "main-system-bus"); main_system_bus->qdev_allocated = 1; + object_property_add_child(container_get(qdev_get_machine(), + "/unattached"), + "sysbus", OBJECT(main_system_bus), NULL); } BusState *sysbus_get_default(void)