From nobody Mon Dec 1 23:02:30 2025 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9518321457 for ; Wed, 26 Nov 2025 10:57:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154673; cv=none; b=fjXQNBoM6S0zvLhRm87gjDV6bpKyU2FLtbr+8b9KCtAk2QD37jDQKDBg4vL5B0oCvc/au6EusLdQuy0ycRM4NZbdvPKPpV4q5lsZsoKpF1FzqzDK7fautHXxFXFcwmaVQqgK6Qob8YfXnBuschoIC8Dxo11NQIoWMv0ui+CXwfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154673; c=relaxed/simple; bh=TNcEQrNzvvULvrZwY1bi1KT31/DfIBlyOCzRtRN9s5s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S2GFr8o+pLASLOAqZa3OD3w+Txnh/ps6NGmJ2muM4X+jJybsrS+CGuNVBtuS3oGb6JyP7QlKG4H5IfUbYTF9rk+A8H5H1DMF/aLSZQMnyWJqxE2WRWhKMuFP7OyHmiba2gT5NjUfX1uM1oxl4d7ADTGLU8HlFndM36vBPFyyrew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OkyK9M7L; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OkyK9M7L" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-47796a837c7so43378535e9.0 for ; Wed, 26 Nov 2025 02:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764154670; x=1764759470; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tm65IZSOvcLW22I95NQ1DesGTVpSHNfrfkgnxYh1pRw=; b=OkyK9M7L6IOvvT6J+v0UGLo0uuw5r0xC08qh3dKepdFl4dbEJWPcKzVGNcaZaEcUSj Nib1ZduXnzxXdaJrP51FuHvUvAKJE0n9ms2Uy2nygxVlCwToVUKYfoCYXVIuLAH7XVg5 F6THHDBwFgo+BJUhstFIqTfKVXINubo54iRnLcSqdU6dEZRu6tTX5R28YDN39Noe+IGm yTScUbKMP7PnYPwTRIiotTqxVD785GrICFhl12G6aGQUefAmkk+LslGgJLgqeHN9/l4v JVwfW5z/mA859QMKrvfCXMQfr90jnMQ0Kl+dE8R7e6KsUvL+SVyEg/7qvVmmOYVlwWNQ SogQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764154670; x=1764759470; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=tm65IZSOvcLW22I95NQ1DesGTVpSHNfrfkgnxYh1pRw=; b=gMUoc0D9M5cQ2bFWcAMEdr4AFkZKshuE11+xaJa86mraNRXFpveTv6IBz25sm+uPBw FX1AhUX86EzQtYoC872qA0m7g1ihtTUzrOksavllWv7T0Su+ABgQ/r3vaZ+ejlA4iPz/ Hm6tzS7L5Na+wmkdfrOkNj5y1PWxe6/Qj2jyGwqzx//jG9R4y64PiYncM2XfJPScNxqL q6BRjQkZA3KQ80B+dgN+VipOP03/sbc1xPkrpgTdRWAdElWiW+Lcn/mRXEbOfclTXpyX kM6I3iAirIweanYy4uz8H4ZByQpovp//zeGANGmxygHHaLUEefrkVUXQA8GRUCwghlvG QIUg== X-Forwarded-Encrypted: i=1; AJvYcCUtFvJsH4uvcpzrol5O/5Y7fubd5Kwao6nZygN8wBfO7PNW/B0mKQ5XM43AcM1+x809TuAICnRmB3GdfGE=@vger.kernel.org X-Gm-Message-State: AOJu0YyD43hy+5DSBis+QelD8xzi9pJcaBMGW69dUJu8f08L5uXrMNMV BdZl9lu9JF91gVUDbta5D6NnGC46PPjJhl8F5WJh+L9PzaqbY0rtHkWOa/mKbX66AGo= X-Gm-Gg: ASbGncs/fDAIHrH2UhiIyFuew6+HEKHIqySKL3/R7NPhg18jFcBsyJbThAdjXf5o21p EXB/VSYbVFCWvU+saZTFhhTErfcf6BEOWjABTHfqx1Rg9DCYabfo6ftBx8XeR4TXaUEF9qYL9Tm 2485B8EuermiyXHArXm/11wGM4OSz+65IZg7cUlEnWRIk/q6LDpaKS/p90pnHB2UrCNHG2F8rsW UF7wFkgTyEicI9kifVzNTEwz+VrYhTUceUGGPaj4M/HCdsh477j1o7qkg6dlJpngX0POaM1uSCU w2WJHeGy116w2vVmG/jiJZsyrXitstfEAhYw/0EVN7h/28q87HiymrevWwrFSr1cuPoFwDZHbq+ YyFcsCcDWBKCZAvYUOnWinRsTtTLSSkUhuVAiDbX1VJToR9seadcxqTEuzue3uVAkNMNe0Mkkj5 UTFELMseXOC9Oo1vXcEnzj X-Google-Smtp-Source: AGHT+IGJ2v0yxKZrimXOs4gdJGwyABW10H3d7x7EO5UfBg1Qo/N3VaSJ69gFaHjyPQmsOrFh8yPBvA== X-Received: by 2002:a05:600c:3541:b0:477:7f4a:44b4 with SMTP id 5b1f17b1804b1-477c0162dfamr184534115e9.1.1764154670166; Wed, 26 Nov 2025 02:57:50 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790ade13ddsm36991765e9.8.2025.11.26.02.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 02:57:49 -0800 (PST) From: James Clark Date: Wed, 26 Nov 2025 10:54:37 +0000 Subject: [PATCH v7 08/13] coresight: Interpret perf config with ATTR_CFG_GET_FLD() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251126-james-cs-syncfreq-v7-8-7fae5e0e5e16@linaro.org> References: <20251126-james-cs-syncfreq-v7-0-7fae5e0e5e16@linaro.org> In-Reply-To: <20251126-james-cs-syncfreq-v7-0-7fae5e0e5e16@linaro.org> To: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jonathan Corbet , Leo Yan , Randy Dunlap Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, James Clark X-Mailer: b4 0.14.0 The "config:" string construction in format_attr_contextid_show() can be removed because it either showed the existing context1 or context2 formats which have already been generated, so can be called themselves. The other conversions are straightforward replacements. Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-etm-perf.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index bf4b105e0f41..3c8a6f795094 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -77,10 +77,9 @@ static ssize_t format_attr_contextid_show(struct device = *dev, struct device_attribute *attr, char *page) { - int pid_fmt =3D ETM_OPT_CTXTID; - - pid_fmt =3D is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; - return sprintf(page, "config:%d\n", pid_fmt); + if (is_kernel_in_hyp_mode()) + return contextid2_show(dev, attr, page); + return contextid1_show(dev, attr, page); } =20 static struct device_attribute format_attr_contextid =3D @@ -319,7 +318,7 @@ static bool sinks_compatible(struct coresight_device *a, static void *etm_setup_aux(struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - u32 id, cfg_hash; + u32 sink_hash, cfg_hash; int cpu =3D event->cpu; cpumask_t *mask; struct coresight_device *sink =3D NULL; @@ -332,13 +331,12 @@ static void *etm_setup_aux(struct perf_event *event, = void **pages, INIT_WORK(&event_data->work, free_event_data); =20 /* First get the selected sink from user space. */ - if (event->attr.config2 & GENMASK_ULL(31, 0)) { - id =3D (u32)event->attr.config2; - sink =3D user_sink =3D coresight_get_sink_by_id(id); - } + sink_hash =3D ATTR_CFG_GET_FLD(&event->attr, sinkid); + if (sink_hash) + sink =3D user_sink =3D coresight_get_sink_by_id(sink_hash); =20 /* check if user wants a coresight configuration selected */ - cfg_hash =3D (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32); + cfg_hash =3D ATTR_CFG_GET_FLD(&event->attr, configid); if (cfg_hash) { if (cscfg_activate_config(cfg_hash)) goto err; --=20 2.34.1