Commit e328894d authored by Sukadev Bhattiprolu's avatar Sukadev Bhattiprolu Committed by Treehugger Robot
Browse files

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: default avatarSukadev Bhattiprolu <quic_sukadev@quicinc.com>
parent a850e0e0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment