This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 0/3] PVUSB update and bugfix
From: Noboru Iwamatsu <n_iwamatsu@xxxxxxxxxxxxxx>
Date: Wed, 07 Oct 2009 16:27:26 +0900
Delivery-date: Wed, 07 Oct 2009 00:28:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird (Windows/20090812)
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.
  # 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.


PVUSB XenStore Reference

Noboru Iwamatsu <n_iwamatsu@xxxxxxxxxxxxxx>
5th Oct 2009


                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        - 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)
                                                1       - physical usb port 
path the virtual port is attached to
                                        state           - communication state 
across XenBus to the frontend.

                        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 - 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.
# Setup XenStore entry for paravirtualized USB driver.
# Written by Noboru Iwamatsu <n_iwamatsu@xxxxxxxxxxxxxx>


# Max 16 ports.

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


# 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 \

# 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 \

# 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)
        # Set all port to disconnected state
        $XSWRITE /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/port/$i ""

# 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)
        $XSCHMOD /local/domain/0/backend/$DEV_NAME/$1/$DEV_ID/port/$i n0 r0

# 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 0/3] PVUSB update and bugfix, Noboru Iwamatsu <=