]> asedeno.scripts.mit.edu Git - linux.git/commit
iommu: Revisit iommu_insert_resv_region() implementation
authorEric Auger <eric.auger@redhat.com>
Wed, 21 Aug 2019 12:09:40 +0000 (14:09 +0200)
committerJoerg Roedel <jroedel@suse.de>
Fri, 30 Aug 2019 13:49:55 +0000 (15:49 +0200)
commit4dbd258ff63e0597ee8fb44d277c6c701f5019d9
treef0336cf209b43b16b53951d35b35b3e3eb4b392a
parent0d87308cca2c124f9bce02383f1d9632c9be89c4
iommu: Revisit iommu_insert_resv_region() implementation

Current implementation is recursive and in case of allocation
failure the existing @regions list is altered. A non recursive
version looks better for maintainability and simplifies the
error handling. We use a separate stack for overlapping segment
merging. The elements are sorted by start address and then by
type, if their start address match.

Note this new implementation may change the region order of
appearance in /sys/kernel/iommu_groups/<n>/reserved_regions
files but this order has never been documented, see
commit bc7d12b91bd3 ("iommu: Implement reserved_regions
iommu-group sysfs file").

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c