[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [Experimental patch] PCI emulation layer



Hello!

  I have experimented a bit further with the emulation of the PCI layer. 
The attached patches allow to hide a PCI device from domain 0 by passing a 
'hide=' argument to the grub module line of the domain 0 kernel (i.e., 
module /vmlinuz-2.6.12-xen0 root=/dev/hda2 ro hide=02:09.0). For example 
to hide the second ethernet card in my system, I pass 'hide=02:09.0', 
where '2' indicates the bus number, '9' the device number and '0' the 
function. 'lspci' or 'cat /proc/pci' can tell which devices are available 
in a system. The hidden device becomes automatically visible to the first 
user domain that is started or to any subsequent domain that is started 
after the previously owning domain is killed (this is hardcoded for now). 
That PCI device's config space is not emulated, but its config space 
'shines through', meaning that all inb/w/l and outb/w/l from the kernel 
are first intercepted by Xen and then issued again in the PCI emulation 
code. The Host and ISA bridge PCI entries are emulated by the QEMU code, 
though (see below).

If you want to try the patches, apply them *after* one full XEN compile - 
the reason being that the Linux patch applies against the 
linux-2.6.12-xen0 directory. The .config file is my domU configuration 
file.

A 'cat /proc/pci' in the user domain shows the 2nd PCI card of the system:


PCI devices found:
  Bus  0, device   0, function  0:
    Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 2).
  Bus  0, device   1, function  0:
    ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 
(rev 0).
  Bus  0, device   9, function  0:
    Ethernet controller: Intel Corporation 82557/8/9 [Ethernet Pro 100] 
(rev 8).
      IRQ 9.
      Master Capable.  Latency=66.  Min Gnt=8.Max Lat=56.
      Non-prefetchable 32 bit memory at 0xc0101000 [0xc0101fff].
      I/O at 0x2040 [0x207f].
      Non-prefetchable 32 bit memory at 0xc0200000 [0xc02fffff].

Although the device appears on bus '0', it is internally correctly handled 
as being on 'bus 2'.
One problem is certainly that the IRQ number is not correct for the device 
to function - it should be '21' on that machine. 


The positive side I think is that so far the changes to Linux are minimal. 
The hiding of PCI devices could be done in Xen if also domain 0 received 
an emulated PCI layer, which would completely eliminate changes to Linux - 
at least for making PCI devices visible.


Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>


Attachment: .config
Description: Binary data

Attachment: pci_emu_xen.diff
Description: Binary data

Attachment: pci_hide.diff
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.