pci-test-howto.txt 5.6 KB

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