On 25/10/2021 11:59, Bough Chen wrote: > Hi Ulf, Adrian > > For mmc controllers with quirks SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, it > limit the max segment size as 64K-1. > Currently, linux kernel support 4K/16K/64K PAGE_SIZE. If choose 64K > PAGE_SIZE, sdhci in ADMA mode with the upper quirks will meet issue. > Though mmc driver give block layer the max segment size through > blk_queue_max_segment_size(), but in this function, it will compare the > argument with PAGE_SIZE. > In this case, finally the mmc request queue will get 64K as the max segment > size. Once the sg data length=64K, ADMA will meet issue. > > Find this issue on i.MX8MM-evk board, and I just notice omap/tegra/s3c also > contain this quirks, seems a common issue. > Should sdhci driver detect this case, and change to use SDMA mode > automatically? Any thoughts? It seems sensible to clear SDHCI_USE_ADMA in sdhci_setup_host() if it is not going to work because of >= 64K page size. > > > /block/blk-settings.c > void blk_queue_max_segment_size(struct request_queue *q, unsigned int > max_size) > { > if (max_size < PAGE_SIZE) { > max_size = PAGE_SIZE; > printk(KERN_INFO "%s: set to minimum %d\n", > __func__, max_size); > } > > /* see blk_queue_virt_boundary() for the explanation */ > WARN_ON_ONCE(q->limits.virt_boundary_mask); > > q->limits.max_segment_size = max_size; > } > EXPORT_SYMBOL(blk_queue_max_segment_size); > > > > Best Regards > Haibo Chen > >