From patchwork Mon May 23 13:12:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9131815 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 5E6286075F for ; Mon, 23 May 2016 13:14:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 580DD2823C for ; Mon, 23 May 2016 13:14:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BCD52823E; Mon, 23 May 2016 13:14:09 +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=-3.2 required=2.0 tests=BAYES_00,FSL_HELO_HOME, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BAB002823C for ; Mon, 23 May 2016 13:14:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4pea-0004zG-4Z; Mon, 23 May 2016 13:12:16 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4peY-0004xv-Bw for xen-devel@lists.xensource.com; Mon, 23 May 2016 13:12:14 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id C6/0F-04050-CA103475; Mon, 23 May 2016 13:12:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRWlGSWpSXmKPExsVysWW7jO4aRud wg8mrGS3uTXnP7sDosb1vF3sAYxRrZl5SfkUCa8aCq73sBT3iFbOeXWZrYLwt3MXIxSEksJNJ 4uGMdYwQzgVGiSMff7J3MXICOWUS7zcuB7PZBNQlzsw+zApiiwhISvzuOs0M0sAs8IxR4ve66 2wgCWEBM4nJHWtZQGwWAVWJF7OmgTXwCjhInDr0GizOKeAo0T+5lRVigYPEip1HmUBsCQFtie cXJrND2H2MEh8nMk1g5F3AyLCKUb04tagstUjXSC+pKDM9oyQ3MTNH19DAWC83tbg4MT01JzG pWC85P3cTIzAg6hkYGHcwnmp2PsQoycGkJMp7codTuBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ 3kUMzuFCgkWp6akVaZk5wNCESUtw8CiJ8P77D9TKW1yQmFucmQ6ROsWoKCXO+wCkTwAkkVGaB 9cGi4dLjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5X4NM4cnMK4Gb/gpoMRPQ4ofSDiCLSx IRUlINjFW2hz9O4Fi3qnNfBtcGh6un/vat+XFqklDZi3uFxl5/bzAIbPqRdUJZ79Dm/Fk7fHi Fn5jl2SR0RtZsybflDC+6sEXzc2W8fWPJ8q0uPYrLJrfbJjUqmLU93/niwdeIjy+VdU0Fnmjf n6H001Gf7SGP4Ky7qW6ioV/ZrVI/vXogtu+gq4vcLCWW4oxEQy3mouJEAMThOk6CAgAA X-Env-Sender: kraxel@redhat.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1464009129!31924217!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31681 invoked from network); 23 May 2016 13:12:11 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-4.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 May 2016 13:12:11 -0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3ACA3DA; Mon, 23 May 2016 13:12:08 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4NDC7eh019725; Mon, 23 May 2016 09:12:07 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 3C00B8294C; Mon, 23 May 2016 15:12:06 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 23 May 2016 15:12:00 +0200 Message-Id: <1464009123-5814-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1464009123-5814-1-git-send-email-kraxel@redhat.com> References: <1464009123-5814-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 23 May 2016 13:12:08 +0000 (UTC) Cc: Juergen Gross , Anthony Perard , Stefano Stabellini , Gerd Hoffmann , "open list:X86" Subject: [Xen-devel] [PULL 1/4] xen: introduce dummy system device X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Juergen Gross Introduce a new dummy system device serving as parent for virtual buses. This will enable new pv backends to introduce virtual buses which are removable again opposed to system buses which are meant to stay once added. Signed-off-by: Juergen Gross Acked-by: Anthony PERARD Reviewed-by: Wei Liu Message-id: 1463062421-613-2-git-send-email-jgross@suse.com Signed-off-by: Gerd Hoffmann --- hw/xenpv/xen_machine_pv.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 1 + 2 files changed, 41 insertions(+) diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index fc13535..48d5bc6 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -25,10 +25,15 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/boards.h" +#include "hw/sysbus.h" #include "hw/xen/xen_backend.h" #include "xen_domainbuild.h" #include "sysemu/block-backend.h" +#define TYPE_XENSYSDEV "xensysdev" + +DeviceState *xen_sysdev; + static void xen_init_pv(MachineState *machine) { DriveInfo *dinfo; @@ -67,6 +72,9 @@ static void xen_init_pv(MachineState *machine) break; } + xen_sysdev = qdev_create(NULL, TYPE_XENSYSDEV); + qdev_init_nofail(xen_sysdev); + xen_be_register("console", &xen_console_ops); xen_be_register("vkbd", &xen_kbdmouse_ops); xen_be_register("vfb", &xen_framebuffer_ops); @@ -101,6 +109,38 @@ static void xen_init_pv(MachineState *machine) xen_init_display(xen_domid); } +static int xen_sysdev_init(SysBusDevice *dev) +{ + return 0; +} + +static Property xen_sysdev_properties[] = { + {/* end of property list */}, +}; + +static void xen_sysdev_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = xen_sysdev_init; + dc->props = xen_sysdev_properties; +} + +static const TypeInfo xensysdev_info = { + .name = TYPE_XENSYSDEV, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SysBusDevice), + .class_init = xen_sysdev_class_init, +}; + +static void xenpv_register_types(void) +{ + type_register_static(&xensysdev_info); +} + +type_init(xenpv_register_types); + static void xenpv_machine_init(MachineClass *mc) { mc->desc = "Xen Para-virtualized PC"; diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index c839eeb..b4b4ff0 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -60,6 +60,7 @@ extern xc_interface *xen_xc; extern xenforeignmemory_handle *xen_fmem; extern struct xs_handle *xenstore; extern const char *xen_protocol; +extern DeviceState *xen_sysdev; /* xenstore helper functions */ int xenstore_write_str(const char *base, const char *node, const char *val);