intel_iommu: Fix unexpected unmaps during global unmap
This is an replacement work of Yan Zhao's patch:
https://www.mail-archive.com/
[email protected]/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 <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Tested-by: Yan Zhao <[email protected]>
Message-Id: <
20190624091811[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>