[PATCH 1/3] accel/habanalabs: remove unused asic functions

Ofir Bitton obitton at habana.ai
Sun Oct 1 09:08:46 UTC 2023


On 19/09/2023 13:37, Oded Gabbay wrote:
> asic_dma_{un}map_single() asic-specific functions are no longer called
> from the common code, so delete these functions.
> 
> In addition, delete the gaudi2 implementation as they are also not
> called.
> 
> Signed-off-by: Oded Gabbay <ogabbay at kernel.org>
> ---
>   drivers/accel/habanalabs/common/habanalabs.h |  8 --------
>   drivers/accel/habanalabs/gaudi2/gaudi2.c     | 20 --------------------
>   2 files changed, 28 deletions(-)
> 
> diff --git a/drivers/accel/habanalabs/common/habanalabs.h b/drivers/accel/habanalabs/common/habanalabs.h
> index 3c224942a758..4f667ac46301 100644
> --- a/drivers/accel/habanalabs/common/habanalabs.h
> +++ b/drivers/accel/habanalabs/common/habanalabs.h
> @@ -1520,8 +1520,6 @@ struct engines_data {
>    * @asic_dma_pool_free: free small DMA allocation from pool.
>    * @cpu_accessible_dma_pool_alloc: allocate CPU PQ packet from DMA pool.
>    * @cpu_accessible_dma_pool_free: free CPU PQ packet from DMA pool.
> - * @asic_dma_unmap_single: unmap a single DMA buffer
> - * @asic_dma_map_single: map a single buffer to a DMA
>    * @hl_dma_unmap_sgtable: DMA unmap scatter-gather table.
>    * @cs_parser: parse Command Submission.
>    * @asic_dma_map_sgtable: DMA map scatter-gather table.
> @@ -1645,12 +1643,6 @@ struct hl_asic_funcs {
>   				size_t size, dma_addr_t *dma_handle);
>   	void (*cpu_accessible_dma_pool_free)(struct hl_device *hdev,
>   				size_t size, void *vaddr);
> -	void (*asic_dma_unmap_single)(struct hl_device *hdev,
> -				dma_addr_t dma_addr, int len,
> -				enum dma_data_direction dir);
> -	dma_addr_t (*asic_dma_map_single)(struct hl_device *hdev,
> -				void *addr, int len,
> -				enum dma_data_direction dir);
>   	void (*hl_dma_unmap_sgtable)(struct hl_device *hdev,
>   				struct sg_table *sgt,
>   				enum dma_data_direction dir);
> diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2.c b/drivers/accel/habanalabs/gaudi2/gaudi2.c
> index 35db02e5010b..be4a745f8548 100644
> --- a/drivers/accel/habanalabs/gaudi2/gaudi2.c
> +++ b/drivers/accel/habanalabs/gaudi2/gaudi2.c
> @@ -6731,24 +6731,6 @@ static void gaudi2_cpu_accessible_dma_pool_free(struct hl_device *hdev, size_t s
>   	hl_fw_cpu_accessible_dma_pool_free(hdev, size, vaddr);
>   }
>   
> -static dma_addr_t gaudi2_dma_map_single(struct hl_device *hdev, void *addr, int len,
> -					enum dma_data_direction dir)
> -{
> -	dma_addr_t dma_addr;
> -
> -	dma_addr = dma_map_single(&hdev->pdev->dev, addr, len, dir);
> -	if (unlikely(dma_mapping_error(&hdev->pdev->dev, dma_addr)))
> -		return 0;
> -
> -	return dma_addr;
> -}
> -
> -static void gaudi2_dma_unmap_single(struct hl_device *hdev, dma_addr_t addr, int len,
> -					enum dma_data_direction dir)
> -{
> -	dma_unmap_single(&hdev->pdev->dev, addr, len, dir);
> -}
> -
>   static int gaudi2_validate_cb_address(struct hl_device *hdev, struct hl_cs_parser *parser)
>   {
>   	struct asic_fixed_properties *asic_prop = &hdev->asic_prop;
> @@ -11515,8 +11497,6 @@ static const struct hl_asic_funcs gaudi2_funcs = {
>   	.asic_dma_pool_free = gaudi2_dma_pool_free,
>   	.cpu_accessible_dma_pool_alloc = gaudi2_cpu_accessible_dma_pool_alloc,
>   	.cpu_accessible_dma_pool_free = gaudi2_cpu_accessible_dma_pool_free,
> -	.asic_dma_unmap_single = gaudi2_dma_unmap_single,
> -	.asic_dma_map_single = gaudi2_dma_map_single,
>   	.hl_dma_unmap_sgtable = hl_dma_unmap_sgtable,
>   	.cs_parser = gaudi2_cs_parser,
>   	.asic_dma_map_sgtable = hl_dma_map_sgtable,

Reviewed-by: Ofir Bitton <obitton at habana.ai>


More information about the dri-devel mailing list