]> git.proxmox.com Git - mirror_qemu.git/commit
intel_iommu: Fix unexpected unmaps during global unmap
authorPeter Xu <peterx@redhat.com>
Mon, 24 Jun 2019 09:18:11 +0000 (17:18 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 5 Jul 2019 20:16:46 +0000 (22:16 +0200)
commit9a4bb8391fda2312803d44664575a662b9be7189
tree335eee30aea3174e5f3963bf04f625770cde2a24
parentd6d10793dcfa33504745be40b49bd747ff8752ef
intel_iommu: Fix unexpected unmaps during global unmap

This is an replacement work of Yan Zhao's patch:

https://www.mail-archive.com/qemu-devel@nongnu.org/msg625340.html

vtd_address_space_unmap() will do proper page mask alignment to make
sure each IOTLB message will have correct masks for notification
messages (2^N-1), but sometimes it can be expanded to even supercede
the registered range.  That could lead to unexpected UNMAP of already
mapped regions in some other notifiers.

Instead of doing mindless expension of the start address and address
mask, we split the range into smaller ones and guarantee that each
small range will have correct masks (2^N-1) and at the same time we
should also try our best to generate as less IOTLB messages as
possible.

Reported-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Yan Zhao <yan.y.zhao@intel.com>
Message-Id: <20190624091811.30412-3-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/i386/intel_iommu.c