[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-users] SMMU Question for passthrough device



Hi experts,

There are two linux os running on my ARM64 platform. Now I want to passthrough
a platform device(sd controller) to DomU to let DomU can directly access the
external SD card. The sd controller supports DMA. The sd controller driver
work well in Host Linux.

So I have a question how DomU DMA interacts with SMMU and finally access memory?

There are 3 dma_map_ops in linux arch/arm64/mm/dma-mapping.c
static struct dma_map_ops iommu_dma_ops
static struct dma_map_ops swiotlb_dma_ops
struct dma_map_ops dummy_dma_ops

Since smmu will be assigned to XEN, linux kernel will not use
iommu_dma_ops. So swiotlb_dma_ops will be used for DomU. But I can not find
out how swiotlb_dma_ops interacts with SMMU.

I checked xen/driver/passthrough/arm/smmu.c and find arm_smmu_map_page has
such a checking code "BUG_ON(!is_domain_direct_mapped(d));", so to my case,
only dom0 can use smmu, and DomU is not 1:1 mapping.

I am confused about how DomU can DMA through SMMU.

There also one in arch/arm/xen/mm.c
struct dma_map_ops xen_swiotlb_dma_ops
This one seems only is used in Dom0. Then Dom0 linux kernel defaults does not 
use
iommu, how can I use iommu for Dom0? I have the dts with SMMU and XEN can detect
the SMMU, but dom0 use swiotlb, can you help explain how dom0 dma work through
smmu?

Thanks,
Peng.

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.