On 07/06/2009 01:41 AM, Stephen Donnelly wrote:
I am looking at how to do memory mapped IO between host and guests under kvm. I expect to use the PCI emulation layer to present a PCI device to the guest. I see virtio_pci uses cpu_physical_memory_map() which provides either read or write mappings and notes "Use only for reads OR writes - not for read-modify-write operations."
Right, these are for unidirectional transient DMA.
Is there an alternative method that allows large (Several MB) persistent hg memory mappings that are r/w? I would only be using this under kvm, not kqemu or plain qemu.
All of guest memory is permanently mapped in the host. You can use accessors like cpu_physical_memory_rw() or cpu_physical_memory_map() to access it. What exactly do you need that is not provided by these accessors?
Also it appears that PCI IO memory (cpu_register_io_memory) is provided via access functions, like the pci config space?
It can also use ordinary RAM (for example, vga maps its framebuffer as a PCI BAR).
Does this cause a page fault/vm_exit on each read or write, or is it more efficient than that?
It depends on how you configure it. Look at the vga code (hw/vga.c, hw/cirrus_vga.c). Also Cam (copied) wrote a PCI card that provides shared memory across guests, you may want to look at that.
-- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html