From patchwork Mon Sep 26 12:43:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 9350637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 782E66077A for ; Mon, 26 Sep 2016 12:44:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A5B828D5E for ; Mon, 26 Sep 2016 12:44:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EBA328D7E; Mon, 26 Sep 2016 12:44:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id B8DFA28D70 for ; Mon, 26 Sep 2016 12:44:41 +0000 (UTC) Received: from localhost ([::1]:44143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVGw-0007ef-SL for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Sep 2016 08:44:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVGU-0007cQ-EO for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boVGN-0007oT-DZ for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:44:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:41234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVGN-0007nU-7F for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:44:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 50B7FAAEF; Mon, 26 Sep 2016 12:44:01 +0000 (UTC) From: Juergen Gross To: qemu-devel@nongnu.org, xen-devel@lists.xensource.com Date: Mon, 26 Sep 2016 14:43:56 +0200 Message-Id: <1474893837-13010-2-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1474893837-13010-1-git-send-email-jgross@suse.com> References: <1474893837-13010-1-git-send-email-jgross@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH 1/2] xen: add an own bus for xen backend devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, Juergen Gross , sstabellini@kernel.org, kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a bus for Xen backend devices in order to be able to establish a dedicated device path for pluggable devices. Signed-off-by: Juergen Gross --- hw/xen/xen_backend.c | 19 ++++++++++++++++--- include/hw/xen/xen_backend.h | 4 ++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 69a2388..687adf4 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -29,13 +29,13 @@ #include "hw/sysbus.h" #include "sysemu/char.h" #include "qemu/log.h" +#include "qapi/error.h" #include "hw/xen/xen_backend.h" #include -#define TYPE_XENSYSDEV "xensysdev" - DeviceState *xen_sysdev; +BusState *xen_sysbus; /* ------------------------------------------------------------- */ @@ -750,6 +750,8 @@ int xen_be_init(void) xen_sysdev = qdev_create(NULL, TYPE_XENSYSDEV); qdev_init_nofail(xen_sysdev); + xen_sysbus = qbus_create(TYPE_XENSYSBUS, DEVICE(xen_sysdev), "xen-sysbus"); + qbus_set_bus_hotplug_handler(xen_sysbus, &error_abort); return 0; @@ -862,6 +864,15 @@ void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ... qemu_log_flush(); } +static const TypeInfo xensysbus_info = { + .name = TYPE_XENSYSBUS, + .parent = TYPE_BUS, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + } +}; + static int xen_sysdev_init(SysBusDevice *dev) { return 0; @@ -878,6 +889,7 @@ static void xen_sysdev_class_init(ObjectClass *klass, void *data) k->init = xen_sysdev_init; dc->props = xen_sysdev_properties; + dc->bus_type = TYPE_XENSYSBUS; } static const TypeInfo xensysdev_info = { @@ -889,7 +901,8 @@ static const TypeInfo xensysdev_info = { static void xenbe_register_types(void) { + type_register_static(&xensysbus_info); type_register_static(&xensysdev_info); } -type_init(xenbe_register_types); +type_init(xenbe_register_types) diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 0df282a..4087231 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -54,6 +54,9 @@ struct XenDevice { QTAILQ_ENTRY(XenDevice) next; }; +#define TYPE_XENSYSDEV "xensysdev" +#define TYPE_XENSYSBUS "xen-sysbus" + /* ------------------------------------------------------------- */ /* variables */ @@ -62,6 +65,7 @@ extern xenforeignmemory_handle *xen_fmem; extern struct xs_handle *xenstore; extern const char *xen_protocol; extern DeviceState *xen_sysdev; +extern BusState *xen_sysbus; /* xenstore helper functions */ int xenstore_mkdir(char *path, int p);