xref: /linux/Documentation/ABI/testing/debugfs-intel-iommu (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1*967912a3SJingqi LiuWhat:		/sys/kernel/debug/iommu/intel/iommu_regset
2*967912a3SJingqi LiuDate:		December 2023
3*967912a3SJingqi LiuContact:	Jingqi Liu <Jingqi.liu@intel.com>
4*967912a3SJingqi LiuDescription:
5*967912a3SJingqi Liu		This file dumps all the register contents for each IOMMU device.
6*967912a3SJingqi Liu
7*967912a3SJingqi Liu		Example in Kabylake:
8*967912a3SJingqi Liu
9*967912a3SJingqi Liu		::
10*967912a3SJingqi Liu
11*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/iommu_regset
12*967912a3SJingqi Liu
13*967912a3SJingqi Liu		 IOMMU: dmar0 Register Base Address: 26be37000
14*967912a3SJingqi Liu
15*967912a3SJingqi Liu		 Name                    Offset          Contents
16*967912a3SJingqi Liu		 VER                     0x00            0x0000000000000010
17*967912a3SJingqi Liu		 GCMD                    0x18            0x0000000000000000
18*967912a3SJingqi Liu		 GSTS                    0x1c            0x00000000c7000000
19*967912a3SJingqi Liu		 FSTS                    0x34            0x0000000000000000
20*967912a3SJingqi Liu		 FECTL                   0x38            0x0000000000000000
21*967912a3SJingqi Liu
22*967912a3SJingqi Liu		 [...]
23*967912a3SJingqi Liu
24*967912a3SJingqi Liu		 IOMMU: dmar1 Register Base Address: fed90000
25*967912a3SJingqi Liu
26*967912a3SJingqi Liu		 Name                    Offset          Contents
27*967912a3SJingqi Liu		 VER                     0x00            0x0000000000000010
28*967912a3SJingqi Liu		 GCMD                    0x18            0x0000000000000000
29*967912a3SJingqi Liu		 GSTS                    0x1c            0x00000000c7000000
30*967912a3SJingqi Liu		 FSTS                    0x34            0x0000000000000000
31*967912a3SJingqi Liu		 FECTL                   0x38            0x0000000000000000
32*967912a3SJingqi Liu
33*967912a3SJingqi Liu		 [...]
34*967912a3SJingqi Liu
35*967912a3SJingqi Liu		 IOMMU: dmar2 Register Base Address: fed91000
36*967912a3SJingqi Liu
37*967912a3SJingqi Liu		 Name                    Offset          Contents
38*967912a3SJingqi Liu		 VER                     0x00            0x0000000000000010
39*967912a3SJingqi Liu		 GCMD                    0x18            0x0000000000000000
40*967912a3SJingqi Liu		 GSTS                    0x1c            0x00000000c7000000
41*967912a3SJingqi Liu		 FSTS                    0x34            0x0000000000000000
42*967912a3SJingqi Liu		 FECTL                   0x38            0x0000000000000000
43*967912a3SJingqi Liu
44*967912a3SJingqi Liu		 [...]
45*967912a3SJingqi Liu
46*967912a3SJingqi LiuWhat:		/sys/kernel/debug/iommu/intel/ir_translation_struct
47*967912a3SJingqi LiuDate:		December 2023
48*967912a3SJingqi LiuContact:	Jingqi Liu <Jingqi.liu@intel.com>
49*967912a3SJingqi LiuDescription:
50*967912a3SJingqi Liu		This file dumps the table entries for Interrupt
51*967912a3SJingqi Liu		remapping and Interrupt posting.
52*967912a3SJingqi Liu
53*967912a3SJingqi Liu		Example in Kabylake:
54*967912a3SJingqi Liu
55*967912a3SJingqi Liu		::
56*967912a3SJingqi Liu
57*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/ir_translation_struct
58*967912a3SJingqi Liu
59*967912a3SJingqi Liu		 Remapped Interrupt supported on IOMMU: dmar0
60*967912a3SJingqi Liu		 IR table address:100900000
61*967912a3SJingqi Liu
62*967912a3SJingqi Liu		 Entry SrcID   DstID    Vct IRTE_high           IRTE_low
63*967912a3SJingqi Liu		 0     00:0a.0 00000080 24  0000000000040050    000000800024000d
64*967912a3SJingqi Liu		 1     00:0a.0 00000001 ef  0000000000040050    0000000100ef000d
65*967912a3SJingqi Liu
66*967912a3SJingqi Liu		 Remapped Interrupt supported on IOMMU: dmar1
67*967912a3SJingqi Liu		 IR table address:100300000
68*967912a3SJingqi Liu		 Entry SrcID   DstID    Vct IRTE_high           IRTE_low
69*967912a3SJingqi Liu		 0     00:02.0 00000002 26  0000000000040010    000000020026000d
70*967912a3SJingqi Liu
71*967912a3SJingqi Liu		 [...]
72*967912a3SJingqi Liu
73*967912a3SJingqi Liu		 ****
74*967912a3SJingqi Liu
75*967912a3SJingqi Liu		 Posted Interrupt supported on IOMMU: dmar0
76*967912a3SJingqi Liu		 IR table address:100900000
77*967912a3SJingqi Liu		 Entry SrcID   PDA_high PDA_low  Vct IRTE_high          IRTE_low
78*967912a3SJingqi Liu
79*967912a3SJingqi LiuWhat:		/sys/kernel/debug/iommu/intel/dmar_translation_struct
80*967912a3SJingqi LiuDate:		December 2023
81*967912a3SJingqi LiuContact:	Jingqi Liu <Jingqi.liu@intel.com>
82*967912a3SJingqi LiuDescription:
83*967912a3SJingqi Liu		This file dumps Intel IOMMU DMA remapping tables, such
84*967912a3SJingqi Liu		as root table, context table, PASID directory and PASID
85*967912a3SJingqi Liu		table entries in debugfs. For legacy mode, it doesn't
86*967912a3SJingqi Liu		support PASID, and hence PASID field is defaulted to
87*967912a3SJingqi Liu		'-1' and other PASID related fields are invalid.
88*967912a3SJingqi Liu
89*967912a3SJingqi Liu		Example in Kabylake:
90*967912a3SJingqi Liu
91*967912a3SJingqi Liu		::
92*967912a3SJingqi Liu
93*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/dmar_translation_struct
94*967912a3SJingqi Liu
95*967912a3SJingqi Liu		 IOMMU dmar1: Root Table Address: 0x103027000
96*967912a3SJingqi Liu		 B.D.F   Root_entry
97*967912a3SJingqi Liu		 00:02.0 0x0000000000000000:0x000000010303e001
98*967912a3SJingqi Liu
99*967912a3SJingqi Liu		 Context_entry
100*967912a3SJingqi Liu		 0x0000000000000102:0x000000010303f005
101*967912a3SJingqi Liu
102*967912a3SJingqi Liu		 PASID   PASID_table_entry
103*967912a3SJingqi Liu		 -1      0x0000000000000000:0x0000000000000000:0x0000000000000000
104*967912a3SJingqi Liu
105*967912a3SJingqi Liu		 IOMMU dmar0: Root Table Address: 0x103028000
106*967912a3SJingqi Liu		 B.D.F   Root_entry
107*967912a3SJingqi Liu		 00:0a.0 0x0000000000000000:0x00000001038a7001
108*967912a3SJingqi Liu
109*967912a3SJingqi Liu		 Context_entry
110*967912a3SJingqi Liu		 0x0000000000000000:0x0000000103220e7d
111*967912a3SJingqi Liu
112*967912a3SJingqi Liu		 PASID   PASID_table_entry
113*967912a3SJingqi Liu		 0       0x0000000000000000:0x0000000000800002:0x00000001038a5089
114*967912a3SJingqi Liu
115*967912a3SJingqi Liu		 [...]
116*967912a3SJingqi Liu
117*967912a3SJingqi LiuWhat:		/sys/kernel/debug/iommu/intel/invalidation_queue
118*967912a3SJingqi LiuDate:		December 2023
119*967912a3SJingqi LiuContact:	Jingqi Liu <Jingqi.liu@intel.com>
120*967912a3SJingqi LiuDescription:
121*967912a3SJingqi Liu		This file exports invalidation queue internals of each
122*967912a3SJingqi Liu		IOMMU device.
123*967912a3SJingqi Liu
124*967912a3SJingqi Liu		Example in Kabylake:
125*967912a3SJingqi Liu
126*967912a3SJingqi Liu		::
127*967912a3SJingqi Liu
128*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/invalidation_queue
129*967912a3SJingqi Liu
130*967912a3SJingqi Liu		 Invalidation queue on IOMMU: dmar0
131*967912a3SJingqi Liu		 Base: 0x10022e000      Head: 20        Tail: 20
132*967912a3SJingqi Liu		 Index          qw0                    qw1                     qw2
133*967912a3SJingqi Liu		     0   0000000000000014        0000000000000000        0000000000000000
134*967912a3SJingqi Liu		     1   0000000200000025        0000000100059c04        0000000000000000
135*967912a3SJingqi Liu		     2   0000000000000014        0000000000000000        0000000000000000
136*967912a3SJingqi Liu
137*967912a3SJingqi Liu				qw3                  status
138*967912a3SJingqi Liu			 0000000000000000        0000000000000000
139*967912a3SJingqi Liu			 0000000000000000        0000000000000000
140*967912a3SJingqi Liu			 0000000000000000        0000000000000000
141*967912a3SJingqi Liu
142*967912a3SJingqi Liu		 [...]
143*967912a3SJingqi Liu
144*967912a3SJingqi Liu		 Invalidation queue on IOMMU: dmar1
145*967912a3SJingqi Liu		 Base: 0x10026e000      Head: 32        Tail: 32
146*967912a3SJingqi Liu		 Index           qw0                     qw1                   status
147*967912a3SJingqi Liu		     0   0000000000000004        0000000000000000         0000000000000000
148*967912a3SJingqi Liu		     1   0000000200000025        0000000100059804         0000000000000000
149*967912a3SJingqi Liu		     2   0000000000000011        0000000000000000         0000000000000000
150*967912a3SJingqi Liu
151*967912a3SJingqi Liu		 [...]
152*967912a3SJingqi Liu
153*967912a3SJingqi LiuWhat:		/sys/kernel/debug/iommu/intel/dmar_perf_latency
154*967912a3SJingqi LiuDate:		December 2023
155*967912a3SJingqi LiuContact:	Jingqi Liu <Jingqi.liu@intel.com>
156*967912a3SJingqi LiuDescription:
157*967912a3SJingqi Liu		This file is used to control and show counts of
158*967912a3SJingqi Liu		execution time ranges for various types per DMAR.
159*967912a3SJingqi Liu
160*967912a3SJingqi Liu		Firstly, write a value to
161*967912a3SJingqi Liu		/sys/kernel/debug/iommu/intel/dmar_perf_latency
162*967912a3SJingqi Liu		to enable sampling.
163*967912a3SJingqi Liu
164*967912a3SJingqi Liu		The possible values are as follows:
165*967912a3SJingqi Liu
166*967912a3SJingqi Liu		* 0 - disable sampling all latency data
167*967912a3SJingqi Liu
168*967912a3SJingqi Liu		* 1 - enable sampling IOTLB invalidation latency data
169*967912a3SJingqi Liu
170*967912a3SJingqi Liu		* 2 - enable sampling devTLB invalidation latency data
171*967912a3SJingqi Liu
172*967912a3SJingqi Liu		* 3 - enable sampling intr entry cache invalidation latency data
173*967912a3SJingqi Liu
174*967912a3SJingqi Liu		Next, read /sys/kernel/debug/iommu/intel/dmar_perf_latency gives
175*967912a3SJingqi Liu		a snapshot of sampling result of all enabled monitors.
176*967912a3SJingqi Liu
177*967912a3SJingqi Liu		Examples in Kabylake:
178*967912a3SJingqi Liu
179*967912a3SJingqi Liu		::
180*967912a3SJingqi Liu
181*967912a3SJingqi Liu		 1) Disable sampling all latency data:
182*967912a3SJingqi Liu
183*967912a3SJingqi Liu		 $ sudo echo 0 > /sys/kernel/debug/iommu/intel/dmar_perf_latency
184*967912a3SJingqi Liu
185*967912a3SJingqi Liu		 2) Enable sampling IOTLB invalidation latency data
186*967912a3SJingqi Liu
187*967912a3SJingqi Liu		 $ sudo echo 1 > /sys/kernel/debug/iommu/intel/dmar_perf_latency
188*967912a3SJingqi Liu
189*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/dmar_perf_latency
190*967912a3SJingqi Liu
191*967912a3SJingqi Liu		 IOMMU: dmar0 Register Base Address: 26be37000
192*967912a3SJingqi Liu				 <0.1us   0.1us-1us    1us-10us  10us-100us   100us-1ms
193*967912a3SJingqi Liu		 inv_iotlb           0           0           0           0           0
194*967912a3SJingqi Liu
195*967912a3SJingqi Liu				 1ms-10ms      >=10ms     min(us)     max(us) average(us)
196*967912a3SJingqi Liu		 inv_iotlb           0           0           0           0           0
197*967912a3SJingqi Liu
198*967912a3SJingqi Liu		 [...]
199*967912a3SJingqi Liu
200*967912a3SJingqi Liu		 IOMMU: dmar2 Register Base Address: fed91000
201*967912a3SJingqi Liu				 <0.1us   0.1us-1us    1us-10us  10us-100us   100us-1ms
202*967912a3SJingqi Liu		 inv_iotlb           0           0          18           0           0
203*967912a3SJingqi Liu
204*967912a3SJingqi Liu				 1ms-10ms      >=10ms     min(us)     max(us) average(us)
205*967912a3SJingqi Liu		 inv_iotlb           0           0           2           2           2
206*967912a3SJingqi Liu
207*967912a3SJingqi Liu		 3) Enable sampling devTLB invalidation latency data
208*967912a3SJingqi Liu
209*967912a3SJingqi Liu		 $ sudo echo 2 > /sys/kernel/debug/iommu/intel/dmar_perf_latency
210*967912a3SJingqi Liu
211*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/dmar_perf_latency
212*967912a3SJingqi Liu
213*967912a3SJingqi Liu		 IOMMU: dmar0 Register Base Address: 26be37000
214*967912a3SJingqi Liu				 <0.1us   0.1us-1us    1us-10us  10us-100us   100us-1ms
215*967912a3SJingqi Liu		 inv_devtlb           0           0           0           0           0
216*967912a3SJingqi Liu
217*967912a3SJingqi Liu				 >=10ms     min(us)     max(us) average(us)
218*967912a3SJingqi Liu		 inv_devtlb           0           0           0           0
219*967912a3SJingqi Liu
220*967912a3SJingqi Liu		 [...]
221*967912a3SJingqi Liu
222*967912a3SJingqi LiuWhat:		/sys/kernel/debug/iommu/intel/<bdf>/domain_translation_struct
223*967912a3SJingqi LiuDate:		December 2023
224*967912a3SJingqi LiuContact:	Jingqi Liu <Jingqi.liu@intel.com>
225*967912a3SJingqi LiuDescription:
226*967912a3SJingqi Liu		This file dumps a specified page table of Intel IOMMU
227*967912a3SJingqi Liu		in legacy mode or scalable mode.
228*967912a3SJingqi Liu
229*967912a3SJingqi Liu		For a device that only supports legacy mode, dump its
230*967912a3SJingqi Liu		page table by the debugfs file in the debugfs device
231*967912a3SJingqi Liu		directory. e.g.
232*967912a3SJingqi Liu		/sys/kernel/debug/iommu/intel/0000:00:02.0/domain_translation_struct.
233*967912a3SJingqi Liu
234*967912a3SJingqi Liu		For a device that supports scalable mode, dump the
235*967912a3SJingqi Liu		page table of specified pasid by the debugfs file in
236*967912a3SJingqi Liu		the debugfs pasid directory. e.g.
237*967912a3SJingqi Liu		/sys/kernel/debug/iommu/intel/0000:00:02.0/1/domain_translation_struct.
238*967912a3SJingqi Liu
239*967912a3SJingqi Liu		Examples in Kabylake:
240*967912a3SJingqi Liu
241*967912a3SJingqi Liu		::
242*967912a3SJingqi Liu
243*967912a3SJingqi Liu		 1) Dump the page table of device "0000:00:02.0" that only supports legacy mode.
244*967912a3SJingqi Liu
245*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/0000:00:02.0/domain_translation_struct
246*967912a3SJingqi Liu
247*967912a3SJingqi Liu		 Device 0000:00:02.0 @0x1017f8000
248*967912a3SJingqi Liu		 IOVA_PFN                PML5E                   PML4E
249*967912a3SJingqi Liu		 0x000000008d800 |       0x0000000000000000      0x00000001017f9003
250*967912a3SJingqi Liu		 0x000000008d801 |       0x0000000000000000      0x00000001017f9003
251*967912a3SJingqi Liu		 0x000000008d802 |       0x0000000000000000      0x00000001017f9003
252*967912a3SJingqi Liu
253*967912a3SJingqi Liu		 PDPE                    PDE                     PTE
254*967912a3SJingqi Liu		 0x00000001017fa003      0x00000001017fb003      0x000000008d800003
255*967912a3SJingqi Liu		 0x00000001017fa003      0x00000001017fb003      0x000000008d801003
256*967912a3SJingqi Liu		 0x00000001017fa003      0x00000001017fb003      0x000000008d802003
257*967912a3SJingqi Liu
258*967912a3SJingqi Liu		 [...]
259*967912a3SJingqi Liu
260*967912a3SJingqi Liu		 2) Dump the page table of device "0000:00:0a.0" with PASID "1" that
261*967912a3SJingqi Liu		 supports scalable mode.
262*967912a3SJingqi Liu
263*967912a3SJingqi Liu		 $ sudo cat /sys/kernel/debug/iommu/intel/0000:00:0a.0/1/domain_translation_struct
264*967912a3SJingqi Liu
265*967912a3SJingqi Liu		 Device 0000:00:0a.0 with pasid 1 @0x10c112000
266*967912a3SJingqi Liu		 IOVA_PFN                PML5E                   PML4E
267*967912a3SJingqi Liu		 0x0000000000000 |       0x0000000000000000      0x000000010df93003
268*967912a3SJingqi Liu		 0x0000000000001 |       0x0000000000000000      0x000000010df93003
269*967912a3SJingqi Liu		 0x0000000000002 |       0x0000000000000000      0x000000010df93003
270*967912a3SJingqi Liu
271*967912a3SJingqi Liu		 PDPE                    PDE                     PTE
272*967912a3SJingqi Liu		 0x0000000106ae6003      0x0000000104b38003      0x0000000147c00803
273*967912a3SJingqi Liu		 0x0000000106ae6003      0x0000000104b38003      0x0000000147c01803
274*967912a3SJingqi Liu		 0x0000000106ae6003      0x0000000104b38003      0x0000000147c02803
275*967912a3SJingqi Liu
276*967912a3SJingqi Liu		 [...]
277