From nobody Tue Apr 7 15:28:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 38BED37416C for ; Thu, 26 Feb 2026 02:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772071536; cv=none; b=AHoPV0ekF65Sn8UGuYHfs3QDxscMr8m6uZd7sHW/chhcnkm4kPbKFE9tVq4nOndriH9yoJrMB1dARnuBU9jHmkeIUPH5sdta6xS1rVOttvGL6eLsUMbRavGQmCjiXM8R7u4MC2f2cbZODtSArZdK86m00mYQfgYCsnwUK3XkTzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772071536; c=relaxed/simple; bh=UrpgWf+xJx6aMMqxAJ6EHYzF2xVosrLWfQsXPJkdtCw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jd7fyhtkWiXmMEsvQ8EsCNjj9eibR64dnRqsdngjfHEPlRfqkLQqRpYXpxu31duTehhEPL5i40OvF1uiOskupbZ9tZ3u11EAR//TUK4sc2fa0s9m2lHUxddsy6iigAkugY+BXEZubTAWx8vZYh/nKqWJh16JH417qBQSY7Dk74U= 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=l3E2GLb2; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=H29zBOhr; arc=none smtp.client-ip=205.220.180.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="l3E2GLb2"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="H29zBOhr" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61PKJ9Z7789059 for ; Thu, 26 Feb 2026 02:05:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=Oc6efl1YSvC J4xlvycJVJOfJR851o7jM97hjpoKPK5A=; b=l3E2GLb2z5RVcsdEyc5BnEHDdw1 75My7oqor1O9wESi9ZIn2/iQitX98Q3rxhWhMD0J3IxLOX7HFNSTK4cGNgUgPz3V mkPpjLcggTD0UnCb42bOQzPv1bixc12461pczcNvsab1mbaiGJfMpbJ9B75IIeD/ 21V1eOoMYiK1ao1qYk/03/+aOlJVjMzvAtLyKLD38o1uY91nD5+6PVwC92iutd5P VVMLMCaPyv40gjv7uoVBwcZBfkyWLAmA1jDYkt3PzQjicXsBGilTJRmdh06TbSKo DDzppvtLEbEB6b6bQE3kaRZpQ9dhN7sgwLZr1Odz4RoOG5qs3xm+a4VU4Tg== Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4chyv9jgbv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 26 Feb 2026 02:05:32 +0000 (GMT) Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-7d4cf783c73so2011832a34.3 for ; Wed, 25 Feb 2026 18:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772071531; x=1772676331; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Oc6efl1YSvCJ4xlvycJVJOfJR851o7jM97hjpoKPK5A=; b=H29zBOhrTKm2WP6g+jNu61coMMptTaT6QCKkSeuUhoLMnq+i5mpsMVIpEP2nFPZHxm BA9Q26jCTeOzrO+eg0BpQnU/JhCNDJCpS8lyEUxjzTNOmBK62MTK7kiSk6VC+C1R9+JT DXZucXaI8/N6Ozlu0oJt1OvDBdBjQ+zPE0tKIdk/P49BR2XveQ2BEN0s+Qclq2zbfGyh 3SeYxSPloURnU7neBf8Xdrz/HcpiJOooDBDVmFzEpMhbzH9is88veKFgHuZo6WZSK0m7 ooEXiQyQk1uolROx0AL+BzBaMHalTDustCU2On25RQlundb24p2Wy98hABehD3WSLejM rHHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772071531; x=1772676331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Oc6efl1YSvCJ4xlvycJVJOfJR851o7jM97hjpoKPK5A=; b=CVVD2jHFbxtfcsStxvBlumWRJWIi1L7RVEjPCFvBq2bvnj3Y430ZAaBbUlQaE3zjEM LIOhbhksGnQbjyMRD8LXAtEgHH+yFkzb1X3M2MPXPhhLhNNnviM8d5F06FOLuuCTxh7g cayaZDJRM7c275jOyU2jrREA60RZugq6htY1ySaTkDyp+Cs43r4ve+OMPcbHGmPWSceH lKcyIP+Gx27UB17aJQABBlqdNuKBztvhLr0VJBf3CdnQ2xHm8ZvRKiPPRZFPugpV81in A1oi13LoFGCwrv6VFO1dx3tKKwnMqF9A0rj1IYzY5Rmz3+J1hsv+hcgmU381o8JADZ4d Vdlw== X-Forwarded-Encrypted: i=1; AJvYcCW3+sdVRRiqmJtC1Wfasd5hWyNl/TR9odbxctYQpeF3/Hda/an7H2o9cU+oGolBlOCp3wZA8/NqYyvRrdw=@vger.kernel.org X-Gm-Message-State: AOJu0YyNrn4rFjWi2jSyK1S+iyom2rAbsyQ3c39nBulE/nZ/BfEGrBv3 uEKf9Uk9y+2HiTyXXNQ6r6my/fHwj1qj3qqzlCVIiHeUcKEIGJzOr9ZjWN1uMZ2gawVk/mTZitI /YI9K/N8OTdUXK8CDXHlsmLRVMxOCdM6YEyrGXRhrJBgGXyXa7t5h+LoLZ3cPcomg84w= X-Gm-Gg: ATEYQzyfDSEr8TmiV46dCOZItcgfDfBVa3jD9xV6PwwtJ7R4SXTcxGAvwEjD7EJKpN7 ecNbkNyYywU3ZW9dUBoCBE3lx/JnYBG7UMbkzbQglrwIX6/0STxtk+D264swTefVKJWnhx2E8Ly E5sbUzzUanTpQatg27qKQBvJx4rABxZD57Jlt6lcpfkDszJqcf+DNmj7g2yFPoU3bGkoFAJXJ8C OAvtH8V6HxweRT0Tjrj3iakECDB2EYmqc/0pMSZEYYtn6fopAw5gni2aWsrXMMBX7aqA4lPa/IB Qi+K/OFRV3BBQ4WWn2F4U03GpX9Zir0CNd48qnExLVzOJzQrjki5cJzuQsSSFFK3YSmbJos1KtI FIQ4zujOzVM1t+w5n8JTPXKrktfJF4OrvKWJbXIlGNtu3QavnWllnQZJDLSERSkOTKwHKfv4I4/ Xg X-Received: by 2002:a05:6820:1c92:b0:662:f660:5a1b with SMTP id 006d021491bc7-679f3c0761emr294776eaf.0.1772071531461; Wed, 25 Feb 2026 18:05:31 -0800 (PST) X-Received: by 2002:a05:6820:1c92:b0:662:f660:5a1b with SMTP id 006d021491bc7-679f3c0761emr294769eaf.0.1772071530953; Wed, 25 Feb 2026 18:05:30 -0800 (PST) Received: from hu-songchai-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-679f2d9e8d6sm549939eaf.13.2026.02.25.18.05.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Feb 2026 18:05:30 -0800 (PST) From: Songwei Chai To: andersson@kernel.org, alexander.shishkin@linux.intel.com, mike.leach@linaro.org, konrad.dybcio@oss.qualcomm.com, suzuki.poulose@arm.com, james.clark@arm.com, krzk+dt@kernel.org, conor+dt@kernel.org Cc: Songwei Chai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, coresight@lists.linaro.org, devicetree@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH v11 7/7] qcom-tgu: Add reset node to initialize Date: Wed, 25 Feb 2026 18:04:54 -0800 Message-Id: <20260226020454.3210149-8-songwei.chai@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260226020454.3210149-1-songwei.chai@oss.qualcomm.com> References: <20260226020454.3210149-1-songwei.chai@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: Gos-k8y6_RxzoUNBSgtadAO6_xiYye6d X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI2MDAxNiBTYWx0ZWRfX5vMDZ4dqXKvf 0IeBEdGvEtimjnXzPmJG6n/bs+iZ8MickP5Wb5HF5n7r2hfldc8vgIwO0O9ltxEnWkx/1LWCmhY SKykJ+kChpezv0jOtvvosjR0bGmXj4ibkQeTQxRQVLm4Bn61P31j3J2045DdL+Q3MacUGitFJbi ACVQaRxp1eA3yDsxUMbB7IIOYukySQNTGEI0mNGQr893kyQN2xBUdUKfU9Wq8+w+Sg3tXUwOkWh lSddjCRTJbMcFGk9Fokpwx9D6iwrKqd9WGOFC/IRSdDHEOEP6RZ+tWQAl/65ESbXePNJq6E8dQh kjDEnR2G4R1qEU5tUFwsLb/9ZdGCd08OG7EXzG+u9r6JUYjnAUd9zBbXHClVcbHZrhG0hRZzwBk iR8KG4vHIWbRoy90KwuIitt4vDF1JGqI0k4NbtyXW8UsX8r+4PkVU/KADPJMRBgEQKuOaOaEAH8 zNWqBye0hVj6k1x/gSA== X-Authority-Analysis: v=2.4 cv=GZwaXAXL c=1 sm=1 tr=0 ts=699faa6c cx=c_pps a=z9lCQkyTxNhZyzAvolXo/A==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=IgPCHI2mAnvcCQI4J_AA:9 a=EyFUmsFV_t8cxB2kMr4A:22 X-Proofpoint-GUID: Gos-k8y6_RxzoUNBSgtadAO6_xiYye6d X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-25_04,2026-02-25_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602260016 Content-Type: text/plain; charset="utf-8" Add reset node to initialize the value of priority/condition_decode/condition_select/timer/counter nodes. Signed-off-by: Songwei Chai --- .../ABI/testing/sysfs-bus-amba-devices-tgu | 7 ++ drivers/hwtracing/qcom/tgu.c | 77 +++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-amba-devices-tgu b/Documen= tation/ABI/testing/sysfs-bus-amba-devices-tgu index 9daacd68eed0..3ff34a769d94 100644 --- a/Documentation/ABI/testing/sysfs-bus-amba-devices-tgu +++ b/Documentation/ABI/testing/sysfs-bus-amba-devices-tgu @@ -42,3 +42,10 @@ KernelVersion 6.20 Contact: Jinlong Mao , Songwei Chai Description: (RW) Set/Get the counter value with specific step for TGU. + +What: /sys/bus/amba/devices//reset_tgu +Date: February 2026 +KernelVersion 6.20 +Contact: Jinlong Mao , Songwei Chai +Description: + (Write) Write 1 to reset the dataset for TGU. diff --git a/drivers/hwtracing/qcom/tgu.c b/drivers/hwtracing/qcom/tgu.c index 4539415571f6..e28e6d27cf56 100644 --- a/drivers/hwtracing/qcom/tgu.c +++ b/drivers/hwtracing/qcom/tgu.c @@ -410,8 +410,85 @@ static ssize_t enable_tgu_store(struct device *dev, } static DEVICE_ATTR_RW(enable_tgu); =20 +/* reset_tgu_store - Reset Trace and Gating Unit (TGU) configuration. */ +static ssize_t reset_tgu_store(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t size) +{ + struct tgu_drvdata *drvdata =3D dev_get_drvdata(dev); + struct value_table *vt =3D drvdata->value_table; + u32 *cond_decode =3D drvdata->value_table->condition_decode; + bool need_pm_put =3D false; + unsigned long value; + int i, j, ret; + + if (kstrtoul(buf, 0, &value) || value !=3D 1) + return -EINVAL; + + spin_lock(&drvdata->lock); + if (!drvdata->enabled) { + spin_unlock(&drvdata->lock); + ret =3D pm_runtime_resume_and_get(drvdata->dev); + if (ret) + return ret; + need_pm_put =3D true; + spin_lock(&drvdata->lock); + } + + tgu_do_disable(drvdata); + + if (vt->priority) { + size_t size =3D MAX_PRIORITY * drvdata->num_step * + drvdata->num_reg * sizeof(unsigned int); + memset(vt->priority, 0, size); + } + + if (vt->condition_decode) { + size_t size =3D drvdata->num_condition_decode * + drvdata->num_step * sizeof(unsigned int); + memset(vt->condition_decode, 0, size); + } + + /* Initialize all condition registers to NOT(value=3D0x1000000) */ + for (i =3D 0; i < drvdata->num_step; i++) { + for (j =3D 0; j < drvdata->num_condition_decode; j++) { + cond_decode[calculate_array_location(drvdata, i, + TGU_CONDITION_DECODE, j)] =3D 0x1000000; + } + } + + if (vt->condition_select) { + size_t size =3D drvdata->num_condition_select * + drvdata->num_step * sizeof(unsigned int); + memset(vt->condition_select, 0, size); + } + + if (vt->timer) { + size_t size =3D (drvdata->num_step) * (drvdata->num_timer) * + sizeof(unsigned int); + memset(vt->timer, 0, size); + } + + if (vt->counter) { + size_t size =3D (drvdata->num_step) * (drvdata->num_counter) * + sizeof(unsigned int); + memset(vt->counter, 0, size); + } + + spin_unlock(&drvdata->lock); + + dev_dbg(dev, "Qualcomm-TGU reset complete\n"); + + if (need_pm_put) + pm_runtime_put(drvdata->dev); + + return size; +} +static DEVICE_ATTR_WO(reset_tgu); + static struct attribute *tgu_common_attrs[] =3D { &dev_attr_enable_tgu.attr, + &dev_attr_reset_tgu.attr, NULL, }; =20 --=20 2.34.1