From nobody Tue Dec 2 02:42:37 2025 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 1D6133A1CFB for ; Tue, 18 Nov 2025 16:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763483306; cv=none; b=rwtG8Gv8sx97lA60x9ph76foxeu6ThzfwSmVGEJF1T9ffvv1Zrwzo/vapy565Z5QJvCrKnWk1r05kMu8gVyDRI1SmuAp34G37p/16wGT/sb1c3h3XZvtbG/y3ZB3b6Aa75WbHBd7vICkRpz4Rk9i74HkfMuKDUxBWHGZdxU2w7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763483306; c=relaxed/simple; bh=dzP9hXvjEFYTJ+sYEH3OS9fqnJEZYSr9lDuXso7NVaA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j5hD1nH6jmCLcVRQHVtx5l+KCFKodpWP53wl7lUMhcxamPKulktf4XPvcE2rHV9/jgYEg8n8QfXMrYzxAGO57LzFNG1KRHg6ht4aqfJSYviqchf/yBotPn1PbUPl+Fv/vlyDr5VT6xXl0Is8lk/hILUXq8wEASINkRQtv0pMtnE= 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=s6SIGZVQ; arc=none smtp.client-ip=209.85.128.42 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="s6SIGZVQ" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4779adb38d3so26952715e9.2 for ; Tue, 18 Nov 2025 08:28:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763483302; x=1764088102; 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=l9PmA5gGpR/tWp7wz6WLiRdtF8z1fVXXlKYB4lN3jNM=; b=s6SIGZVQ6ET2YQ244cAn/t/dKNMZXalrQef//gQMJ+9tuyhisGohw1xf76rRHdQUG9 IcMGiWfIN2Dq/r1PDwdQQm0T8VWcbt8B3LQ4npcuD1mtQViwUqvPRDMtEduKHWvFbbfZ 3yWul+N1oxc/ZmJg+BReE7wIBMvw0+6bNh6Cyy5szRyfKgFeIO0zswHzecDVle/CHtjm hTWIswpoM49DIMicoFTmzZTUBWn7f0m2nHSyqmJKNmtEVc9r+ChXN0eQwR9c0hxPy+yD BBPVB1QlL7i1sSUHKQsqtYxsMdo12pFiY7yKIvoZqvjPxI3YyO+lOD6XCXrOZVmOGbRd 4D6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763483302; x=1764088102; 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=l9PmA5gGpR/tWp7wz6WLiRdtF8z1fVXXlKYB4lN3jNM=; b=tf5gCpQydX6ppYb5ffdGtgz/S7XPk+Cmn0shpph09a0pGCeh9+nz3ee02EFkVd4i7b 8Y+GMoQMZoDhmevV+FTq5QPUYo3sKwMR7eG+EyCdfmCWtr+qEtUEelNrn05XNj7v/w03 p4D/iRYRoXbfMgyX5OtLIJb+LO4BhtRW8liCIN9/Pdvak+DF+JACX6V6pN0yFD3lo0Tg yNDe4R+HwA9+f1Ji+qVvrWhYnWoQdTrWhnq+bArW0c7XaX+6pXK0rrdJGo8N1YMzpyUe nVxjDH8iMa8J5ctrPI8UjSpAWitQ4VtLIWiq1WB10J+saWEVimktGq+uvIqJHSSyRiwg Mo4g== X-Forwarded-Encrypted: i=1; AJvYcCWjUGlWGyls6RWzl1nhsaEdm2Qfyg8dG2tQH4nrcV9airn9DCX7URhq/vhFkGRg+5rNQ381UY8+BzgHRmM=@vger.kernel.org X-Gm-Message-State: AOJu0YwGGCEQsXj7fd1q1BELBWXO5lfGCl3JbrBvGpbEC+5RCZ2t7UMs vRvNSxHKsK1YnmXWtfBeirpLAeRml3oF8dquKP+eLNvEOx+xGsRZ0+XPV2p0cPwhtig= X-Gm-Gg: ASbGncu2D8RN5UUCtnb8jJw0eM1eC18o/8rbg0dzZ2RRF/mNbH9FWmTqfRVs+psoHHV PgdHQONfgSlr4KY44VLHQB7vUuHco3Gg9tr7az7yHf2IkyuVZMI/uYjx2Fb9H3l9whIc2lIBF1E Fj7pRY7//R2Wh4Wt5p07PB5TjrtIAd7zXfAV8fb7wCozPd6Otk4d1vuTUUzaLEScRazQlcgGSYQ +ov+4xxPnXojvK++epbJN/yNxGMT/9gQ2OeVkeTJKBFht3anbuEe4vCzQIhMco4egmeCLTVr8/D 0M6Hy/JxQmIS4V1LijjjuHUKiIi9u5lF8bL+7gr1bMAfFMojy+PMnmOvOa3vkdGqlIbat+D/DX9 CYpvpGP/mo7lQlqihPqxUn22BsdhldB+kNTMqWZw+70hmEfK34UoZY8skjNES92b1/Osu4SN10s mTlM1iil1py7Xv5R72F6IniPu6zfpsSSQ= X-Google-Smtp-Source: AGHT+IFBsfyqI4nfvni5vPvJYY1wHrZ3i9XROTrpO6sjMJMIe4fE7Y8UeZdT+PEXWHCYRfnXU1kcgA== X-Received: by 2002:a05:600c:4685:b0:477:7a1a:4b82 with SMTP id 5b1f17b1804b1-4778fe5fb4amr166705645e9.8.1763483302373; Tue, 18 Nov 2025 08:28:22 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477a9dea7fcsm20369125e9.8.2025.11.18.08.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Nov 2025 08:28:21 -0800 (PST) From: James Clark Date: Tue, 18 Nov 2025 16:27:58 +0000 Subject: [PATCH v5 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: <20251118-james-cs-syncfreq-v5-8-82efd7b1a751@linaro.org> References: <20251118-james-cs-syncfreq-v5-0-82efd7b1a751@linaro.org> In-Reply-To: <20251118-james-cs-syncfreq-v5-0-82efd7b1a751@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 | 26 +++++++++++++++-----= ---- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwt= racing/coresight/coresight-etm-perf.c index 28f1bfc4579f..1b9ae832a576 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -80,12 +80,19 @@ static ssize_t format_attr_contextid_show(struct device= *dev, struct device_attribute *attr, char *page) { - int pid_fmt =3D ETM_OPT_CTXTID; + /* + * is_kernel_in_hyp_mode() isn't defined in arm32 so avoid calling it + * even though is_visible() prevents this function from being called. + */ +#if IS_ENABLED(CONFIG_ARM64) + if (is_kernel_in_hyp_mode()) + return contextid2_show(dev, attr, page); =20 -#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) - pid_fmt =3D is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; + return contextid1_show(dev, attr, page); +#else + WARN_ONCE(1, "ETM contextid not supported on arm32\n"); + return 0; #endif - return sprintf(page, "config:%d\n", pid_fmt); } =20 static struct device_attribute format_attr_contextid =3D @@ -337,7 +344,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; @@ -350,13 +357,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