From mboxrd@z Thu Jan 1 00:00:00 1970 From: enjoymindful@gmail.com (Real Name) Date: Wed, 9 Jul 2014 23:08:17 +0800 Subject: View device <=> IOMMU mapping table In-Reply-To: <1404907938.95659.YahooMailNeo@web162501.mail.bf1.yahoo.com> References: <1404880420.97769.YahooMailNeo@web162506.mail.bf1.yahoo.com> <20140709081803.GB1770@name> <1404907938.95659.YahooMailNeo@web162501.mail.bf1.yahoo.com> Message-ID: <20140709150817.GA16438@name> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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.