Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

PV USB Use Case for Xen 4.x

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


tparker at cbnco

Aug 15, 2012, 10:07 AM

Post #1 of 6 (74 views)
Permalink
PV USB Use Case for Xen 4.x

Good Afternoon. My colleague Stefan (sstan) was asked on the IRC
channel to provide our use case for PV USB in our environment. This is
possible with the current xm stack but not available with the xl stack.

Currently we use PVUSB to attach a USB Smartcard reader through our dom0
(SLES 11 SP1) running on an HP Blade Server with the Token mounted on an
internal USB Port to our domU CA server (SLES 11)

The config file syntax is broken so we have to manually attach (I have
it scripted) whenever our hosts reboot (which is almost never.)

On the dom0 server I have to do the following steps:

*/usr/sbin/xm usb-list-assignable-devices* (get the bus-id of the USB
device)
*/usr/sbin/xm usb-hc-create $Domain 2 2* (Create a USB 2.0 Root Hub with
2 ports in $Domain)
*/usr/sbin/xm usb-attach $Domain $DevId $PortNumber $BusId* (Attach the
USB bus-id found in step 1 to the hub created in step 2)

On the domU the lsusb looks like this after the above (before it returns
nothing)
*
mgaca:~ # lsusb
Bus 001 Device 002: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1
SmartCard Reader
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub*

Once I have done this I can use the usb devce in the domU as if it was
directly connected.

Thanks for your time.

Tom Parker
Canadian Bank Note Company, Ltd.
tparker [at] cbnco


Ian.Campbell at citrix

Aug 16, 2012, 2:25 AM

Post #2 of 6 (76 views)
Permalink
Re: PV USB Use Case for Xen 4.x [In reply to]

On Wed, 2012-08-15 at 18:07 +0100, Tom Parker wrote:
> Good Afternoon. My colleague Stefan (sstan) was asked on the IRC
> channel to provide our use case for PV USB in our environment. This
> is possible with the current xm stack but not available with the xl
> stack.

Thanks for doing this.

At first glance this doesn't seem like something which we could do for
4.2.0 at this stage, although we should do it for 4.3 and potentially
consider it for 4.2.1.

Is it something which you guys might be interested in providing patches
for? It is at heart a moderately simple C coding exercise, I'm more than
happy to provide guidance etc. Much of the generic framework already
exists and there are examples in the form of other device types.

> Currently we use PVUSB to attach a USB Smartcard reader through our
> dom0 (SLES 11 SP1) running on an HP Blade Server with the Token
> mounted on an internal USB Port to our domU CA server (SLES 11)
>
> The config file syntax is broken so we have to manually attach (I have
> it scripted) whenever our hosts reboot (which is almost never.)

Can you give an example of what the syntax *should* be?

> On the dom0 server I have to do the following steps:
>
> /usr/sbin/xm usb-list-assignable-devices (get the bus-id of the USB
> device)
> /usr/sbin/xm usb-hc-create $Domain 2 2 (Create a USB 2.0 Root Hub with
> 2 ports in $Domain)
> /usr/sbin/xm usb-attach $Domain $DevId $PortNumber $BusId (Attach the
> USB bus-id found in step 1 to the hub created in step 2)

What (if anything) is the output of these commands?

Do you need to do anything to make a device "assignable"? (I get no
output from the list command for example)

> On the domU the lsusb looks like this after the above (before it
> returns nothing)
>
> mgaca:~ # lsusb
> Bus 001 Device 002: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1
> SmartCard Reader
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Can you post the output of "xenstore-ls -fp" while the device is
connected?

Do you happen to know if this uses the PVUSB drivers or some other
mechanism? "lsmod" in both dom0 and domU should provide a clue if the
drivers are loaded.

Does this work for both PV and HVM guests or do you only use one or the
other?

> Once I have done this I can use the usb devce in the domU as if it was
> directly connected.
>
> Thanks for your time.

Thank you for describing the functionality.

Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


pasik at iki

Aug 16, 2012, 5:21 AM

Post #3 of 6 (72 views)
Permalink
Re: PV USB Use Case for Xen 4.x [In reply to]

