• Rob Herring's avatar
    drm/panfrost: Implement per FD address spaces · 7282f764
    Rob Herring authored
    Up until now, a single shared GPU address space was used. This is not
    ideal as there's no protection between processes and doesn't work for
    supporting the same GPU/CPU VA feature. Most importantly, this will
    hopefully mitigate Alyssa's fear of WebGL, whatever that is.
    
    Most of the changes here are moving struct drm_mm and struct
    panfrost_mmu objects from the per device struct to the per FD struct.
    The critical function is panfrost_mmu_as_get() which handles allocating
    and switching the h/w address spaces.
    
    There's 3 states an AS can be in: free, allocated, and in use. When a
    job runs, it requests an address space and then marks it not in use when
    job is complete(but stays assigned). The first time thru, we find a free
    AS in the alloc_mask and assign the AS to the FD. Then the next time
    thru, we most likely already have our AS and we just mark it in use with
    a ref count. We need a ref count because we have multiple job slots. If
    the job/FD doesn't have an AS assigned and there are no free ones, then
    we pick an allocated one not in use from our LRU list and switch the AS
    from the old FD to the new one.
    
    Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Robin Murphy <robin.murphy@arm.com>
    Cc: Steven Price <steven.price@arm.com>
    Signed-off-by: default avatarRob Herring <robh@kernel.org>
    Acked-by: default avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
    Reviewed-by: default avatarSteven Price <steven.price@arm.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190813150115.30338-1-robh@kernel.org
    7282f764
panfrost_drv.c 15.7 KB