Hi Christoph, > From: Christoph Hellwig, Sent: Monday, June 17, 2019 3:54 PM > > On Mon, Jun 17, 2019 at 06:46:33AM +0000, Yoshihiro Shimoda wrote: > > > can_merge seems a little too generic a name to me. Maybe can_iommu_merge? > > > > I'll fix the name. Also, only the device_iommu_mapped() condition wiil cause > > a problem on iommu=pt [1]. So, I'll add another condition here. > > Instead of adding another condition here I think we need to properly > abstract it out in the DMA layer. E.g. have a
Thank you for your comment and sample code! I'll add such functions on next patch series. Best regards, Yoshihiro Shimoda > unsigned long dma_get_merge_boundary(struct device *dev) > { > const struct dma_map_ops *ops = get_dma_ops(dev); > > if (!ops || !ops->get_merge_boundary) > return 0; /* can't merge */ > return ops->get_merge_boundary(dev); > } > > and then implement the method in dma-iommu.c. > > blk_queue_can_use_iommu_merging then comes: > > bool blk_queue_enable_iommu_merging(struct request_queue *q, > struct device *dev) > { > unsigned long boundary = dma_get_merge_boundary(dev); > > if (!boundary) > return false; > blk_queue_virt_boundary(q, boundary); > return true; > }