Re: [PATCH v2 3/4] coresight: etm4x: Report the external outputs the PMU counts

From: James Clark

Date: Mon Oct 26 2026 - 05:22:35 EST




On 23/10/2026 15:00, Leo Yan wrote:
On Fri, Oct 23, 2026 at 10:49:40AM +0100, James Clark wrote:

[...]

* a device that matches one of its classes and has all of its capabilities.
*/
#define CS_CFG_MATCH_CAP_MASK 0x0000ff00
+/* trace unit external output n is countable by the PMU as TRCEXTOUTn */
+#define CS_CFG_MATCH_CAP_PMU_EXTOUT_SHIFT 8
+#define CS_CFG_MATCH_CAP_PMU_EXTOUT_NR 4 /* TRCEXTOUT0-3 */
+#define CS_CFG_MATCH_CAP_PMU_EXTOUT(n) BIT(CS_CFG_MATCH_CAP_PMU_EXTOUT_SHIFT + (n))

Isn't this recreating what GENMASK() and FIELD_PREP() does? Can we use that
instead?

TBC, are you suggesting using separate capability bits to represent
TRCEXTOUT0-3? Why can't we use a single capability bit to indicate
whether the feature is supported and caps->num_event to indicate
the number of external output signals?

Just the pattern of *_SHIFT and other stuff to make a bitfield is usually better done with GENMASK(). Or if there are only 4 of them, even defining four BIT()s would be clearer.

But yes if a single bit and caps->num_event works we should do that instead.