On 21 May 2013 11:57, Paolo Bonzini <pbonz...@redhat.com> wrote: > From: Avi Kivity <avi.kiv...@gmail.com> > > 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 implementation uses an AddressSpace mapping the target region to > avoid hierarchical dispatch all the way to the resolved region; only > iommu regions are looked up dynamically. > > Signed-off-by: Avi Kivity <avi.kiv...@gmail.com> > [Modified to put translation in address_space_translate - Paolo] > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
More overlong lines here, and these are in comments so trivial to avoid. > /** > + * memory_region_is_iommu: check whether a memory region is an iommu > + * > + * Returns %true is a memory region is an iommu. "s/is/if/" > > +void memory_region_init_iommu(MemoryRegion *mr, > + MemoryRegionIOMMUOps *ops, > + AddressSpace *target_as, > + const char *name, > + uint64_t size) > +{ > + memory_region_init(mr, name, size); > + mr->ops = NULL; > + mr->iommu_ops = ops, > + mr->opaque = mr; > + mr->terminates = true; /* then re-forwards */ > + mr->destructor = memory_region_destructor_none; destructor_none is the default, you don't need to set it again. thanks -- PMM