Christoph Hellwig <hch@xxxxxxxxxxxxx> 于2019年12月3日周二 上午1:52写道: > > On Mon, Dec 02, 2019 at 10:41:04PM +0800, Jun Nie wrote: > > DMA memory cannot cross specific boundary for some SDHCI controller, > > such as DesignWare SDHCI controller. Add DMA memory boundary dt > > property and workaround the limitation. > > If you use blk_queue_segment_boundary to tell the block layer the > segment boundary restrictions it won't ever send you segments > that don't fit. With just the workaround in this patch you'll run into > max_segments accounting issues, don't you? Thanks for the reminder! So I need to parse the segment_boundary from device tree and use below code to set it, right? For the max_segments accounting error, I did not see it so far though I believe it is true in theory. Maybe it is due to segment boundary value is very large. +++ b/drivers/mmc/core/queue.c @@ -374,6 +374,7 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) WARN(!blk_queue_can_use_dma_map_merging(mq->queue, mmc_dev(host)), "merging was advertised but not possible"); + blk_queue_segment_boundary(mq->queue, mmc->segment_boundary); blk_queue_max_segments(mq->queue, mmc_get_max_segments(host));