Re: [PATCH v3 10/10] drm/msm: Add a way for userspace to allocate GPU iova

From: Dmitry Osipenko
Date: Thu Apr 07 2022 - 05:58:32 EST


On 4/7/22 00:46, Rob Clark wrote:
> From: Rob Clark <robdclark@xxxxxxxxxxxx>
>
> The motivation at this point is mainly native userspace mesa driver in a
> VM guest. The one remaining synchronous "hotpath" is buffer allocation,
> because guest needs to wait to know the bo's iova before it can start
> emitting cmdstream/state that references the new bo. By allocating the
> iova in the guest userspace, we no longer need to wait for a response
> from the host, but can just rely on the allocation request being
> processed before the cmdstream submission. Allocation failures (OoM,
> etc) would just be treated as context-lost (ie. GL_GUILTY_CONTEXT_RESET)
> or subsequent allocations (or readpix, etc) can raise GL_OUT_OF_MEMORY.
>
> v2: Fix inuse check
> v3: Change mismatched iova case to -EBUSY
>
> Signed-off-by: Rob Clark <robdclark@xxxxxxxxxxxx>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
> ---
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 10 ++++++
> drivers/gpu/drm/msm/msm_drv.c | 21 +++++++++++
> drivers/gpu/drm/msm/msm_gem.c | 48 +++++++++++++++++++++++++
> drivers/gpu/drm/msm/msm_gem.h | 8 +++++
> drivers/gpu/drm/msm/msm_gem_vma.c | 2 ++
> include/uapi/drm/msm_drm.h | 3 ++
> 6 files changed, 92 insertions(+)

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx>