mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33: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
|
@ -98,18 +98,21 @@ struct IOMMUNotifier {
|
|||
/* Notify for address space range start <= addr <= end */
|
||||
hwaddr start;
|
||||
hwaddr end;
|
||||
int iommu_idx;
|
||||
QLIST_ENTRY(IOMMUNotifier) node;
|
||||
};
|
||||
typedef struct IOMMUNotifier IOMMUNotifier;
|
||||
|
||||
static inline void iommu_notifier_init(IOMMUNotifier *n, IOMMUNotify fn,
|
||||
IOMMUNotifierFlag flags,
|
||||
hwaddr start, hwaddr end)
|
||||
hwaddr start, hwaddr end,
|
||||
int iommu_idx)
|
||||
{
|
||||
n->notify = fn;
|
||||
n->notifier_flags = flags;
|
||||
n->start = start;
|
||||
n->end = end;
|
||||
n->iommu_idx = iommu_idx;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1008,11 +1011,13 @@ uint64_t memory_region_iommu_get_min_page_size(IOMMUMemoryRegion *iommu_mr);
|
|||
* should be notified with an UNMAP followed by a MAP.
|
||||
*
|
||||
* @iommu_mr: the memory region that was changed
|
||||
* @iommu_idx: the IOMMU index for the translation table which has changed
|
||||
* @entry: the new entry in the IOMMU translation table. The entry
|
||||
* replaces all old entries for the same virtual I/O address range.
|
||||
* Deleted entries have .@perm == 0.
|
||||
*/
|
||||
void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
|
||||
int iommu_idx,
|
||||
IOMMUTLBEntry entry);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue