On 6/10/19 3:18 AM, Christoph Hellwig wrote: > On Sat, Jun 08, 2019 at 04:52:24PM -0500, Larry Finger wrote: >> On 6/7/19 12:29 PM, Christoph Hellwig wrote: >>> I don't think we should work around this in the driver, we need to fix >>> it in the core. I'm curious why my previous patch didn't work. Can >>> you throw in a few printks what failed? I.e. did dma_direct_supported >>> return false? Did the actual allocation fail? >> >> Routine dma_direct_supported() returns true. >> >> The failure is in routine dma_set_mask() in the following if test: >> >> if (!dev->dma_mask || !dma_supported(dev, mask)) >> return -EIO; >> >> For b43legacy, dev->dma_mask is 0xc265684800000000. >> dma_supported(dev, mask) is 0xc08b000000000000, mask is 0x3fffffff, and >> the routine returns -EIO. >> >> For b43, dev->dma_mask is 0xc265684800000001, >> dma_supported(dev, mask) is 0xc08b000000000000, mask is 0x77777777, and >> the routine returns 0. > > I don't fully understand what values the above map to. Can you send > me your actual debugging patch as well? I do not understand why the if statement returns true as neither of the values is zero. After seeing the x86 output shown below, I also do not understand all the trailing zeros. My entire patch is attached. That output came from this section: diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index f7afdad..ba2489d 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -317,9 +317,12 @@ int dma_supported(struct device *dev, u64 mask) int dma_set_mask(struct device *dev, u64 mask) { + pr_info("mask 0x%llx, dma_mask 0x%llx, dma_supported 0x%llx\n", mask, dev->dma_mask, + dma_supported(dev, mask)); if (!dev->dma_mask || !dma_supported(dev, mask)) return -EIO; + pr_info("Continuing in dma_set_mask()\n"); arch_dma_set_mask(dev, mask); dma_check_mask(dev, mask); *dev->dma_mask = mask; On a 32-bit x86 computer with 1GB of RAM, that same output was For b43legacy, dev->dma_mask is 0x01f4029044. dma_supported(dev, mask) is 0x1ef37f7000, mask is 0x3fffffff, and the routine returns 0. 30-bit DMA works. For b43, dev->dma_mask is 0x01f4029044, dma_supported(dev, mask) is 0x1ef37f7000, mask is 0xffffffff, and the routine also returns 0. This card supports 32-bit DMA. Larry