From patchwork Wed Aug 3 13:05:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9261289 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 896B26048B for ; Wed, 3 Aug 2016 13:15:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A81227FA6 for ; Wed, 3 Aug 2016 13:15:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F73028508; Wed, 3 Aug 2016 13:15:53 +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 7802B27FA6 for ; Wed, 3 Aug 2016 13:15:51 +0000 (UTC) Received: from localhost ([::1]:34481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUw1W-0000Zr-Eg for patchwork-qemu-devel@patchwork.kernel.org; Wed, 03 Aug 2016 09:15:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUvrz-0008Dr-N8 for qemu-devel@nongnu.org; Wed, 03 Aug 2016 09:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUvrv-00085V-15 for qemu-devel@nongnu.org; Wed, 03 Aug 2016 09:05:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUvru-000855-PH for qemu-devel@nongnu.org; Wed, 03 Aug 2016 09:05:54 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 5D488C057FA6; Wed, 3 Aug 2016 13:05:54 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u73D5rrF015011; Wed, 3 Aug 2016 09:05:53 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id CE81D81021; Wed, 3 Aug 2016 15:05:51 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 3 Aug 2016 15:05:49 +0200 Message-Id: <1470229549-32477-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1470229549-32477-1-git-send-email-kraxel@redhat.com> References: <1470229549-32477-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 03 Aug 2016 13:05:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/6] xen: use a common function for pv and hvm guest backend register calls 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: Juergen Gross , Anthony Perard , Stefano Stabellini , Gerd Hoffmann , "open list:X86" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Juergen Gross Instead of calling xen_be_register() for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice. This at once fixes the error that hvm domains couldn't use the qusb backend. Signed-off-by: Juergen Gross Acked-by: Anthony PERARD Message-id: 1470119552-16170-1-git-send-email-jgross@suse.com Signed-off-by: Gerd Hoffmann --- hw/xen/xen_backend.c | 10 ++++++++++ hw/xenpv/xen_machine_pv.c | 7 +------ include/hw/xen/xen_backend.h | 1 + xen-hvm.c | 4 +--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 3ceb778..69a2388 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -780,6 +780,16 @@ int xen_be_register(const char *type, struct XenDevOps *ops) return xenstore_scan(type, xen_domid, ops); } +void xen_be_register_common(void) +{ + xen_be_register("console", &xen_console_ops); + xen_be_register("vkbd", &xen_kbdmouse_ops); + xen_be_register("qdisk", &xen_blkdev_ops); +#ifdef CONFIG_USB_LIBUSB + xen_be_register("qusb", &xen_usb_ops); +#endif +} + int xen_be_bind_evtchn(struct XenDevice *xendev) { if (xendev->local_port != -1) { diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 48f725c..79aef4e 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -67,14 +67,9 @@ static void xen_init_pv(MachineState *machine) break; } - xen_be_register("console", &xen_console_ops); - xen_be_register("vkbd", &xen_kbdmouse_ops); + xen_be_register_common(); xen_be_register("vfb", &xen_framebuffer_ops); - xen_be_register("qdisk", &xen_blkdev_ops); xen_be_register("qnic", &xen_netdev_ops); -#ifdef CONFIG_USB_LIBUSB - xen_be_register("qusb", &xen_usb_ops); -#endif /* configure framebuffer */ if (xenfb_enabled) { diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 754c0a4..0df282a 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -87,6 +87,7 @@ void xen_be_check_state(struct XenDevice *xendev); /* xen backend driver bits */ int xen_be_init(void); +void xen_be_register_common(void); int xen_be_register(const char *type, struct XenDevOps *ops); int xen_be_set_state(struct XenDevice *xendev, enum xenbus_state state); int xen_be_bind_evtchn(struct XenDevice *xendev); diff --git a/xen-hvm.c b/xen-hvm.c index eb57792..3b0343a 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -1318,9 +1318,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) error_report("xen backend core setup failed"); goto err; } - xen_be_register("console", &xen_console_ops); - xen_be_register("vkbd", &xen_kbdmouse_ops); - xen_be_register("qdisk", &xen_blkdev_ops); + xen_be_register_common(); xen_read_physmap(state); return;