From patchwork Mon Jul 4 11:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Gondois X-Patchwork-Id: 587374 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67FD1CCA479 for ; Mon, 4 Jul 2022 11:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233427AbiGDL2g (ORCPT ); Mon, 4 Jul 2022 07:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233823AbiGDL2c (ORCPT ); Mon, 4 Jul 2022 07:28:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EA9176458; Mon, 4 Jul 2022 04:28:29 -0700 (PDT) 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 1044523A; Mon, 4 Jul 2022 04:28:30 -0700 (PDT) Received: from pierre123.arm.com (unknown [10.57.41.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 626FA3F66F; Mon, 4 Jul 2022 04:28:27 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Ionela.Voinescu@arm.com, Dietmar.Eggemann@arm.com, Pierre Gondois , "Rafael J. Wysocki" , Viresh Kumar , Andy Gross , Bjorn Andersson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 1/4] cpufreq: qcom-hw: Reset cancel_throttle when policy is re-enabled Date: Mon, 4 Jul 2022 13:27:36 +0200 Message-Id: <20220704112739.3020516-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704112739.3020516-1-pierre.gondois@arm.com> References: <20220704112739.3020516-1-pierre.gondois@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If LMH (Limits Management Hardware) is available, when a policy is disabled by unplugging the last online CPU of policy->cpus, qcom_cpufreq_hw_cpu_offline() sets cancel_throttle=true. cancel_throttle is not reset when the policy is re-enabled with any of the CPU in policy->cpus being plugged in. So reset it. This patch also adds an early exit check. Signed-off-by: Pierre Gondois --- drivers/cpufreq/qcom-cpufreq-hw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 36c79580fba2..8e5eeb982ebd 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -445,6 +445,10 @@ static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy) if (data->throttle_irq <= 0) return 0; + mutex_lock(&data->throttle_lock); + data->cancel_throttle = false; + mutex_unlock(&data->throttle_lock); + ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus); if (ret) dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",