]> git.baikalelectronics.ru Git - kernel.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)
commita5b4007c68777e2415ba5893e6243c84b57a99e8
treef0336cf209b43b16b53951d35b35b3e3eb4b392a
parent11984309adfa96b3e59efa03d95b7515fbe1b091
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 85ef37bef0ad ("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