Skip to contentSkip to conversation

[7223] xen: add block device backend driver.

Qemu-devel Anthony Liguori 1 participant 1 message Apr 22, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

Revision: 7223

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7223
Author:   aliguori
Date:     2009-04-22 15:19:30 +0000 (Wed, 22 Apr 2009)

Log Message:
-----------
xen: add block device backend driver. (Gerd Hoffmann)

This patch adds a block device backend driver to qemu. It is a pure userspace implemention using the gntdev interface. It uses "qdisk" as backend name in xenstore so it doesn't interfere with the other existing backends (blkback aka "vbd" and tapdisk aka "tap").

Modified Paths:
--------------
trunk/Makefile.target
trunk/hw/xen_backend.h
trunk/hw/xen_machine_pv.c
trunk/sysemu.h
trunk/vl.c

Added Paths:
-----------
trunk/hw/xen_blkif.h
trunk/hw/xen_disk.c

Modified: trunk/Makefile.target
===================================================================

Makefile.target +1 -1
@@ -562,7 +562,7 @@
 
 # xen backend driver support
 XEN_OBJS := xen_machine_pv.o xen_backend.o
-XEN_OBJS += xen_console.o xenfb.o
+XEN_OBJS += xen_console.o xenfb.o xen_disk.o
 ifeq ($(CONFIG_XEN), yes)
   OBJS += $(XEN_OBJS)
   LIBS += $(XEN_LIBS)

Modified: trunk/hw/xen_backend.h
===================================================================

hw/xen_backend.h +2 -0
@@ -2,6 +2,7 @@
 #define QEMU_HW_XEN_BACKEND_H 1
 
 #include "xen_common.h"
+#include "sysemu.h"
 
 /* ------------------------------------------------------------- */
 
@@ -87,6 +88,7 @@
 extern struct XenDevOps xen_console_ops;      /* xen_console.c     */
 extern struct XenDevOps xen_kbdmouse_ops;     /* xen_framebuffer.c */
 extern struct XenDevOps xen_framebuffer_ops;  /* xen_framebuffer.c */
+extern struct XenDevOps xen_blkdev_ops;       /* xen_disk.c        */
 
 void xen_init_display(int domid);
 

Added: trunk/hw/xen_blkif.h
===================================================================

hw/xen_blkif.h +103 -0

103 lines not on this page · raw message

Added: trunk/hw/xen_disk.c
===================================================================

hw/xen_disk.c +779 -0

779 lines not on this page · raw message

Modified: trunk/hw/xen_machine_pv.c
===================================================================

hw/xen_machine_pv.c +1 -0
@@ -59,6 +59,7 @@
     xen_be_register("console", &xen_console_ops);
     xen_be_register("vkbd", &xen_kbdmouse_ops);
     xen_be_register("vfb", &xen_framebuffer_ops);
+    xen_be_register("qdisk", &xen_blkdev_ops);
 
     /* setup framebuffer */
     xen_init_display(xen_domid);

Modified: trunk/sysemu.h
===================================================================

sysemu.h +1 -1
@@ -131,7 +131,7 @@
 #endif
 
 typedef enum {
-    IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO
+    IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN
 } BlockInterfaceType;
 
 typedef enum {

Modified: trunk/vl.c
===================================================================

vl.c +5 -1
@@ -2373,7 +2373,10 @@
         } else if (!strcmp(buf, "virtio")) {
             type = IF_VIRTIO;
             max_devs = 0;
-        } else {
+	} else if (!strcmp(buf, "xen")) {
+	    type = IF_XEN;
+            max_devs = 0;
+	} else {
             fprintf(stderr, "qemu: '%s' unsupported bus type '%s'\n", str, buf);
             return -1;
 	}
@@ -2587,6 +2590,7 @@
     switch(type) {
     case IF_IDE:
     case IF_SCSI:
+    case IF_XEN:
         switch(media) {
 	case MEDIA_DISK:
             if (cyls != 0) {