hwtracing: hisi_ptt: Export available filters through sysfs
authorYicong Yang <yangyicong@hisilicon.com>
Wed, 21 Jun 2023 09:28:02 +0000 (17:28 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 21 Jun 2023 10:52:09 +0000 (11:52 +0100)
commit6373c463ac894e41cab24469d1947ff91aaea486
tree4fd134a66a7d31cd10544c323ee8fc161b1ab22d
parent556ef09392dbc2d0b9aad5fd880d5d11addfc40d
hwtracing: hisi_ptt: Export available filters through sysfs

The PTT can only filter the traced TLP headers by the Root Ports or the
Requester ID of the Endpoint, which are located on the same PCIe core of
the PTT device. The filter value used is derived from the BDF number of
the supported Root Port or the Endpoint. It's not friendly enough for the
users since it requires the user to be familiar enough with the platform
and calculate the filter value manually.

This patch export the available filters through sysfs. Each available
filters is presented as an individual file with the name of the BDF
number of the related PCIe device. The files are created under
$(PTT PMU dir)/available_root_port_filters and
$(PTT PMU dir)/available_requester_filters respectively. The filter
value can be known by reading the related file.

Then the users can easily know the available filters for trace and get
the filter values without calculating.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230621092804.15120-4-yangyicong@huawei.com
Documentation/ABI/testing/sysfs-devices-hisi_ptt
Documentation/trace/hisi-ptt.rst
drivers/hwtracing/ptt/hisi_ptt.c
drivers/hwtracing/ptt/hisi_ptt.h