Received: from eggs.gnu.org ([2001:4830:134:3::10]:45949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXji0-0001QF-W5 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 01:11:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXjhx-000211-PY for qemu-devel@nongnu.org; Mon, 22 Feb 2016 01:11:00 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:58153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXjhx-0001y5-66 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 01:10:57 -0500 Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 22 Feb 2016 16:10:51 +1000 Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 75D0D2BB0057 for ; Mon, 22 Feb 2016 17:10:46 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1M6ATLc37421214 for ; Mon, 22 Feb 2016 17:10:46 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1M6A5Rl010162 for ; Mon, 22 Feb 2016 17:10:05 +1100 From: Alexey Kardashevskiy Date: Mon, 22 Feb 2016 17:09:39 +1100 Message-Id: <1456121379-13434-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH qemu] memory: Fix IOMMU replay base address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , David Gibson Since a788f227 "memory: Allow replay of IOMMU mapping notifications" when new VFIO listener is added, all existing IOMMU mappings are replayed. However there is a problem that the base address of an IOMMU memory region (IOMMU MR) is ignored which is not a problem for the existing user (which is pseries) with its default 32bit DMA window starting at 0 but it is if there is another DMA window. This adjusts the replaying address by mr->addr. Signed-off-by: Alexey Kardashevskiy --- memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory.c b/memory.c index 09041ed..377269b 100644 --- a/memory.c +++ b/memory.c @@ -1436,7 +1436,7 @@ void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, IOMMUTLBEntry iotlb; for (addr = 0; addr < memory_region_size(mr); addr += granularity) { - iotlb = mr->iommu_ops->translate(mr, addr, is_write); + iotlb = mr->iommu_ops->translate(mr, mr->addr + addr, is_write); if (iotlb.perm != IOMMU_NONE) { n->notify(n, &iotlb); } -- 2.5.0.rc3