From: Mark Kettenis Subject: Re: Intel AX210 DMA memory allocation fails To: "Jan Schreiber" Cc: tech@openbsd.org Date: Wed, 15 Jul 2026 16:09:51 +0200 > Content-Type: text/plain; charset=UTF-8 > Date: Wed, 15 Jul 2026 13:20:10 +0000 > > On my RK3588 board with an Intel AX210 wifi card I reliably get: > > iwx0: could not allocate DMA memory for firmware image loader > iwx0: could not init context info > iwx0: failed to load init firmware > iwx0: could not allocate context info DMA memory > iwx0: could not init context info > iwx0: failed to load init firmware > > Retrying to allocate the memory works and the error does not show up any > more. Another way to fix this would be look at the state of the wifi > connection after boot and retry in e.g. /etc/rc.local with some logic. The proper way to solve this is to use BUS_DMA_WAITOK instead of BUS_DMA_NOWAIT. Some careful analysis is needed to make sure that sleeping is ok in all the codepaths that call iwx_dma_contig_alloc(). > diff --git sys/dev/pci/if_iwx.c sys/dev/pci/if_iwx.c > index 2bf28bd4480..7c2ac7e9af6 100644 > --- sys/dev/pci/if_iwx.c > +++ sys/dev/pci/if_iwx.c > @@ -143,6 +143,9 @@ int iwx_debug = 1; > #define DPRINTFN(n, x) do { ; } while (0) > #endif > > +#define IWX_DMA_RETRY_MAX 100 > +#define IWX_DMA_RETRY_DELAY 10000 /* usec (10ms) */ > + > #include > #include > > @@ -1869,9 +1872,10 @@ int > iwx_dma_contig_alloc(bus_dma_tag_t tag, struct iwx_dma_info *dma, > bus_size_t size, bus_size_t alignment) > { > - int nsegs, err; > + int nsegs, err, retry = 0; > caddr_t va; > > +again: > dma->tag = tag; > dma->size = size; > > @@ -1907,6 +1911,10 @@ iwx_dma_contig_alloc(bus_dma_tag_t tag, struct iwx_dma_info *dma, > return 0; > > fail: iwx_dma_contig_free(dma); > + if (err == ENOMEM && retry++ < IWX_DMA_RETRY_MAX) { > + DELAY(IWX_DMA_RETRY_DELAY); > + goto again; > + } > return err; > } > > >