Commit | Line | Data |
---|---|---|
16263d9e KVA |
1 | PCI TEST USERGUIDE |
2 | Kishon Vijay Abraham I <kishon@ti.com> | |
3 | ||
4 | This document is a guide to help users use pci-epf-test function driver | |
5 | and pci_endpoint_test host driver for testing PCI. The list of steps to | |
6 | be followed in the host side and EP side is given below. | |
7 | ||
8 | 1. Endpoint Device | |
9 | ||
10 | 1.1 Endpoint Controller Devices | |
11 | ||
12 | To find the list of endpoint controller devices in the system: | |
13 | ||
14 | # ls /sys/class/pci_epc/ | |
15 | 51000000.pcie_ep | |
16 | ||
17 | If PCI_ENDPOINT_CONFIGFS is enabled | |
18 | # ls /sys/kernel/config/pci_ep/controllers | |
19 | 51000000.pcie_ep | |
20 | ||
21 | 1.2 Endpoint Function Drivers | |
22 | ||
23 | To find the list of endpoint function drivers in the system: | |
24 | ||
25 | # ls /sys/bus/pci-epf/drivers | |
26 | pci_epf_test | |
27 | ||
28 | If PCI_ENDPOINT_CONFIGFS is enabled | |
29 | # ls /sys/kernel/config/pci_ep/functions | |
30 | pci_epf_test | |
31 | ||
32 | 1.3 Creating pci-epf-test Device | |
33 | ||
34 | PCI endpoint function device can be created using the configfs. To create | |
35 | pci-epf-test device, the following commands can be used | |
36 | ||
37 | # mount -t configfs none /sys/kernel/config | |
38 | # cd /sys/kernel/config/pci_ep/ | |
39 | # mkdir functions/pci_epf_test/func1 | |
40 | ||
41 | The "mkdir func1" above creates the pci-epf-test function device that will | |
42 | be probed by pci_epf_test driver. | |
43 | ||
44 | The PCI endpoint framework populates the directory with the following | |
45 | configurable fields. | |
46 | ||
47 | # ls functions/pci_epf_test/func1 | |
c2e00e31 GP |
48 | baseclass_code interrupt_pin progif_code subsys_id |
49 | cache_line_size msi_interrupts revid subsys_vendorid | |
50 | deviceid msix_interrupts subclass_code vendorid | |
16263d9e KVA |
51 | |
52 | The PCI endpoint function driver populates these entries with default values | |
53 | when the device is bound to the driver. The pci-epf-test driver populates | |
54 | vendorid with 0xffff and interrupt_pin with 0x0001 | |
55 | ||
56 | # cat functions/pci_epf_test/func1/vendorid | |
57 | 0xffff | |
58 | # cat functions/pci_epf_test/func1/interrupt_pin | |
59 | 0x0001 | |
60 | ||
61 | 1.4 Configuring pci-epf-test Device | |
62 | ||
63 | The user can configure the pci-epf-test device using configfs entry. In order | |
64 | to change the vendorid and the number of MSI interrupts used by the function | |
65 | device, the following commands can be used. | |
66 | ||
67 | # echo 0x104c > functions/pci_epf_test/func1/vendorid | |
68 | # echo 0xb500 > functions/pci_epf_test/func1/deviceid | |
69 | # echo 16 > functions/pci_epf_test/func1/msi_interrupts | |
c2e00e31 | 70 | # echo 8 > functions/pci_epf_test/func1/msix_interrupts |
16263d9e KVA |
71 | |
72 | 1.5 Binding pci-epf-test Device to EP Controller | |
73 | ||
74 | In order for the endpoint function device to be useful, it has to be bound to | |
75 | a PCI endpoint controller driver. Use the configfs to bind the function | |
76 | device to one of the controller driver present in the system. | |
77 | ||
78 | # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/ | |
79 | ||
80 | Once the above step is completed, the PCI endpoint is ready to establish a link | |
81 | with the host. | |
82 | ||
83 | 1.6 Start the Link | |
84 | ||
85 | In order for the endpoint device to establish a link with the host, the _start_ | |
86 | field should be populated with '1'. | |
87 | ||
88 | # echo 1 > controllers/51000000.pcie_ep/start | |
89 | ||
90 | 2. RootComplex Device | |
91 | ||
92 | 2.1 lspci Output | |
93 | ||
94 | Note that the devices listed here correspond to the value populated in 1.4 above | |
95 | ||
96 | 00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01) | |
97 | 01:00.0 Unassigned class [ff00]: Texas Instruments Device b500 | |
98 | ||
99 | 2.2 Using Endpoint Test function Device | |
100 | ||
101 | pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint | |
1ce78ce0 | 102 | tests. To compile this tool the following commands should be used: |
16263d9e | 103 | |
1ce78ce0 GP |
104 | # cd <kernel-dir> |
105 | # make -C tools/pci | |
106 | ||
107 | or if you desire to compile and install in your system: | |
108 | ||
109 | # cd <kernel-dir> | |
110 | # make -C tools/pci install | |
111 | ||
112 | The tool and script will be located in <rootfs>/usr/bin/ | |
16263d9e KVA |
113 | |
114 | 2.2.1 pcitest.sh Output | |
1ce78ce0 | 115 | # pcitest.sh |
16263d9e KVA |
116 | BAR tests |
117 | ||
118 | BAR0: OKAY | |
119 | BAR1: OKAY | |
120 | BAR2: OKAY | |
121 | BAR3: OKAY | |
122 | BAR4: NOT OKAY | |
123 | BAR5: NOT OKAY | |
124 | ||
125 | Interrupt tests | |
126 | ||
0653217c | 127 | SET IRQ TYPE TO LEGACY: OKAY |
16263d9e | 128 | LEGACY IRQ: NOT OKAY |
0653217c | 129 | SET IRQ TYPE TO MSI: OKAY |
16263d9e KVA |
130 | MSI1: OKAY |
131 | MSI2: OKAY | |
132 | MSI3: OKAY | |
133 | MSI4: OKAY | |
134 | MSI5: OKAY | |
135 | MSI6: OKAY | |
136 | MSI7: OKAY | |
137 | MSI8: OKAY | |
138 | MSI9: OKAY | |
139 | MSI10: OKAY | |
140 | MSI11: OKAY | |
141 | MSI12: OKAY | |
142 | MSI13: OKAY | |
143 | MSI14: OKAY | |
144 | MSI15: OKAY | |
145 | MSI16: OKAY | |
146 | MSI17: NOT OKAY | |
147 | MSI18: NOT OKAY | |
148 | MSI19: NOT OKAY | |
149 | MSI20: NOT OKAY | |
150 | MSI21: NOT OKAY | |
151 | MSI22: NOT OKAY | |
152 | MSI23: NOT OKAY | |
153 | MSI24: NOT OKAY | |
154 | MSI25: NOT OKAY | |
155 | MSI26: NOT OKAY | |
156 | MSI27: NOT OKAY | |
157 | MSI28: NOT OKAY | |
158 | MSI29: NOT OKAY | |
159 | MSI30: NOT OKAY | |
160 | MSI31: NOT OKAY | |
161 | MSI32: NOT OKAY | |
0653217c GP |
162 | SET IRQ TYPE TO MSI-X: OKAY |
163 | MSI-X1: OKAY | |
164 | MSI-X2: OKAY | |
165 | MSI-X3: OKAY | |
166 | MSI-X4: OKAY | |
167 | MSI-X5: OKAY | |
168 | MSI-X6: OKAY | |
169 | MSI-X7: OKAY | |
170 | MSI-X8: OKAY | |
171 | MSI-X9: NOT OKAY | |
172 | MSI-X10: NOT OKAY | |
173 | MSI-X11: NOT OKAY | |
174 | MSI-X12: NOT OKAY | |
175 | MSI-X13: NOT OKAY | |
176 | MSI-X14: NOT OKAY | |
177 | MSI-X15: NOT OKAY | |
178 | MSI-X16: NOT OKAY | |
c2e00e31 | 179 | [...] |
0653217c GP |
180 | MSI-X2047: NOT OKAY |
181 | MSI-X2048: NOT OKAY | |
16263d9e KVA |
182 | |
183 | Read Tests | |
184 | ||
0653217c | 185 | SET IRQ TYPE TO MSI: OKAY |
16263d9e KVA |
186 | READ ( 1 bytes): OKAY |
187 | READ ( 1024 bytes): OKAY | |
188 | READ ( 1025 bytes): OKAY | |
189 | READ (1024000 bytes): OKAY | |
190 | READ (1024001 bytes): OKAY | |
191 | ||
192 | Write Tests | |
193 | ||
194 | WRITE ( 1 bytes): OKAY | |
195 | WRITE ( 1024 bytes): OKAY | |
196 | WRITE ( 1025 bytes): OKAY | |
197 | WRITE (1024000 bytes): OKAY | |
198 | WRITE (1024001 bytes): OKAY | |
199 | ||
200 | Copy Tests | |
201 | ||
202 | COPY ( 1 bytes): OKAY | |
203 | COPY ( 1024 bytes): OKAY | |
204 | COPY ( 1025 bytes): OKAY | |
205 | COPY (1024000 bytes): OKAY | |
206 | COPY (1024001 bytes): OKAY |