2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _LINUX_MISCDEVICE_H
|
|
|
|
#define _LINUX_MISCDEVICE_H
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/major.h>
|
|
|
|
|
2008-11-26 19:03:54 +08:00
|
|
|
#define PSMOUSE_MINOR 1
|
|
|
|
#define MS_BUSMOUSE_MINOR 2
|
|
|
|
#define ATIXL_BUSMOUSE_MINOR 3
|
|
|
|
/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
|
|
|
|
#define ATARIMOUSE_MINOR 5
|
|
|
|
#define SUN_MOUSE_MINOR 6
|
|
|
|
#define APOLLO_MOUSE_MINOR 7
|
|
|
|
#define PC110PAD_MINOR 9
|
|
|
|
/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
|
2005-04-17 06:20:36 +08:00
|
|
|
#define WATCHDOG_MINOR 130 /* Watchdog timer */
|
|
|
|
#define TEMP_MINOR 131 /* Temperature Sensor */
|
2008-11-26 19:03:54 +08:00
|
|
|
#define RTC_MINOR 135
|
2005-04-17 06:20:36 +08:00
|
|
|
#define EFI_RTC_MINOR 136 /* EFI Time services */
|
2008-11-26 19:03:54 +08:00
|
|
|
#define SUN_OPENPROM_MINOR 139
|
2005-04-17 06:20:36 +08:00
|
|
|
#define DMAPI_MINOR 140 /* DMAPI */
|
2008-11-26 19:03:54 +08:00
|
|
|
#define NVRAM_MINOR 144
|
|
|
|
#define SGI_MMTIMER 153
|
2005-04-17 06:20:36 +08:00
|
|
|
#define STORE_QUEUE_MINOR 155
|
2008-11-26 19:03:54 +08:00
|
|
|
#define I2O_MINOR 166
|
2005-04-17 06:20:36 +08:00
|
|
|
#define MICROCODE_MINOR 184
|
2008-11-26 19:03:54 +08:00
|
|
|
#define TUN_MINOR 200
|
|
|
|
#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
|
|
|
|
#define MPT_MINOR 220
|
2009-03-09 15:27:49 +08:00
|
|
|
#define MPT2SAS_MINOR 221
|
2008-11-26 19:03:54 +08:00
|
|
|
#define HPET_MINOR 228
|
|
|
|
#define FUSE_MINOR 229
|
|
|
|
#define KVM_MINOR 232
|
vhost_net: a kernel-level virtio server
What it is: vhost net is a character device that can be used to reduce
the number of system calls involved in virtio networking.
Existing virtio net code is used in the guest without modification.
There's similarity with vringfd, with some differences and reduced scope
- uses eventfd for signalling
- structures can be moved around in memory at any time (good for
migration, bug work-arounds in userspace)
- write logging is supported (good for migration)
- support memory table and not just an offset (needed for kvm)
common virtio related code has been put in a separate file vhost.c and
can be made into a separate module if/when more backends appear. I used
Rusty's lguest.c as the source for developing this part : this supplied
me with witty comments I wouldn't be able to write myself.
What it is not: vhost net is not a bus, and not a generic new system
call. No assumptions are made on how guest performs hypercalls.
Userspace hypervisors are supported as well as kvm.
How it works: Basically, we connect virtio frontend (configured by
userspace) to a backend. The backend could be a network device, or a tap
device. Backend is also configured by userspace, including vlan/mac
etc.
Status: This works for me, and I haven't see any crashes.
Compared to userspace, people reported improved latency (as I save up to
4 system calls per packet), as well as better bandwidth and CPU
utilization.
Features that I plan to look at in the future:
- mergeable buffers
- zero copy
- scalability tuning: figure out the best threading model to use
Note on RCU usage (this is also documented in vhost.h, near
private_pointer which is the value protected by this variant of RCU):
what is happening is that the rcu_dereference() is being used in a
workqueue item. The role of rcu_read_lock() is taken on by the start of
execution of the workqueue item, of rcu_read_unlock() by the end of
execution of the workqueue item, and of synchronize_rcu() by
flush_workqueue()/flush_work(). In the future we might need to apply
some gcc attribute or sparse annotation to the function passed to
INIT_WORK(). Paul's ack below is for this RCU usage.
(Includes fixes by Alan Cox <alan@linux.intel.com>,
David L Stevens <dlstevens@us.ibm.com>,
Chris Wright <chrisw@redhat.com>)
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-01-14 14:17:27 +08:00
|
|
|
#define VHOST_NET_MINOR 233
|
2008-11-26 19:03:54 +08:00
|
|
|
#define MISC_DYNAMIC_MINOR 255
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct device;
|
|
|
|
|
|
|
|
struct miscdevice {
|
|
|
|
int minor;
|
|
|
|
const char *name;
|
2006-03-28 17:56:41 +08:00
|
|
|
const struct file_operations *fops;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct list_head list;
|
2006-07-28 07:16:04 +08:00
|
|
|
struct device *parent;
|
|
|
|
struct device *this_device;
|
2009-09-19 05:01:12 +08:00
|
|
|
const char *nodename;
|
|
|
|
mode_t mode;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern int misc_register(struct miscdevice * misc);
|
2008-03-24 03:28:24 +08:00
|
|
|
extern int misc_deregister(struct miscdevice *misc);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define MODULE_ALIAS_MISCDEV(minor) \
|
|
|
|
MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
|
|
|
|
"-" __stringify(minor))
|
|
|
|
#endif
|