Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Leo Yan <leo.yan@arm.com>, Amir Ayupov <aaupov@fb.com>
Cc: James Clark <james.clark@linaro.org>,
	Mike Leach <mike.leach@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] coresight: syscfg: Match feature capabilities separately from device class
Date: Tue, 27 Oct 2026 11:21:59 +0000	[thread overview]
Message-ID: <82adee03-a169-4106-99f2-7624a4926037@arm.com> (raw)
In-Reply-To: <20261021143958.GH26205@e132581.arm.com>

On 21/10/2026 15:39, Leo Yan wrote:
> On Mon, Oct 12, 2026 at 04:05:21PM -0700, Amir Ayupov wrote:
> 
> [...]
> 
>> --- a/drivers/hwtracing/coresight/coresight-config.h
>> +++ b/drivers/hwtracing/coresight/coresight-config.h
>> @@ -30,6 +30,12 @@
>>   #define CS_CFG_MATCH_CLASS_SRC_ALL	0x0001	/* match any source */
>>   #define CS_CFG_MATCH_CLASS_SRC_ETM4	0x0002	/* match any ETMv4 device */
> 
> It is good to introduce a marco:
> 
>    #define CS_CFG_MATCH_CLASS_MASK       GENMASK_U32(7, 0)
> 
>> +/*
>> + * flags defining device capabilities a feature can require. A feature loads on
>> + * a device that matches one of its classes and has all of its capabilities.
>> + */
>> +#define CS_CFG_MATCH_CAP_MASK		0x0000ff00
> 
> To make the mask explicitly 32-bit unsigned:
> 
>    #define CS_CFG_MATCH_CAP_MASK		GENMASK_U32(15, 8)
> 
>> +
>>   /* flags defining device instance matching - used in config match desc data. */
>>   #define CS_CFG_MATCH_INST_ANY		0x80000000 /* any instance of a class */
> 
> Not an issue with this patch, but CS_CFG_MATCH_INST_ANY appears to be
> unused and could be removed in a separate cleanup patch.
> 
>> diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtracing/coresight/coresight-syscfg.c
>> index a816c22c87bc8..1545d64afec01 100644
>> --- a/drivers/hwtracing/coresight/coresight-syscfg.c
>> +++ b/drivers/hwtracing/coresight/coresight-syscfg.c
>> @@ -172,7 +172,21 @@ cscfg_alloc_csdev_feat(struct coresight_device *csdev, struct cscfg_feature_desc
>>   }
>>   
>>   /* load one feature into one coresight device */
>> +/*
>> + * A feature matches a device that shares one of its class flags and has all of
>> + * the capability flags it requires.
>> + */
>> +static bool cscfg_match_feat_csdev(u32 feat_flags, u32 csdev_flags)
>> +{
>> +	u32 caps = feat_flags & CS_CFG_MATCH_CAP_MASK;
>> +
>> +	return (feat_flags & csdev_flags & ~CS_CFG_MATCH_CAP_MASK) &&
>> +	       (csdev_flags & caps) == caps;
> 
> For clearer comparison conditions:
> 
>         /* Class type must be matches */
>         if ((feat_flags & CS_CFG_MATCH_CLASS_MASK) !=
>             (csdev_flags & CS_CFG_MATCH_CLASS_MASK)
>             return false;

Why not use FIELD_GET() to compare to make it more explicit ?

> 
>         /* No required capabilities miss from the device */
>         if (feat_flags & ~csdev_flags & CS_CFG_MATCH_CAP_MASK)
>             return false;

Same here.

Suzuki>
>         return true;
> 
> Thanks,
> Leo



  parent reply	other threads:[~2026-10-27 11:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 23:05 [PATCH v2 0/4] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-12 23:05 ` [PATCH v2 1/4] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-21 14:09   ` Leo Yan
2026-10-12 23:05 ` [PATCH v2 2/4] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-21 14:39   ` Leo Yan
2026-10-25  6:21     ` Amir Ayupov
2026-10-27 11:21     ` Suzuki K Poulose [this message]
2026-10-12 23:05 ` [PATCH v2 3/4] coresight: etm4x: Report the external outputs the PMU counts Amir Ayupov
2026-10-21 16:43   ` Leo Yan
2026-10-23  9:49     ` James Clark
2026-10-23 14:00       ` Leo Yan
2026-10-26  9:22         ` James Clark
2026-10-25  6:34     ` Amir Ayupov
2026-10-23  9:57   ` James Clark
2026-10-12 23:05 ` [PATCH v2 4/4] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-13  1:09   ` Daniel Pereira
2026-10-25  6:38     ` Amir Ayupov
2026-10-26  9:36       ` James Clark
2026-10-25  6:39 ` [PATCH v3 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-10-25 17:05     ` kernel test robot
2026-10-26  0:43     ` kernel test robot
2026-10-25  6:39   ` [PATCH v3 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-26  5:48   ` [PATCH v4 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-26  5:48     ` [PATCH v4 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-10-26  9:37       ` James Clark
2026-10-26  5:48     ` [PATCH v4 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-26  5:48     ` [PATCH v4 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-26  9:45       ` James Clark
2026-10-26  5:48     ` [PATCH v4 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-10-26  9:45       ` James Clark
2026-10-26  5:48     ` [PATCH v4 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-10-26  9:47       ` James Clark
2026-10-26  5:48     ` [PATCH v4 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-10-26  9:49       ` James Clark
2026-10-26  5:48     ` [PATCH v4 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-26  9:50       ` James Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82adee03-a169-4106-99f2-7624a4926037@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=aaupov@fb.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox