PV drivers for HVM guests
PATCH 1/1 PV drivers for HVM guests
I am enclosing the patch I have been working on. I have tested this on sles9 (2.6.5) and RHEL 4 (2.6.9). The patch applies cleanly on ChangeSet 11635. This patch was cleaned up based on Ian's and DOI's work.
Signed-off-by K. Y. Srinivasan ([email protected])
linux-2.6/blkfront/blkfront.c +26 -0
@@ -47,6 +47,7 @@#include <xen/gnttab.h> #include <asm/hypervisor.h> #include <asm/maddr.h> +#include <xen/platform_compat.h> #define BLKIF_STATE_DISCONNECTED 0#define BLKIF_STATE_CONNECTED 1
@@ -466,6 +467,27 @@ command, (long)argument, inode->i_rdev);switch (command) { +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 ) +case HDIO_GETGEO : { +struct block_device *bd = inode->i_bdev; +struct hd_geometry geo; +int ret; + +if (!argument) +return -EINVAL ; + + geo.start =get_start_sect (bd); + ret =blkif_getgeo (bd, &geo); +if (ret) +return ret; + +if (copy_to_user ((struct hd_geometry __user *)argument, &geo, +sizeof (geo))) +return -EFAULT ; + +return 0 ; + } +#endif case CDROMMULTISESSION :DPRINTK ("FIXME: support multisession CDs later\n" );for (i =0 ; i <sizeof (struct cdrom_multisession ); i++)
@@ -678,8 +700,12 @@ req, (bret->status ==BLKIF_RSP_OKAY ), req->hard_nr_sectors);BUG_ON (ret); +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 ) +end_that_request_last (req); +#else end_that_request_last ( req, (bret->status ==BLKIF_RSP_OKAY )); +#endif break ;default :BUG ();
linux-2.6/blkfront/Makefile +3 -3
@@ -1,5 +1,5 @@ +include $(M)/overrides.mk -obj-$(CONFIG_XEN_BLKDEV_FRONTEND) := xenblk.o - -xenblk-objs := blkfront.o vbd.o +obj-m += xen-vbd.o +xen-vbd-objs := blkfront.o vbd.o
linux-2.6/blkfront/vbd.c +7 -0
@@ -35,6 +35,7 @@#include "block.h" #include <linux/blkdev.h> #include <linux/list.h> +#include <xen/platform_compat.h> #define BLKIF_MAJOR (dev) ((dev)>>8)#define BLKIF_MINOR (dev) ((dev) & 0xff)
@@ -91,7 +92,9 @@ .open = blkif_open, .release = blkif_release, .ioctl = blkif_ioctl, +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,15 ) .getgeo = blkif_getgeo +#endif };DEFINE_SPINLOCK (blkif_io_lock);
@@ -186,7 +189,11 @@if (rq ==NULL )return -1 ; +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,9 )elevator_init (rq,"noop" ); +#else +elevator_init (rq, &elevator_noop); +#endif /* Hard sector size and max sectors impersonate the equiv. hardware. */ blk_queue_hardsect_size (rq, sector_size);
linux-2.6/include/asm/hypervisor.h +7 -3
@@ -47,10 +47,14 @@#include <asm/ptrace.h> #include <asm/page.h> #if defined(__i386__) -# ifdef CONFIG_X86_PAE -# include <asm-generic/pgtable-nopud.h> +# if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +# ifdef CONFIG_X86_PAE +# include <asm-generic/pgtable-nopud.h> +# else +# include <asm-generic/pgtable-nopmd.h> +# endif # else -# include <asm-generic/pgtable-nopmd.h> +typedef struct {pgd_t pgd; }pud_t ;# endif #endif
linux-2.6/include/asm/synch_bitops.h +1 -0
@@ -8,6 +8,7 @@*/ #include <linux/config.h> +#include <xen/platform_compat.h> #define ADDR (*(volatile long *) addr)
linux-2.6/include/xen/platform_compat.h +55 -0
55 lines not on this page · raw message
linux-2.6/include/xen/xenbus.h +5 -0
@@ -35,13 +35,18 @@#define _XEN_XENBUS_H#include <linux/device.h> +#include <linux/init.h> #include <linux/notifier.h> +#include <linux/version.h> +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,15 )#include <linux/mutex.h> +#endif #include <linux/completion.h> #include <xen/interface/xen.h> #include <xen/interface/grant_table.h> #include <xen/interface/io/xenbus.h> #include <xen/interface/io/xs_wire.h> +#include <xen/platform_compat.h> /* Register callback to watch this node. */ struct xenbus_watch
linux-2.6/netfront/Makefile +3 -3
@@ -1,4 +1,4 @@ +include $(M)/overrides.mk -obj-$(CONFIG_XEN_NETDEV_FRONTEND) := xennet.o - -xennet-objs := netfront.o +obj-m = xen-vnif.o +xen-vnif-objs := netfront.o
linux-2.6/netfront/netfront.c +0 -1
@@ -46,7 +46,6 @@#include <linux/ethtool.h> #include <linux/in.h> #include <linux/if_ether.h> -#include <linux/io.h> #include <net/sock.h> #include <net/pkt_sched.h> #include <net/arp.h>
linux-2.6/platform-pci/features.c +1 -0
@@ -10,6 +10,7 @@#include <linux/module.h> #include <asm/hypervisor.h> #include <xen/features.h> +#include <xen/platform_compat.h> u8 xen_features[XENFEAT_NR_SUBMAPS *32 ]__read_mostly ;/* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
linux-2.6/platform-pci/Kbuild +1 -1
@@ -4,4 +4,4 @@ EXTRA_CFLAGS += -I$(M)/platform-pci -xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o +xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o platform_compat.o
linux-2.6/platform-pci/Makefile +7 -0
@@ -0,0 +1,7 @@ +include $(M)/overrides.mk + +obj-m := xen-platform-pci.o + +EXTRA_CFLAGS += -I$(M)/platform-pci + +xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o platform_compat.o
linux-2.6/platform-pci/platform_compat.c +93 -0
93 lines not on this page · raw message
linux-2.6/platform-pci/platform-pci.c +1 -0
@@ -35,6 +35,7 @@#include <asm/hypervisor.h> #include <xen/interface/memory.h> #include <xen/features.h> +#include <xen/platform_compat.h> #include "platform-pci.h"
linux-2.6/xenbus/Makefile +6 -8
@@ -1,12 +1,10 @@ -obj-y += xenbus.o -obj-$(CONFIG_XEN_BACKEND) += xenbus_be.o - -xenbus_be-objs = -xenbus_be-objs += xenbus_backend_client.o +include $(M)/overrides.mk +obj-m += xenbus.o xenbus-objs = -xenbus-objs += xenbus_client.o xenbus-objs += xenbus_comms.o xenbus-objs += xenbus_xs.o -xenbus-objs += xenbus_probe.o -obj-$(CONFIG_XEN_XENBUS_DEV) += xenbus_dev.o +xenbus-objs += xenbus_probe.o +xenbus-objs += xenbus_dev.o +xenbus-objs += xenbus_client.o +xenbus-objs += xen_proc.o
linux-2.6/xenbus/xenbus_probe.c +58 -11
235 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel