• Boris Brezillon's avatar
    drm/panthor: Add the heap logical block · 9cca48fa
    Boris Brezillon authored
    Tiler heap growing requires some kernel driver involvement: when the
    tiler runs out of heap memory, it will raise an exception which is
    either directly handled by the firmware if some free heap chunks are
    available in the heap context, or passed back to the kernel otherwise.
    The heap helpers will be used by the scheduler logic to allocate more
    heap chunks to a heap context, when such a situation happens.
    
    Heap context creation is explicitly requested by userspace (using
    the TILER_HEAP_CREATE ioctl), and the returned context is attached to a
    queue through some command stream instruction.
    
    All the kernel does is keep the list of heap chunks allocated to a
    context, so they can be freed when TILER_HEAP_DESTROY is called, or
    extended when the FW requests a new chunk.
    
    v6:
    - Add Maxime's and Heiko's acks
    
    v5:
    - Fix FIXME comment
    - Add Steve's R-b
    
    v4:
    - Rework locking to allow concurrent calls to panthor_heap_grow()
    - Add a helper to return a heap chunk if we couldn't pass it to the
      FW because the group was scheduled out
    
    v3:
    - Add a FIXME for the heap OOM deadlock
    - Use the panthor_kernel_bo abstraction for the heap context and heap
      chunks
    - Drop the panthor_heap_gpu_ctx struct as it is opaque to the driver
    - Ensure that the heap context is aligned to the GPU cache line size
    - Minor code tidy ups
    Co-developed-by: default avatarSteven Price <steven.price@arm.com>
    Signed-off-by: default avatarSteven Price <steven.price@arm.com>
    Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
    Reviewed-by: default avatarSteven Price <steven.price@arm.com>
    Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
    Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240229162230.2634044-10-boris.brezillon@collabora.com
    9cca48fa
panthor_heap.c 15.2 KB