forked from luck/tmp_suning_uos_patched
07ad157f6e
lguest is a simple hypervisor for Linux on Linux. Unlike kvm it doesn't need VT/SVM hardware. Unlike Xen it's simply "modprobe and go". Unlike both, it's 5000 lines and self-contained. Performance is ok, but not great (-30% on kernel compile). But given its hackability, I expect this to improve, along with the paravirt_ops code which it supplies a complete example for. There's also a 64-bit version being worked on and other craziness. But most of all, lguest is awesome fun! Too much of the kernel is a big ball of hair. lguest is simple enough to dive into and hack, plus has some warts which scream "fork me!". This patch: This is the code and headers required to make an i386 kernel an lguest guest. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Andi Kleen <ak@suse.de> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
#ifndef _ASM_LGUEST_DEVICE_H
|
|
#define _ASM_LGUEST_DEVICE_H
|
|
/* Everything you need to know about lguest devices. */
|
|
#include <linux/device.h>
|
|
#include <linux/lguest.h>
|
|
#include <linux/lguest_launcher.h>
|
|
|
|
struct lguest_device {
|
|
/* Unique busid, and index into lguest_page->devices[] */
|
|
unsigned int index;
|
|
|
|
struct device dev;
|
|
|
|
/* Driver can hang data off here. */
|
|
void *private;
|
|
};
|
|
|
|
/* By convention, each device can use irq index+1 if it wants to. */
|
|
static inline int lgdev_irq(const struct lguest_device *dev)
|
|
{
|
|
return dev->index + 1;
|
|
}
|
|
|
|
/* dma args must not be vmalloced! */
|
|
void lguest_send_dma(unsigned long key, struct lguest_dma *dma);
|
|
int lguest_bind_dma(unsigned long key, struct lguest_dma *dmas,
|
|
unsigned int num, u8 irq);
|
|
void lguest_unbind_dma(unsigned long key, struct lguest_dma *dmas);
|
|
|
|
/* Map the virtual device space */
|
|
void *lguest_map(unsigned long phys_addr, unsigned long pages);
|
|
void lguest_unmap(void *);
|
|
|
|
struct lguest_driver {
|
|
const char *name;
|
|
struct module *owner;
|
|
u16 device_type;
|
|
int (*probe)(struct lguest_device *dev);
|
|
void (*remove)(struct lguest_device *dev);
|
|
|
|
struct device_driver drv;
|
|
};
|
|
|
|
extern int register_lguest_driver(struct lguest_driver *drv);
|
|
extern void unregister_lguest_driver(struct lguest_driver *drv);
|
|
|
|
extern struct lguest_device_desc *lguest_devices; /* Just past max_pfn */
|
|
#endif /* _ASM_LGUEST_DEVICE_H */
|