Re: [PATCH] can: kvaser_pciefd: Enable 64-bit DMA addressing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19.08.2024 16:22:55, Martin Jocic wrote:
> Enabling 64-bit addressing for DMA buffers will prevent issues
> on some memory constrained platforms like e.g. Raspberry Pi 5,
> where the driver won't load because it cannot allocate enough
> continuous memory in the default 32-bit memory address range.
> 
> Signed-off-by: Martin Jocic <martin.jocic@xxxxxxxxxx>
> ---
>  drivers/net/can/kvaser_pciefd.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
> index a60d9efd5f8d..5885f1ce189d 100644
> --- a/drivers/net/can/kvaser_pciefd.c
> +++ b/drivers/net/can/kvaser_pciefd.c
> @@ -1104,6 +1104,11 @@ static int kvaser_pciefd_setup_dma(struct kvaser_pciefd *pcie)
> 
>  	/* Disable the DMA */
>  	iowrite32(0, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CTRL_REG);
> +
> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> +	dma_set_mask_and_coherent(&pcie->pci->dev, DMA_BIT_MASK(64));
> +#endif
> +

Several other driver first set a 64 bit mask and if this fails they set
a 32 bit mask and then bail out, e.g.:

https://elixir.bootlin.com/linux/v6.10.6/source/drivers/net/ethernet/intel/i40e/i40e_main.c#L15613


>  	for (i = 0; i < KVASER_PCIEFD_DMA_COUNT; i++) {
>  		pcie->dma_data[i] = dmam_alloc_coherent(&pcie->pci->dev,
>  							KVASER_PCIEFD_DMA_SIZE,
> --
> 2.43.0
> 
> 
> 

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux