From patchwork Fri Jan 24 08:58:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 13949152 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 DC9B2C02181 for ; Fri, 24 Jan 2025 09:06:02 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eMlqr/+/x/eRJJM9d3zjLn1HVC6jDi6vYxdaFPI1JRA=; b=pmhZdlapmniBOyllw/rx/lFmsI ifwR42dNAz1LZVK0N+yFxHcfrAW6O5xAhurny0+eQcPWZbqMqIVk+tjHT6TtA7vQMQer/zLRHu4HS taQZPIGWyB7kzpaj8n7Cv8RurX6u5WYkA5LfezekrZzwIspSgRCbsJYaODmMTejULSobhOYsW5wsj JEozokHmJeWoAz4LN0/eJuWHKHsyBhOGJekxSdw/S4NOj/GyBENS4RPm6z6fMbStzjDuu1saePm3M 6xPr1/md2hiu5pLeqso5hJk9hLMtZf8zuakzRcOiMSr/6BMMFeQu7tENCztkC7WHf6dil8n1oUIuD 4LnjSSJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tbFdN-0000000EK6t-3vMa; Fri, 24 Jan 2025 09:05:49 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tbFWl-0000000EIo6-04yw for linux-arm-kernel@lists.infradead.org; Fri, 24 Jan 2025 08:59:00 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-218c8aca5f1so42894905ad.0 for ; Fri, 24 Jan 2025 00:58:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737709138; x=1738313938; darn=lists.infradead.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=eMlqr/+/x/eRJJM9d3zjLn1HVC6jDi6vYxdaFPI1JRA=; b=kH/alWyjl4ybqLFXdE+DYFo71ukZsR2jEHf4RsAOZg2lbY2rZA6OPOOl1B1j96KrKt AFhBIZx/6R96pu4n7ZOk7DUs1V4xtrxpaRgUQknzjfnIR4RpfwQrvqVf+EHaDzFqZcdH HlM0VZcTohTjpkx0Ud0XvFu0+HNyoRy9dX5BU3OQgyqNRy/N/Qy4XHep+EVTHybNVGlM F0/FxV42m0/PCKG/gOdhC3rknVhk04+SVODypYGiqMnMmA29LZACTbfymYte/IQ4bScj TDxxY18sgQ09qc3G2ft0XGAaDR/Ks4H5KCUgAa+fdm3J26l+qsQxxhusSPlFVbCgsAAM PTkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737709138; x=1738313938; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eMlqr/+/x/eRJJM9d3zjLn1HVC6jDi6vYxdaFPI1JRA=; b=eGsgIX6cJ3ZZW59ypyPiBko9AkO4dW/bx0tI5L63Ro+2AARLdmgaBe9s74kn3IADe3 hldDR9N5z0uoR/rgMp1XJA2VwaYjjvz7OEq4GKjjgKuCkNKUj0vBfHtk0Fqoa86Fri4x 9Jszh/3+cWbOK0fivOUhyM/alH31shvCgLh0jY0f1KvQ5k9RvAYRmXBXG/1U38Oye52R byoy5Zv3RVRVznG0o4iltgCI5CEDZja05jgLNgJvr39r8lFmeVTodeyGJwlm4ffFa11q Vz0fjrlwXovh7/xALOKKVdWv0cY2I5oQJhZ1xjPPknF/Txt031tgBsWxPbPR6pzBOXzZ oZOw== X-Forwarded-Encrypted: i=1; AJvYcCVwKrcErqtsY9VABJ/7DgwIJzu9qJ19Og3JZ57hiKmpH+3lWjVzRmHLHAdF2O4amcNhSBg8LELa1y/hBcG2C++M@lists.infradead.org X-Gm-Message-State: AOJu0YyvnWYS8VzBZOLq9iXCs63tE9x/M8VqM46FeYLw8FaDV5uMVDiO t8XmjMD5pRRyFm/bbMCMcsOj/P+4IGcfFNWCY3Zl+/bHC19UE+CDZ6WeyXp66eCnvhAQ2r+iTRs 9 X-Gm-Gg: ASbGncuD6vX7Xm3W71MDjaKa7kEiXqoMi4aXuwF68WUFgOieG1V+CRUUQMDELDzlhz0 dN8xWErqAv+G2Lvd2Rkebftc9DkObuxGZOq83Z0DwC/3M5am3dGjvowtXBDq1jFsMtKMkqASco/ peD7tvGhJ6p+IIgfgAv7M0Rb3aMg2ct7jsMNV3q/I0iiXxv01/QGk8QcQQWLlJxnpKl2RfrrTkt /NtTMCafnZpfo1t5A8fmZpSmthebGyLFeCrH6OEhS5ZW2GZhpB68rTxztM8cN9/mzo5eJFJZum7 Q7PQFLg= X-Google-Smtp-Source: AGHT+IFw8pe4tFyZIYNOF9s8Ywp9EEDR1mTMV9kBrefpwpJLLbKS7BB6GQPOd2o0T5Xa7ofgRk6iIw== X-Received: by 2002:a05:6a00:ad8a:b0:72a:bc54:84f7 with SMTP id d2e1a72fcca58-72dafa03117mr40695468b3a.12.1737709138233; Fri, 24 Jan 2025 00:58:58 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6d234fsm1337263b3a.77.2025.01.24.00.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 00:58:57 -0800 (PST) From: Viresh Kumar To: "Rafael J. Wysocki" , Hector Martin , Sven Peter , Alyssa Rosenzweig , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lifeng Zheng , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/15] cpufreq: apple: Set .set_boost directly Date: Fri, 24 Jan 2025 14:28:12 +0530 Message-Id: <417fcceae52d5173cc2606dcaafe9886fd4cfeb3.1737707712.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250124_005859_056220_08BAB2EA X-CRM114-Status: GOOD ( 13.67 ) 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 boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar --- drivers/cpufreq/apple-soc-cpufreq.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 6ff604a0fe79..4994c86feb57 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -310,15 +310,6 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy) policy->fast_switch_possible = true; policy->suspend_freq = freq_table[0].frequency; - if (policy_has_boost_freq(policy)) { - ret = cpufreq_enable_boost_support(); - if (ret) { - dev_warn(cpu_dev, "failed to enable boost: %d\n", ret); - } else { - apple_soc_cpufreq_driver.boost_enabled = true; - } - } - return 0; out_free_cpufreq_table: @@ -353,6 +344,7 @@ static struct cpufreq_driver apple_soc_cpufreq_driver = { .target_index = apple_soc_cpufreq_set_target, .fast_switch = apple_soc_cpufreq_fast_switch, .register_em = cpufreq_register_em_with_opp, + .set_boost = cpufreq_boost_set_sw, .suspend = cpufreq_generic_suspend, }; From patchwork Fri Jan 24 08:58:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 13949153 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 4158AC02181 for ; Fri, 24 Jan 2025 09:07:26 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5lzQ5jAgJPMOysDkyB7FBY4kIjh3CZ6BVNPDK8eFRq4=; b=DDQqxhtnf7kTJ+isH0NYUdc5ap yfmUEjjpvfNu7L+CoxEWsCbK7MPrIYZz0M8wIIRHCWyODjhNeLPc3u79e64RlivxBUIS3XiSjeXCt xMOaFd3nJFkBYoiEZn52bgSWh+A9oVuarzAfgTj5r8m5Fv2Zyk/tgZ9HWE0aytp9B6Lryr/Qb+Q57 xm0iT6b6UfmgwP+BPe5jjm15TGf1wW2ZfbEHl9ve8G8zciOukRxrApjb8zZeac9z4b6e3CB3p5w94 pfJ8URpLfX+mXBBpmhu/GgS3v+cmn5c7Mkd3khQRepzZQr/Q3orvQjdGLXfXSSY+pa+Fprraf5XRU EvBuXpGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tbFeh-0000000EKLl-2pXs; Fri, 24 Jan 2025 09:07:11 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tbFWu-0000000EIqe-2AG7 for linux-arm-kernel@lists.infradead.org; Fri, 24 Jan 2025 08:59:09 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2163dc5155fso33178035ad.0 for ; Fri, 24 Jan 2025 00:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737709148; x=1738313948; darn=lists.infradead.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=5lzQ5jAgJPMOysDkyB7FBY4kIjh3CZ6BVNPDK8eFRq4=; b=oB68bxpJnBGVCh4vdUE8AwOeRYe6jhB4vuUpVYaX+tsc6RV805zk9ad1dF1VqBZrku ZV9DULfUsvKMEeo5calv2iVM2Ac6ILcl0MPzGTNXcA5fV8lp0yEE1osOg96wQChYu32w fe7c1DvduAO/yjnpPZHL9EBBd2fTn3X60pK+1kCQgSpaV9bhUVK4LFeiBy08KkQmskjh W2oPnlSOW0qkRvkhrNzs7QQKImXrLXuw8mYnBlj2ttH+wWRv8+n67oGVQnBrRxKSyzYx m3blkUiR6qju8zvQBGLYWBR2sjtdU3wSSx9aaIxb0G8ulEoScz1GKKG1Qhm48Q7GssCF 8DhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737709148; x=1738313948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5lzQ5jAgJPMOysDkyB7FBY4kIjh3CZ6BVNPDK8eFRq4=; b=d6yOAxXIVhqpm1lBpPYjESwYg7PNPY12TD7Kb0HnktYJGH8z1u6QixiYJ3sXwA7jf6 JZqY5IDOXKuJOf+XDYRDSltxhApJHvE/OR7JblJmNm8H7kbKi3jFXf9a0ATQBMP+IWdT pe/QPT/s8xlwaQavLlmRmTQMCYw5f0FtGFLrO3jOwgcq6c3d3CQLIi303Qlj1jPP1nTE sUYCyIoaDfJLF2fOhn6zDP6Zb+Zu02DvCssWPA59HHrpVmGp75ip6wZ6S2O4nQvCvCWJ 26NNIRIn5/yhUWxoYyMkKAHZbfH97WzTndP2Ad3iClTyswEl0H1MaCU/iYaCpundTC6i VA3w== X-Forwarded-Encrypted: i=1; AJvYcCUngmyid2hiyyJTNJepOoBBlTOSkTZc6mQqG1GafezEjurQ66SVWCcgaKHgP4ENV5bNzTVszdMBQTIkk681t3b8@lists.infradead.org X-Gm-Message-State: AOJu0YyhZYURtzP4EhYDOtMEHXEnRJJh32hk2CJXXHi+1stG/jQ7S3ok w403uUEHzVaZ94vkqAPoC+b+TW/JjFuvNePoUfq6TGWqLAJ+ZYfZDiqX/4s/BIw= X-Gm-Gg: ASbGncv+y6gaYkQNUi3lTiZaC0Gqm9ipDvSUysMUJ0xiJsSPTqmRTvrfV1q5EFSq200 nWxOLqlBO/hBi4LIY2nCKtaVlzjQrMFu6/vXIzrk7otUYUig6XH5h/U7syRHh91wo52I3nKhSR9 OJ/gY0/g+eHv6LGdOtqyiyaN0DFPcPxrV2S/GWwyVobQuS89j4z8w0mmM+BaCVncIg/K85WAApG yda4s52lORu1FN3nlqApLxv0ukX9Ls6wPpfk6aZN4dtNXfxDEpWk0BXK3WtANd9ZxraTZE9EtBA jqzMKsI= X-Google-Smtp-Source: AGHT+IFW/BLYxcm27YoFLdxNsrAZiy/t9OXPfZRg22Xfepty1UtE6fjh27SK8kn9i9L/O6GYWvG4GQ== X-Received: by 2002:a17:902:cf0b:b0:216:2af7:a2a3 with SMTP id d9443c01a7336-21c3560726cmr494020895ad.53.1737709147994; Fri, 24 Jan 2025 00:59:07 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da3d9c55dsm11824845ad.10.2025.01.24.00.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 00:59:07 -0800 (PST) From: Viresh Kumar To: "Rafael J. Wysocki" , Sudeep Holla , Cristian Marussi , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lifeng Zheng , arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/15] cpufreq: scmi: Set .set_boost directly Date: Fri, 24 Jan 2025 14:28:15 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250124_005908_562198_057576B4 X-CRM114-Status: GOOD ( 13.69 ) 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 boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar --- drivers/cpufreq/scmi-cpufreq.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 4a3ee59cb771..ff2897789797 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -297,16 +297,6 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) policy->transition_delay_us = scmi_get_rate_limit(domain, policy->fast_switch_possible); - if (policy_has_boost_freq(policy)) { - ret = cpufreq_enable_boost_support(); - if (ret) { - dev_warn(cpu_dev, "failed to enable boost: %d\n", ret); - goto out_free_table; - } else { - scmi_cpufreq_driver.boost_enabled = true; - } - } - ret = freq_qos_add_request(&policy->constraints, &priv->limits_freq_req, FREQ_QOS_MAX, FREQ_QOS_MAX_DEFAULT_VALUE); if (ret < 0) { @@ -394,6 +384,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit, .register_em = scmi_cpufreq_register_em, + .set_boost = cpufreq_boost_set_sw, }; static int scmi_cpufreq_probe(struct scmi_device *sdev)