Merge branches 'intel_pstate', 'pm-cpufreq' and 'pm-cpufreq-sched'
[linux-2.6-microblaze.git] / Documentation / PCI / endpoint / pci-test-howto.txt
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
48           baseclass_code        interrupt_pin   revid           subsys_vendor_id
49           cache_line_size       msi_interrupts  subclass_code   vendorid
50           deviceid              progif_code     subsys_id
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
70
71 1.5 Binding pci-epf-test Device to EP Controller
72
73 In order for the endpoint function device to be useful, it has to be bound to
74 a PCI endpoint controller driver. Use the configfs to bind the function
75 device to one of the controller driver present in the system.
76
77         # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/
78
79 Once the above step is completed, the PCI endpoint is ready to establish a link
80 with the host.
81
82 1.6 Start the Link
83
84 In order for the endpoint device to establish a link with the host, the _start_
85 field should be populated with '1'.
86
87         # echo 1 > controllers/51000000.pcie_ep/start
88
89 2. RootComplex Device
90
91 2.1 lspci Output
92
93 Note that the devices listed here correspond to the value populated in 1.4 above
94
95         00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
96         01:00.0 Unassigned class [ff00]: Texas Instruments Device b500
97
98 2.2 Using Endpoint Test function Device
99
100 pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint
101 tests. Before pcitest.sh can be used pcitest.c should be compiled using the
102 following commands.
103
104         cd <kernel-dir>
105         make headers_install ARCH=arm
106         arm-linux-gnueabihf-gcc -Iusr/include tools/pci/pcitest.c -o pcitest
107         cp pcitest  <rootfs>/usr/sbin/
108         cp tools/pci/pcitest.sh <rootfs>
109
110 2.2.1 pcitest.sh Output
111         # ./pcitest.sh
112         BAR tests
113
114         BAR0:           OKAY
115         BAR1:           OKAY
116         BAR2:           OKAY
117         BAR3:           OKAY
118         BAR4:           NOT OKAY
119         BAR5:           NOT OKAY
120
121         Interrupt tests
122
123         LEGACY IRQ:     NOT OKAY
124         MSI1:           OKAY
125         MSI2:           OKAY
126         MSI3:           OKAY
127         MSI4:           OKAY
128         MSI5:           OKAY
129         MSI6:           OKAY
130         MSI7:           OKAY
131         MSI8:           OKAY
132         MSI9:           OKAY
133         MSI10:          OKAY
134         MSI11:          OKAY
135         MSI12:          OKAY
136         MSI13:          OKAY
137         MSI14:          OKAY
138         MSI15:          OKAY
139         MSI16:          OKAY
140         MSI17:          NOT OKAY
141         MSI18:          NOT OKAY
142         MSI19:          NOT OKAY
143         MSI20:          NOT OKAY
144         MSI21:          NOT OKAY
145         MSI22:          NOT OKAY
146         MSI23:          NOT OKAY
147         MSI24:          NOT OKAY
148         MSI25:          NOT OKAY
149         MSI26:          NOT OKAY
150         MSI27:          NOT OKAY
151         MSI28:          NOT OKAY
152         MSI29:          NOT OKAY
153         MSI30:          NOT OKAY
154         MSI31:          NOT OKAY
155         MSI32:          NOT OKAY
156
157         Read Tests
158
159         READ (      1 bytes):           OKAY
160         READ (   1024 bytes):           OKAY
161         READ (   1025 bytes):           OKAY
162         READ (1024000 bytes):           OKAY
163         READ (1024001 bytes):           OKAY
164
165         Write Tests
166
167         WRITE (      1 bytes):          OKAY
168         WRITE (   1024 bytes):          OKAY
169         WRITE (   1025 bytes):          OKAY
170         WRITE (1024000 bytes):          OKAY
171         WRITE (1024001 bytes):          OKAY
172
173         Copy Tests
174
175         COPY (      1 bytes):           OKAY
176         COPY (   1024 bytes):           OKAY
177         COPY (   1025 bytes):           OKAY
178         COPY (1024000 bytes):           OKAY
179         COPY (1024001 bytes):           OKAY