PV drivers for HVM guests
I am trying to build PV drivers for SLES9 HVM guests. SLES 9 is based on the 2.6.5 kernel. Since the PV driver code is really designed for the latest kernel release, I have had many issues/problems in building the PV drivers for older Linux OS targets - I have only been looking at the issues with 2.6.5 kernel base and I suspect the problem will be even worse if one were to look at older Linux kernels. This is unfortunate since PV drivers are so critical for HVM guests and there is considerable interest in supporting legacy Linux environments as HVM guests. The problems I have had to deal with can be broadly classified into:
a) Compiler related issues
b) Missing functionality in the legacy kernel - this includes features as well as changed data structures
c) Implementation differences of a given feature
These differences can be dealt with in a couple of different ways:
1) Modify the code in the PV drivers under appropriate compilation switches to deal with the differences in the base kernels.
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.
I have implemented both these schemes for the sles9 kernel and would like to get your input on your preference. I personally like option 2. Going forward, the evolution of PV drivers needs to be constrained by the required support for legacy Linux environments.
Regards,
K. Y. Srinivasan
Interesting! Ideally, there would be better performance in the base HVM device model. I think I know of some people that are working hard on that.
I'm curious to see what you've done for (1) and (2).
Peace.
Andrew
Quoted 24 lines · Ky Srinivasan
I am trying to build PV drivers for SLES9 HVM guests. SLES 9 is based on the 2.6.5 kernel. Since the PV driver code is really designed for the latest kernel release, I have had many issues/problems in building the PV drivers for older Linux OS targets - I have only been looking at the issues with 2.6.5 kernel base and I suspect the problem will be even worse if one were to look at older Linux kernels. This is unfortunate since PV drivers are so critical for HVM guests and there is considerable interest in supporting legacy Linux environments as HVM guests. The problems I have had to deal with can be broadly classified into:
a) Compiler related issues
b) Missing functionality in the legacy kernel - this includes features as well as changed data structures
c) Implementation differences of a given featureThese differences can be dealt with in a couple of different ways:
1) Modify the code in the PV drivers under appropriate compilation switches to deal with the differences in the base kernels.
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.I have implemented both these schemes for the sles9 kernel and would like to get your input on your preference. I personally like option 2. Going forward, the evolution of PV drivers needs to be constrained by the required support for legacy Linux environments.
Regards,
K. Y. Srinivasan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines · Ky Srinivasan
I am trying to build PV drivers for SLES9 HVM guests. SLES 9 is based on the 2.6.5 kernel. Since the PV driver code is really designed for the latest kernel release, I have had many issues/problems in building the PV drivers for older Linux OS targets - I have only been looking at the issues with 2.6.5 kernel base and I suspect the problem will be even worse if one were to look at older Linux kernels. This is unfortunate since PV drivers are so critical for HVM guests and there is considerable interest in supporting legacy Linux environments as HVM guests. The problems I have had to deal with can be broadly classified into:
a) Compiler related issues
b) Missing functionality in the legacy kernel - this includes features as well as changed data structures
c) Implementation differences of a given featureThese differences can be dealt with in a couple of different ways:
1) Modify the code in the PV drivers under appropriate compilation switches to deal with the differences in the base kernels.
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.I have implemented both these schemes for the sles9 kernel and would like to get your input on your preference. I personally like option 2. Going forward, the evolution of PV drivers needs to be constrained by the required support for legacy Linux environments.
We have generally taken approach 1, for supporting SLES9 32/64 & RHEL4 32/64, with others under development. While the code is uglier, it is also more obvious to a maintainer when they run across something like the following:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
elevator_init(rq, "noop");
#else
elevator_init(rq, &elevator_noop);#endif
or
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
end_that_request_last(
req, (bret->status == BLKIF_RSP_OKAY));
#else
end_that_request_last(req);#endif
In this way, the sensitive areas of the code are obvious. As the PV drivers move forward, new kernel interface changes require similar changes. As you mention, which ever method is used, some level of discipline is required in maintaining the PV drivers.
With your suggested option 2, does this require separate "compatibility component" code for each supported kernel version? Or do you envision a single compatibility layer that would hide the conditionally compiled code from the PV drivers proper?
There is also the issue of whether the PV drivers can/should support multiple hypervisor versions moving forward.
Steve
Signature · 1 line
Steve Ofsthun - Virtual Iron Software, Inc.
Quoted 11 lines · Ky Srinivasan
These differences can be dealt with in a couple of different ways:
1) Modify the code in the PV drivers under appropriate compilation switches to deal with the differences in the base kernels.
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.I have implemented both these schemes for the sles9 kernel and would like to get your input on your preference. I personally like option 2. Going forward, the evolution of PV drivers needs to be constrained by the required support for legacy Linux environments.
A shim layer (i.e., a set of compat macros) that avoids ifdef'ing the core driver code is definitely the way to go.
-- Keir
Quoted 7 lines · Keir Fraser
Quoted 4 lines
I have implemented both these schemes for the sles9 kernel and would like to get your input on your preference. I personally like option 2. Going forward, the evolution of PV drivers needs to be constrained by the required support for legacy Linux environments.
A shim layer (i.e., a set of compat macros) that avoids ifdef'ing the core driver code is definitely the way to go.
FWIW, neither option has a chance of being accepted upstream. For upstream acceptance (assuming that it is a goal - it should be, otherwise you forever chase the latest kernel API change, multiplied by the number of different distro kernel trees you support) just write the latest version of the driver to the latest kernel version. But I suspect you already know this :-)
Cheers,
Muli
Quoted 9 lines · Muli Ben-Yehuda
Quoted 2 lines
A shim layer (i.e., a set of compat macros) that avoids ifdef'ing the core driver code is definitely the way to go.
FWIW, neither option has a chance of being accepted upstream. For upstream acceptance (assuming that it is a goal - it should be, otherwise you forever chase the latest kernel API change, multiplied by the number of different distro kernel trees you support) just write the latest version of the driver to the latest kernel version. But I suspect you already know this :-)
The versions in the upstream patches get cleaned up as necessary for acceptance. Yes, our aim is to get all the code support needed for PV-on-HVM drivers out of the external unmodified_drivers directory and properly into the Linux tree so that they can be built in-tree either for a PV kernel or a native kernel. Then the unmodified_drivers directory will contain only some build-system magic to make it easier to build drivers out-of-tree.
-- Keir
Quoted 4 lines · Muli Ben-Yehuda
Quoted 2 lines
A shim layer (i.e., a set of compat macros) that avoids ifdef'ing the core driver code is definitely the way to go.
FWIW, neither option has a chance of being accepted upstream.
Exactly thats why a shim layer is the way to go (if possible, doesn't work for all changes but for most). Did that that quite some time while maintaining the v4l subsystem. Making driver source code use the 2.6.latest conventions and have some compat.h header file full of stuff like this ...
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,xx) # define foo gryyz #endif
or (better if possible as it catches distro backports, which does happen now and then for compiling recent drivers on old distro kernels).
#ifndef bar # define bar xyzzy #endif
nicely separates out the compat bits. It makes the code more readable and also is less work when submitting code upstream.
cheers,
Gerd
Signature · 2 lines
Gerd Hoffmann <[email protected]> http://www.suse.de/~kraxel/julika-dora.jpeg
Quoted 19 lines · Gerd Hoffmann
Quoted 4 lines · Muli Ben-Yehuda
Quoted 2 lines
A shim layer (i.e., a set of compat macros) that avoids ifdef'ing the core driver code is definitely the way to go.
FWIW, neither option has a chance of being accepted upstream.
Exactly thats why a shim layer is the way to go (if possible, doesn't work for all changes but for most). Did that that quite some time while maintaining the v4l subsystem. Making driver source code use the 2.6.latest conventions and have some
compat.hheader file full of stuff like this ...#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,xx) # define foo gryyz #endifor (better if possible as it catches distro backports, which does happen now and then for compiling recent drivers on old distro kernels).
Quoted 6 lines
#ifndef bar # define bar xyzzy #endifnicely separates out the compat bits. It makes the code more readable and also is less work when submitting code upstream.
I hate to point out the obvious, but often when calls get renamed upstream it is actually because the semantics changed subtly (the point of the rename was to enforce a audit and proper fix of the driver) Typically then using define bar xyz is then not the right thing to do.
Especially when you do
#define oldfunctionname newfunctionname
without any translation you very likely have a bug.
A shim layer can be the right thing to do still, but you have to be very careful to not miss such a semantics change.
-Andi
Quoted 6 lines
These differences can be dealt with in a couple of different ways:
1) Modify the code in the PV drivers under appropriate compilation switches to deal with the differences in the base kernels.
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.
How much code is actually required in this abstraction layer?
Steven.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Ky Srinivasan
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.
I have implemented both these schemes for the sles9 kernel
FWIW I have a half complete implementation (compile tested only) of such a scheme which I've attached, perhaps you can crib something useful from it ;-).
Basically it adds a compat-include directory to the end of the include search path which contains compatibility versions of headers which may not present in older kernels and adds compat.h which defines other missing bits where necessary.
It covers most of the issues compiling against a RHEL4 (2.6.9) or SLES9 (2.6.5) kernel, although compatibility shims for schedule_timeout_interruptible() and nonseekable_open() are still missing and the versions used for triggering compatibility code are certainly totally wrong (just right for RHEL4 and SLES9 though ;-)).
I'm fairly unhappy about the number of ifdef's in xenbus_probe.c. I reckon some function reordering could coalesce a lot of them. Perhaps they are candidates for splitting into a separate file.
This work will also be useful for the fully PV vendor kernel ports which is why I'm interested.
Ian.
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +25 -0
@@ -48,6 +48,10 @@#include <asm/hypervisor.h> #include <asm/maddr.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_STATE_DISCONNECTED 0#define BLKIF_STATE_CONNECTED 1#define BLKIF_STATE_SUSPENDED 2
@@ -468,6 +472,27 @@ int blkif_ioctl(struct inode *inode, str command, (long)argument, inode->i_rdev);switch (command) { +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 )/* TODO: confirm version */ +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++)
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +10 -0
@@ -36,6 +36,10 @@#include <linux/blkdev.h> #include <linux/list.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_MAJOR (dev) ((dev)>>8)#define BLKIF_MINOR (dev) ((dev) & 0xff)
@@ -91,7 +95,9 @@ static struct block_device_operations xl .open = blkif_open, .release = blkif_release, .ioctl = blkif_ioctl, +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,9 )/* TODO: check version */ .getgeo = blkif_getgeo +#endif };DEFINE_SPINLOCK (blkif_io_lock);
@@ -186,7 +192,11 @@ xlvbd_init_blk_queue(struct gendisk *gd,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-xen-sparse/drivers/xen/core/features.c +4 -0
@@ -10,6 +10,10 @@#include <linux/module.h> #include <asm/hypervisor.h> #include <xen/features.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif u8 xen_features[XENFEAT_NR_SUBMAPS *32 ]__read_mostly ;/* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +4 -0
@@ -44,6 +44,10 @@#include <asm/io.h> #include <xen/interface/memory.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +4 -0
@@ -64,6 +64,10 @@#include <xen/interface/grant_table.h> #include <xen/gnttab.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* * Mutually-exclusive module options to select receive data path: * rx_copy : Packets are copied by network backend into local memory
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c +4 -0
@@ -34,6 +34,10 @@#include <xen/gnttab.h> #include <xen/xenbus.h> #include <xen/driver_util.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +4 -0
@@ -39,6 +39,10 @@#include <xen/xenbus.h> #include "xenbus_comms.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +static int xenbus_irq;extern void xenbus_probe (void *);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +54 -2
234 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +5 -0
@@ -42,8 +42,13 @@#include <linux/fcntl.h> #include <linux/kthread.h> #include <linux/rwsem.h> +#include <linux/module.h> #include <xen/xenbus.h> #include "xenbus_comms.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h +4 -0
@@ -8,6 +8,10 @@*/ #include <linux/config.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif #define ADDR (*(volatile long *) addr)
linux-2.6-xen-sparse/include/xen/xenbus.h +5 -0
@@ -38,10 +38,15 @@#include <linux/notifier.h> #include <linux/mutex.h> #include <linux/completion.h> +#include <linux/init.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> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* Register callback to watch this node. */ struct xenbus_watch
unmodified_drivers/linux-2.6/overrides.mk +1 -1
@@ -9,4 +9,4 @@ EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRAN EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRANT -DXEN_EVTCHN_MASK_OPS EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202 -EXTRA_CFLAGS += -I$(M)/include +EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_COMPAT_H
unmodified_drivers/linux-2.6/platform-pci/evtchn.c +4 -0
@@ -35,6 +35,10 @@#include <xen/interface/hvm/ioreq.h> #include <xen/features.h> #include "platform-pci.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif void *shared_info_area;
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +4 -0
@@ -38,6 +38,10 @@#include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define DRV_NAME "xen-platform-pci"#define DRV_VERSION "0.10"#define DRV_RELDATE "03/03/2005"
unmodified_drivers/linux-2.6/platform-pci/xen_support.c +4 -0
@@ -26,6 +26,10 @@#include <asm/hypervisor.h> #include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +void xen_machphys_update (unsigned long mfn,unsigned long pfn) {BUG ();
unmodified_drivers/linux-2.6/xenbus/Kbuild +1 -0
@@ -8,3 +8,4 @@ xenbus-objs += xenbus_dev.o xenbus-objs += xenbus_dev.o xenbus-objs += xenbus_client.o xenbus-objs += xen_proc.o +xenbus-objs += compat.o
unmodified_drivers/linux-2.6/blkfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPMD_H +#define _PGTABLE_NOPMD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,16 )/* TODO: confirm version */ +#error "This version of Linux should not need compat pgtable-nopmd.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPMD_H */
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPUD_H +#define _PGTABLE_NOPUD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,16 )/* TODO: confirm version */ +#error "This version of Linux should not need compat pgtable-nopud.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPUD_H */
unmodified_drivers/linux-2.6/compat-include/compat.h new file +49 -0
49 lines not on this page · raw message
unmodified_drivers/linux-2.6/compat-include/linux/io.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _LINUX_IO_H +#define _LINUX_IO_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,9 )/* TODO: check version */ +#error "This version of Linux should not need compat linux/io.h" +#endif + +#include <asm/io.h> + +#endif
unmodified_drivers/linux-2.6/compat-include/linux/mutex.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Cisco Systems. All rights reserved. +* +* This file is released under the GPLv2. +*/ + +/* mutex compatibility for pre-2.6.16 kernels */ + +#ifndef __LINUX_MUTEX_H +#define __LINUX_MUTEX_H + +#include <linux/version.h> +#include <asm/semaphore.h> + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,16 )/* TODO: confirm version */ +#error "This version of Linux should not need compat mutex.h" +#endif + +#define mutex semaphore +#define DEFINE_MUTEX (foo) DECLARE_MUTEX(foo) +#define mutex_init (foo) init_MUTEX(foo) +#define mutex_lock (foo) down(foo) +#define mutex_lock_interruptible (foo) down_interruptible(foo) +/* this function follows the spin_trylock() convention, so * +* it is negated to the down_trylock() return values! Be careful */ +#define mutex_trylock (foo) !down_trylock(foo) +#define mutex_unlock (foo) up(foo) + +#endif /* __LINUX_MUTEX_H */
unmodified_drivers/linux-2.6/netfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/xenbus/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/xenbus/compat.c new file +54 -0
54 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Thanks Ian. I am currently testing my implementation on sles9. I will certainly look at how I can leverage your work.
Regards,
K. Y
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Thu, Oct 5, 2006 at 11:21 AM, in message
<[email protected]>, Ian Campbell
Quoted 30 lines · <[email protected]> wrote:
Quoted 5 lines · Ky Srinivasan
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.
I have implemented both these schemes for the sles9 kernel
FWIW I have a half complete implementation (compile tested only) of such a scheme which I've attached, perhaps you can crib something useful from it ;- ).
Basically it adds a compat- include directory to the end of the include search path which contains compatibility versions of headers which may not present in older kernels and adds
compat.hwhich defines other missing bits where necessary.It covers most of the issues compiling against a RHEL4 (2.6.9) or SLES9 (2.6.5) kernel, although compatibility shims for
schedule_timeout_interruptible()andnonseekable_open()are still missing and the versions used for triggering compatibility code are certainly totally wrong (just right for RHEL4 and SLES9 though ;- )).I'm fairly unhappy about the number of ifdef's in
xenbus_probe.c. I reckon some function reordering could coalesce a lot of them. Perhaps they are candidates for splitting into a separate file.This work will also be useful for the fully PV vendor kernel ports which is why I'm interested.
Ian.
Hi,
Quoted 10 lines · Ian Campbell
Quoted 5 lines · Ky Srinivasan
2) Introduce a compatibility component that bridges the gap between the current PV code and a given Linux target and leave much of the PV driver code untouched.
I have implemented both these schemes for the sles9 kernel
FWIW I have a half complete implementation (compile tested only) of such a scheme which I've attached, perhaps you can crib something useful from it ;-).
I modified Ian's patch for RHEL4.
We've tested compiling and attaching them on RHEL4. In our simple
test, PV-on-HVM VBD/VNIF drivers work on RHEL4 original kernel.
Thanks,
- Tsunehisa Doi
# HG changeset patch
# User [email protected]
# Node ID 605297fb8618ffab4dc5bf14887700ccf3e98b78 # Parent ab85c20d33e50fb29b451580ce03f7697a0fc3b5 Backport PV-on-HVM for pre linux-2.6.16
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +25 -0
@@ -48,6 +48,10 @@#include <asm/hypervisor.h> #include <asm/maddr.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_STATE_DISCONNECTED 0#define BLKIF_STATE_CONNECTED 1#define BLKIF_STATE_SUSPENDED 2
@@ -468,6 +472,27 @@ int blkif_ioctl(struct inode *inode, str command, (long)argument, inode->i_rdev);switch (command) { +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,16 )/* TODO: confirm version */ +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++)
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +10 -0
@@ -36,6 +36,10 @@#include <linux/blkdev.h> #include <linux/list.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_MAJOR (dev) ((dev)>>8)#define BLKIF_MINOR (dev) ((dev) & 0xff)
@@ -91,7 +95,9 @@ static struct block_device_operations xl .open = blkif_open, .release = blkif_release, .ioctl = blkif_ioctl, +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,9 )/* TODO: check version */ .getgeo = blkif_getgeo +#endif };DEFINE_SPINLOCK (blkif_io_lock);
@@ -186,7 +192,11 @@ xlvbd_init_blk_queue(struct gendisk *gd,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-xen-sparse/drivers/xen/core/features.c +4 -0
@@ -10,6 +10,10 @@#include <linux/module.h> #include <asm/hypervisor.h> #include <xen/features.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif u8 xen_features[XENFEAT_NR_SUBMAPS *32 ]__read_mostly ;/* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +4 -0
@@ -44,6 +44,10 @@#include <asm/io.h> #include <xen/interface/memory.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +4 -0
@@ -64,6 +64,10 @@#include <xen/interface/grant_table.h> #include <xen/gnttab.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* * Mutually-exclusive module options to select receive data path: * rx_copy : Packets are copied by network backend into local memory
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c +4 -0
@@ -34,6 +34,10 @@#include <xen/gnttab.h> #include <xen/xenbus.h> #include <xen/driver_util.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +4 -0
@@ -39,6 +39,10 @@#include <xen/xenbus.h> #include "xenbus_comms.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +static int xenbus_irq;extern void xenbus_probe (void *);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +54 -2
234 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +5 -0
@@ -42,8 +42,13 @@#include <linux/fcntl.h> #include <linux/kthread.h> #include <linux/rwsem.h> +#include <linux/module.h> #include <xen/xenbus.h> #include "xenbus_comms.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h +4 -0
@@ -8,6 +8,10 @@*/ #include <linux/config.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif #define ADDR (*(volatile long *) addr)
linux-2.6-xen-sparse/include/xen/xenbus.h +5 -0
@@ -38,10 +38,15 @@#include <linux/notifier.h> #include <linux/mutex.h> #include <linux/completion.h> +#include <linux/init.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> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* Register callback to watch this node. */ struct xenbus_watch
unmodified_drivers/linux-2.6/overrides.mk +1 -1
@@ -9,4 +9,4 @@ EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRAN EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRANT -DXEN_EVTCHN_MASK_OPS EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202 -EXTRA_CFLAGS += -I$(M)/include +EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_COMPAT_H
unmodified_drivers/linux-2.6/platform-pci/Kbuild +7 -1
@@ -4,4 +4,10 @@ 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 +xen-platform-pci-objs := +xen-platform-pci-objs += platform-pci.o +xen-platform-pci-objs += features.o +xen-platform-pci-objs += evtchn.o +xen-platform-pci-objs += gnttab.o +xen-platform-pci-objs += xen_support.o +xen-platform-pci-objs += compat.o
unmodified_drivers/linux-2.6/platform-pci/evtchn.c +4 -0
@@ -35,6 +35,10 @@#include <xen/interface/hvm/ioreq.h> #include <xen/features.h> #include "platform-pci.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif void *shared_info_area;
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +4 -0
@@ -38,6 +38,10 @@#include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define DRV_NAME "xen-platform-pci"#define DRV_VERSION "0.10"#define DRV_RELDATE "03/03/2005"
unmodified_drivers/linux-2.6/platform-pci/xen_support.c +4 -0
@@ -26,6 +26,10 @@#include <asm/hypervisor.h> #include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +void xen_machphys_update (unsigned long mfn,unsigned long pfn) {BUG ();
unmodified_drivers/linux-2.6/blkfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPMD_H +#define _PGTABLE_NOPMD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +#error "This version of Linux should not need compat pgtable-nopmd.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPMD_H */
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPUD_H +#define _PGTABLE_NOPUD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +#error "This version of Linux should not need compat pgtable-nopud.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPUD_H */
unmodified_drivers/linux-2.6/compat-include/compat.h new file +52 -0
52 lines not on this page · raw message
unmodified_drivers/linux-2.6/compat-include/linux/io.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _LINUX_IO_H +#define _LINUX_IO_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,16 ) +#error "This version of Linux should not need compat linux/io.h" +#endif + +#include <asm/io.h> + +#endif
unmodified_drivers/linux-2.6/compat-include/linux/mutex.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Cisco Systems. All rights reserved. +* +* This file is released under the GPLv2. +*/ + +/* mutex compatibility for pre-2.6.16 kernels */ + +#ifndef __LINUX_MUTEX_H +#define __LINUX_MUTEX_H + +#include <linux/version.h> +#include <asm/semaphore.h> + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,16 ) +#error "This version of Linux should not need compat mutex.h" +#endif + +#define mutex semaphore +#define DEFINE_MUTEX (foo) DECLARE_MUTEX(foo) +#define mutex_init (foo) init_MUTEX(foo) +#define mutex_lock (foo) down(foo) +#define mutex_lock_interruptible (foo) down_interruptible(foo) +/* this function follows the spin_trylock() convention, so * +* it is negated to the down_trylock() return values! Be careful */ +#define mutex_trylock (foo) !down_trylock(foo) +#define mutex_unlock (foo) up(foo) + +#endif /* __LINUX_MUTEX_H */
unmodified_drivers/linux-2.6/netfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/compat.c new file +48 -0
48 lines not on this page · raw message
unmodified_drivers/linux-2.6/xenbus/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi all,
Quoted 4 lines · DOI Tsunehisa
I modified Ian's patch for RHEL4.
We've tested compiling and attaching them on RHEL4. In our simple
test, PV-on-HVM VBD/VNIF drivers work on RHEL4 original kernel.
I checked several version of kernel source, and modified the patch.
This patch is modified from Ian's patch:
+ move compat.c from xenbus to platform-pci
- platform-pci needs vmalloc_to_pfn() realized in compat.c
* platform-pci is inserted before xenbus insertion.
+ append schedule_timeout_interruptible() to compat.c
- the code was copied from linux/kernel/timer.c
+ append do_exit() faker to compat.c
- the faker was implemented using complete_and_exit()
+ delete vmalloc_to_page() from compat.c
- vmalloc_to_page() already exists in linux-2.6.0 kernel.
+ conferm version for several features
- do conferm version about "TODO: conferm version"
We've tested compiling and attaching them on RHEL4. And they
work on RHEL4 in same test.
Thanks,
- Doi Tsunehisa
# HG changeset patch
# User [email protected]
# Node ID 50d32ae2e0f45bdd06d6f14cc1c851cf3f130adf # Parent f7d65fb7299b95b8b6d3a44134a9f2af211393c6 Backport PV-on-HVM drivers for pre-linux-2.6.16
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +25 -0
@@ -48,6 +48,10 @@#include <asm/hypervisor.h> #include <asm/maddr.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_STATE_DISCONNECTED 0#define BLKIF_STATE_CONNECTED 1#define BLKIF_STATE_SUSPENDED 2
@@ -468,6 +472,27 @@ int blkif_ioctl(struct inode *inode, str 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++)
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +10 -0
@@ -36,6 +36,10 @@#include <linux/blkdev.h> #include <linux/list.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_MAJOR (dev) ((dev)>>8)#define BLKIF_MINOR (dev) ((dev) & 0xff)
@@ -91,7 +95,9 @@ static struct block_device_operations xl .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 +192,11 @@ xlvbd_init_blk_queue(struct gendisk *gd,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-xen-sparse/drivers/xen/core/features.c +4 -0
@@ -10,6 +10,10 @@#include <linux/module.h> #include <asm/hypervisor.h> #include <xen/features.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif u8 xen_features[XENFEAT_NR_SUBMAPS *32 ]__read_mostly ;/* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +4 -0
@@ -44,6 +44,10 @@#include <asm/io.h> #include <xen/interface/memory.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +4 -0
@@ -64,6 +64,10 @@#include <xen/interface/grant_table.h> #include <xen/gnttab.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* * Mutually-exclusive module options to select receive data path: * rx_copy : Packets are copied by network backend into local memory
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c +4 -0
@@ -34,6 +34,10 @@#include <xen/gnttab.h> #include <xen/xenbus.h> #include <xen/driver_util.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +4 -0
@@ -39,6 +39,10 @@#include <xen/xenbus.h> #include "xenbus_comms.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +static int xenbus_irq;extern void xenbus_probe (void *);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +54 -2
234 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +5 -0
@@ -42,8 +42,13 @@#include <linux/fcntl.h> #include <linux/kthread.h> #include <linux/rwsem.h> +#include <linux/module.h> #include <xen/xenbus.h> #include "xenbus_comms.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h +4 -0
@@ -8,6 +8,10 @@*/ #include <linux/config.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif #define ADDR (*(volatile long *) addr)
linux-2.6-xen-sparse/include/xen/xenbus.h +5 -0
@@ -38,10 +38,15 @@#include <linux/notifier.h> #include <linux/mutex.h> #include <linux/completion.h> +#include <linux/init.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> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* Register callback to watch this node. */ struct xenbus_watch
unmodified_drivers/linux-2.6/overrides.mk +1 -1
@@ -9,4 +9,4 @@ EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRAN EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRANT -DXEN_EVTCHN_MASK_OPS EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202 -EXTRA_CFLAGS += -I$(M)/include +EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_COMPAT_H
unmodified_drivers/linux-2.6/platform-pci/Kbuild +7 -1
@@ -4,4 +4,10 @@ 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 +xen-platform-pci-objs := +xen-platform-pci-objs += platform-pci.o +xen-platform-pci-objs += features.o +xen-platform-pci-objs += evtchn.o +xen-platform-pci-objs += gnttab.o +xen-platform-pci-objs += xen_support.o +xen-platform-pci-objs += compat.o
unmodified_drivers/linux-2.6/platform-pci/evtchn.c +4 -0
@@ -35,6 +35,10 @@#include <xen/interface/hvm/ioreq.h> #include <xen/features.h> #include "platform-pci.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif void *shared_info_area;
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +4 -0
@@ -38,6 +38,10 @@#include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define DRV_NAME "xen-platform-pci"#define DRV_VERSION "0.10"#define DRV_RELDATE "03/03/2005"
unmodified_drivers/linux-2.6/platform-pci/xen_support.c +4 -0
@@ -26,6 +26,10 @@#include <asm/hypervisor.h> #include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +void xen_machphys_update (unsigned long mfn,unsigned long pfn) {BUG ();
unmodified_drivers/linux-2.6/blkfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPMD_H +#define _PGTABLE_NOPMD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +#error "This version of Linux should not need compat pgtable-nopmd.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPMD_H */
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPUD_H +#define _PGTABLE_NOPUD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +#error "This version of Linux should not need compat pgtable-nopud.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPUD_H */
unmodified_drivers/linux-2.6/compat-include/compat.h new file +52 -0
52 lines not on this page · raw message
unmodified_drivers/linux-2.6/compat-include/linux/io.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _LINUX_IO_H +#define _LINUX_IO_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,15 ) +#error "This version of Linux should not need compat linux/io.h" +#endif + +#include <asm/io.h> + +#endif
unmodified_drivers/linux-2.6/compat-include/linux/mutex.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Cisco Systems. All rights reserved. +* +* This file is released under the GPLv2. +*/ + +/* mutex compatibility for pre-2.6.16 kernels */ + +#ifndef __LINUX_MUTEX_H +#define __LINUX_MUTEX_H + +#include <linux/version.h> +#include <asm/semaphore.h> + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,16 ) +#error "This version of Linux should not need compat mutex.h" +#endif + +#define mutex semaphore +#define DEFINE_MUTEX (foo) DECLARE_MUTEX(foo) +#define mutex_init (foo) init_MUTEX(foo) +#define mutex_lock (foo) down(foo) +#define mutex_lock_interruptible (foo) down_interruptible(foo) +/* this function follows the spin_trylock() convention, so * +* it is negated to the down_trylock() return values! Be careful */ +#define mutex_trylock (foo) !down_trylock(foo) +#define mutex_unlock (foo) up(foo) + +#endif /* __LINUX_MUTEX_H */
unmodified_drivers/linux-2.6/netfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/compat.c new file +48 -0
48 lines not on this page · raw message
unmodified_drivers/linux-2.6/xenbus/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi all,
I found some issue with my old patch.
+ Fix do_exit() faker type
- can't compile on linux-2.6.10 and 2.6.11
- do_exit() faker is mismatched with original header.
- do_exit type changed after linux-2.6.10
< asmlinkage NORET_TYPE void do_exit(long code); > fastcall NORET_TYPE void do_exit(long code);
+ Fix compat-include/linun/mutex.h about version checker
- change reference version from 2.6.16 to 2.6.15
Quoted 24 lines · DOI Tsunehisa
Hi all,
Quoted 4 lines · DOI Tsunehisa
I modified Ian's patch for RHEL4.
We've tested compiling and attaching them on RHEL4. In our simple
test, PV-on-HVM VBD/VNIF drivers work on RHEL4 original kernel.I checked several version of kernel source, and modified the patch.
This patch is modified from Ian's patch:
+ move
compat.cfrom xenbus to platform-pci
- platform-pci needsvmalloc_to_pfn()realized incompat.c
* platform-pci is inserted before xenbus insertion.
+ appendschedule_timeout_interruptible()tocompat.c
- the code was copied fromlinux/kernel/timer.c
+ appenddo_exit()faker tocompat.c
- the faker was implemented usingcomplete_and_exit()
+ deletevmalloc_to_page()fromcompat.c
-vmalloc_to_page()already exists in linux-2.6.0 kernel.
+ conferm version for several features
- do conferm version about "TODO: conferm version"
Quoted 5 lines
We've tested compiling and attaching them on RHEL4. And they
work on RHEL4 in same test.Thanks,
- Doi Tsunehisa
# HG changeset patch
# User [email protected]
# Node ID 6e075156ea4603c81d1ebd37bdb2fea00eb9f026 # Parent f14a67a35becfb8fb9b455a219fd1a7c942bc21d Modify for backporting PV-on-HVM drivers
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +25 -0
@@ -48,6 +48,10 @@#include <asm/hypervisor.h> #include <asm/maddr.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_STATE_DISCONNECTED 0#define BLKIF_STATE_CONNECTED 1#define BLKIF_STATE_SUSPENDED 2
@@ -468,6 +472,27 @@ int blkif_ioctl(struct inode *inode, str 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++)
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +10 -0
@@ -36,6 +36,10 @@#include <linux/blkdev.h> #include <linux/list.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define BLKIF_MAJOR (dev) ((dev)>>8)#define BLKIF_MINOR (dev) ((dev) & 0xff)
@@ -91,7 +95,9 @@ static struct block_device_operations xl .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 +192,11 @@ xlvbd_init_blk_queue(struct gendisk *gd,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-xen-sparse/drivers/xen/core/features.c +4 -0
@@ -10,6 +10,10 @@#include <linux/module.h> #include <asm/hypervisor.h> #include <xen/features.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif u8 xen_features[XENFEAT_NR_SUBMAPS *32 ]__read_mostly ;/* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +4 -0
@@ -44,6 +44,10 @@#include <asm/io.h> #include <xen/interface/memory.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +4 -0
@@ -64,6 +64,10 @@#include <xen/interface/grant_table.h> #include <xen/gnttab.h> +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +/* * Mutually-exclusive module options to select receive data path: * rx_copy : Packets are copied by network backend into local memory
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c +4 -0
@@ -34,6 +34,10 @@#include <xen/gnttab.h> #include <xen/xenbus.h> #include <xen/driver_util.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +4 -0
@@ -39,6 +39,10 @@#include <xen/xenbus.h> #include "xenbus_comms.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +static int xenbus_irq;extern void xenbus_probe (void *);
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +54 -2
234 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +5 -0
@@ -42,8 +42,13 @@#include <linux/fcntl.h> #include <linux/kthread.h> #include <linux/rwsem.h> +#include <linux/module.h> #include <xen/xenbus.h> #include "xenbus_comms.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* xenbus_probe.c */ extern char *kasprintf (const char *fmt, ...);
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h +4 -0
@@ -8,6 +8,10 @@*/ #include <linux/config.h> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif #define ADDR (*(volatile long *) addr)
linux-2.6-xen-sparse/include/xen/xenbus.h +5 -0
@@ -38,10 +38,15 @@#include <linux/notifier.h> #include <linux/mutex.h> #include <linux/completion.h> +#include <linux/init.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> + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif /* Register callback to watch this node. */ struct xenbus_watch
unmodified_drivers/linux-2.6/overrides.mk +1 -1
@@ -9,4 +9,4 @@ EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRAN EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRANT -DXEN_EVTCHN_MASK_OPS EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202 -EXTRA_CFLAGS += -I$(M)/include +EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_COMPAT_H
unmodified_drivers/linux-2.6/platform-pci/Kbuild +7 -1
@@ -4,4 +4,10 @@ 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 +xen-platform-pci-objs := +xen-platform-pci-objs += platform-pci.o +xen-platform-pci-objs += features.o +xen-platform-pci-objs += evtchn.o +xen-platform-pci-objs += gnttab.o +xen-platform-pci-objs += xen_support.o +xen-platform-pci-objs += compat.o
unmodified_drivers/linux-2.6/platform-pci/evtchn.c +4 -0
@@ -35,6 +35,10 @@#include <xen/interface/hvm/ioreq.h> #include <xen/features.h> #include "platform-pci.h" + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif void *shared_info_area;
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +4 -0
@@ -38,6 +38,10 @@#include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +#define DRV_NAME "xen-platform-pci"#define DRV_VERSION "0.10"#define DRV_RELDATE "03/03/2005"
unmodified_drivers/linux-2.6/platform-pci/xen_support.c +4 -0
@@ -26,6 +26,10 @@#include <asm/hypervisor.h> #include "platform-pci.h" +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif +void xen_machphys_update (unsigned long mfn,unsigned long pfn) {BUG ();
unmodified_drivers/linux-2.6/blkfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPMD_H +#define _PGTABLE_NOPMD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +#error "This version of Linux should not need compat pgtable-nopmd.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPMD_H */
unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPUD_H +#define _PGTABLE_NOPUD_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,10 ) +#error "This version of Linux should not need compat pgtable-nopud.h" +#endif + +#define pud_t pgd_t +#define pud_offset (d, va) d +#define pud_none (pud) 0 +#define pud_present (pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPUD_H */
unmodified_drivers/linux-2.6/compat-include/compat.h new file +52 -0
52 lines not on this page · raw message
unmodified_drivers/linux-2.6/compat-include/linux/io.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _LINUX_IO_H +#define _LINUX_IO_H + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,15 ) +#error "This version of Linux should not need compat linux/io.h" +#endif + +#include <asm/io.h> + +#endif
unmodified_drivers/linux-2.6/compat-include/linux/mutex.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 Cisco Systems. All rights reserved. +* +* This file is released under the GPLv2. +*/ + +/* mutex compatibility for pre-2.6.16 kernels */ + +#ifndef __LINUX_MUTEX_H +#define __LINUX_MUTEX_H + +#include <linux/version.h> +#include <asm/semaphore.h> + +#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,15 ) +#error "This version of Linux should not need compat mutex.h" +#endif + +#define mutex semaphore +#define DEFINE_MUTEX (foo) DECLARE_MUTEX(foo) +#define mutex_init (foo) init_MUTEX(foo) +#define mutex_lock (foo) down(foo) +#define mutex_lock_interruptible (foo) down_interruptible(foo) +/* this function follows the spin_trylock() convention, so * +* it is negated to the down_trylock() return values! Be careful */ +#define mutex_trylock (foo) !down_trylock(foo) +#define mutex_unlock (foo) up(foo) + +#endif /* __LINUX_MUTEX_H */
unmodified_drivers/linux-2.6/netfront/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
unmodified_drivers/linux-2.6/platform-pci/compat.c new file +52 -0
52 lines not on this page · raw message
unmodified_drivers/linux-2.6/xenbus/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 1 line · DOI Tsunehisa
I found some issue with my old patch.
Thanks for these. I'll look at them properly once the 3.0.3 release is out and the unstable tree has opened again.
Cheers,
Ian.