On Tue, Jan 9, 2024 at 9:41 AM Kalle Valo <kvalo@xxxxxxxxxx> wrote: > > Zhenghao Gu <imguzh@xxxxxxxxx> writes: > > > virt_to_phys doesn't work on systems with IOMMU enabled, > > which have non-identity physical-to-IOVA mappings. > > Can you give an example of such system? Just curious where you are > seeing this. I'm testing on an AMD system with IOMMU enabled in the BIOS and "iommu=nopt" in the kernel command line. I also noticed https://bugzilla.kernel.org/show_bug.cgi?id=217056 which may be the same issue. > > > It leads to IO_PAGE_FAULTs like this: > > [IO_PAGE_FAULT domain=0x0023 address=0x1cce00000 flags=0x0020] > > and no link can be established. > > What do you mean with link in this context? Are you talking about 802.11 > association? Yes. > > > This patch changes that to dma_map_single(), which works correctly. > > Good catch. And virt_to_phys() documentation even says this: > > * This function does not give bus mappings for DMA transfers. In > * almost all conceivable cases a device driver should not be using > * this function > > > Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 > > Signed-off-by: Zhenghao Gu <imguzh@xxxxxxxxx> > > Jeff, are you ok with this? > > I did some cosmetics changes in the pending branch (removed unnecessary > parenthesis, reverse xmas tree etc), please check: > > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=fefa43d63e1928fce6e8c2bb626900e9ce98ca69