USB host controller driver for virtual usb bus (Xen)

Xen provides the ability to pass USB devices through from the physical
machine to a virtual machine. I am having a bit of a look around at what
would be involved in implementing this in a Windows virtual machine and
would like to know if anyone knows of any technical reason why I might
run into trouble?

Certainly with scsiport, there are all sorts of problems to overcome,
like the device really has to have an IRQ (you can use a timer but
performance is horrible) and has to have a memory resource etc. NDIS is
a lot nicer. Storport appears to be nicer but gave me enough trouble
that I went back to scsiport.

I also can’t seem to find a sample for a USB host controller driver…
looking through the 6001.18002 ‘src’ directory there doesn’t appear to
be much there.

In the docs (WDM Driver Layers: An Example) it says “The USB host
controller class and miniclass drivers are provided with the system by
Microsoft.”. I’m not sure if this means “we don’t provide a way for you
to write your own USB host controller driver” or “we provide a
framework, but this isn’t something most people need to worry about”. I
fear the former.

All input appreciated.

Thanks

James

James,

It is the former, this has been discussed before a number of times. I
suspect the only course you would have is a licensing of the driver from
Microsoft if they would consider it.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

“James Harper” wrote in message
news:xxxxx@ntdev…
Xen provides the ability to pass USB devices through from the physical
machine to a virtual machine. I am having a bit of a look around at what
would be involved in implementing this in a Windows virtual machine and
would like to know if anyone knows of any technical reason why I might
run into trouble?

Certainly with scsiport, there are all sorts of problems to overcome,
like the device really has to have an IRQ (you can use a timer but
performance is horrible) and has to have a memory resource etc. NDIS is
a lot nicer. Storport appears to be nicer but gave me enough trouble
that I went back to scsiport.

I also can’t seem to find a sample for a USB host controller driver…
looking through the 6001.18002 ‘src’ directory there doesn’t appear to
be much there.

In the docs (WDM Driver Layers: An Example) it says “The USB host
controller class and miniclass drivers are provided with the system by
Microsoft.”. I’m not sure if this means “we don’t provide a way for you
to write your own USB host controller driver” or “we provide a
framework, but this isn’t something most people need to worry about”. I
fear the former.

All input appreciated.

Thanks

James

Information from ESET NOD32 Antivirus, version of virus signature
database 4267 (20090722)


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Information from ESET NOD32 Antivirus, version of virus signature database 4267 (20090722)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

There is a port/miniport architecture for usb hbas but it is not
published in the WDK.

Mark Roddy

On Wed, Jul 22, 2009 at 5:20 AM, James
Harper wrote:
> Xen provides the ability to pass USB devices through from the physical
> machine to a virtual machine. I am having a bit of a look around at what
> would be involved in implementing this in a Windows virtual machine and
> would like to know if anyone knows of any technical reason why I might
> run into trouble?
>
> Certainly with scsiport, there are all sorts of problems to overcome,
> like the device really has to have an IRQ (you can use a timer but
> performance is horrible) and has to have a memory resource etc. NDIS is
> a lot nicer. Storport appears to be nicer but gave me enough trouble
> that I went back to scsiport.
>
> I also can’t seem to find a sample for a USB host controller driver…
> looking through the 6001.18002 ‘src’ directory there doesn’t appear to
> be much there.
>
> In the docs (WDM Driver Layers: An Example) it says “The USB host
> controller class and miniclass drivers are provided with the system by
> Microsoft.”. I’m not sure if this means “we don’t provide a way for you
> to write your own USB host controller driver” or “we provide a
> framework, but this isn’t something most people need to worry about”. I
> fear the former.
>
> All input appreciated.
>
> Thanks
>
> James
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

“Mark Roddy” wrote in message news:xxxxx@ntdev…
> There is a port/miniport architecture for usb hbas but it is not
> published in the WDK.
>
> Mark Roddy

VMware nevertheless managed to solve this mistery in a quite elegant way.
And it works, here, now.

–pa

> On Wed, Jul 22, 2009 at 5:20 AM, James
> Harper wrote:
>> Xen provides the ability to pass USB devices through from the physical
>> machine to a virtual machine. I am having a bit of a look around at what
>> would be involved in implementing this in a Windows virtual machine and
>> would like to know if anyone knows of any technical reason why I might
>> run into trouble?
>>
>> Certainly with scsiport, there are all sorts of problems to overcome,
>> like the device really has to have an IRQ (you can use a timer but
>> performance is horrible) and has to have a memory resource etc. NDIS is
>> a lot nicer. Storport appears to be nicer but gave me enough trouble
>> that I went back to scsiport.
>>
>> I also can’t seem to find a sample for a USB host controller driver…
>> looking through the 6001.18002 ‘src’ directory there doesn’t appear to
>> be much there.
>>
>> In the docs (WDM Driver Layers: An Example) it says “The USB host
>> controller class and miniclass drivers are provided with the system by
>> Microsoft.”. I’m not sure if this means “we don’t provide a way for you
>> to write your own USB host controller driver” or “we provide a
>> framework, but this isn’t something most people need to worry about”. I
>> fear the former.
>>
>> All input appreciated.
>>
>> Thanks
>>
>> James
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>

>

“Mark Roddy” wrote in message
news:xxxxx@ntdev…
> > There is a port/miniport architecture for usb hbas but it is not
> > published in the WDK.
> >
> > Mark Roddy
>
> VMware nevertheless managed to solve this mistery in a quite elegant
way.
> And it works, here, now.
>

Can you elaborate on how they solved this? I imagine a company like
VMWare would be in a position to negotiate something with Microsoft to
do it the ‘right way’.

Alternatively, they may just emulate a [UOE]HCI PCI Host Controller
which is slower but doesn’t break any rules.

Thanks

James

>

Alternatively, they may just emulate a [UOE]HCI PCI Host Controller
which is slower but doesn’t break any rules.

I should also add that I don’t consider this to be ‘elegant’ in any way
at all :slight_smile:

James

James Harper wrote:

> Alternatively, they may just emulate a [UOE]HCI PCI Host Controller
> which is slower but doesn’t break any rules.

It seems so. The free Payer has USB support, you can see how exactly it
works…

I should also add that I don’t consider this to be ‘elegant’ in any way
at all :slight_smile:

They don’t break rules, they are amazingly stable, devices can
be easily switched between host to guest, devices can be installed
in a guest even if no driver is available on the host side.
Pretty nice, IMHO.

–pa

Pavel A. wrote:

James Harper wrote:
>> Alternatively, they may just emulate a [UOE]HCI PCI Host Controller
>> which is slower but doesn’t break any rules.

It seems so. The free Payer has USB support, you can see how exactly it

PLAYER

>

> I should also add that I don’t consider this to be ‘elegant’ in any
way
> at all :slight_smile:

They don’t break rules, they are amazingly stable, devices can
be easily switched between host to guest, devices can be installed
in a guest even if no driver is available on the host side.
Pretty nice, IMHO.

My disagreement is that in order to make it ‘elegant’ on the Windows
side, it has to be implemented inefficiently on the ‘back end’. Windows
reminds me of the spoilt child that everything else has to revolve
around. Having said that, there is something to be said for a solution
that does actually work :slight_smile:

James

>My disagreement is that in order to make it ‘elegant’ on the Windows

side

Why not emulate the USB controller fully at hardware level for the Xen guest? Given the way they work, it is not so bad in performance - the DMA schedule page can be remapped to Xen host which will update it the way it wants.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com