On Thu, Aug 16, 2012 at 10:25:02AM +0100, Ian Campbell wrote:
> On Wed, 2012-08-15 at 18:07 +0100, Tom Parker wrote:
> > Good Afternoon. My colleague Stefan (sstan) was asked on the IRC
> > channel to provide our use case for PV USB in our environment. This
> > is possible with the current xm stack but not available with the xl
> > stack.
>
> Thanks for doing this.
>
> At first glance this doesn't seem like something which we could do for
> 4.2.0 at this stage, although we should do it for 4.3 and potentially
> consider it for 4.2.1.
>
> Is it something which you guys might be interested in providing patches
> for? It is at heart a moderately simple C coding exercise, I'm more than
> happy to provide guidance etc. Much of the generic framework already
> exists and there are examples in the form of other device types.
>
> > Currently we use PVUSB to attach a USB Smartcard reader through our
> > dom0 (SLES 11 SP1) running on an HP Blade Server with the Token
> > mounted on an internal USB Port to our domU CA server (SLES 11)
> >
> > The config file syntax is broken so we have to manually attach (I have
> > it scripted) whenever our hosts reboot (which is almost never.)
>
> Can you give an example of what the syntax *should* be?
>
> > On the dom0 server I have to do the following steps:
> >
> > /usr/sbin/xm usb-list-assignable-devices (get the bus-id of the USB
> > device)
> > /usr/sbin/xm usb-hc-create $Domain 2 2 (Create a USB 2.0 Root Hub with
> > 2 ports in $Domain)
> > /usr/sbin/xm usb-attach $Domain $DevId $PortNumber $BusId (Attach the
> > USB bus-id found in step 1 to the hub created in step 2)
>
> What (if anything) is the output of these commands?
>
> Do you need to do anything to make a device "assignable"? (I get no
> output from the list command for example)
>
> > On the domU the lsusb looks like this after the above (before it
> > returns nothing)
> >
> > mgaca:~ # lsusb
> > Bus 001 Device 002: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1
> > SmartCard Reader
> > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>
> Can you post the output of "xenstore-ls -fp" while the device is
> connected?
>
> Do you happen to know if this uses the PVUSB drivers or some other
> mechanism? "lsmod" in both dom0 and domU should provide a clue if the
> drivers are loaded.
>
> Does this work for both PV and HVM guests or do you only use one or the
> other?
>
> > Once I have done this I can use the usb devce in the domU as if it was
> > directly connected.
> >
> > Thanks for your time.
>
> Thank you for describing the functionality.
>

We should also update / keep up-to-date this wiki page:
http://wiki.xen.org/wiki/Xen_USB_Passthrough

already earlier I added the missing USB features to :
http://wiki.xen.org/wiki/XL_vs_Xend_Feature_Comparison

Worth a note: in xm/xend there are two different kind of USB passthru methods available:

1) Xen qemu-dm usb 1.1 passthru for HVM guests.
2) Xen PVUSB usb 2.0 passthru for both PV and PVHVM guests.


-- Pasi


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


tparker at cbnco

Aug 20, 2012, 12:48 PM

Post #4 of 6 (72 views)
Permalink
Re: PV USB Use Case for Xen 4.x [In reply to]

Hi Ian

Sorry to be slow to respond. I missed this e-mail when you sent it. I
will try to get the information you are looking for.
On 08/16/2012 05:25 AM, Ian Campbell wrote:
> On Wed, 2012-08-15 at 18:07 +0100, Tom Parker wrote:
>> Good Afternoon. My colleague Stefan (sstan) was asked on the IRC
>> channel to provide our use case for PV USB in our environment. This
>> is possible with the current xm stack but not available with the xl
>> stack.
> Thanks for doing this.
>
> At first glance this doesn't seem like something which we could do for
> 4.2.0 at this stage, although we should do it for 4.3 and potentially
> consider it for 4.2.1.
>
> Is it something which you guys might be interested in providing patches
> for? It is at heart a moderately simple C coding exercise, I'm more than
> happy to provide guidance etc. Much of the generic framework already
> exists and there are examples in the form of other device types.
At this time we can't provide patches. We are a sysadmin group and have
no programmers with experience in this. It would take me a long time to
get back into C programming :) Sorry.
>
>> Currently we use PVUSB to attach a USB Smartcard reader through our
>> dom0 (SLES 11 SP1) running on an HP Blade Server with the Token
>> mounted on an internal USB Port to our domU CA server (SLES 11)
>>
>> The config file syntax is broken so we have to manually attach (I have
>> it scripted) whenever our hosts reboot (which is almost never.)
> Can you give an example of what the syntax *should* be?
There used to be some data in the wiki or in an initial presentation on
PVUSB but as it has never worked for me. I don't remember how it worked.
>
>> On the dom0 server I have to do the following steps:
>>
>> /usr/sbin/xm usb-list-assignable-devices (get the bus-id of the USB
>> device)
>> /usr/sbin/xm usb-hc-create $Domain 2 2 (Create a USB 2.0 Root Hub with
>> 2 ports in $Domain)
>> /usr/sbin/xm usb-attach $Domain $DevId $PortNumber $BusId (Attach the
>> USB bus-id found in step 1 to the hub created in step 2)
> What (if anything) is the output of these commands?
Nothing. They return silently if there is no error.
>
> Do you need to do anything to make a device "assignable"? (I get no
> output from the list command for example)
You just have to have a device that is not attached anywhere else. For
example:

mgaxen1:~ # xm usb-list-assignable-devices
6-1 : ID 03f0:1027 HP Virtual Keyboard

That means that for the xm usb-attach (/usr/sbin/xm usb-attach $Domain
$DevId $PortNumber $BusId) part I would use the 6-1 as the $BusId

>
>> On the domU the lsusb looks like this after the above (before it
>> returns nothing)
>>
>> mgaca:~ # lsusb
>> Bus 001 Device 002: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1
>> SmartCard Reader
>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Can you post the output of "xenstore-ls -fp" while the device is
> connected?
This is the part of the output that refers to the the vusb:
/vm/99a002ad-7c36-4a40-b9f5-545770f2d1b2/device/vusb = "" (n0)
/vm/99a002ad-7c36-4a40-b9f5-545770f2d1b2/device/vusb/0 = "" (n0)
/vm/99a002ad-7c36-4a40-b9f5-545770f2d1b2/device/vusb/0/frontend =
"/local/domain/3/device/vusb/0" (n0)
/vm/99a002ad-7c36-4a40-b9f5-545770f2d1b2/device/vusb/0/frontend-id =
"3" (n0)
/vm/99a002ad-7c36-4a40-b9f5-545770f2d1b2/device/vusb/0/backend-id =
"0" (n0)
/vm/99a002ad-7c36-4a40-b9f5-545770f2d1b2/device/vusb/0/backend =
"/local/domain/0/backend/vusb/3/0" (n0)

The rest of the output I have attached as a file.
>
> Do you happen to know if this uses the PVUSB drivers or some other
> mechanism? "lsmod" in both dom0 and domU should provide a clue if the
> drivers are loaded.
Looks like it:

dom0
mgaxen1:~ # lsmod | grep usb
usbbk 23503 0
xenbus_be 3952 4 usbbk,netbk,blkbk,blktap
usbhid 50900 0
hid 83977 1 usbhid
usbcore 221920 5 usbbk,usbhid,uhci_hcd,ehci_hcd

domU
mgaca:~ # lsmod | grep usb
usbcore 220777 3 xen_hcd
>
> Does this work for both PV and HVM guests or do you only use one or the
> other?
I only use PV guests.
>
>> Once I have done this I can use the usb devce in the domU as if it was
>> directly connected.
>>
>> Thanks for your time.
> Thank you for describing the functionality.
>
> Ian.
>
>
Attachments: xenstore-ls.fp.out (81.6 KB)


pasik at iki

Aug 20, 2012, 1:10 PM

Post #5 of 6 (72 views)
Permalink
Re: PV USB Use Case for Xen 4.x [In reply to]

On Mon, Aug 20, 2012 at 03:48:45PM -0400, Tom Parker wrote:
> >
> >> Currently we use PVUSB to attach a USB Smartcard reader through our
> >> dom0 (SLES 11 SP1) running on an HP Blade Server with the Token
> >> mounted on an internal USB Port to our domU CA server (SLES 11)
> >>
> >> The config file syntax is broken so we have to manually attach (I have
> >> it scripted) whenever our hosts reboot (which is almost never.)
> > Can you give an example of what the syntax *should* be?
> There used to be some data in the wiki or in an initial presentation on
> PVUSB but as it has never worked for me. I don't remember how it worked.
>

http://wiki.xen.org/wiki/Xen_USB_Passthrough

> >
> > Do you happen to know if this uses the PVUSB drivers or some other
> > mechanism? "lsmod" in both dom0 and domU should provide a clue if the
> > drivers are loaded.
> Looks like it:
>
> dom0
> mgaxen1:~ # lsmod | grep usb
> usbbk 23503 0
> xenbus_be 3952 4 usbbk,netbk,blkbk,blktap
> usbhid 50900 0
> hid 83977 1 usbhid
> usbcore 221920 5 usbbk,usbhid,uhci_hcd,ehci_hcd
>
> domU
> mgaca:~ # lsmod | grep usb
> usbcore 220777 3 xen_hcd
>

So this looks like the PVUSB drivers (usbback/usbfront) from xen unmodified_drivers
and/or from Suse's xenlinux forward-ported patches.

There's also a PVUSB port to pvops kernels, it's available in konrad's git tree.


> >
> > Does this work for both PV and HVM guests or do you only use one or the
> > other?
> I only use PV guests.
>

PVUSB works for both PV and HVM guests.
And James Harper's GPLPV Windows drivers contain PVUSB frontend driver for Windows.


-- Pasi


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


james.harper at bendigoit

Aug 20, 2012, 11:18 PM

Post #6 of 6 (66 views)
Permalink
Re: PV USB Use Case for Xen 4.x [In reply to]

>
> PVUSB works for both PV and HVM guests.
> And James Harper's GPLPV Windows drivers contain PVUSB frontend driver
> for Windows.
>

GPLPV PVUSB is considered experimental... just in case anyone thinks it's production ready!

James

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.