accel/ivpu: Add GEM buffer object management
authorJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Tue, 17 Jan 2023 09:27:19 +0000 (10:27 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 19 Jan 2023 10:11:34 +0000 (11:11 +0100)
commit647371a6609ddf8700fe151af72e32daebb9baa7
tree808525b4fbf4def5b5b5c785d596fc4a74c0976b
parent263b2ba5fc93c875129e0d2b4034d7d8a34b3d39
accel/ivpu: Add GEM buffer object management

Adds four types of GEM-based BOs for the VPU:
  - shmem
  - internal
  - prime

All types are implemented as struct ivpu_bo, based on
struct drm_gem_object. VPU address is allocated when buffer is created
except for imported prime buffers that allocate it in BO_INFO IOCTL due
to missing file_priv arg in gem_prime_import callback.
Internal buffers are pinned on creation, the rest of buffers types
can be pinned on demand (in SUBMIT IOCTL).
Buffer VPU address, allocated pages and mappings are released when the
buffer is destroyed.
Eviction mechanism is planned for future versions.

Add two new IOCTLs: BO_CREATE, BO_INFO

Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20230117092723.60441-4-jacek.lawrynowicz@linux.intel.com
drivers/accel/ivpu/Makefile
drivers/accel/ivpu/ivpu_drv.c
drivers/accel/ivpu/ivpu_drv.h
drivers/accel/ivpu/ivpu_gem.c [new file with mode: 0644]
drivers/accel/ivpu/ivpu_gem.h [new file with mode: 0644]
include/uapi/drm/ivpu_accel.h