]> git.baikalelectronics.ru Git - kernel.git/commit
drm/panfrost: Calculate lock region size correctly
authorSteven Price <steven.price@arm.com>
Fri, 3 Sep 2021 09:49:57 +0000 (10:49 +0100)
committerSteven Price <steven.price@arm.com>
Fri, 17 Sep 2021 10:47:26 +0000 (11:47 +0100)
commit23585f091e62863cbf04b55f6d57c292596d6e17
treeb4c75809c4c3432f22c274d7eb2671c69c4e8b54
parent6b2668dd6a8d721d5e7430057bb45805553afe37
drm/panfrost: Calculate lock region size correctly

It turns out that when locking a region, the region must be a naturally
aligned power of 2. The upshot of this is that if the desired region
crosses a 'large boundary' the region size must be increased
significantly to ensure that the locked region completely covers the
desired region. Previous calculations (including in kbase for the
proprietary driver) failed to take this into account.

Since it's known that the lock region must be naturally aligned we can
compute the required size by looking at the highest bit position which
changes between the start/end of the lock region (subtracting 1 from the
end because the end address is exclusive). The start address is then
aligned based on the size (this is technically unnecessary as the
hardware will ignore these bits, but the spec advises to do this "to
avoid confusion").

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210903094957.74560-1-steven.price@arm.com
drivers/gpu/drm/panfrost/panfrost_mmu.c