On Mon, Oct 03, 2011 at 08:17:05AM -0500, Anthony Liguori wrote: > On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > >>>Hmm, not entirely virtio specific, some devices use stX macros to do the > >>>conversion. E.g. stw_be_phys and stl_le_phys are used in several > >>>places. > >> > >>These are fine - explicit endianness. > > > >Right. So changing these to e.g. stl_dma and assuming > >LE is default seems like a step backwards. > > We're generalizing too much. > > In general, the device model doesn't need atomic access functions. > That's because device model RAM access is not coherent with CPU RAM > access.
Ok, so the next spin of these patches will have explicit LE and BE versions of the accessors by popular demand. I'm still using cpu_physical_memory_rw() as the backend though, because I can't see a case where a device could safely _require_ an emulated DMA access to be atomic. > Virtio is a very, very special case. virtio requires coherent RAM access. Right. Virtio's access to memory is *not* emulated PCI DMA, it's god-like hypervisor access to guest system memory. It should correctly bypass any IOMMU, and so should remain as cpu_physical_memory_rw() or the atomic accessors, rather than being converted to this new API. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson