accel/qaic: Remove ->size field from struct qaic_bo
authorPranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Fri, 1 Sep 2023 17:22:41 +0000 (11:22 -0600)
committerJeffrey Hugo <quic_jhugo@quicinc.com>
Fri, 22 Sep 2023 15:55:12 +0000 (09:55 -0600)
commitcb850f6f69d1ee03ca4a5746df2870cf49e90871
tree549e9bf3751f02b156b44f17a114875816c72cf6
parenta08e0622c42f6d445604d8bc042e0f78dee09594
accel/qaic: Remove ->size field from struct qaic_bo

->size field in struct qaic_bo stores user requested buffer size for
allocate path or size of the dmabuf(PRIME). Now for allocate path driver
allocates a BO of size which is PAGE_SIZE aligned, this size is already
stored in base BO structure (struct drm_gem_object).

So difference is ->size of struct qaic_bo stores the raw value coming from
user and ->size in struct drm_gem_object stores the PAGE_SZIE aligned size.

Do not use ->size from struct qaic_bo for any validation or operation
instead use ->size from struct drm_gem_object since we already have
allocated that much memory then why not use it. Only validate if user
is trying to use more then the BO size. This make the driver more flexible.

After this change ->size field of struct qaic_bo becomes redundant. Remove
it.

Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901172247.11410-2-quic_jhugo@quicinc.com
drivers/accel/qaic/qaic.h
drivers/accel/qaic/qaic_data.c
include/uapi/drm/qaic_accel.h