Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-15 Thread Avi Kivity
On 10/12/2012 04:51 AM, Benjamin Herrenschmidt wrote: > On Thu, 2012-10-11 at 15:57 +0200, Avi Kivity wrote: >> >> Map/unmap is supported via address_space_map(), which calls >> >> ->translate(). I don't see how a lower-level map/unmap helps, >> unless >> >> the hardware supplies such a function.

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-13 Thread Benjamin Herrenschmidt
On Sat, 2012-10-13 at 09:30 +, Blue Swirl wrote: > > The problem with map and unmap is invalidations. How do you convey to > > the devices having done a map that the guest has invalidated a > > translation entry. > > Also in Sparc32, IOMMU uses a table in RAM which the guest can change, > so

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-13 Thread Blue Swirl
On Fri, Oct 12, 2012 at 2:45 AM, Benjamin Herrenschmidt wrote: > On Thu, 2012-10-11 at 15:42 +0200, Paolo Bonzini wrote: >> Il 11/10/2012 15:26, Avi Kivity ha scritto: >> > +struct MemoryRegionIOMMUOps { >> > +/* Returns a TLB entry that contains a given address. */ >> > +IOMMUTLBEntry (*t

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Benjamin Herrenschmidt
On Thu, 2012-10-11 at 15:57 +0200, Avi Kivity wrote: > >> Map/unmap is supported via address_space_map(), which calls > >> ->translate(). I don't see how a lower-level map/unmap helps, > unless > >> the hardware supplies such a function. > > > > Yep, it's just the map/unmap callbacks that are not

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Benjamin Herrenschmidt
On Thu, 2012-10-11 at 15:42 +0200, Paolo Bonzini wrote: > Il 11/10/2012 15:26, Avi Kivity ha scritto: > > +struct MemoryRegionIOMMUOps { > > +/* Returns a TLB entry that contains a given address. */ > > +IOMMUTLBEntry (*translate)(MemoryRegion *iommu, target_phys_addr_t > > addr, > > +

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Avi Kivity
On 10/11/2012 03:26 PM, Avi Kivity wrote: > Add a new memory region type that translates addresses it is given, > then forwards them to a target address space. This is similar to > an alias, except that the mapping is more flexible than a linear > translation and trucation, and also less efficient

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Avi Kivity
On 10/11/2012 03:54 PM, Paolo Bonzini wrote: > Il 11/10/2012 15:45, Avi Kivity ha scritto: >> +struct MemoryRegionIOMMUOps { >> +/* Returns a TLB entry that contains a given address. */ >> +IOMMUTLBEntry (*translate)(MemoryRegion *iommu, target_phys_addr_t >> addr,

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Paolo Bonzini
Il 11/10/2012 15:45, Avi Kivity ha scritto: >>> >> +struct MemoryRegionIOMMUOps { >>> >> +/* Returns a TLB entry that contains a given address. */ >>> >> +IOMMUTLBEntry (*translate)(MemoryRegion *iommu, target_phys_addr_t >>> >> addr, >>> >> + bool is_write);

[Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Avi Kivity
Add a new memory region type that translates addresses it is given, then forwards them to a target address space. This is similar to an alias, except that the mapping is more flexible than a linear translation and trucation, and also less efficient since the translation happens at runtime. The im

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Avi Kivity
On 10/11/2012 03:42 PM, Paolo Bonzini wrote: > Il 11/10/2012 15:26, Avi Kivity ha scritto: >> +struct MemoryRegionIOMMUOps { >> +/* Returns a TLB entry that contains a given address. */ >> +IOMMUTLBEntry (*translate)(MemoryRegion *iommu, target_phys_addr_t addr, >> +

Re: [Qemu-devel] [RFC v1 3/7] memory: iommu support

2012-10-11 Thread Paolo Bonzini
Il 11/10/2012 15:26, Avi Kivity ha scritto: > +struct MemoryRegionIOMMUOps { > +/* Returns a TLB entry that contains a given address. */ > +IOMMUTLBEntry (*translate)(MemoryRegion *iommu, target_phys_addr_t addr, > + bool is_write); > +}; Do map/unmap still ma