Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread David Gibson
On Thu, Jun 08, 2017 at 05:30:57PM +0200, Paolo Bonzini wrote: 1;4602;0c> > > On 08/06/2017 16:58, David Gibson wrote: > > So, doing that via the standard macro wrappers would be slow, because > > it does type verification. However, looking up the class function is > > fundamentally: > > > >

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread Paolo Bonzini
On 08/06/2017 16:58, David Gibson wrote: > So, doing that via the standard macro wrappers would be slow, because > it does type verification. However, looking up the class function is > fundamentally: > > ((IOMMUMemoryRegionClass *)(((Object *)mr)->class))->translate > > i.e. two pointer

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread David Gibson
On Thu, Jun 08, 2017 at 03:59:27PM +0200, Paolo Bonzini wrote: > > > On 08/06/2017 09:42, David Gibson wrote: > > So.. this seems like an only halfway QOMification. The main init > > function still takes an ops structure, whereas the QOMish way to do > > this would be to have the base IOMMUMemor

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread David Gibson
On Fri, Jun 09, 2017 at 12:28:35AM +1000, Alexey Kardashevskiy wrote: > On 08/06/17 17:42, David Gibson wrote: > > On Wed, Jun 07, 2017 at 06:32:43PM +1000, Alexey Kardashevskiy wrote: > >> This defines new QOM object - IOMMUMemoryRegion - with MemoryRegion > >> as a parent. > >> > >> This moves IO

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread Paolo Bonzini
On 08/06/2017 16:28, Alexey Kardashevskiy wrote: >>> +void memory_region_init_iommu_type(const char *mrtypename, >>> + IOMMUMemoryRegion *iommu_mr, >>> + Object *owner, >>> + const MemoryRegionIO

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread Alexey Kardashevskiy
On 08/06/17 17:42, David Gibson wrote: > On Wed, Jun 07, 2017 at 06:32:43PM +1000, Alexey Kardashevskiy wrote: >> This defines new QOM object - IOMMUMemoryRegion - with MemoryRegion >> as a parent. >> >> This moves IOMMU-related fields from MR to IOMMU MR. However to avoid >> dymanic QOM casting in

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread Paolo Bonzini
On 08/06/2017 09:42, David Gibson wrote: > So.. this seems like an only halfway QOMification. The main init > function still takes an ops structure, whereas the QOMish way to do > this would be to have the base IOMMUMemoryRegion be an abstract class, > and have the IOMMUOps pointers as part of t

Re: [Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-08 Thread David Gibson
On Wed, Jun 07, 2017 at 06:32:43PM +1000, Alexey Kardashevskiy wrote: > This defines new QOM object - IOMMUMemoryRegion - with MemoryRegion > as a parent. > > This moves IOMMU-related fields from MR to IOMMU MR. However to avoid > dymanic QOM casting in fast path (address_space_translate, etc), >

[Qemu-devel] [PATCH qemu v7] memory/iommu: QOM'fy IOMMU MemoryRegion

2017-06-07 Thread Alexey Kardashevskiy
This defines new QOM object - IOMMUMemoryRegion - with MemoryRegion as a parent. This moves IOMMU-related fields from MR to IOMMU MR. However to avoid dymanic QOM casting in fast path (address_space_translate, etc), this adds an @is_iommu boolean flag to MR and provides new helper to do simple cas