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

Re: [Xen-users] SMMU Question for passthrough device



On Thu, 2016-01-07 at 14:50 +0800, Peng Fan wrote:
> 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?

I'm not terribly familiar with the SMMU stuff on Xen, but I shall try.

> 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.

AFAIK it doesn't, Xen uses the SMMU and it is unavailable to guests. We
don't currently support any of the stage 1+2 variants of the SMMU AFAIK.

> 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.

Have you actually hit this BUG_ON?

According to the comment this function is only called for direct mapped
domains, and my reading of all three of the callers, via iommu_map_page, is
that they are gated on gnttab_need_iommu_mapping(ld) which on ARM is:

#define gnttab_need_iommu_mapping(d)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ\
ÂÂÂÂ(is_domain_direct_mapped(d) && need_iommu(d))

> I am confused about how DomU can DMA through SMMU.

Have you seen docs/misc/arm/passthrough.txt in the Xen tree? The process is
a bit manual but I believe that if you follow something along those lines
then things should work.

Ian.


_______________________________________________
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®.