Hi Christoph,
> From: Christoph Hellwig, Sent: Friday, June 7, 2019 2:50 PM
>
> On Fri, Jun 07, 2019 at 05:41:56AM +0000, Yoshihiro Shimoda wrote:
> > > bool blk_can_use_iommu_merging(struct request_queue *q, struct device
> > > *dev)
> > > {
> > > if (!IOMMU_CAN_MERGE_SEGMENTS(dev))
> > > return false;
> >
> > As Robin mentioned, all IOMMUs can merge segments so that we don't need
> > this condition, IIUC. However, this should check whether the device is
> > mapped
> > on iommu by using device_iommu_mapped().
>
> There are plenty of dma_map_ops based drivers that can't merge segments.
> Examples:
>
> - arch/ia64/sn/pci/pci_dma.c
> - arch/mips/jazz/jazzdma.c
> - arch/sparc/mm/io-unit.c
> - arch/sparc/mm/iommu.c
> - arch/x86/kernel/pci-calgary_64.c
Thank you for the indicate. I'll check these codes.
> Nevermind the diret mapping, swiotlb and other weirdos.
I got it.
> > > blk_queue_virt_boundary(q, IOMMU_PAGE_SIZE(dev));
> > > blk_queue_max_segment_size(q, IOMMU_MAX_SEGMENT_SIZE(dev));
> >
> > By the way, I reported an issue [1] and I'm thinking dima_is_direct()
> > environment
> > (especially for swiotlb) is also needed such max_segment_size changes
> > somehow.
> > What do you think?
> >
> > [1]
> > https://marc.info/?l=linux-block&m=155954415603356&w=2
>
> That doesn't seem to be related to the segment merging. I'll take
> a look, but next time please Cc the author of a suspect commit if
> you already bisect things.
Oops. I'll Cc the author in next time.
Best regards,
Yoshihiro Shimoda