Re: [PATCH] docs: dma-api: require checking DMA mask setup errors
From: Christoph Hellwig
Date: Mon Sep 07 2026 - 01:53:51 EST
On Mon, Sep 07, 2026 at 01:44:00PM +0800, Ruizhe Zhou wrote:
> The DMA HOWTO says dma_set_mask_and_coherent() cannot fail for
> DMA_BIT_MASK(64), and more generally for masks wider than 32 bits. It
> consequently recommends calls to discard the check for return value.
>
> The generic direct-DMA path does accept every mask of at least 32 bits,
> but that is not an API-wide success guarantee. Backend callbacks can
> reject wider masks: ibmebus_dma_supported() and
> xen_grant_dma_supported() accept only DMA_BIT_MASK(64), so a 40-bit mask
> fails.
Please fix them as they break the very sensible API guarantees
instead of officially sanctioning this behavior.
>
> Even DMA_BIT_MASK(64) can fail when DMA setup is unavailable or
> inconsistent. For example, dma_dummy_supported() rejects every mask.
So? Did you actually try to understand this code or is this just dumb
agent work?