From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5j2l-0008B1-Fm for qemu-devel@nongnu.org; Tue, 02 May 2017 21:25:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5j2i-0000Su-AZ for qemu-devel@nongnu.org; Tue, 02 May 2017 21:25:27 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:34022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5j2i-0000Sj-1j for qemu-devel@nongnu.org; Tue, 02 May 2017 21:25:24 -0400 Received: by mail-pf0-x241.google.com with SMTP id g23so1816415pfj.1 for ; Tue, 02 May 2017 18:25:23 -0700 (PDT) References: <20170429123707.16675-1-aik@ozlabs.ru> <20170502182550.5edb9565.cornelia.huck@de.ibm.com> From: Alexey Kardashevskiy Message-ID: Date: Wed, 3 May 2017 11:25:16 +1000 MIME-Version: 1.0 In-Reply-To: <20170502182550.5edb9565.cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=koi8-r Content-Language: en-AU Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH qemu v5] memory/iommu: QOM'fy IOMMU MemoryRegion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson , Alex Williamson , Christian Borntraeger , Paolo Bonzini , Peter Xu , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= On 03/05/17 02:25, Cornelia Huck wrote: > On Sat, 29 Apr 2017 22:37:07 +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), >> this adds an @is_iommu boolean flag to MR and provides new helper to >> do simple cast to IOMMU MR - memory_region_get_iommu. The flag >> is set in the instance init callback. This defines >> memory_region_is_iommu as memory_region_get_iommu()!=NULL. >> >> This switches MemoryRegion to IOMMUMemoryRegion in most places except >> the ones where MemoryRegion may be an alias. >> >> This defines memory_region_init_iommu_type() to allow creating >> IOMMUMemoryRegion subclasses. In order to support custom QOM type, >> this splits memory_region_init() to object_initialize() + >> memory_region_do_init. >> >> Signed-off-by: Alexey Kardashevskiy > >> /** >> + * memory_region_init_iommu_type: Initialize a memory region of a custom type >> + * that translates addresses >> + * >> + * An IOMMU region translates addresses and forwards accesses to a target >> + * memory region. >> + * >> + * @typename: QOM class name >> + * @iommumr: the #IOMMUMemoryRegion to be initialized > > > I find "iommumr" terribly hard to read. Maybe iommu_mr is better? (Lots > of times in this patch.) > Terribly? Really? :) Seriously, since linux uses underscores in typenames, I kind of developed resistance to underscores in variable names which look like typenames (even though c allows using same token for a type and a variable). May be just "iommu"? I need one more vote for "iommu" vs. "iommumr" vs. "iommu_mr" to respin v6 :) > > The s390 parts look fine. > -- Alexey