leonard michelet
2009-Mar-20 15:55 UTC
[Xen-devel] patch to assign PCI device on VM without address translation
Hi everybody, we are two french students working for EADS to assign PCI device to VM with Xen. We had a problem to use some National Instruments PCI Card. These cards have 2 Base Address Register of 4K each, and their driver write in the BAR1''s address in a register of BAR0. But since the driver can''t know physical addresses, it write the wrong address, and the card can''t initialize her BAR. We worked on it several days, and come up with a solution : force physical and virtual BAR addresses to match. We are currently doing that thanks to a small change in the function "pt_pci_write_config" in the file tools/ioemu-remote/hw/pass-through.c from the xen unstable tree. We add a "if" which check what BAR address the function has be given as argument. If this address is the usual address where Xen map the BAR of our card, we change it''s value for the physical one. We made tests with this patch, and our cards worked fine. So we would like to make a patch for Xen to add a mode "1:1 mapping" for assigned device, using a configuration file (something like the xend-pci-quirks.sxp file in etc/xen) where each users could add their own card. Since we set our background, and if you''re still reading, we assume that you think this patch could be useful. Now, it''s question time : Do you think we should move virtual addresses to match physical addresses (changes in QEmu) or move physical addresses to match virtual adresses (change in Dom0)? Do you have any idea how addresses are choosen, in a VM or in the Dom0, or in which order? Thanks to you for reading, We''ll be glad to hear your comment about our idea. Feel free to send us a private e-mail just to share your point of view, or answer on the mailing list. Best regards, LĂ©onard & Guillaume _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel