From nobody Fri Apr 3 04:35:26 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CA463115BC for ; Wed, 25 Mar 2026 05:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774417445; cv=none; b=JzRLnNH5pRSc3FCIYUOjbVms9B+ekFsLHwNtYM+8TZdxNBZT+I3TF5oQX7WdbbzhsrKQx4ddJB8jI95jUEejCPKNEO1hMrfTVORoQ1cOj8z5RETga1od0KAEIwxbg/7EcJ8S59HUgMUYMYcJXvD9prDmX8R7O2Y3PIIcYhynUco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774417445; c=relaxed/simple; bh=qAzZ+u/woLYDbL6f/lfFrwEnDhUdQIVjsv7FGZH74vE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FYL40GhE6HkW685LZw0YWY6fg06RehyKi1WJ4GGUoElJZNNxGs7NaqIm/z29u7pDTDAuSH9h5XfJk1eunuwVEZOM2fUgFCsUklFoSvacHLq6LdFEJ5NTcDFmnGnmS1LrqgTq7IpXlRGBA8Q1feySdGnwSmEnteLyT05Zy8fP47o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Ig+5FkGC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=EuDKMoB9; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Ig+5FkGC"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EuDKMoB9" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62P4MsVU3110426 for ; Wed, 25 Mar 2026 05:44:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 25fbS8mRuUBMqAXg6T/z6v9tHy/oYlGG8Pqk/K9vN7I=; b=Ig+5FkGCAbUc3AUE lCSSO7QnCBIRlHpyNQd7YaXWAB9WblZCVGQUtOG3F2TlXXmxLThGwS2vnessL1wX 2Qi426EWbhnTT382mRrGb0Bo0TytBN8Fo+/5D3m+BAhSM96A1sCnicmLkBmOwkO6 0rTz42x7R3JCk8GaVyTp8uh6vKlMcjpBozJl7zwht6Mik7c5jBdGYa4tuyWTAt8Q wRVyzsibalJpWMGwXPHMddMeLZC48llE4BryjJO+gGLG6Uf0KTS97D4OUD+K0giO wUhPgcZAy/55mrxZlhl+jKrJ7UHxjLxyq+rSc7LuLyaucBoXNv9KVoXT3A4yA3UO cuQiRg== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d3vhvtwqy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 25 Mar 2026 05:44:02 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2b059ab124dso64612645ad.1 for ; Tue, 24 Mar 2026 22:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774417442; x=1775022242; 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=25fbS8mRuUBMqAXg6T/z6v9tHy/oYlGG8Pqk/K9vN7I=; b=EuDKMoB96TYHULAyWdgM4H5YItMQISawG/9OFAM2yLFAKKYD4CExmnz8NLR5lNTakD wX7zLXcLvNSyfBc84sQdi1GHAPcf2kjhkfUEsj3OY1GCyJO70WTzfCqWq+objYARR4m6 Mmt44Dj9/niGVRi9UlwvQ95LbJ8hiC9Mx0bGS9zGZMWCLrqLxQAcrqBay6AkPykZW+az yp78BG+821/fgXhHIZRtO/gtiRWkPbuykYdp6FbW76ichjy3wPiqI2warPODgVvZnve6 XuhaSO6fYYQnaXmdY6UCRSklVw2qvf6RmGRbVv5CkXJ3LPMg8k505ZmwBMIYoUoOjmLg /VYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774417442; x=1775022242; 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=25fbS8mRuUBMqAXg6T/z6v9tHy/oYlGG8Pqk/K9vN7I=; b=lNR2qrF60Y21f7msgGnjbNw6k2wKPZv4e86Ix39M+rBBS/xI3EuE4oFN/7gjU6np+F fU/3Axw3p31zTpD/e4B03+tyCX1Hxu2SfqNmWHpBOty4qxDs3WtWAhGKuKvpirMj8Q/n ew1Van28FMd+m4St9URHrVwekGOtQOrn5G9x49DuLPA4/+IrUW11QlVTB0S0wxwcllrw 7Ss0HFs26g1bAILV0Ezn0gYACFT0coEdSU/gy0fgkhhBCHEKg3KO13Sj36X5AbP5Hu3n I45sgx5e3tyO2w+ZgRShdDaE1UGF8W7Q1dLPo/VIYob5n3395QV7sLhvc//06zBdpdx7 iY1Q== X-Forwarded-Encrypted: i=1; AJvYcCWeUW9wwzRmKH/tO9RI+LPgdJ19vIS0CIRVkmV7ca15V5HDBBUYt/I64dw3y00ajNE37tRJMHtw8VH9oVM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzu38jICBiETkUruNnNtm8enqXp3qUaQXSFPLmLCnN7EYeyMGVT awGCmc0NyRyp9iMFtG6wLSh9KG9nCCpD6niGxWGK9nuBMJrJ/pZiBKkABdXuolCthQExnf5IbQU ZGPMyLum/oaeklDS2PXJAeLJZj7QUuGCYD210EAFrG6IqBGtG7YBOHi5OrmYL7/g9qGr954gS2R o= X-Gm-Gg: ATEYQzzWqKPLW8J7Dty73GUBJJHEBTlbN1W0fmnZbAANGYBDQ/N+0PGPaQ98nZ0Zpgl MdaZ/P055LL2zi1iUNmWKFvNWgYzSxqw+9L7JGzmW+kbybnl1+dE3aX3hCaqVyIuBCj6NQaGH+0 KU0UqeVXHJqtw57iRAzj5kc6C3bvCnTutk2MN8mVwcfoP7azPpO5ywRbkkTUjYSI9M2gxmg8hMx 2R9ITIz5Jmgu13hS5SYPjPBCMUSEMLyBCJLZ32QnMMP8l/j3YK6INUq7nppZVFJl/7z+BhsRVB0 iCWuX3PU9w4SnDlFhRDXpfYPE8fxnAhURG4QSj/HiHeCq5lNVmX2skU9AZ6rTKMLVk1NrF1wFj3 9Ki1kKBrctWC1/CLnQIJA8jSEzeYahe/+BN0i+CR6rRglVVprUDItCzIEFwT+YQFanoxm08pmtx JZ6a7+qyR/obrJrw== X-Received: by 2002:a17:903:234a:b0:2ae:4445:f39a with SMTP id d9443c01a7336-2b0b099d271mr24386435ad.7.1774417441582; Tue, 24 Mar 2026 22:44:01 -0700 (PDT) X-Received: by 2002:a17:903:234a:b0:2ae:4445:f39a with SMTP id d9443c01a7336-2b0b099d271mr24386175ad.7.1774417440961; Tue, 24 Mar 2026 22:44:00 -0700 (PDT) Received: from jinlmao-gv.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0836556f6sm219985805ad.49.2026.03.24.22.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 22:44:00 -0700 (PDT) From: Yingchao Deng Date: Wed, 25 Mar 2026 13:43:44 +0800 Subject: [PATCH v7 1/4] coresight: cti: Convert trigger usage fields to dynamic bitmaps and arrays 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: <20260325-extended_cti-v7-1-bb406005089f@oss.qualcomm.com> References: <20260325-extended_cti-v7-0-bb406005089f@oss.qualcomm.com> In-Reply-To: <20260325-extended_cti-v7-0-bb406005089f@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , Alexander Shishkin Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Jinlong Mao , Tingwei Zhang , Jie Gan , quic_yingdeng@quicinc.com, Yingchao Deng X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774417433; l=10928; i=yingchao.deng@oss.qualcomm.com; s=20260324; h=from:subject:message-id; bh=qAzZ+u/woLYDbL6f/lfFrwEnDhUdQIVjsv7FGZH74vE=; b=0Kh5Lc/nzRfpzwGgV7GyzeF6MuKhH7iWTmlVU6okSE1pU+fbUygtkD5sBgvzeufPgQgZggox0 XwhjY48/XQTCfZQzqSbUb8uHubuvZ8ewW83DFQpsqUCXURAkMztduz1 X-Developer-Key: i=yingchao.deng@oss.qualcomm.com; a=ed25519; pk=5tp504LR96W2IVT3sAbRCqWtoG16CxJVUnXJSfU8NlQ= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzI1MDAzOCBTYWx0ZWRfXwNuqL4QSCm2k cWTeGIhYdmQeRqTV2v5a+wcNXAZTNK8UPEecGQqtCWwS+dc/sk+KU5D/UHpNsRyVx3xxYAirH63 OJbXFBJgVRgC9Z1HH0EaFMH1wrWd8r4ENAISGKU8aUbQT4dokB/sHeXflaJMt7P3s77pyDsSjx/ vvkwq+MNsORl0XKtc9ai6btT4HvPwzNCPp4eiZVV9jGYOUiQ2PIdogBbcOsDtrFXf7RZYcbWPOb q6LO3F+9z7saViDUG74Bob6nEPubarih1CX135sJZvFEgj4u/mfq78nMBY7aBmANQ88ZKzU+lXe A2WZmtBvVkKjvTtjzH1zBXZPuKcGSWP17pJi/juJEpeMK856XMPkSJ1e1h4EQSQtQiUhk2kvUyz PS2Sw1KmDz/9maPFC4rmqkRDT6rI2QbVd8LPEUIzWCpyHCd7YS6dAA+y8DTO6vvHNf/ARTylnrj jJlVh64t9LMhsM1XBxg== X-Authority-Analysis: v=2.4 cv=P5M3RyAu c=1 sm=1 tr=0 ts=69c37622 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=gAozoMUHzvVhJ8WkzYYA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: 0zwPGJdrAtp6OcHZMvrAFUKKlPARlx_w X-Proofpoint-GUID: 0zwPGJdrAtp6OcHZMvrAFUKKlPARlx_w X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-25_02,2026-03-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 spamscore=0 bulkscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603250038 Replace the fixed-size u32 fields in the cti_config and cti_trig_grp structure with dynamically allocated bitmaps and arrays. This allows memory to be allocated based on the actual number of triggers during probe time, reducing memory footprint and improving scalability for platforms with varying trigger counts. Signed-off-by: Yingchao Deng --- drivers/hwtracing/coresight/coresight-cti-core.c | 57 ++++++++++++++++--= ---- .../hwtracing/coresight/coresight-cti-platform.c | 16 +++--- drivers/hwtracing/coresight/coresight-cti-sysfs.c | 13 ++--- drivers/hwtracing/coresight/coresight-cti.h | 12 ++--- 4 files changed, 62 insertions(+), 36 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwt= racing/coresight/coresight-cti-core.c index 2f4c9362709a..d5cb94e33184 100644 --- a/drivers/hwtracing/coresight/coresight-cti-core.c +++ b/drivers/hwtracing/coresight/coresight-cti-core.c @@ -161,8 +161,8 @@ void cti_write_intack(struct device *dev, u32 ackval) /* DEVID[19:16] - number of CTM channels */ #define CTI_DEVID_CTMCHANNELS(devid_val) ((int) BMVAL(devid_val, 16, 19)) =20 -static void cti_set_default_config(struct device *dev, - struct cti_drvdata *drvdata) +static int cti_set_default_config(struct device *dev, + struct cti_drvdata *drvdata) { struct cti_config *config =3D &drvdata->config; u32 devid; @@ -181,6 +181,26 @@ static void cti_set_default_config(struct device *dev, config->nr_trig_max =3D CTIINOUTEN_MAX; } =20 + config->trig_in_use =3D devm_bitmap_zalloc(dev, config->nr_trig_max, GFP_= KERNEL); + if (!config->trig_in_use) + return -ENOMEM; + + config->trig_out_use =3D devm_bitmap_zalloc(dev, config->nr_trig_max, GFP= _KERNEL); + if (!config->trig_out_use) + return -ENOMEM; + + config->trig_out_filter =3D devm_bitmap_zalloc(dev, config->nr_trig_max, = GFP_KERNEL); + if (!config->trig_out_filter) + return -ENOMEM; + + config->ctiinen =3D devm_kcalloc(dev, config->nr_trig_max, sizeof(u32), G= FP_KERNEL); + if (!config->ctiinen) + return -ENOMEM; + + config->ctiouten =3D devm_kcalloc(dev, config->nr_trig_max, sizeof(u32), = GFP_KERNEL); + if (!config->ctiouten) + return -ENOMEM; + config->nr_ctm_channels =3D CTI_DEVID_CTMCHANNELS(devid); =20 /* Most regs default to 0 as zalloc'ed except...*/ @@ -189,6 +209,7 @@ static void cti_set_default_config(struct device *dev, config->enable_req_count =3D 0; =20 config->asicctl_impl =3D !!FIELD_GET(GENMASK(4, 0), devid); + return 0; } =20 /* @@ -219,8 +240,10 @@ int cti_add_connection_entry(struct device *dev, struc= t cti_drvdata *drvdata, cti_dev->nr_trig_con++; =20 /* add connection usage bit info to overall info */ - drvdata->config.trig_in_use |=3D tc->con_in->used_mask; - drvdata->config.trig_out_use |=3D tc->con_out->used_mask; + bitmap_or(drvdata->config.trig_in_use, drvdata->config.trig_in_use, + tc->con_in->used_mask, drvdata->config.nr_trig_max); + bitmap_or(drvdata->config.trig_out_use, drvdata->config.trig_out_use, + tc->con_out->used_mask, drvdata->config.nr_trig_max); =20 return 0; } @@ -242,12 +265,20 @@ struct cti_trig_con *cti_allocate_trig_con(struct dev= ice *dev, int in_sigs, if (!in) return NULL; =20 + in->used_mask =3D devm_bitmap_alloc(dev, in_sigs, GFP_KERNEL); + if (!in->used_mask) + return NULL; + out =3D devm_kzalloc(dev, offsetof(struct cti_trig_grp, sig_types[out_sigs]), GFP_KERNEL); if (!out) return NULL; =20 + out->used_mask =3D devm_bitmap_alloc(dev, out_sigs, GFP_KERNEL); + if (!out->used_mask) + return NULL; + tc->con_in =3D in; tc->con_out =3D out; tc->con_in->nr_sigs =3D in_sigs; @@ -263,7 +294,6 @@ int cti_add_default_connection(struct device *dev, stru= ct cti_drvdata *drvdata) { int ret =3D 0; int n_trigs =3D drvdata->config.nr_trig_max; - u32 n_trig_mask =3D GENMASK(n_trigs - 1, 0); struct cti_trig_con *tc =3D NULL; =20 /* @@ -274,8 +304,8 @@ int cti_add_default_connection(struct device *dev, stru= ct cti_drvdata *drvdata) if (!tc) return -ENOMEM; =20 - tc->con_in->used_mask =3D n_trig_mask; - tc->con_out->used_mask =3D n_trig_mask; + bitmap_fill(tc->con_in->used_mask, n_trigs); + bitmap_fill(tc->con_out->used_mask, n_trigs); ret =3D cti_add_connection_entry(dev, drvdata, tc, NULL, "default"); return ret; } @@ -288,7 +318,6 @@ int cti_channel_trig_op(struct device *dev, enum cti_ch= an_op op, { struct cti_drvdata *drvdata =3D dev_get_drvdata(dev->parent); struct cti_config *config =3D &drvdata->config; - u32 trig_bitmask; u32 chan_bitmask; u32 reg_value; int reg_offset; @@ -298,18 +327,16 @@ int cti_channel_trig_op(struct device *dev, enum cti_= chan_op op, (trigger_idx >=3D config->nr_trig_max)) return -EINVAL; =20 - trig_bitmask =3D BIT(trigger_idx); - /* ensure registered triggers and not out filtered */ if (direction =3D=3D CTI_TRIG_IN) { - if (!(trig_bitmask & config->trig_in_use)) + if (!(test_bit(trigger_idx, config->trig_in_use))) return -EINVAL; } else { - if (!(trig_bitmask & config->trig_out_use)) + if (!(test_bit(trigger_idx, config->trig_out_use))) return -EINVAL; =20 if ((config->trig_filter_enable) && - (config->trig_out_filter & trig_bitmask)) + test_bit(trigger_idx, config->trig_out_filter)) return -EINVAL; } =20 @@ -687,7 +714,9 @@ static int cti_probe(struct amba_device *adev, const st= ruct amba_id *id) raw_spin_lock_init(&drvdata->spinlock); =20 /* initialise CTI driver config values */ - cti_set_default_config(dev, drvdata); + ret =3D cti_set_default_config(dev, drvdata); + if (ret) + return ret; =20 pdata =3D coresight_cti_get_platform_data(dev); if (IS_ERR(pdata)) { diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers= /hwtracing/coresight/coresight-cti-platform.c index 4eff96f48594..af5f45c6fcf0 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -136,8 +136,8 @@ static int cti_plat_create_v8_etm_connection(struct dev= ice *dev, goto create_v8_etm_out; =20 /* build connection data */ - tc->con_in->used_mask =3D 0xF0; /* sigs <4,5,6,7> */ - tc->con_out->used_mask =3D 0xF0; /* sigs <4,5,6,7> */ + bitmap_set(tc->con_in->used_mask, 4, 4); /* sigs <4,5,6,7> */ + bitmap_set(tc->con_out->used_mask, 4, 4); /* sigs <4,5,6,7> */ =20 /* * The EXTOUT type signals from the ETM are connected to a set of input @@ -194,10 +194,10 @@ static int cti_plat_create_v8_connections(struct devi= ce *dev, goto of_create_v8_out; =20 /* Set the v8 PE CTI connection data */ - tc->con_in->used_mask =3D 0x3; /* sigs <0 1> */ + bitmap_set(tc->con_in->used_mask, 0, 2); /* sigs <0 1> */ tc->con_in->sig_types[0] =3D PE_DBGTRIGGER; tc->con_in->sig_types[1] =3D PE_PMUIRQ; - tc->con_out->used_mask =3D 0x7; /* sigs <0 1 2 > */ + bitmap_set(tc->con_out->used_mask, 0, 3); /* sigs <0 1 2 > */ tc->con_out->sig_types[0] =3D PE_EDBGREQ; tc->con_out->sig_types[1] =3D PE_DBGRESTART; tc->con_out->sig_types[2] =3D PE_CTIIRQ; @@ -213,7 +213,7 @@ static int cti_plat_create_v8_connections(struct device= *dev, goto of_create_v8_out; =20 /* filter pe_edbgreq - PE trigout sig <0> */ - drvdata->config.trig_out_filter |=3D 0x1; + set_bit(0, drvdata->config.trig_out_filter); =20 of_create_v8_out: return ret; @@ -257,7 +257,7 @@ static int cti_plat_read_trig_group(struct cti_trig_grp= *tgrp, if (!err) { /* set the signal usage mask */ for (idx =3D 0; idx < tgrp->nr_sigs; idx++) - tgrp->used_mask |=3D BIT(values[idx]); + set_bit(values[idx], tgrp->used_mask); } =20 kfree(values); @@ -331,7 +331,9 @@ static int cti_plat_process_filter_sigs(struct cti_drvd= ata *drvdata, =20 err =3D cti_plat_read_trig_group(tg, fwnode, CTI_DT_FILTER_OUT_SIGS); if (!err) - drvdata->config.trig_out_filter |=3D tg->used_mask; + bitmap_or(drvdata->config.trig_out_filter, + drvdata->config.trig_out_filter, + tg->used_mask, drvdata->config.nr_trig_max); =20 kfree(tg); return err; diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hw= tracing/coresight/coresight-cti-sysfs.c index 4c0a60840efb..88f8a08ef778 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -720,12 +720,9 @@ static ssize_t trigout_filtered_show(struct device *de= v, { struct cti_drvdata *drvdata =3D dev_get_drvdata(dev->parent); struct cti_config *cfg =3D &drvdata->config; - int size =3D 0, nr_trig_max =3D cfg->nr_trig_max; - unsigned long mask =3D cfg->trig_out_filter; + int nr_trig_max =3D cfg->nr_trig_max; =20 - if (mask) - size =3D bitmap_print_to_pagebuf(true, buf, &mask, nr_trig_max); - return size; + return bitmap_print_to_pagebuf(true, buf, cfg->trig_out_filter, nr_trig_m= ax); } static DEVICE_ATTR_RO(trigout_filtered); =20 @@ -934,9 +931,8 @@ static ssize_t trigin_sig_show(struct device *dev, struct cti_trig_con *con =3D (struct cti_trig_con *)ext_attr->var; struct cti_drvdata *drvdata =3D dev_get_drvdata(dev->parent); struct cti_config *cfg =3D &drvdata->config; - unsigned long mask =3D con->con_in->used_mask; =20 - return bitmap_print_to_pagebuf(true, buf, &mask, cfg->nr_trig_max); + return bitmap_print_to_pagebuf(true, buf, con->con_in->used_mask, cfg->nr= _trig_max); } =20 static ssize_t trigout_sig_show(struct device *dev, @@ -948,9 +944,8 @@ static ssize_t trigout_sig_show(struct device *dev, struct cti_trig_con *con =3D (struct cti_trig_con *)ext_attr->var; struct cti_drvdata *drvdata =3D dev_get_drvdata(dev->parent); struct cti_config *cfg =3D &drvdata->config; - unsigned long mask =3D con->con_out->used_mask; =20 - return bitmap_print_to_pagebuf(true, buf, &mask, cfg->nr_trig_max); + return bitmap_print_to_pagebuf(true, buf, con->con_out->used_mask, cfg->n= r_trig_max); } =20 /* convert a sig type id to a name */ diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracin= g/coresight/coresight-cti.h index c5f9e79fabc6..ef079fc18b72 100644 --- a/drivers/hwtracing/coresight/coresight-cti.h +++ b/drivers/hwtracing/coresight/coresight-cti.h @@ -68,7 +68,7 @@ struct fwnode_handle; */ struct cti_trig_grp { int nr_sigs; - u32 used_mask; + unsigned long *used_mask; int sig_types[]; }; =20 @@ -145,17 +145,17 @@ struct cti_config { int enable_req_count; =20 /* registered triggers and filtering */ - u32 trig_in_use; - u32 trig_out_use; - u32 trig_out_filter; + unsigned long *trig_in_use; + unsigned long *trig_out_use; + unsigned long *trig_out_filter; bool trig_filter_enable; u8 xtrig_rchan_sel; =20 /* cti cross trig programmable regs */ u32 ctiappset; u8 ctiinout_sel; - u32 ctiinen[CTIINOUTEN_MAX]; - u32 ctiouten[CTIINOUTEN_MAX]; + u32 *ctiinen; + u32 *ctiouten; u32 ctigate; u32 asicctl; }; --=20 2.43.0