PCI Delegation in Xen
I haven't been able to find any existing documentation on this, and since I had it working properly on a test server that I recently killed (and then I had to figure out how to do it again), I figured I'd document it here, for myself, and anyone else who's looking for it.
Disclaimer: If you don't know what Xen or PCI Delegation are, you can probably stop reading here.
PCI Delegation lets you hide PCI devices from your Dom0 system and access them directly in a DomU system. The first thing you'll need to do is ensure PCI backend is enabled for your Dom0 kernel and PCI frontend for you DomU kernel.
CONFIG_XEN_PCIDEV_FRONTEND=y
CONFIG_XEN_PCIDEV_BACKEND=y
To hide a device, you'll first need to note the PCI id of the device, run lspci to find this out. It's represented by the first column in the listing. In my case, I'm trying to hide one of my ethernet cards, my output looks something like this (non-relevant information snipped):
06:07.0 Ethernet controller: Intel Corporation 82541GI/PI Gigabit Ethernet Controller (rev 05)
07:08.0 Ethernet controller: Intel Corporation 82541GI/PI Gigabit Ethernet Controller (rev 05)
So the id I want to note is 07:08.0.
Now, add pciback.hide=(07:08.0) to your grub.conf kernel line, mine looks something like this:
module /vmlinuz-2.6.16.26-xen0 root=/dev/sda7 pciback.hide=(07:08.0)
When you reboot, your Dom0 system will no longer be aware of the specified PCI device. Run ifconfig ethX to verify this.
All you need to do now is add the device to your DomU system. In your Xen config file add the line:
pci = [ '07:08.0' ]
You also won't need any vif lines unless you still want virtual interfaces within the same DomU. Boot into your Dom0 and run lspci, you should see your PCI device listed there now.
























Peanut Gallery
Thank you very much! Just
Thank you very much! Just what I needed. The documentation for Xen really is poor.
[...] PCI Delegation in Xen
[...] PCI Delegation in Xen [...]
Post new comment