USB split driver
PATCH 1/1 USB split driver
Here's a xenidc free version of the USB split driver patch. I've tested this patch against a376bab39768 for x86_32 and x86_64.
Changes since the xenidc based version include:
o - Removed xenidc code.
o - Disabled support for building driver as loadable modules.
o - Changed 'path' configuration parameter such that it now includes the USB bus number and is the same as the string that appears
in /sys/bus/usb/devices.
o - Implemented save-restore support (works for x86_32; base xen unstable (without my code) doesn't seem to work for x86_64).
o - Now tested on both x86_64 and x86_32.
linux-2.6-xen-sparse/drivers/xen/Kconfig +45 -0
@@ -132,6 +132,28 @@ a failure. The corresponding domain's channel will be closed. Say Y if you want this feature. +config XEN_USBDEV_BACKEND + bool "USB-device backend driver" + select USB + default y + help + The USB-device backend driver allows the kernel to export USB + devices to USB-device frontend drivers running in other domains. + This is not required for USB device access in domain 0 or any domain + given exclusive control over a USB host controller device at the PCI + level. + Say Y if you want to use this kernel to export a USB device to + another domain running a USB-device frontend driver. + +config XEN_USBDEV_BACKEND_TRACE + bool "USB-device backend driver tracing" + depends on XEN_USBDEV_BACKEND + default n + help + This option causes the driver to output a continual trace of its + activity. + Say N here unless you are trying to debug the driver. + config XEN_BLKDEV_FRONTEND tristate "Block-device frontend driver" depends on XEN
@@ -168,6 +190,29 @@ select TCG_XEN help The TPM-device frontend driver. + +config XEN_USBDEV_FRONTEND + bool "USB-device frontend driver" + select USB + default y + help + The USB-device frontend driver allows the kernel to access USB + devices exported by a USB-device backend driver running in another + domain. + This is not required for USB device access in domain 0 or any domain + given exclusive control over a USB host controller device at the PCI + level. + Say Y if you want to use a USB-device backend driver to export a USB + device from another domain to the domain which will run this kernel. + +config XEN_USBDEV_FRONTEND_TRACE + bool "USB-device frontend driver tracing" + depends on XEN_USBDEV_FRONTEND + default n + help + This option causes the driver to output a continual trace of its + activity. + Say N here unless you are trying to debug the driver. config XEN_SCRUB_PAGES bool "Scrub memory before freeing it to Xen"
linux-2.6-xen-sparse/drivers/xen/Makefile +2 -1
@@ -13,10 +13,11 @@ obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/ obj-$(CONFIG_XEN_TPMDEV_BACKEND) += tpmback/ +obj-$(CONFIG_XEN_USBDEV_BACKEND) += usbback/ obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += blkfront/ obj-$(CONFIG_XEN_NETDEV_FRONTEND) += netfront/ obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/ obj-$(CONFIG_XEN_TPMDEV_FRONTEND) += tpmfront/ +obj-$(CONFIG_XEN_USBDEV_FRONTEND) += usbfront/ obj-$(CONFIG_XEN_PCIDEV_BACKEND) += pciback/ obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += pcifront/ -
tools/examples/Makefile +1 -0
@@ -26,6 +26,7 @@ XEN_SCRIPTS += network-nat vif-nat XEN_SCRIPTS += block XEN_SCRIPTS += block-enbd block-nbd +XEN_SCRIPTS += usb XEN_SCRIPTS += vtpm vtpm-delete XEN_SCRIPTS += xen-hotplug-cleanup XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
tools/examples/xen-backend.agent +3 -0
@@ -3,6 +3,9 @@ PATH=/etc/xen/scripts:$PATH case "$XENBUS_TYPE" in + usb) + /etc/xen/scripts/usb "$ACTION" + ;; vbd) /etc/xen/scripts/block "$ACTION" ;;
tools/examples/xen-backend.rules +2 -0
@@ -2,4 +2,6 @@ SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online" SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline" +SUBSYSTEM=="xen-backend", KERNEL=="usb*", RUN+="/etc/xen/scripts/usb $env{ACTION}" SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup" +
tools/examples/xmexample1 +7 -0
@@ -56,6 +56,13 @@ # and MODE is r for read-only, w for read-write. disk = [ 'phy:hda1,hda1,w' ] + +#---------------------------------------------------------------------------- +# Define USB devices. +# +# Specify the USB device path as it appears in /sys/bus/usb/devices in the +# backend. This example exports device 3 on bus 1 and device 2 on bus 2. +#usb = ['path=1-3','path=2-2'] #---------------------------------------------------------------------------- # Define to which TPM instance the user domain should communicate.
tools/python/xen/xend/server/usbif.py +25 -4
@@ -22,8 +22,9 @@ """Support for virtual USB hubs. """ +from xen.xend import sxp + from xen.xend.server.DevController import DevController - class UsbifController(DevController): """USB device interface controller. Handles all USB devices
@@ -35,8 +36,28 @@ """ DevController.__init__(self, vm) - - def getDeviceDetails(self, _): + def getDeviceDetails(self, config): """@see DevController.getDeviceDetails""" - return (self.allocateDeviceID(), {}, {}) + path = sxp.child_value(config, 'path') + + devid = self.allocateDeviceID() + + back = { 'path' : path, + 'handle' : "%i" % devid } + + front = { 'handle' : "%i" % devid } + + return (devid, back, front) + + def configuration(self, devid): + """@see DevController.configuration""" + + result = DevController.configuration(self, devid) + + path = self.readBackend(devid,'path') + + if path: + result.append(['path', path]) + + return result
tools/python/xen/xm/create.py +36 -5
78 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +obj-y = \ +usbback_buffer_resource_provider.o \ +usbback_callback.o \ +usbback_device.o \ +usbback_gw.o \ +usbback_gw_resource.o \ +usbback_rbr_mapper_pool.o \ +usbback_resource.o \ +usbback_ring_channel.o \ +usbback_work.o \ +usbback_xb_channel.o
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_buffer_resource_provider.c new file +196 -0
196 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_buffer_resource_provider.h new file +77 -0
77 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_callback.c new file +41 -0
41 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_callback.h new file +146 -0
146 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_channel.h new file +159 -0
159 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_device.c new file +839 -0
839 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_device.h new file +32 -0
@@ -0,0 +1,32 @@ +/*****************************************************************************/ +/* Copyright (c) 2005 Harry Butterworth IBM Corporation */ +/* */ +/* This program is free software; you can redistribute it and/or modify it */ +/* under the terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but */ +/* WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */ +/* Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with this program; if not, write to the Free Software Foundation, Inc., */ +/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* */ +/*****************************************************************************/ + +#ifndef USBBACK_DEVICE_H +#define USBBACK_DEVICE_H + +#include "usbback_resource.h" + +domid_t usbback_device_query_remote_domain (struct usbback_device *device); + +struct usb_device *usbback_device_query_usbdev (struct usbback_device *device); + +void usbback_device_rsrc_completed_io (struct usbback_device *device, +struct usbback_rsrc *rsrc); + +#endif
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_gw.c new file +466 -0
466 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_gw.h new file +163 -0
163 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_gw_resource.c new file +75 -0
75 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_rbr_mapper_pool.c new file +347 -0
347 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_rbr_mapper_pool.h new file +155 -0
155 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_resource.c new file +655 -0
70 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_resource.h new file +75 -0
75 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_ring_channel.c new file +760 -0
760 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_ring_channel.h new file +111 -0
111 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_trace.h new file +36 -0
Lines of this file are not shown. View the raw message.
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_work.c new file +72 -0
72 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_work.h new file +104 -0
104 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_xb_channel.c new file +333 -0
333 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbback/usbback_xb_channel.h new file +73 -0
73 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/Makefile new file +15 -0
Lines of this file are not shown. View the raw message.
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_buffer_resource_provider.c new file +173 -0
173 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_buffer_resource_provider.h new file +78 -0
78 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_callback.c new file +39 -0
Lines of this file are not shown. View the raw message.
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_callback.h new file +150 -0
150 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_channel.h new file +159 -0
159 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_device.c new file +768 -0
768 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_device.h new file +51 -0
51 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_driver.c new file +569 -0
569 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_driver.h new file +30 -0
Lines of this file are not shown. View the raw message.
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_gw.c new file +503 -0
503 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_gw.h new file +123 -0
123 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_gw_resource.c new file +211 -0
211 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_gw_resource.h new file +84 -0
84 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_hcd_resource.c new file +605 -0
605 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_hcd_resource.h new file +88 -0
88 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_module.c new file +65 -0
65 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_rbr_provider_pool.c new file +339 -0
339 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_rbr_provider_pool.h new file +169 -0
169 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_ring_channel.c new file +744 -0
744 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_ring_channel.h new file +114 -0
114 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_sll.h new file +100 -0
100 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_trace.h new file +36 -0
Lines of this file are not shown. View the raw message.
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_work.c new file +73 -0
73 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_work.h new file +105 -0
105 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_xb_channel.c new file +382 -0
382 lines not on this page · raw message
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront_xb_channel.h new file +75 -0
75 lines not on this page · raw message
xen/include/public/io/usbif.h new file +213 -0
213 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Part of the diff is not shown here. View the raw message.