1 This document contains some hints to test the function of the VCHIQ driver
2 without having additional hardware to the Raspberry Pi.
3 
4 * Requirements & limitations
5 
6 Testing the VCHIQ driver requires a Raspberry Pi with one of the following SoC:
7   - BCM2835 ( e.g. Raspberry Pi Zero W )
8   - BCM2836 ( e.g. Raspberry Pi 2 )
9   - BCM2837 ( e.g. Raspberry Pi 3 B+ )
10 
11 The BCM2711 used in the Raspberry Pi 4 is currently not supported in the
12 mainline kernel.
13 
14 There are no specific requirements to the VideoCore firmware to get VCHIQ
15 working.
16 
17 The test scenarios described in this document based on the tool vchiq_test.
18 Its source code is available here: https://github.com/raspberrypi/userland
19 
20 * Configuration
21 
22 Here are the most common kernel configurations:
23 
24  1. BCM2835 target SoC (ARM 32 bit)
25 
26     Just use bcm2835_defconfig which already has VCHIQ enabled.
27 
28  2. BCM2836/7 target SoC (ARM 32 bit)
29 
30     Use the multi_v7_defconfig as a base and then enable all VCHIQ options.
31 
32  3. BCM2837 target SoC (ARM 64 bit)
33 
34     Use the defconfig which has most of the VCHIQ options enabled.
35 
36 * Scenarios
37 
38  * Initial test
39 
40    Check the driver is probed and /dev/vchiq is created
41 
42  * Functional test
43 
44    Command: vchiq_test -f 10
45 
46    Expected output:
47    Functional test - iters:10
48    ======== iteration 1 ========
49    Testing bulk transfer for alignment.
50    Testing bulk transfer at PAGE_SIZE.
51    ...
52 
53  * Ping test
54 
55    Command: vchiq_test -p 1
56 
57    Expected output:
58    Ping test - service:echo, iters:1, version 3
59    vchi ping (size 0) -> 57.000000us
60    vchi ping (size 0, 0 async, 0 oneway) -> 122.000000us
61    vchi bulk (size 0, 0 async, 0 oneway) -> 546.000000us
62    vchi bulk (size 0, 0 oneway) -> 230.000000us
63    vchi ping (size 0) -> 49.000000us
64    vchi ping (size 0, 0 async, 0 oneway) -> 70.000000us
65    vchi bulk (size 0, 0 async, 0 oneway) -> 296.000000us
66    vchi bulk (size 0, 0 oneway) -> 266.000000us
67    vchi ping (size 0, 1 async, 0 oneway) -> 65.000000us
68    vchi bulk (size 0, 0 oneway) -> 456.000000us
69    vchi ping (size 0, 2 async, 0 oneway) -> 74.000000us
70    vchi bulk (size 0, 0 oneway) -> 640.000000us
71    vchi ping (size 0, 10 async, 0 oneway) -> 125.000000us
72    vchi bulk (size 0, 0 oneway) -> 2309.000000us
73    vchi ping (size 0, 0 async, 1 oneway) -> 70.000000us
74    vchi ping (size 0, 0 async, 2 oneway) -> 76.000000us
75    vchi ping (size 0, 0 async, 10 oneway) -> 105.000000us
76    vchi ping (size 0, 10 async, 10 oneway) -> 165.000000us
77    vchi ping (size 0, 100 async, 0 oneway) -> nanus
78    vchi bulk (size 0, 0 oneway) -> nanus
79    vchi ping (size 0, 0 async, 100 oneway) -> nanus
80    vchi ping (size 0, 100 async, 100 oneway) -> infus
81    vchi ping (size 0, 200 async, 0 oneway) -> infus
82    ...
83 
84  * Debugfs test
85 
86    Command: cat /sys/kernel/debug/vchiq/state
87 
88    Example output:
89    State 0: CONNECTED
90      tx_pos=0x1e8(@43b0acda), rx_pos=0x170(@05493af8)
91      Version: 8 (min 3)
92      Stats: ctrl_tx_count=7, ctrl_rx_count=7, error_count=0
93      Slots: 30 available (29 data), 0 recyclable, 0 stalls (0 data)
94      Platform: 2835 (VC master)
95      Local: slots 34-64 tx_pos=0x1e8 recycle=0x1f
96        Slots claimed:
97        DEBUG: SLOT_HANDLER_COUNT = 20(0x14)
98        DEBUG: SLOT_HANDLER_LINE = 1937(0x791)
99        DEBUG: PARSE_LINE = 1864(0x748)
100        DEBUG: PARSE_HEADER = -249155224(0xf1263168)
101        DEBUG: PARSE_MSGID = 67362817(0x403e001)
102        DEBUG: AWAIT_COMPLETION_LINE = 0(0x0)
103        DEBUG: DEQUEUE_MESSAGE_LINE = 0(0x0)
104        DEBUG: SERVICE_CALLBACK_LINE = 0(0x0)
105        DEBUG: MSG_QUEUE_FULL_COUNT = 0(0x0)
106        DEBUG: COMPLETION_QUEUE_FULL_COUNT = 0(0x0)
107      Remote: slots 2-32 tx_pos=0x170 recycle=0x1f
108        Slots claimed:
109          2: 10/9
110        DEBUG: SLOT_HANDLER_COUNT = 20(0x14)
111        DEBUG: SLOT_HANDLER_LINE = 1851(0x73b)
112        DEBUG: PARSE_LINE = 1827(0x723)
113        DEBUG: PARSE_HEADER = -150330912(0xf70a21e0)
114        DEBUG: PARSE_MSGID = 67113022(0x400103e)
115        DEBUG: AWAIT_COMPLETION_LINE = 0(0x0)
116        DEBUG: DEQUEUE_MESSAGE_LINE = 0(0x0)
117        DEBUG: SERVICE_CALLBACK_LINE = 0(0x0)
118        DEBUG: MSG_QUEUE_FULL_COUNT = 0(0x0)
119        DEBUG: COMPLETION_QUEUE_FULL_COUNT = 0(0x0)
120    Service 0: LISTENING (ref 1) 'PEEK little-endian (0x4b454550)' remote n/a (msg use 0/3840, slot use 0/15)
121      Bulk: tx_pending=0 (size 0), rx_pending=0 (size 0)
122      Ctrl: tx_count=0, tx_bytes=0, rx_count=0, rx_bytes=0
123      Bulk: tx_count=0, tx_bytes=0, rx_count=0, rx_bytes=0
124      0 quota stalls, 0 slot stalls, 0 bulk stalls, 0 aborted, 0 errors
125      instance b511f60b
126