Re: [PATCH V2] coresight: tmc: Make etr buffer mode user configurable from sysfs

From: Anshuman Khandual
Date: Fri Sep 15 2023 - 05:54:55 EST




On 8/18/23 13:51, Anshuman Khandual wrote:
> Currently TMC-ETR automatically selects the buffer mode from all available
> methods in the following sequentially fallback manner - also in that order.
>
> 1. FLAT mode with or without IOMMU
> 2. TMC-ETR-SG (scatter gather) mode when available
> 3. CATU mode when available
>
> But this order might not be ideal for all situations. For example if there
> is a CATU connected to ETR, it may be better to use TMC-ETR scatter gather
> method, rather than CATU. But hard coding such order changes will prevent
> us from testing or using a particular mode. This change provides following
> new sysfs tunables for the user to control TMC-ETR buffer mode explicitly,
> if required. This adds following new sysfs files for buffer mode selection
> purpose explicitly in the user space.
>
> /sys/bus/coresight/devices/tmc_etr<N>/buf_modes_available
> /sys/bus/coresight/devices/tmc_etr<N>/buf_mode_preferred
>
> $ cat buf_modes_available
> auto flat tmc-sg catu ------------------> Supported TMC-ETR buffer modes
>
> $ echo catu > buf_mode_preferred -------> Explicit buffer mode request
>
> But explicit user request has to be within supported ETR buffer modes only.
> These sysfs interface files are exclussive to ETR, and hence these are not
> available for other TMC devices such as ETB or ETF etc.
>
> A new auto' mode (i.e ETR_MODE_AUTO) has been added to help fallback to the
> existing default behaviour, when user provided preferred buffer mode fails.
> ETR_MODE_FLAT and ETR_MODE_AUTO are always available as preferred modes.
>
> Cc: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
> Cc: Mike Leach <mike.leach@xxxxxxxxxx>
> Cc: James Clark <james.clark@xxxxxxx>
> Cc: Leo Yan <leo.yan@xxxxxxxxxx>
> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Cc: coresight@xxxxxxxxxxxxxxxx
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> This applies on v6.5-rc6
>
> Changes in V2:

Hi Suzuki,

This patch still applies cleanly on current coresight/for-next/queue.
But in case, this needs any changes, please do let me know. Thanks !

- Anshuman