ANDROID: iommu: Add vendor hook to alloc_iova()
Add a vendor hook that allows overriding the default alloc_iova() algorithm. The vendor hook can use the iovad->android_vendor_data1 field, initialized in the previous patch, to determine whether to use the best-fit algorithm to allocate iova for this device. If an IOVA was successfully allocated, the vendor hook returns 0. Otherwise it returns non-zero and we fallback to the default, first-fit algorithm. On some 32-bit devices, using a best-fit algorithm reduces chances of the allocation failure due to fragmentation. We submitted patches (listed in Links below) with two different approaches to the community but they were not accepted in part, because we are not able to reproduce the problem with upstream-only code. Links: [1] Use a DT property: https://lore.kernel.org/lkml/20221213163506.GA2011062-robh@kernel.org/ [2] Add an API function to be called by user drivers: https://lore.kernel.org/lkml/20200217080339.GC10342@infradead.org/ Bug: 263499813 Bug: 190519428 Bug: 149544392 Change-Id: I8e948a08e79089d3fb7356eeb7f85b58784688f2 Signed-off-by:Sukadev Bhattiprolu <quic_sukadev@quicinc.com>
Loading
Please sign in to comment