mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
memory: Add IOMMUTLBEvent
This way we can tell between regular IOMMUTLBEntry (entry of IOMMU hardware) and notifications. In the notifications, we set explicitly if it is a MAPs or an UNMAP, instead of trusting in entry permissions to differentiate them. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20201116165506.31315-3-eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
3b5ebf8532
commit
5039caf3c4
9 changed files with 143 additions and 122 deletions
|
@ -116,6 +116,11 @@ struct IOMMUNotifier {
|
|||
};
|
||||
typedef struct IOMMUNotifier IOMMUNotifier;
|
||||
|
||||
typedef struct IOMMUTLBEvent {
|
||||
IOMMUNotifierFlag type;
|
||||
IOMMUTLBEntry entry;
|
||||
} IOMMUTLBEvent;
|
||||
|
||||
/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
|
||||
#define RAM_PREALLOC (1 << 0)
|
||||
|
||||
|
@ -1326,24 +1331,18 @@ uint64_t memory_region_iommu_get_min_page_size(IOMMUMemoryRegion *iommu_mr);
|
|||
/**
|
||||
* memory_region_notify_iommu: notify a change in an IOMMU translation entry.
|
||||
*
|
||||
* The notification type will be decided by entry.perm bits:
|
||||
*
|
||||
* - For UNMAP (cache invalidation) notifies: set entry.perm to IOMMU_NONE.
|
||||
* - For MAP (newly added entry) notifies: set entry.perm to the
|
||||
* permission of the page (which is definitely !IOMMU_NONE).
|
||||
*
|
||||
* Note: for any IOMMU implementation, an in-place mapping change
|
||||
* 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.
|
||||
* @event: TLB event with the new entry in the IOMMU translation table.
|
||||
* The entry replaces all old entries for the same virtual I/O address
|
||||
* range.
|
||||
*/
|
||||
void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
|
||||
int iommu_idx,
|
||||
IOMMUTLBEntry entry);
|
||||
IOMMUTLBEvent event);
|
||||
|
||||
/**
|
||||
* memory_region_notify_iommu_one: notify a change in an IOMMU translation
|
||||
|
@ -1353,12 +1352,12 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
|
|||
* notifies a specific notifier, not all of them.
|
||||
*
|
||||
* @notifier: the notifier to be notified
|
||||
* @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.
|
||||
* @event: TLB event with the new entry in the IOMMU translation table.
|
||||
* The entry replaces all old entries for the same virtual I/O address
|
||||
* range.
|
||||
*/
|
||||
void memory_region_notify_iommu_one(IOMMUNotifier *notifier,
|
||||
IOMMUTLBEntry *entry);
|
||||
IOMMUTLBEvent *event);
|
||||
|
||||
/**
|
||||
* memory_region_register_iommu_notifier: register a notifier for changes to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue