Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6484527rwl; Mon, 9 Jan 2023 08:55:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXsOxDouLIlG0nK97j6Oe1jBTh5hd6VGqVaQqZOEYpzxc7T4Bl+hhTwAj0pXlt8jmg9PDuGE X-Received: by 2002:aa7:87c7:0:b0:57a:9b14:69b7 with SMTP id i7-20020aa787c7000000b0057a9b1469b7mr63264005pfo.0.1673283347818; Mon, 09 Jan 2023 08:55:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673283347; cv=none; d=google.com; s=arc-20160816; b=tYTyBL7sOBO23cAAhOAtWuUox/yKvva7yrE+LUPJGEKkHNk9n5zVxgD1uGGqQn7Wft t4i1ZH/Uhv15aOgPFAq4pMXks6v0OnKbqQm28eUnI2MlU68Cw7drhCJoyYvICHMNSrjX LFkdndOTQFb2UNNjT4pdMaQBwxGew+mcCGGmx2KF3F/rlXEqXynVsC1A+ApHRa97pC/v 6X+h45yjfl+z0hyZ5FSi4LBbz1pNF56j99Qag83LfVFdHCLaipJNONe2iV8jxSNmTzYX yPd/ySQjre0k2/4RISgsmqM1y431e8OJgQdL158qc9ulAvdt4VMd7fT3+D8t7jvTPwJ2 B+eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=F965YXBKBunT6Z/l9HWnM6D/sBJ00LdAF63rYf1nqxo=; b=DP7+RWg2MZHCp1u7Q5DzQ7+RDnLJqAqMkJIZH9POcSHe5RiJeIZnPkiU+VoiDswl1h ytKvuqOedyXq3Jr/Qay4uNnlCghbCb1+kVDuaXFAn4HlIlXS7z/1/6TpRR77ReLRYIBe 7LXupD0V1wTojW/eSdb4Q3cnhVsmLJzx6a29rdP5antMWEP/z5Topnp3b32Q2T+Vq5GW kqI1usCogbVJP5abpW9mfeagM5DytmlsdH3nzi91BZP2DyqG/uJ4J0EBDh2UXQCzLfi/ qNTagT0U2c5ixB3h52yXN3QHE87KL2pWzKa0RC8qciAjGvBO8k8bA3hyAyYl9xMhLG5U /YIg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056a001ad400b00579f5a64843si10319470pfv.96.2023.01.09.08.55.41; Mon, 09 Jan 2023 08:55:47 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235272AbjAIQt0 (ORCPT + 53 others); Mon, 9 Jan 2023 11:49:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236994AbjAIQtA (ORCPT ); Mon, 9 Jan 2023 11:49:00 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D21F44C55 for ; Mon, 9 Jan 2023 08:47:44 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DFBC4AD7; Mon, 9 Jan 2023 08:47:57 -0800 (PST) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6E3C03F587; Mon, 9 Jan 2023 08:47:14 -0800 (PST) Message-ID: <91bd54ff-f1e3-aa6b-8446-ad73916be6a7@arm.com> Date: Mon, 9 Jan 2023 16:47:12 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 2/3] coresight: cti: Add PM runtime call in enable_store To: James Clark , coresight@lists.linaro.org, quic_jinlmao@quicinc.com, mike.leach@linaro.org Cc: Mathieu Poirier , Leo Yan , Alexander Shishkin , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230106152331.1374973-1-james.clark@arm.com> <20230106152331.1374973-3-james.clark@arm.com> Content-Language: en-US From: Suzuki K Poulose In-Reply-To: <20230106152331.1374973-3-james.clark@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On 06/01/2023 15:23, James Clark wrote: > From: Mao Jinlong > > 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. > > Fixes: 6746eae4bbad ("coresight: cti: Fix hang in cti_disable_hw()") > Signed-off-by: Mao Jinlong > [Change to only call pm_runtime_put if a disable happened] > Signed-off-by: James Clark > --- > drivers/hwtracing/coresight/coresight-cti-sysfs.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c > index 6d59c815ecf5..71e7a8266bb3 100644 > --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c > +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c > @@ -108,10 +108,19 @@ 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); > + if (!ret) > + pm_runtime_put(dev->parent); > + } > + > if (ret) > return ret; > return size; Looks good to me. @Mao Jinolong, Are you able to test the patches 1 & 2 and confirm they solve your issue ? Suzuki