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

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

 



On 21.08.2024 15:10:58, Martin Jocić wrote:
> > 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.:

[...]

> As far as I can tell, the dynamic DMA mapping guide of the Kernel docs seems to
> advise against this:
> 
> From https://www.kernel.org/doc/html/next/core-api/dma-api-howto.html
> 
> <begin quote>
> The standard 64-bit addressing device would do something like this:
> 
> dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))
> 
> dma_set_mask_and_coherent() never return fail when DMA_BIT_MASK(64).
> Typical error code like:
> 
> /* Wrong code */
> if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)))
>         dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))
> 
> dma_set_mask_and_coherent() will never return failure when bigger than 32.
> So typical code like:
> 
> /* Recommended code */
> if (support_64bit)
>         dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> else
>         dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
> <end quote>

Thanks for looking it up and pointing out.

> In Kvaser's case all CAN PCIe devices support 64-bit addressing.
> 
> Should I still change the patch as per your suggestion?

Use the original patch but please convert the ifdef into IS_ENABLED:

        if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)

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