All of lore.kernel.org
 help / color / mirror / Atom feed
* [driver question] IOMMU concept in Xen
@ 2016-10-10  0:19 Maciek
  2016-10-10  7:44 ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Maciek @ 2016-10-10  0:19 UTC (permalink / raw)
  To: xen-devel

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@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-11 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10  0:19 [driver question] IOMMU concept in Xen Maciek
2016-10-10  7:44 ` Jan Beulich
2016-10-10 20:15   ` Maciek
2016-10-11 12:49     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.