[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 0/3] PVUSB update and bugfix



This is the update patch of PVUSB that includes some
enhancement and some bugfixes pointed out on this ML.

Main changes are followings:
- xenbus state flow changed.
  Whole of the flow is changed to be like netback/netfront.
  Reconfiguring/Reconfiguring are removed.

- New RING for hotplug notification added.

- USBIF_MAX_SEGMENTS_PER_REQUEST value is changed (10) to (16).
  According to this change, RING_SIZE is decreased from 32 to 16.
  This affects the performance. My flash drive's read throughput
  was dropped from 29MB/s to 18MB/s in the linux environment.
  However, Windows guest send urb with 64kB buffer(64KB = 4kB * 16).
  This is required.

- New port-setting interface
  xenbus_watch_path2 is added to usbback, port-setting interface
  is moved from sysfs to xenstore.
  Now, the port-rule is directly written to xenstore entry.
  Example.
  # xenstore-write /local/domain/0/backend/vusb/1/0/port/1 “2-1”
    (adding physical bus 2-1 to vusb-1-0 port 1)

- urb dequeue function completed.
  usbfront send unlink-request to usbback, and can cancel the urb
  that is submitted in the backend.

- New USB Spec version (USB1.1/USB2.0) selection support.
  usbfront can act as both USB1.1 and USB2.0 virtual host controller
  according to the xenstore entry key "usb-ver".

- experimental bus_suspend/bus_resume added to usbfront.

- various cleanups, bugfix, refactoring and codestyle-fix.


Attached files are xenstore reference and simple shell-script for
setting up and initializing the xenstore entries.

Current PVUSB has drivers only, but I'm now working on
xm integration and will post by this November.

Regards,
Noboru

PVUSB XenStore Reference

Noboru Iwamatsu <n_iwamatsu@xxxxxxxxxxxxxx>
5th Oct 2009


/local/domain/<domid>

        backend/
                vusb/           - a directory containing vusb backends
                        <domid>/        - a directory vusb's for domid
                                <id>/           - a directory for each virtual 
host controller
                                        frontend-id     - the domain id of the 
frontend
                                        frontend        - the path to the 
frontend domain
                                        usb-ver - USB Spec version (1 = USB1.1, 
2 = USB2.0)
                                        num-ports       - number of root ports 
(max. 16)
                                        port/
                                                1       - physical usb port 
path the virtual port is attached to
                                                ...
                                                16
                                        state           - communication state 
across XenBus to the frontend.

                device/
                        vusb/           - a directory containing the virtual hcd
                                <id>/           - a directory containing the 
virtual hcd id for the domain
                                        backend-id      - the domain id of the 
backend
                                        backend - the path to the backend domain
                                        urb-ring-ref    - the grant table 
reference for the urb request ring queue
                                        conn-ring-ref   - the grant table 
reference for the connection request ring queue
                                        event-channel   - the event channel 
used for the usb request ring queue
                                        state           - communication state 
across XenBus to the backend.
                
#!/bin/sh
#
# Setup XenStore entry for paravirtualized USB driver.
# 
# Written by Noboru Iwamatsu <n_iwamatsu@xxxxxxxxxxxxxx>
#

XSWRITE=/usr/bin/xenstore-write
XSCHMOD=/usr/bin/xenstore-chmod

DEV_NAME=vusb
# Max 16 ports.
NUM_PORTS=8

usage () {
    echo "Usage: `basename $0` <frontend-id> <device-id>"
    echo "    <frontend-id>: the domain id of frontend"
    echo "    <device-id>: the device id of frontend"
    echo ""
    echo "Example:"
    echo "    If you use paravirtual USB driver on Domain ID 1,"
    echo "    simply do"
    echo "    `basename $0` 1 0"
    exit 1
}

[ $# -eq 2 ] || usage

DEV_ID=$2

# Write backend information into the location that frontend look for.
$XSWRITE /local/domain/$1/device/$DEV_NAME/$DEV_ID/backend-id 0
$XSWRITE /local/domain/$1/device/$DEV_NAME/$DEV_ID/backend \
/local/domain/0/backend/$DEV_NAME/$1/$DEV_ID

# Write frontend information into the location that backend look for.
$XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/frontend-id $1
$XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/frontend \
/local/domain/$1/device/$DEV_NAME/$DEV_ID


# Write USB Spec version field.
$XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/usb-ver 2

# Write virtual root hub field.
$XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/num-ports $NUM_PORTS
for i in $(seq 1 $NUM_PORTS)
do
        # Set all port to disconnected state
        $XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/port/$i ""
done

# Set permission
$XSCHMOD /local/domain/$1/device/$DEV_NAME/$DEV_ID n$1 r0
$XSCHMOD /local/domain/$1/device/$DEV_NAME/$DEV_ID/backend-id n$1 r0
$XSCHMOD /local/domain/$1/device/$DEV_NAME/$DEV_ID/backend n$1 r0
$XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID n0 r$1
$XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/frontend-id n0 r$1
$XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/frontend n0 r$1
$XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/usb-ver n0 r$1
$XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/num-ports n0 r$1
for i in $(seq 1 $NUM_PORTS)
do
        $XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/port/$i n0 r0
done

# Set state to XenbusStateInitialising
$XSWRITE /local/domain/$1/device/$DEV_NAME/$DEV_ID/state 1
$XSCHMOD /local/domain/$1/device/$DEV_NAME/$DEV_ID/state n$1 r0
$XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/state 1
$XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/state n0 r$1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.