mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
iommu: Add IOMMU index argument to notifier APIs
Add support for multiple IOMMU indexes to the IOMMU notifier APIs. When initializing a notifier with iommu_notifier_init(), the caller must pass the IOMMU index that it is interested in. When a change happens, the IOMMU implementation must pass memory_region_notify_iommu() the IOMMU index that has changed and that notifiers must be called for. IOMMUs which support only a single index don't need to change. Callers which only really support working with IOMMUs with a single index can use the result of passing MEMTXATTRS_UNSPECIFIED to memory_region_iommu_attrs_to_index(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20180604152941.20374-3-peter.maydell@linaro.org
This commit is contained in:
parent
21f402093c
commit
cb1efcf462
7 changed files with 30 additions and 10 deletions
8
memory.c
8
memory.c
|
@ -1799,6 +1799,9 @@ void memory_region_register_iommu_notifier(MemoryRegion *mr,
|
|||
iommu_mr = IOMMU_MEMORY_REGION(mr);
|
||||
assert(n->notifier_flags != IOMMU_NOTIFIER_NONE);
|
||||
assert(n->start <= n->end);
|
||||
assert(n->iommu_idx >= 0 &&
|
||||
n->iommu_idx < memory_region_iommu_num_indexes(iommu_mr));
|
||||
|
||||
QLIST_INSERT_HEAD(&iommu_mr->iommu_notify, n, node);
|
||||
memory_region_update_iommu_notify_flags(iommu_mr);
|
||||
}
|
||||
|
@ -1891,6 +1894,7 @@ void memory_region_notify_one(IOMMUNotifier *notifier,
|
|||
}
|
||||
|
||||
void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
|
||||
int iommu_idx,
|
||||
IOMMUTLBEntry entry)
|
||||
{
|
||||
IOMMUNotifier *iommu_notifier;
|
||||
|
@ -1898,7 +1902,9 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
|
|||
assert(memory_region_is_iommu(MEMORY_REGION(iommu_mr)));
|
||||
|
||||
IOMMU_NOTIFIER_FOREACH(iommu_notifier, iommu_mr) {
|
||||
memory_region_notify_one(iommu_notifier, &entry);
|
||||
if (iommu_notifier->iommu_idx == iommu_idx) {
|
||||
memory_region_notify_one(iommu_notifier, &entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue