[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 4/5] IOMMU: add specific replay function with def
From: |
Aviv B.D |
Subject: |
[Qemu-devel] [PATCH v7 4/5] IOMMU: add specific replay function with default implemenation |
Date: |
Mon, 28 Nov 2016 17:51:54 +0200 |
From: "Aviv Ben-David" <address@hidden>
The default implementation scans the address space and try to find
translation for each page, if exists.
This callback enables effiecent implementation for intel_iommu and other
subsystems with large address space.
Signed-off-by: Aviv Ben-David <address@hidden>
---
include/exec/memory.h | 4 ++++
memory.c | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2d7ee54..a8b3701 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -180,6 +180,10 @@ struct MemoryRegionIOMMUOps {
void (*notify_flag_changed)(MemoryRegion *iommu,
IOMMUNotifierFlag old_flags,
IOMMUNotifierFlag new_flags);
+ /* Called when region has been moved between iommu domains */
+ void (*replay)(MemoryRegion *mr,
+ IOMMUNotifier *n,
+ bool is_write);
};
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
diff --git a/memory.c b/memory.c
index 9b88638..562d540 100644
--- a/memory.c
+++ b/memory.c
@@ -1624,6 +1624,14 @@ void memory_region_iommu_replay(MemoryRegion *mr,
IOMMUNotifier *n,
hwaddr addr, granularity;
IOMMUTLBEntry iotlb;
+ /* If there is specific implementation, use it */
+ assert(memory_region_is_iommu(mr));
+ if (mr->iommu_ops && mr->iommu_ops->replay) {
+ return mr->iommu_ops->replay(mr, n, is_write);
+ }
+
+ /* No specific implementation for this iommu, fall back to default
+ * implementation */
granularity = memory_region_iommu_get_min_page_size(mr);
for (addr = 0; addr < memory_region_size(mr); addr += granularity) {
--
1.9.1
- [Qemu-devel] [PATCH v7 0/5] IOMMU: intel_iommu support map and unmap notifications, Aviv B.D, 2016/11/28
- [Qemu-devel] [PATCH v7 1/5] IOMMU: add option to enable VTD_CAP_CM to vIOMMU capility exposoed to guest, Aviv B.D, 2016/11/28
- [Qemu-devel] [PATCH v7 2/5] IOMMU: change iommu_op->translate's is_write to flags, add support to NO_FAIL flag mode, Aviv B.D, 2016/11/28
- [Qemu-devel] [PATCH v7 3/5] IOMMU: enable intel_iommu map and unmap notifiers, Aviv B.D, 2016/11/28
- [Qemu-devel] [PATCH v7 5/5] IOMMU: add specific null implementation of iommu_replay to intel_iommu, Aviv B.D, 2016/11/28
- [Qemu-devel] [PATCH v7 4/5] IOMMU: add specific replay function with default implemenation,
Aviv B.D <=
- Re: [Qemu-devel] [PATCH v7 0/5] IOMMU: intel_iommu support map and unmap notifications, Peter Xu, 2016/11/30
- Re: [Qemu-devel] [PATCH v7 0/5] IOMMU: intel_iommu support map and unmap notifications, Tian, Kevin, 2016/11/30