From patchwork Tue Jun 25 02:12:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Gan X-Patchwork-Id: 13710450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46228C2BD09 for ; Tue, 25 Jun 2024 02:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dbZHrYJd/1iSj/Un5JYJPB/0IbbBuVdpQP3hqoiLc4M=; b=thL2z00cGYR7AioBCsN7nlHBb8 b53Wm3bh5kTwSxHWY4s+wTmDm4hpvkiL2VXIzHVre4FpaNoKuklVOCaLd6+AGKDHfEiaembErgJnS 5tqIZ5S7yVkqv+t3DFZD68TVKqhy9MZCmQrD4Hqxt8kt+LTiH9rzqvp84TVpvpzomwcNrvCS1Dkyk HLUzXDoaU2SWdYzSktXI+anICrIIZbrndeVr10uW3JYc4Xxf9PZ/p3AnKjAea64cu9jqza1zQK8Y1 CEVqvPi5Y3+KKrPMy/Sm+JFCcvqpfRSloUXrj/dG437kNroieZ8jQCx/FMAwScQUIwrpkOJNGuO+n dRoA8asA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLvfy-00000001IxX-2aaJ; Tue, 25 Jun 2024 02:12:54 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLvfs-00000001IwM-28RP for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 02:12:50 +0000 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45OIfuTA031942; Tue, 25 Jun 2024 02:12:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=dbZHrYJd/1iSj/Un5JYJPB /0IbbBuVdpQP3hqoiLc4M=; b=o9bhcA56LZdCx2/9/oUH8mcDwC/dCpY6U7BWyS NU12yebrNsEe6U75zbgSKdaHRNOF6HReKqInak/lk6a+gxKmQNc4vEphoXYqcfnm 9zn+tqzKxrRJCE+YBuOmE7gTT/KMaNnhdylCbXscKlF1EllMVYh79dkg7ylAgbGl 9upIO2ELMuvceTeRQcS4jzIzeG7idGGdkzhlLo+c4xmUagU966ytwt6+39O78bhO QEWxLX93xFcVP0wExlSJf3XOtF9KLXqZ1iK5YwoSu+0C7XsxkX/lamcldnFj+CAN aQM0YBnGU+CdhE/VB3ljmMy+x740jYIrBxkp93LVKAOvn9Kg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ywppv53g2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jun 2024 02:12:38 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 45P2Ca9K016792 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jun 2024 02:12:36 GMT Received: from jiegan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 24 Jun 2024 19:12:29 -0700 From: Jie Gan To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Jinlong Mao , Greg Kroah-Hartman , , , , , Tingwei Zhang , Yuanfang Zhang , Tao Zhang , Trilok Soni , Song Chai , , , , , , , , , Subject: [PATCH] Coresight: Set correct cs_mode for TPDM to fix disable issue Date: Tue, 25 Jun 2024 10:12:12 +0800 Message-ID: <20240625021212.1443304-1-quic_jiegan@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: TWm0AB9-P3ksuzcce7YIaMuRuSK0qjc9 X-Proofpoint-ORIG-GUID: TWm0AB9-P3ksuzcce7YIaMuRuSK0qjc9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_22,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 mlxscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406250016 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_191248_775585_54A7B572 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The coresight_disable_source_sysfs function should verify the mode of the coresight device before disabling the source. However, the mode for the TPDM device is always set to CS_MODE_DISABLED, resulting in the check consistently failing. As a result, TPDM cannot be properly disabled. To fix the issue: Configure CS_MODE_SYSFS/CS_MODE_PERF during the enablement of TPDM. Configure CS_MODE_DISABLED during the disablement of TPDM. Fixes: 1f5149c7751c("coresight: Move all sysfs code to sysfs file") Signed-off-by: Jie Gan --- drivers/hwtracing/coresight/coresight-tpdm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index a9708ab0d488..90a5105f6199 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -449,6 +449,11 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event, return -EBUSY; } + if (!coresight_take_mode(csdev, mode)) { + spin_unlock(&drvdata->spinlock); + return -EBUSY; + } + __tpdm_enable(drvdata); drvdata->enable = true; spin_unlock(&drvdata->spinlock); @@ -506,6 +511,7 @@ static void tpdm_disable(struct coresight_device *csdev, } __tpdm_disable(drvdata); + coresight_set_mode(csdev, CS_MODE_DISABLED); drvdata->enable = false; spin_unlock(&drvdata->spinlock);