xref: /linux/Documentation/trace/coresight/ultrasoc-smb.rst (revision 266679ffd867cb247c36717ea4d7998e9304823b)
1.. SPDX-License-Identifier: GPL-2.0
2
3======================================
4UltraSoc - HW Assisted Tracing on SoC
5======================================
6   :Author:   Qi Liu <liuqi115@huawei.com>
7   :Date:     January 2023
8
9Introduction
10------------
11
12UltraSoc SMB is a per SCCL (Super CPU Cluster) hardware. It provides a
13way to buffer and store CPU trace messages in a region of shared system
14memory. The device acts as a coresight sink device and the
15corresponding trace generators (ETM) are attached as source devices.
16
17Sysfs files and directories
18---------------------------
19
20The SMB devices appear on the existing coresight bus alongside other
21devices::
22
23	$# ls /sys/bus/coresight/devices/
24	ultra_smb0   ultra_smb1   ultra_smb2   ultra_smb3
25
26The ``ultra_smb<N>`` names SMB device associated with SCCL.::
27
28	$# ls /sys/bus/coresight/devices/ultra_smb0
29	enable_sink   mgmt
30	$# ls /sys/bus/coresight/devices/ultra_smb0/mgmt
31	buf_size  buf_status  read_pos  write_pos
32
33Key file items are:
34
35   * ``read_pos``: Shows the value on the read pointer register.
36   * ``write_pos``: Shows the value on the write pointer register.
37   * ``buf_status``: Shows the value on the status register.
38     BIT(0) is zero value which means the buffer is empty.
39   * ``buf_size``: Shows the buffer size of each device.
40
41Firmware Bindings
42-----------------
43
44The device is only supported with ACPI. Its binding describes device
45identifier, resource information and graph structure.
46
47The device is identified as ACPI HID "HISI03A1". Device resources are allocated
48using the _CRS method. Each device must present two base address; the first one
49is the configuration base address of the device, the second one is the 32-bit
50base address of shared system memory.
51
52Example::
53
54    Device(USMB) {                                               \
55      Name(_HID, "HISI03A1")                                     \
56      Name(_CRS, ResourceTemplate() {                            \
57          QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, NonCacheable, \
58		       ReadWrite, 0x0, 0x95100000, 0x951FFFFF, 0x0, 0x100000) \
59          QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, Cacheable, \
60		       ReadWrite, 0x0, 0x50000000, 0x53FFFFFF, 0x0, 0x4000000) \
61      })                                                         \
62      Name(_DSD, Package() {                                     \
63        ToUUID("ab02a46b-74c7-45a2-bd68-f7d344ef2153"),          \
64	/* Use CoreSight Graph ACPI bindings to describe connections topology */
65        Package() {                                              \
66          0,                                                     \
67          1,                                                     \
68          Package() {                                            \
69            1,                                                   \
70            ToUUID("3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"),      \
71            8,                                                   \
72            Package() {0x8, 0, \_SB.S00.SL11.CL28.F008, 0},       \
73            Package() {0x9, 0, \_SB.S00.SL11.CL29.F009, 0},       \
74            Package() {0xa, 0, \_SB.S00.SL11.CL2A.F010, 0},       \
75            Package() {0xb, 0, \_SB.S00.SL11.CL2B.F011, 0},       \
76            Package() {0xc, 0, \_SB.S00.SL11.CL2C.F012, 0},       \
77            Package() {0xd, 0, \_SB.S00.SL11.CL2D.F013, 0},       \
78            Package() {0xe, 0, \_SB.S00.SL11.CL2E.F014, 0},       \
79            Package() {0xf, 0, \_SB.S00.SL11.CL2F.F015, 0},       \
80          }                                                      \
81        }                                                        \
82      })                                                         \
83    }
84