VMware
9 Replies Last post: Sep 29, 2004 8:03 PM by blackcat  

Guest able to directly access PCI cards posted: Sep 21, 2004 1:16 AM

Click to view blackcat's profile Lurker 41 posts since
Apr 20, 2004
If the host is not using a card in a certain PCI slot (ie. does not have drivers running for that card) then a guest OS should be able to directly access it.

For example, there is a very popular Linux-only telephony/PBX application called Asterisk, which uses PCI telephony cards from Digium. These cards only have Linux drivers, and cant be used in Windows.

So, on a Windows machine, it would be logical to run a Linux VM in which Asterisk could run and access its telephony cards. However you cant currently do this.

Re: Guest able to directly access PCI cards

1. Sep 28, 2004 8:11 AM in response to: blackcat
Click to view Big Al's profile Novice 10 posts since
Sep 25, 2004
I think you will find this a problem, as windows uses the hardware application layer to communicate with any system devices whether it is using them or not. The virtual machines within the workstation cannot directly communicate with the devices because of hardware application layer of running on the host o/s.

Re: Guest able to directly access PCI cards

2. Sep 28, 2004 12:05 PM in response to: Big Al
Click to view Daryll's profile Master 2,346 posts since
Jul 10, 2003
This is not likely to happen at all in the foreseeable future.

We would need to do a lot more work than just making the PCI slot available to the VM.

I agree that this falls under the "it would be nice to have" umbrella. Given the technical challenges behind this, however, you're probably not going to see this feature included in our products.

-Daryll

Re: Guest able to directly access PCI cards

4. Sep 28, 2004 8:12 PM in response to: blackcat
Click to view sherold's profile Master 1,639 posts since
Dec 10, 2003
Keep in mind one of the reasons we all love ESX. The lightweight VMkernel that allows for minimal virtualization overhead. By creating a driver in such a fashion, there would need to be quite a bit of modification and bloating of the vmkernel (to provide DMA, IRQs, and manage the memory assosciated with these functions). Perhaps with Intel's announcment of the Vanderpool project (http://www.tomshardware.com/hardnews/20040907_141505.html) some of the functionality of the VMkernel can be offladed, allowing for increased functionality in the vmkernel. **Content voluntarily deleted**

Scott

Message was edited by: sherold

Re: Guest able to directly access PCI cards

6. Sep 28, 2004 8:50 PM in response to: blackcat
Click to view sherold's profile Master 1,639 posts since
Dec 10, 2003
BTW I'm not even sure that bloat is an issue. The
VMWare kernel must already be virtualising a PCI bus
and associated hardware controls (IRQs/ports/etc).
What is new here is it passing some of those over to
a new driver on the host (where the hard work is
done) for execution.

Mind you, I'm probably talking nonsense!! :-)


You make a valid point, and I may be the one talking nonsense here, but VMware doesn't actually virtualize (in the sense of the word) the physical PCI devices it can currently use (NIC, SCSI, HBA) directly to the VMs. The guest operating system never sees these physical devices. They see emulated (for lack of a better word) devices at the vmkernel level. The vmkernel then transforms the proper requests back to the physical hardware. I have NO IDEA how they do this...I chalk it up to magic. I would think it would take significantly more code to supply direct interaction of virtual machines to the physical hardware by requiring that they include some form of direct physical hardware abstraction layer.

Scott

Re: Guest able to directly access PCI cards

8. Sep 29, 2004 12:51 PM in response to: blackcat
Click to view petr's profile Champion 7,218 posts since
Jul 10, 2003
It is not that simple. I think that I already answered it in some other thread, but I'm lazy to look for it, so I'll retype it here.

There are three (or maybe more) problems with generic support for PCI cards:

(1) It is not easy to say whether host OS uses card or not. ESX makes it simpler, but we do not want to run ESX, yes?

(2) PCI cards can do busmastering. When you program hardware, you cannot distinguish programming of busmastering transfers from normal programming of card. So either you'll maintain 1:1 mapping between physical guest memory and host's physical memory (which means that you can run only one guest OS, and you'll have to use special host OS. So for hosted products busmastering is impossible, for ESX maybe, but with very huge costs.

(3) After we eliminated busmastering, there are interrupts. As only guest OS has an idea how to acknowledge (and deassert) interrupts generated by hardware, it means that we cannot share generic PCI's interrupt line with any other device which is used by host - as we only know how to disable IRQ on PIC/APIC/IOAPIC. Maybe PCI-X's generic IRQ enable on card can lift this requirement, but I'm afraid that touching this bit could change hardware behavior.

(4) After we eliminated cards with busmastering and interrupts - who's still in contest? I'm afraid that nobody. And from those devices which are still in contest we have to eliminate devices which can lockup PCI bus while programmed - for example (from my exprience) when you setup Matrox cards, there are time windows during which framebuffer access locks up card hard (not that all except old MillenniumI were eliminated by no-busmastering condition above, but you could try to run them without busmastering). So you do not want to run untrusted VMs, as VM can now crash your host.

Due to conditions above I do not think that generic PCI cards access is possible without BIG support from hardware. Maybe chipsets with IOMMU could shield PCI card's busmastering from damaging your system, but until IOMMU is generally available I'm afraid that there is no chance that anybody can implement usable framework.

If we talk about it, I think that instead of direct PCI access you should ask for API which would allow you to write your own virtual devices - that way, with device datasheet, you should be able to write simple pass-through filter which will know which accesses are for busmastering/interrupts and which are not, and then you can map/translate what needs to be translated, and pass through safe operations.

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities