All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/7] accel/qaic: Deprecate ->size field from attach slice IOCTL structure
Date: Mon, 11 Dec 2023 12:23:05 +0100	[thread overview]
Message-ID: <760bbfc4-fd70-4e81-adac-aceef425649c@linux.intel.com> (raw)
In-Reply-To: <20231208163457.1295993-2-quic_jhugo@quicinc.com>

Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>

On 08.12.2023 17:34, Jeffrey Hugo wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> 
> ->size in struct qaic_attach_slice_hdr is redundant since we have BO handle
> and its size can be retrieved from base BO structure.
> 
> 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>
> ---
>  drivers/accel/qaic/qaic_data.c | 17 ++++-------------
>  include/uapi/drm/qaic_accel.h  | 13 +------------
>  2 files changed, 5 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index cf2898eda7ae..0c6f1328df68 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -830,9 +830,6 @@ static int qaic_prepare_import_bo(struct qaic_bo *bo, struct qaic_attach_slice_h
>  	struct sg_table *sgt;
>  	int ret;
>  
> -	if (obj->import_attach->dmabuf->size < hdr->size)
> -		return -EINVAL;
> -
>  	sgt = dma_buf_map_attachment(obj->import_attach, hdr->dir);
>  	if (IS_ERR(sgt)) {
>  		ret = PTR_ERR(sgt);
> @@ -849,9 +846,6 @@ static int qaic_prepare_export_bo(struct qaic_device *qdev, struct qaic_bo *bo,
>  {
>  	int ret;
>  
> -	if (bo->base.size < hdr->size)
> -		return -EINVAL;
> -
>  	ret = dma_map_sgtable(&qdev->pdev->dev, bo->sgt, hdr->dir, 0);
>  	if (ret)
>  		return -EFAULT;
> @@ -952,9 +946,6 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
>  	if (arg_size / args->hdr.count != sizeof(*slice_ent))
>  		return -EINVAL;
>  
> -	if (args->hdr.size == 0)
> -		return -EINVAL;
> -
>  	if (!(args->hdr.dir == DMA_TO_DEVICE || args->hdr.dir == DMA_FROM_DEVICE))
>  		return -EINVAL;
>  
> @@ -994,16 +985,16 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
>  		goto free_slice_ent;
>  	}
>  
> -	ret = qaic_validate_req(qdev, slice_ent, args->hdr.count, args->hdr.size);
> -	if (ret)
> -		goto free_slice_ent;
> -
>  	obj = drm_gem_object_lookup(file_priv, args->hdr.handle);
>  	if (!obj) {
>  		ret = -ENOENT;
>  		goto free_slice_ent;
>  	}
>  
> +	ret = qaic_validate_req(qdev, slice_ent, args->hdr.count, obj->size);
> +	if (ret)
> +		goto put_bo;
> +
>  	bo = to_qaic_bo(obj);
>  	ret = mutex_lock_interruptible(&bo->lock);
>  	if (ret)
> diff --git a/include/uapi/drm/qaic_accel.h b/include/uapi/drm/qaic_accel.h
> index 9dab32316aee..d3ca876a08e9 100644
> --- a/include/uapi/drm/qaic_accel.h
> +++ b/include/uapi/drm/qaic_accel.h
> @@ -242,18 +242,7 @@ struct qaic_attach_slice_entry {
>   * @dbc_id: In. Associate the sliced BO with this DBC.
>   * @handle: In. GEM handle of the BO to slice.
>   * @dir: In. Direction of data flow. 1 = DMA_TO_DEVICE, 2 = DMA_FROM_DEVICE
> - * @size: In. Total length of BO being used. This should not exceed base
> - *	  size of BO (struct drm_gem_object.base)
> - *	  For BOs being allocated using DRM_IOCTL_QAIC_CREATE_BO, size of
> - *	  BO requested is PAGE_SIZE aligned then allocated hence allocated
> - *	  BO size maybe bigger. This size should not exceed the new
> - *	  PAGE_SIZE aligned BO size.
> - * @dev_addr: In. Device address this slice pushes to or pulls from.
> - * @db_addr: In. Address of the doorbell to ring.
> - * @db_data: In. Data to write to the doorbell.
> - * @db_len: In. Size of the doorbell data in bits - 32, 16, or 8.  0 is for
> - *	    inactive doorbells.
> - * @offset: In. Start of this slice as an offset from the start of the BO.
> + * @size: Deprecated. This value is ignored and size of @handle is used instead.
>   */
>  struct qaic_attach_slice_hdr {
>  	__u32 count;

  reply	other threads:[~2023-12-11 11:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 16:34 [PATCH 0/7] qaic cleanups for 6.8 Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-08 16:34 ` [PATCH 1/7] accel/qaic: Deprecate ->size field from attach slice IOCTL structure Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-11 11:23   ` Jacek Lawrynowicz [this message]
2023-12-08 16:34 ` [PATCH 2/7] accel/qaic: Remove bo->queued field Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-11 11:24   ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 3/7] accel/qaic: Fix MHI channel struct field order Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-11 11:23   ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 4/7] accel/qaic: Drop the reference to BO in error path of create BO IOCTL Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-11 11:25   ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 5/7] accel/qaic: Call drm_gem_create_mmap_offset() once for each BO Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-11 11:26   ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 6/7] accel/qaic: Leverage DRM managed APIs to release resources Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-15 18:06   ` Jeffrey Hugo
2023-12-15 18:06     ` Jeffrey Hugo
2023-12-20  7:02     ` Jacek Lawrynowicz
2023-12-20 18:11       ` Jeffrey Hugo
2023-12-08 16:34 ` [PATCH 7/7] accel/qaic: Order pci_remove() operations in reverse of probe() Jeffrey Hugo
2023-12-08 16:34   ` Jeffrey Hugo
2023-12-11 11:27   ` Jacek Lawrynowicz
2023-12-15 18:05 ` [PATCH 0/7] qaic cleanups for 6.8 Jeffrey Hugo
2023-12-15 18:05   ` Jeffrey Hugo
2023-12-20 18:20   ` Jeffrey Hugo
2023-12-20 18:20     ` Jeffrey Hugo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=760bbfc4-fd70-4e81-adac-aceef425649c@linux.intel.com \
    --to=jacek.lawrynowicz@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.