Add support for UltraSoc System Memory Buffer
v15 cover Add support for UltraSoc System Memory Buffer
Add support for UltraSoc System Memory Buffer.
Change since v14:
- Add some helpers to the buffer and simplify dumping data according to Jonathan's comment.
- Link: https://lore.kernel.org/lkml/[email protected]/
Change since v13:
- Modify document and the patches description according to Bagas's comment.
- Add dependency on config ACPI, drop redundant enable hw in smb_update_buffer(), Modify smb_purge_data() description according to Suzuki's comment.
- Link: https://lore.kernel.org/lkml/[email protected]/
Change since v12:
- Modify the code style and add "#ifdef CONFIG_ACPI" according to Jonathan's comment.
- Address the comments from Yicong, included drop "buf_base"__iomem attribute, modify the "reading" type to bool and fix FIELD_PREP.
- Link: https://lore.kernel.org/lkml/[email protected]/
Change since v11:
- Modify the code style and rename the macro according to Jonathan's comment.
- Link: https://lore.kernel.org/lkml/[email protected]/
Change since v10:
- Rebase onto v6.1-rc4, included similar sysfs register accessors (as same as James's patch)
- Link: https://lore.kernel.org/lkml/[email protected]/
Change since v9:
- Update the Contact tag in SMB document.
- Replace the spinlock with mutex.
- Do some clean-ups in "smb_enable()" and "smb_release()".
- Use classic memory mapped interface.
- Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Change since v8:
- Insert a blank line at the end of the config tag in Kconfig according to Randy's comment.
- Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Change since v7:
- Use the macros for register bit flags and numbers of resource.
- Cleanup punctuation.
- Update the Date tag and the KernelVersion tag in the document.
- Link: https://lore.kernel.org/lkml/[email protected]/
Change since v6:
- Modify the code style and driver description according to Suzuki's comment.
- Modify configuration of "drvdata->reading", to void problems in open/read concurrency scenario.
- Rename the macro of "SMB_FLOW_MASK".
- Use the "handle->head" to determine the page number and offset.
- Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Change since v5:
- Address the comments from Suzuki, add some comments in SMB document, and modify configuration of "drvdata->reading", to void problems in multi-core concurrency scenario
- Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Change since v4:
- Add a simple document of SMB driver according to Suzuki's comment.
- Address the comments from Suzuki.
- Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Change since v3:
- Modify the file header according to community specifications.
- Address the comments from Mathieu.
- Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Change since v2:
- Move ultrasoc driver to drivers/hwtracing/coresight by Mathieu's comment.
- Link: https://lists.linaro.org/pipermail/coresight/2021-November/007310.html
Change since v1:
- Drop the document of UltraSoc according to Mathieu's comment.
- Add comments to explain some private hardware settings.
- Address the comments from Mathieu.
- Link: https://lists.linaro.org/pipermail/coresight/2021-August/006842.html
Change since RFC:
- Move driver to drivers/hwtracing/coresight/ultrasoc.
- Remove ultrasoc-axi-com.c, as AXI-COM doesn't need to be configured in basic tracing function.
- Remove ultrasoc.c as SMB does not need to register with the ultrasoc core.
- Address the comments from Mathieu and Suzuki.
- Link: https://lists.linaro.org/pipermail/coresight/2021-June/006535.html
Qi Liu (2):
drivers/coresight: Add UltraSoc System Memory Buffer driver
Documentation: Add document for UltraSoc SMB driver
.../sysfs-bus-coresight-devices-ultra_smb | 31 + .../trace/coresight/ultrasoc-smb.rst | 83 +++ drivers/hwtracing/coresight/Kconfig | 12 + drivers/hwtracing/coresight/Makefile | 1 + drivers/hwtracing/coresight/ultrasoc-smb.c | 648 ++++++++++++++++++ drivers/hwtracing/coresight/ultrasoc-smb.h | 125 ++++ 6 files changed, 900 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb create mode 100644 Documentation/trace/coresight/ultrasoc-smb.rst create mode 100644 drivers/hwtracing/coresight/ultrasoc-smb.c create mode 100644 drivers/hwtracing/coresight/ultrasoc-smb.h
Signature · 1 line
2.33.0
PATCH v15 1/2 drivers/coresight: Add UltraSoc System Memory Buffer driver
From: Qi Liu <[email protected]>
Add driver for UltraSoc SMB(System Memory Buffer) device. SMB provides a way to buffer messages from ETM, and store these "CPU instructions trace" in system memory. The SMB device is identifier as ACPI HID "HISI03A1". Device system memory address resources are allocated using the _CRS method and buffer modes is the circular buffer mode.
SMB is developed by UltraSoc technology, which is acquired by Siemens, and we still use "UltraSoc" to name driver.
--- drivers/hwtracing/coresight/Kconfig | 12 + drivers/hwtracing/coresight/Makefile | 1 + drivers/hwtracing/coresight/ultrasoc-smb.c | 648 +++++++++++++++++++++ drivers/hwtracing/coresight/ultrasoc-smb.h | 125 ++++ 4 files changed, 786 insertions(+) create mode 100644 drivers/hwtracing/coresight/ultrasoc-smb.c create mode 100644 drivers/hwtracing/coresight/ultrasoc-smb.h
drivers/hwtracing/coresight/Kconfig +12 -0
@@ -201,4 +201,16 @@ config CORESIGHT_TRBE To compile this driver as a module, choose M here: the module will be called coresight-trbe. + +config ULTRASOC_SMB + tristate "Ultrasoc system memory buffer drivers" + depends on ACPI || COMPILE_TEST + depends on ARM64 && CORESIGHT_LINKS_AND_SINKS + help + This driver provides support for the Ultrasoc system memory buffer (SMB). + SMB is responsible for receiving the trace data from Coresight ETM devices + and storing them to a system buffer. + + To compile this driver as a module, choose M here: the module will be + called ultrasoc-smb. endif
drivers/hwtracing/coresight/Makefile +1 -0
@@ -27,3 +27,4 @@ obj-$(CONFIG_CORESIGHT_CTI) += coresight-cti.o obj-$(CONFIG_CORESIGHT_TRBE) += coresight-trbe.o coresight-cti-y := coresight-cti-core.o coresight-cti-platform.o \ coresight-cti-sysfs.o +obj-$(CONFIG_ULTRASOC_SMB) += ultrasoc-smb.o
drivers/hwtracing/coresight/ultrasoc-smb.c new file +648 -0
648 lines not on this page · raw message
drivers/hwtracing/coresight/ultrasoc-smb.h new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
2.33.0
PATCH v15 2/2 Documentation: Add document for UltraSoc SMB driver
In reply to Junhao HeFrom: Qi Liu <[email protected]>
Bring in documentation for UltraSoc SMB driver. It simply describes the device, sysfs interface and the firmware bindings.
--- .../sysfs-bus-coresight-devices-ultra_smb | 31 +++++++ .../trace/coresight/ultrasoc-smb.rst | 83 +++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb create mode 100644 Documentation/trace/coresight/ultrasoc-smb.rst
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +31 -0
@@ -0,0 +1,31 @@ +What: /sys/bus/coresight/devices/ultra_smb<N>/enable_sink +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (RW) Add/remove a SMB device from a trace path. There can be + multiple sources for a single SMB device. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/buf_size +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the buffer size of each UltraSoc SMB device. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/buf_status +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB status register. + BIT(0) is zero means buffer is empty. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/read_pos +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB Read Pointer register. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/write_pos +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB Write Pointer register.
Documentation/trace/coresight/ultrasoc-smb.rst new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.33.0
Re: [PATCH v15 2/2] Documentation: Add document for UltraSoc SMB driver
Quoted 27 lines · Junhao He
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +21
-0@@ -0,0 +1,31 @@ +What: /sys/bus/coresight/devices/ultra_smb<N>/enable_sink +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (RW) Add/remove a SMB device from a trace path. There can be + multiple sources for a single SMB device. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/buf_size +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the buffer size of each UltraSoc SMB device. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/buf_status +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB status register. + BIT(0) is zero means buffer is empty. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/read_pos
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb line 31
Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +10
-0+Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB Read Pointer register. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/write_pos +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB Write Pointer register.
s/Read/RO/ and s/value held by/value of/
Quoted 79 lines
Documentation/trace/coresight/ultrasoc-smb.rst new file +73
-0@@ -0,0 +1,83 @@ +.. SPDX-License-Identifier: GPL-2.0 + +====================================== +UltraSoc - HW Assisted Tracing on SoC +====================================== + :Author: Qi Liu <[email protected]> + :Date: December 2022 + +Introduction +------------ + +UltraSoc SMB is a per SCCL (Super CPU Cluster) hardware. It provides a +way to buffer and store CPU trace messages in a region of shared system +memory. The device acts as a coresight sink device and the +corresponding trace generators (ETM) are attached as source devices. + +Sysfs files and directories +--------------------------- + +The SMB devices appear on the existing coresight bus alongside other +devices:: + + $# ls /sys/bus/coresight/devices/ + ultra_smb0 ultra_smb1 ultra_smb2 ultra_smb3 + +The ``ultra_smb<N>`` names SMB device associated with SCCL.:: + + $# ls /sys/bus/coresight/devices/ultra_smb0 + enable_sink mgmt + $# ls /sys/bus/coresight/devices/ultra_smb0/mgmt + buf_size buf_status read_pos write_pos + +Key file items are: + + * ``read_pos``: Shows the value on the read pointer register. + * ``write_pos``: Shows the value on the write pointer register. + * ``buf_status``: Shows the value on the status register. + BIT(0) is zero value which means the buffer is empty. + * ``buf_size``: Shows the buffer size of each device. + +Firmware Bindings +----------------- + +The device is only supported with ACPI. Its binding describes device +identifier, resource information and graph structure. + +The device is identified as ACPI HID "HISI03A1". Device resources are allocated +using the _CRS method. Each device must present two base address; the first one +is the configuration base address of the device, the second one is the 32-bit +base address of shared system memory. + +Example:: + + Device(USMB) { \ + Name(_HID, "HISI03A1") \ + Name(_CRS, ResourceTemplate() { \ + QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, NonCacheable, \ + ReadWrite, 0x0, 0x95100000, 0x951FFFFF, 0x0, 0x100000) \ + QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, Cacheable, \ + ReadWrite, 0x0, 0x50000000, 0x53FFFFFF, 0x0, 0x4000000) \ + }) \ + Name(_DSD, Package() { \ + ToUUID("ab02a46b-74c7-45a2-bd68-f7d344ef2153"), \ + /* Use CoreSight Graph ACPI bindings to describe connections topology */ + Package() { \ + 0, \ + 1, \ + Package() { \ + 1, \ + ToUUID("3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"), \ + 8, \ + Package() {0x8, 0, \_SB.S00.SL11.CL28.F008, 0}, \ + Package() {0x9, 0, \_SB.S00.SL11.CL29.F009, 0}, \
Documentation/trace/coresight/ultrasoc-smb.rst line 83
Quoted 10 lines
Documentation/trace/coresight/ultrasoc-smb.rst new file +10
-0+ Package() {0xa, 0, \_SB.S00.SL11.CL2A.F010, 0}, \ + Package() {0xb, 0, \_SB.S00.SL11.CL2B.F011, 0}, \ + Package() {0xc, 0, \_SB.S00.SL11.CL2C.F012, 0}, \ + Package() {0xd, 0, \_SB.S00.SL11.CL2D.F013, 0}, \ + Package() {0xe, 0, \_SB.S00.SL11.CL2E.F014, 0}, \ + Package() {0xf, 0, \_SB.S00.SL11.CL2F.F015, 0}, \ + } \ + } \ + }) \ + }
This doc LGTM, thanks.
For this doc,
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Re: [PATCH v15 2/2] Documentation: Add document for UltraSoc SMB driver
Quoted 31 lines · Bagas Sanjaya
Quoted 30 lines · Junhao He
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +24
-0@@ -0,0 +1,31 @@ +What: /sys/bus/coresight/devices/ultra_smb<N>/enable_sink +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (RW) Add/remove a SMB device from a trace path. There can be + multiple sources for a single SMB device. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/buf_size +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the buffer size of each UltraSoc SMB device. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/buf_status +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB status register. + BIT(0) is zero means buffer is empty. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/read_pos +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]>
Quoted 8 lines
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb line 31
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +7
-0+Description: (Read) Shows the value held by UltraSoc SMB Read Pointer register. + +What: /sys/bus/coresight/devices/ultra_smb<N>/mgmt/write_pos +Date: December 2022 +KernelVersion: 6.2 +Contact: Junhao He <[email protected]> +Description: (Read) Shows the value held by UltraSoc SMB Write Pointer register.s/Read/RO/ and s/value held by/value of/
Ok, will fix it.
Thanks.
Quoted 91 lines
Quoted 79 lines
Documentation/trace/coresight/ultrasoc-smb.rst new file +73
-0@@ -0,0 +1,83 @@ +.. SPDX-License-Identifier: GPL-2.0 + +====================================== +UltraSoc - HW Assisted Tracing on SoC +====================================== + :Author: Qi Liu <[email protected]> + :Date: December 2022 + +Introduction +------------ + +UltraSoc SMB is a per SCCL (Super CPU Cluster) hardware. It provides a +way to buffer and store CPU trace messages in a region of shared system +memory. The device acts as a coresight sink device and the +corresponding trace generators (ETM) are attached as source devices. + +Sysfs files and directories +--------------------------- + +The SMB devices appear on the existing coresight bus alongside other +devices:: + + $# ls /sys/bus/coresight/devices/ + ultra_smb0 ultra_smb1 ultra_smb2 ultra_smb3 + +The ``ultra_smb<N>`` names SMB device associated with SCCL.:: + + $# ls /sys/bus/coresight/devices/ultra_smb0 + enable_sink mgmt + $# ls /sys/bus/coresight/devices/ultra_smb0/mgmt + buf_size buf_status read_pos write_pos + +Key file items are: + + * ``read_pos``: Shows the value on the read pointer register. + * ``write_pos``: Shows the value on the write pointer register. + * ``buf_status``: Shows the value on the status register. + BIT(0) is zero value which means the buffer is empty. + * ``buf_size``: Shows the buffer size of each device. + +Firmware Bindings +----------------- + +The device is only supported with ACPI. Its binding describes device +identifier, resource information and graph structure. + +The device is identified as ACPI HID "HISI03A1". Device resources are allocated +using the _CRS method. Each device must present two base address; the first one +is the configuration base address of the device, the second one is the 32-bit +base address of shared system memory. + +Example:: + + Device(USMB) { \ + Name(_HID, "HISI03A1") \ + Name(_CRS, ResourceTemplate() { \ + QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, NonCacheable, \ + ReadWrite, 0x0, 0x95100000, 0x951FFFFF, 0x0, 0x100000) \ + QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, Cacheable, \ + ReadWrite, 0x0, 0x50000000, 0x53FFFFFF, 0x0, 0x4000000) \ + }) \ + Name(_DSD, Package() { \ + ToUUID("ab02a46b-74c7-45a2-bd68-f7d344ef2153"), \ + /* Use CoreSight Graph ACPI bindings to describe connections topology */ + Package() { \ + 0, \ + 1, \ + Package() { \ + 1, \ + ToUUID("3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"), \ + 8, \ + Package() {0x8, 0, \_SB.S00.SL11.CL28.F008, 0}, \ + Package() {0x9, 0, \_SB.S00.SL11.CL29.F009, 0}, \Documentation/trace/coresight/ultrasoc-smb.rst line 83
Quoted 10 lines
Documentation/trace/coresight/ultrasoc-smb.rst new file +10
-0+ Package() {0xa, 0, \_SB.S00.SL11.CL2A.F010, 0}, \ + Package() {0xb, 0, \_SB.S00.SL11.CL2B.F011, 0}, \ + Package() {0xc, 0, \_SB.S00.SL11.CL2C.F012, 0}, \ + Package() {0xd, 0, \_SB.S00.SL11.CL2D.F013, 0}, \ + Package() {0xe, 0, \_SB.S00.SL11.CL2E.F014, 0}, \ + Package() {0xf, 0, \_SB.S00.SL11.CL2F.F015, 0}, \ + } \ + } \ + }) \ + }This doc LGTM, thanks.
Quoted 3 lines
For this doc,
Reviewed-by Bagas Sanjaya <[email protected]>
Thanks for your comments.
Best regards,
Junhao.
Suzuki K Poulose
maintainerRe: [PATCH v15 2/2] Documentation: Add document for UltraSoc SMB driver
In reply to Junhao HeQuoted 22 lines · Junhao He
From: Qi Liu <[email protected]>
Bring in documentation for UltraSoc SMB driver. It simply describes the device, sysfs interface and the firmware bindings.
Signed-off-by Qi Liu <[email protected]>Signed-off-by Junhao He <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>--- .../sysfs-bus-coresight-devices-ultra_smb | 31 +++++++ .../trace/coresight/ultrasoc-smb.rst | 83 +++++++++++++++++++ 2 files changed, 114 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smbcreate mode 100644Documentation/trace/coresight/ultrasoc-smb.rstDocumentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +0
-0
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb line 3
Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +3
-0@@ -0,0 +1,31 @@ +What: /sys/bus/coresight/devices/ultra_smb<N>/enable_sink +Date: December 2022 +KernelVersion: 6.2
This is not going in for 6.2. This must be 6.3 now and everywhere below.
Thanks
Suzuki
Re: [PATCH v15 2/2] Documentation: Add document for UltraSoc SMB driver
Quoted 31 lines · Suzuki K Poulose
Quoted 23 lines · Junhao He
From: Qi Liu <[email protected]>
Bring in documentation for UltraSoc SMB driver. It simply describes the device, sysfs interface and the firmware bindings.
Signed-off-by Qi Liu <[email protected]>Signed-off-by Junhao He <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>--- .../sysfs-bus-coresight-devices-ultra_smb | 31 +++++++ .../trace/coresight/ultrasoc-smb.rst | 83 +++++++++++++++++++ 2 files changed, 114 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb
create mode 100644Documentation/trace/coresight/ultrasoc-smb.rstDocumentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +0
-0Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb line 3
Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-coresight-devices-ultra_smb new file +3
-0@@ -0,0 +1,31 @@ +What: /sys/bus/coresight/devices/ultra_smb<N>/enable_sink +Date: December 2022 +KernelVersion: 6.2This is not going in for 6.2. This must be 6.3 now and everywhere below.
Quoted 3 lines
Thanks
Suzuki
OK, Will fix in next version.
Thanks
Junhao.
Quoted 7 lines
_______________________________________________
CoreSight mailing list -- [email protected] To unsubscribe send an email to [email protected].