From patchwork Mon Feb 15 13:33:05 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: 8315121 Return-Path: X-Original-To: patchwork-xen-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 3FA5DC02AA for ; Mon, 15 Feb 2016 13:35:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44F85200D9 for ; Mon, 15 Feb 2016 13:35:45 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 333DD2017D for ; Mon, 15 Feb 2016 13:35:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aVJH5-0005fK-6z; Mon, 15 Feb 2016 13:33:11 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aVJH3-0005f8-Cd for xen-devel@lists.xenproject.org; Mon, 15 Feb 2016 13:33:09 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id DD/AC-03225-493D1C65; Mon, 15 Feb 2016 13:33:08 +0000 X-Env-Sender: jgross@suse.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1455543187!22439565!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11902 invoked from network); 15 Feb 2016 13:33:07 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-10.tower-206.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 15 Feb 2016 13:33:07 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9CB12AAB4; Mon, 15 Feb 2016 13:33:06 +0000 (UTC) To: Wei Liu , Paul Durrant References: <20160212191037.GF8818@citrix.com> <3fbbf2a606a14f708655037f5e4fb31e@AMSPEX02CL03.citrite.net> <20160215131621.GL8818@citrix.com> From: Juergen Gross Message-ID: <56C1D391.101@suse.com> Date: Mon, 15 Feb 2016 14:33:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160215131621.GL8818@citrix.com> Cc: "qemu-devel@nongnu.org" , Stefano Stabellini , "aneesh.kumar@linux.vnet.ibm.com" , Anthony Perard , Xen-devel , "gkurz@linux.vnet.ibm.com" Subject: Re: [Xen-devel] [Qemu-devel] RFC: configuring QEMU virtfs for Xen PV(H) guests X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 On 15/02/16 14:16, Wei Liu wrote: > On Mon, Feb 15, 2016 at 09:07:13AM +0000, Paul Durrant wrote: >>> > [...] >>> # Option 2: Invent a xen-9p device >>> >>> Another way of doing it is to expose a dummy xen-9p device, so that we >>> can use -fsdev XXX -device xen-9p,YYY. This simple device should be >>> used to capture the parameters like mount_tag and fsdev_id, and then >>> chained itself to a known location. Later Xen transport can traverse >>> this known location. This xen-9p device doesn't seem to fit well into >>> the hierarchy. The best I can think of its parent should be >>> TYPE_DEVICE. In this case: >>> >>> 1. Toolstack arranges some xenstore entries. >>> 2. Toolstack arranges command line options for QEMU: >>> -fsdev XXX -device xen-9p,XXX >>> 3. QEMU starts up in xen-attach mode, scans xenstore for relevant >>> entries, then traverses the known location. >>> >>> Downside: Inventing a dummy device looks suboptimal to me. Sorry, didn't notice this thread before. For Xen pvUSB backend in qemu I need a Xen system device acting as parent for being able to attach/detach virtual USB busses. I haven't had time to update my patches for some time, but the patch for this system device is rather easy. It could be used as a parent of the xen-9p devices, too. I've attached the patch for reference. Juergen From 1bc23acf54e60c666b1ec8e3f59c7e5550423e6f Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: Thu, 3 Sep 2015 11:54:50 +0200 Subject: [Patch V1 1/3] xen: introduce dummy system device 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 --- hw/xenpv/xen_machine_pv.c | 39 +++++++++++++++++++++++++++++++++++++++ include/hw/xen/xen_backend.h | 1 + 2 files changed, 40 insertions(+) diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 2e545d2..57bc071 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -24,10 +24,15 @@ #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) { const char *kernel_filename = machine->kernel_filename; @@ -59,6 +64,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); @@ -93,6 +101,31 @@ 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 QEMUMachine xenpv_machine = { .name = "xenpv", .desc = "Xen Para-virtualized PC", @@ -101,9 +134,15 @@ static QEMUMachine xenpv_machine = { .default_machine_opts = "accel=xen", }; +static void xenpv_register_types(void) +{ + type_register_static(&xensysdev_info); +} + static void xenpv_machine_init(void) { qemu_register_machine(&xenpv_machine); } +type_init(xenpv_register_types) machine_init(xenpv_machine_init); diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 3b4125e..911ba6d 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -59,6 +59,7 @@ struct XenDevice { extern XenXC xen_xc; 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); -- 2.1.4