Re: iwx 64-bit dma

Mark Kettenis <[email protected]> Fri, 31 Jul 2026 11:50:26 +0200
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
> Date: Thu, 30 Jul 2026 18:33:49 -0700
> From: Chris Cappuccio <[email protected]>
> 
> Theo de Raadt [[email protected]] wrote:
> > 
> > The diff in question which adds BUS_DMA_64BIT is a declaration to
> > the higher-level code that _all_ chipsets supported by this driver can
> > work with 64 bit-addressable memory if the higher levels provide it.
> > 
> 
> Linux iwlwifi has a 36-bit dma limit for older hardware. For the
> AX200/201 and the AX210/211 it's 64-bit all the way. So iwx is
> doing the right thing.
> 
> However, there is a bug with the AX200/201 dma engine crossing 32-bit
> boundaries:
> 
> https://code.opensuse.org/kernel/kernel-source/blob/5377a688dcc5c526f0a5df6d91df22d8b4f2dce6/f/patches.suse/iwlwifi-pcie-extend-hardware-workaround-to-context-i.patch
> 
> To avoid triggering it, we'd need to do something like this with
> any post-IOMMU addresses:
> 
> iwx_crosses_4g_boundary(struct iwx_softc *sc, bus_addr_t addr, bus_size_t len) {
> 	if (sc->sc_device_family != IWX_DEVICE_FAMILY_22000)
> 		return 0;
> 
> 	return (addr >> 32) != ((addr + len) >> 32);
> }
> ...
> 	for (i = 0; i < map->dm_nsegs; i++) {
> 		if (iwx_crosses_4g_boundary(sc, map->dm_segs[i].ds_addr,
> 		    map->dm_segs[i].ds_len)) {
> 			/* remap */
> 		}
> 	}

The right way to solve that issue is to specify a non-zero boundary
when calling bus_dmamap_create() to create the DMA map.