Received: from eggs.gnu.org ([2001:4830:134:3::10]:54355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctZhF-0005W3-3k for qemu-devel@nongnu.org; Thu, 30 Mar 2017 09:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctZhC-0007LV-18 for qemu-devel@nongnu.org; Thu, 30 Mar 2017 09:01:01 -0400 References: <20170330124707.28142-1-aik@ozlabs.ru> <20170330124707.28142-2-aik@ozlabs.ru> From: Paolo Bonzini Message-ID: <183be420-3192-56b7-eb76-29a2830c7244@redhat.com> Date: Thu, 30 Mar 2017 15:00:52 +0200 MIME-Version: 1.0 In-Reply-To: <20170330124707.28142-2-aik@ozlabs.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH qemu 1/5] memory/iommu: QOM'fy IOMMU MemoryRegion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, David Gibson , Alex Williamson On 30/03/2017 14:47, Alexey Kardashevskiy wrote: > @@ -633,7 +663,7 @@ static inline bool memory_region_is_iommu(MemoryReg= ion *mr) > if (mr->alias) { > return memory_region_is_iommu(mr->alias); > } > - return mr->iommu_ops; > + return object_dynamic_cast(OBJECT(mr), TYPE_IOMMU_MEMORY_REGION) != =3D NULL; > } This is going to be too slow for all the places where fast paths use address_space_translate. You need a (slightly hackish) bool iommu flag in MemoryRegion, and a regular C cast rather than the type-safe IOMMU_MEMORY_REGION(mr) in address_space_translate. You can set the flag in iommu_memory_region_instance_init for example. Paolo