On Wed, 4 Dec 2019 14:00:08 +0800 Jun Nie wrote: > > > Christoph Hellwig <hch@xxxxxxxxxxxxx> 于2019年12月3日周二 下午3:36写道: > > > > On Tue, Dec 03, 2019 at 11:29:15AM +0800, Jun Nie wrote: > > > 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)); > > > > Yes, I think should do it. Maybe modulo a check if the low-level > > driver actually sets a segment boundary. > > For the block device, such as SD card, it is right solution. But I > have concern on SDIO case. Maybe we should add workaround together > with block layer segment boundary restriction. How do you think about > it? > Another trouble is how to workaround if the sg is constructed by mmc and no block layer interactions at all. e.g __mmc_blk_ioctl_cmd(), and all those sgs in mmc_test.c Thanks