[nzlug] Xen and USB

Michal Ludvig michal at logix.cz
Wed Nov 14 01:36:59 NZDT 2007


Volker Kuhlmann wrote:
> On Fri 09 Nov 2007 15:04:47 NZDT +1300, Toby Collett wrote:
> 
>> I am setting up a xen domU which as part of its existence will function as a
>> print server. The dom0 is running gutsy 64bit (as is the domU) and I am
>> wanting to use a USB printer on the domU. There are various bits an pieces
>> on the web about claiming PCI devices and USB devices, but I cant seem to
>> find a single location with up to date details of how to do these things.
>> So, does anyone on the list know: Has usb claiming made it into mainstream
>> xen? a good practical example of how to use it and a good reference for some
>> of the hardware functions...
> 
> I think what people (me too) misunderstand about Xen is that it is a
> piece of software which lets you virtualise servers. Peripherals and I/O
> other than from the disks or network don't feature in any equation. 

There are two types of kernels running in Xen - One is privileged dom0
which has full control over the hardware and the other is non-privileged
domU which uses hypervisor as its hardware provider and talks to
hypervisor everytime it needs access to disk or network.

> the nvidia graphics driver is mutually exclusive with the xen kernel.

It is mutually exclusive just because nvidia driver may not compile for
xen-enabled kernel. But that's just a deficiency of that particular
nvidia driver. There is no reason why dom0 couldn't have accelerated
video if someone would care enough to make the drivers compile. Dom0 has
full access to the hardware and can therefore do whatever it wants with
the nvidia videocard.

Accelerated video in domU is a different question. In normal setup it is
not possible. Xen, however, could assign particular PCI devices to
unprivileged domains (which have to run dom0-compatible kernel in such a
case). If you have two network cards in a PC one could be used by dom0
and the other by this semi-privileged domU.

With USB it's yet a bit more interesting. It isn't possible (AFAIK) to
export a single USB device to domU. All you can do is to export the
whole USB controller. If you mainboard has only one USB controller
(/sbin/lspci will tell you) and you need it for keyboard or mouse go to
your nearest DSE and get a standalone PCI USB card. Plug it in and
export it to your domU. This way you'll get direct access to your
printer from domU.

All the above used to work fine with Xen 2.x when I tried some two years
ago. I have never tried exporting PCI devices with Xen 3 though. Look
for "Xen PCI passthrough" on google. I couldn't find a definitive answer
whether it works with Xen3 or not.

Michal







More information about the NZLUG mailing list