Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1989715rwj; Sat, 24 Dec 2022 06:56:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoEjaoCu10JQDufMJ7DEBBwoGm7Wp6zLT3RYz3fqvynNXv04WrmNtOGGUKPHgMIZMRdLrZ X-Received: by 2002:aa7:d484:0:b0:468:ccfb:7201 with SMTP id b4-20020aa7d484000000b00468ccfb7201mr10329335edr.17.1671893770966; Sat, 24 Dec 2022 06:56:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671893770; cv=none; d=google.com; s=arc-20160816; b=b+k1NZ8JiGS2UAMOSA2dZGQ9gv4P3//6yOYM2b6TlumKdzWrsKVTVYhNHTDD0l43i4 8M2boELg+IvjxGabH/J+/4roTrOcHiOicX6cGREneyvesJFGfw8m5l87SEz7A6aEhN8x GXIPs+411U6ojDzhWyknjQ/FMzlFv1+TfZTUelQEvmTu8hgkwhZKyVKVAiMTovjRnFFn 7w36i662sig5PW9N5QWZp8x0GUNQfSGTX/Y9uFfgZiOu3+xu5Xqeltv25AdtKmwGN45f GRspWxzpl1cr1z19ivURamYs+RDR5qNGGxFnyd7ol7pu8OXmrICfOjse3ar26dce0zj6 PemQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=QPI7CpkeNFA37K/s5S0XM4qXRqVAmViGI/VD+Yhp8As=; b=oE/Hiw1V5FuHpz96SR5FEvZzg1k6xYjB5CGW4UK2OnITEuIV2X2k3i7vQ4/Q+eYmjp CM+xk8oYF1yuOzC2VPWstr9Jd0LbaEBQZ7Uq6nmhjNNPvkRW8zgZda+MXXEwQEUvskdU 9f8bjF5VfxuJS7LmRUJpuEU2geL1oJTdLzuvEQd/8qmE4I4qq5X1cpSpvNxcIPvT5emb q0IaGwuOFOJC+B80COp9hOyJ95hmuAanob96xIYQ0i92P7uIXmXYx9cR0y86Hbif0TCM AKD9Bvlp4m9ogqt823DD3Uci0X/KkRIDetdgczCTzwBeDp7wJ+LqhDyasblk2SSikhqe uvpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ELcJd5um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a05640205ce00b0047ff6d56c55si4687241edx.599.2022.12.24.06.55.55; Sat, 24 Dec 2022 06:56:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ELcJd5um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbiLXOSf (ORCPT + 66 others); Sat, 24 Dec 2022 09:18:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiLXOSd (ORCPT ); Sat, 24 Dec 2022 09:18:33 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40DA5BF51; Sat, 24 Dec 2022 06:18:32 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BOEHKE5017121; Sat, 24 Dec 2022 14:17:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=QPI7CpkeNFA37K/s5S0XM4qXRqVAmViGI/VD+Yhp8As=; b=ELcJd5umWvX6pyMYDKCF6jqNCvGskWCVALpcd+5YEIRILjVk/uut+GGZK6t0Y5giDrLr lApGMjf3hIp3KOjYYiBTfqYYba0Cw+ro/A37pcdXcauD9ksXECAiyEQIYvc/oTGGBrYu IsK2ojWh2fqqBAtMEU1X/n7LhcXFvoCj8GevHamC4tnp67KV9VOqUh73SMEzwWJ1UBOL ewcVxxkd3TCFlToOYlJ8ON6Nq8XK8H8syHo2xEUMUFrj+0fCGfhAGLA19MoXlRXzskMJ cq07ZJxHHmAfbtWrTk/9PsiYD9/Wr19UDB/E260BjD+lKno6dBT94pBCpBNJ+97Doj3w 1A== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mnrd18j0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 24 Dec 2022 14:17:20 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2BOEHJJE025679 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 24 Dec 2022 14:17:19 GMT Received: from jinlmao-gv.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sat, 24 Dec 2022 06:17:16 -0800 From: Mao Jinlong To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , Alexander Shishkin CC: Mao Jinlong , , , , Tingwei , Yuanfang Zhang , Tao Zhang , Hao Zhang , Subject: [PATCH] coresight: cti: Add PM runtime call in enable_store Date: Sat, 24 Dec 2022 22:17:00 +0800 Message-ID: <20221224141700.20891-1-quic_jinlmao@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: KV26Nt-TXqsfPjBy2G7NHCkG8XcOWXKd X-Proofpoint-GUID: KV26Nt-TXqsfPjBy2G7NHCkG8XcOWXKd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-24_06,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212240119 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit 6746eae4bbad ("coresight: cti: Fix hang in cti_disable_hw()") PM runtime calls are removed from cti_enable_hw/cti_disable_hw. When enabling CTI by writing enable sysfs node, clock for accessing CTI register won't be enabled. Device will crash due to register access issue. Add PM runtime call in enable_store to fix this issue. Signed-off-by: Mao Jinlong --- drivers/hwtracing/coresight/coresight-cti-sysfs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c index 6d59c815ecf5..b1ed424ae043 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -108,10 +108,17 @@ static ssize_t enable_store(struct device *dev, if (ret) return ret; - if (val) + if (val) { + ret = pm_runtime_resume_and_get(dev->parent); + if (ret) + return ret; ret = cti_enable(drvdata->csdev); - else + if (ret) + pm_runtime_put(dev->parent); + } else { ret = cti_disable(drvdata->csdev); + pm_runtime_put(dev->parent); + } if (ret) return ret; return size; -- 2.17.1