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

[Xen-devel] [driver question] IOMMU concept in Xen



Hi all,

During development of linux kernel PCI driver with SR-IOV I meet some difficulty and I wanted to make sure that I understand correctly Xen concepts.

Things that confuse me is build in function: iommu_present. Is usually used in driver that are using iommu to work. My problem is that this function work perfectly fine on bare-metal linux, but when I move to Xen (or XenServer) then this function return always false.

I know that Xen concept move IOMMU from linux kernel (which is on xen just VM) to the hyperviosr. In XenServer is done using command: xen-cmdline --set-xen iommu=1. After this command (and restart) iommu should work. I can also add this parameter to kernel cmd line (intel_iommu=on). Using that in kernel messages I can see message: Intel-IOMMU: enabled. But no matter which way I follow, iommu_present will always return me false.

I just commented out this check block and run whole driver, there wasn't any issue and driver works perfectly.

After that I if there are other drivers in kernel that have the same issue, but I didn't find anything that can solve this issue. One driver check has conditional compilation for iommu_present block: #if IS_ENABLED(CONFIG_IOMMU_API), but in XenServer (I checked XS 6.5) this option is set to yes in kernel configuration. (This driver source is: drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c)

Using grep I found other drivers that can run into same trouble (doesn't start or throw warning log) inside Xen as dom0:
## drivers that are uisng iommu_present
drivers/gpu/drm/tegra/drm.c
drivers/infiniband/hw/usnic/usnic_uiom.c
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
drivers/vfio/vfio.c
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/crypto/qat/qat_common/adf_sriov.c

So there are two options: there drivers are not designed for Xen or I totally mess up something.

In my driver I started thinking to use #if IS_ENABLED(CONFIG_XEN_DOM0) to handle different Hypervisor, but maybe is not right solution.


I will appreciate any help and clarification of IOMMU concept

Thanks

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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