qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Juergen Gross <jgross@suse.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	"open list:X86" <xen-devel@lists.xensource.com>
Subject: [Qemu-devel] [PULL 6/6] xen: use a common function for pv and hvm guest backend register calls
Date: Wed,  3 Aug 2016 15:05:49 +0200	[thread overview]
Message-ID: <1470229549-32477-7-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1470229549-32477-1-git-send-email-kraxel@redhat.com>

From: Juergen Gross <jgross@suse.com>

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 <jgross@suse.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Message-id: 1470119552-16170-1-git-send-email-jgross@suse.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 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;
 
-- 
1.8.3.1

  parent reply	other threads:[~2016-08-03 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 13:05 [Qemu-devel] [PULL for-2.7 0/6] usb patch queue Gerd Hoffmann
2016-08-03 13:05 ` [Qemu-devel] [PULL 1/6] wxx: Fix compiler warning for host-libusb.c Gerd Hoffmann
2016-08-03 13:05 ` [Qemu-devel] [PULL 2/6] wxx: Fix compilation of host-libusb.c Gerd Hoffmann
2016-08-03 13:05 ` [Qemu-devel] [PULL 3/6] ehci: faster frame index calculation for skipped frames Gerd Hoffmann
2016-08-03 13:05 ` [Qemu-devel] [PULL 4/6] xen: when removing a backend don't remove many of them Gerd Hoffmann
2016-08-03 13:05 ` [Qemu-devel] [PULL 5/6] xen: drain submit queue in xen-usb before removing device Gerd Hoffmann
2016-08-03 13:05 ` Gerd Hoffmann [this message]
2016-08-03 15:02 ` [Qemu-devel] [PULL for-2.7 0/6] usb patch queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470229549-32477-7-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=jgross@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).