memory: allow memory_region_register_iommu_notifier() to fail
commit549d4005874f602e957b07459949ae514ea96f20
authorEric Auger <eric.auger@redhat.com>
Tue, 24 Sep 2019 08:25:17 +0000 (24 10:25 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 4 Oct 2019 16:49:18 +0000 (4 18:49 +0200)
treea3d987bddb558edc3787a626a8fb28f867072153
parentd7d8783647841a4c18349fe60d0d99e0de865ce5
memory: allow memory_region_register_iommu_notifier() to fail

Currently, when a notifier is attempted to be registered and its
flags are not supported (especially the MAP one) by the IOMMU MR,
we generally abruptly exit in the IOMMU code. The failure could be
handled more nicely in the caller and especially in the VFIO code.

So let's allow memory_region_register_iommu_notifier() to fail as
well as notify_flag_changed() callback.

All sites implementing the callback are updated. This patch does
not yet remove the exit(1) in the amd_iommu code.

in SMMUv3 we turn the warning message into an error message saying
that the assigned device would not work properly.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c
hw/arm/smmuv3.c
hw/i386/amd_iommu.c
hw/i386/intel_iommu.c
hw/ppc/spapr_iommu.c
hw/vfio/common.c
hw/virtio/vhost.c
include/exec/memory.h
memory.c