View device <=> IOMMU mapping table

Real Name enjoymindful at gmail.com
Wed Jul 9 11:08:17 EDT 2014


On Wed, Jul 09, 2014 at 05:12:18AM -0700, Ahmed A wrote:
> Hello,
> I know the b:d.f  of my device.  However, I am not able to tell if this specific device is mapped to the right IOMMU.  In my specific system there are two IOMMU, right? 

http://www.intel.com/content/www/us/en/intelligent-systems/intel-technology/vt-directed-io-spec.html

Why you think there are two IOMMU? Just because there are two socket?
If there is north bridge, the IOMMU is in the north bridge, not the
CPU/socket.

/proc/iomem list the bus space address range of the PCIe device. The bus space
to memory space mapping is dynamic. I insrumented the mlx4 infiniband
driver to trace the DMA mapping (on a 2-sockets x86_64 server).


[root at localhost mlx4]# lspci -vs 07:00.0
07:00.0 Network controller: Mellanox Technologies MT27500 Family [ConnectX-3]
	Subsystem: Mellanox Technologies Device 0050
	Physical Slot: 2
	Flags: bus master, fast devsel, latency 0, IRQ 26
	Memory at f7f00000 (64-bit, non-prefetchable) [size=1M]
	Memory at f6000000 (64-bit, prefetchable) [size=8M]
	Capabilities: [40] Power Management version 3
	Capabilities: [48] Vital Product Data
	Capabilities: [9c] MSI-X: Enable+ Count=128 Masked-
	Capabilities: [60] Express Endpoint, MSI 00
	Capabilities: [100] Alternative Routing-ID Interpretation (ARI)
	Capabilities: [148] Device Serial Number 00-02-c9-03-00-b3-c7-c0
	Capabilities: [108] Single Root I/O Virtualization (SR-IOV)
	Capabilities: [154] Advanced Error Reporting
	Capabilities: [18c] #19
	Kernel driver in use: mlx4_core

[root at localhost mlx4]# 
[root at localhost mlx4]# dmesg 
[root at localhost mlx4]# ibv_rc_pingpong 
  local address:  LID 0x0002, QPN 0x000054, PSN 0x454e1a, GID ::
  remote address: LID 0x0001, QPN 0x000054, PSN 0x6e4596, GID ::
8192000 bytes in 0.00 seconds = 13799.96 Mbit/sec
1000 iters in 0.00 seconds = 4.75 usec/iter
[root at localhost mlx4]# dmesg 
[ 5474.650073] vma = ffff8804164460b8, vma->vm_start = 00002af33ba39000, pfn = 1007753, pva = 00000000f6089000, kva = ffff8800f6089000, n = 1
[ 5474.706424] vma = ffff880416446730, vma->vm_start = 00002af33ba3a000, pfn = 1007753, pva = 00000000f6089000, kva = ffff8800f6089000, n = 2
[root at localhost ~]#

As you see, pva (000f6089000) belong to this bus space address "Memory at f6000000 (64-bit, prefetchable) [size=8M]".

Hope this can be help.

>  If so, I am not sure how I can get the mapping info from the output of /proc/iomem.



More information about the Kernelnewbies mailing list