Hi, Stefano!

I have observed your patch here:
https://patchwork.kernel.org/project/xen-devel/patch/alpine.DEB.2.21.2102161333090.3234@sstabellini-ThinkPad-T480s/

And I collided with the same issue, when Dom0 device trying to use
swiotlb fops for devices which are controlled by IOMMU.

Prerequisites:
https://github.com/xen-project/xen/tree/stable-4.15
https://github.com/torvalds/linux/tree/v5.10

Issue caused in xen_swiotlb_map_page():
```
 dev: rcar-fcp, cap: 0, dma_mask: ffffffff, page: fffffe00180c7400, 
page_to_phys: 64b1d0000, 
xen_phys_to_dma(phys): 64b1d0000
```

There is retrieved MFN(0x64b1d0000), which belongs to DomU. Dom0
swiotlb couldn't proceed to this address and throws the log:

```
[   99.504990] rcar-fcp fea2f000.fcp: swiotlb buffer is full (sz: 3686400 
bytes), total 32768 (slots), used 64 (slots)
```

Temporary, I resolved this issue by disabling swiotlb for dom0 at all
because sure that all devices goes through IOMMU, but this mention can
be true only for me.

But, I think of a more reliable way is to declare a special IOMMU
property in xen dts for each device. If the device controlled by IOMMU
not need to set swiotlb fops in arch_setup_dma_ops.
What do you think about it?

Reply via email to