mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
memory: Add MemoryRegionIOMMUOps.notify_started/stopped callbacks
The IOMMU driver may change behavior depending on whether a notifier client is present. In the case of POWER, this represents a change in the visibility of the IOTLB, for other drivers such as intel-iommu and future AMD-Vi emulation, notifier support is not yet enabled and this provides the opportunity to flag that incompatibility. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Peter Xu <peterx@redhat.com> Tested-by: Peter Xu <peterx@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> [new log & extracted from [PATCH qemu v17 12/12] spapr_iommu, vfio, memory: Notify IOMMU about starting/stopping listening] Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
e37dac06dc
commit
d22d8956b1
3 changed files with 19 additions and 4 deletions
10
memory.c
10
memory.c
|
@ -1499,6 +1499,10 @@ bool memory_region_is_logging(MemoryRegion *mr, uint8_t client)
|
|||
|
||||
void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n)
|
||||
{
|
||||
if (mr->iommu_ops->notify_started &&
|
||||
QLIST_EMPTY(&mr->iommu_notify.notifiers)) {
|
||||
mr->iommu_ops->notify_started(mr);
|
||||
}
|
||||
notifier_list_add(&mr->iommu_notify, n);
|
||||
}
|
||||
|
||||
|
@ -1532,9 +1536,13 @@ void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_write)
|
|||
}
|
||||
}
|
||||
|
||||
void memory_region_unregister_iommu_notifier(Notifier *n)
|
||||
void memory_region_unregister_iommu_notifier(MemoryRegion *mr, Notifier *n)
|
||||
{
|
||||
notifier_remove(n);
|
||||
if (mr->iommu_ops->notify_stopped &&
|
||||
QLIST_EMPTY(&mr->iommu_notify.notifiers)) {
|
||||
mr->iommu_ops->notify_stopped(mr);
|
||||
}
|
||||
}
|
||||
|
||||
void memory_region_notify_iommu(MemoryRegion *mr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue