From nobody Sat Feb 7 07:25:56 2026 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 2F86AC001B0 for ; Thu, 13 Jul 2023 14:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbjGMOS4 (ORCPT ); Thu, 13 Jul 2023 10:18:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235212AbjGMOSN (ORCPT ); Thu, 13 Jul 2023 10:18:13 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40E421BE3 for ; Thu, 13 Jul 2023 07:18:12 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4fb7589b187so1376752e87.1 for ; Thu, 13 Jul 2023 07:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257890; x=1691849890; 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=XCW60+QKZJEwgQNKCkjT3LLL/G0odRdDq+OVPuDNpv8=; b=oOxWTQL84s47HzPwib77Qkzsk0IUI6gsDA6gu4jy0Yi+N8ICwlsvxW3n48T0+dpvad +LS59ztXwWyAgcVThqitorScRIRWebmtctZCKl1/oprdbAy0u060M6pLsWLzw7sXDQ1u TZrF8pAxZ152VQlX/QZqxOgHre1rwjtsa31dvqY8h8Cge6iJER9gvbA78oChr+XqUY2t P+6Gt760N4T+lcazbAhV2N/HpewowrkJHHJuisYZQBWJeK5VKKBbVxrYs/VomTaZn8Cc JQfo0XldJbMVoHeTv1pXCF+RdgeDNE6I0D6eOi0KZ++EsX9OtZj1bayKgar/03HsJa/S ogGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257890; x=1691849890; 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=XCW60+QKZJEwgQNKCkjT3LLL/G0odRdDq+OVPuDNpv8=; b=av8PvszsF9x1vPFKzanLBmhQBhvLPE9tiUDKrgXOmcT6AvZuXNXAylQnoFlu2zc6BR w4zTe53UtwCQIUgMRgf9QUgFBjGcAjizfdSnkifIgtO2fyCjziJopvqItMZTDS2W0vTu Ej5j0pb2kNqtlOULFY1PRX4ZacU8jN+6rGXXz+NRNw6hH7N8t8vUc6cfpvEaIhhoDifT 2sZYUG3ZjLsuFmjwU+myH8oO1+RY+3DVZXtaTEqfq2iBx3VPFsM1u0Hyv7NNvTdeCntz sOKtwzc1rPZ/vmwXjXD40UfWJVRElG+GBfmHzvH1qXAPZANjNYtRL+1CRQ2WIlsq7A5Z bhgA== X-Gm-Message-State: ABy/qLYZCmygDR+IneJQ4wnNnMZ9i1jG8/tudhTLNHg+rtpSFsfdIlUx Y2sQoUaYi0Yrc9VuUl3LggIPfA== X-Google-Smtp-Source: APBJJlHhUlmQdmzVtzAmBWmH4d/Jr/axU6dbey0CJjqA6hkRispEKgjxi6n+QoR4ZZ7q3oEvSoW5zw== X-Received: by 2002:ac2:58e9:0:b0:4f8:7528:50b5 with SMTP id v9-20020ac258e9000000b004f8752850b5mr1225250lfo.14.1689257890294; Thu, 13 Jul 2023 07:18:10 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:09 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/11] firmware: arm_scmi: Extend perf protocol ops to get number of domains Date: Thu, 13 Jul 2023 16:17:28 +0200 Message-Id: <20230713141738.23970-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Similar to other protocol ops, it's useful for an scmi module driver to get the number of supported performance domains, hence let's make this available by adding a new perf protocol callback. Note that, a user is being added from subsequent changes. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/firmware/arm_scmi/perf.c | 8 ++++++++ include/linux/scmi_protocol.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/p= erf.c index ecf5c4de851b..cf7f0de4d6db 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -333,6 +333,13 @@ scmi_perf_describe_levels_get(const struct scmi_protoc= ol_handle *ph, u32 domain, return ret; } =20 +static int scmi_perf_num_domains_get(const struct scmi_protocol_handle *ph) +{ + struct scmi_perf_info *pi =3D ph->get_priv(ph); + + return pi->num_domains; +} + static int scmi_perf_mb_limits_set(const struct scmi_protocol_handle *ph, u32 domain, u32 max_perf, u32 min_perf) { @@ -687,6 +694,7 @@ scmi_power_scale_get(const struct scmi_protocol_handle = *ph) } =20 static const struct scmi_perf_proto_ops perf_proto_ops =3D { + .num_domains_get =3D scmi_perf_num_domains_get, .limits_set =3D scmi_perf_limits_set, .limits_get =3D scmi_perf_limits_get, .level_set =3D scmi_perf_level_set, diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index e6fe4f73ffe6..71b39cbbdace 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -101,6 +101,7 @@ struct scmi_clk_proto_ops { * struct scmi_perf_proto_ops - represents the various operations provided * by SCMI Performance Protocol * + * @num_domains_get: gets the number of supported performance domains * @limits_set: sets limits on the performance level of a domain * @limits_get: gets limits on the performance level of a domain * @level_set: sets the performance level of a domain @@ -120,6 +121,7 @@ struct scmi_clk_proto_ops { * or in some other (abstract) scale */ struct scmi_perf_proto_ops { + int (*num_domains_get)(const struct scmi_protocol_handle *ph); int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain, u32 max_perf, u32 min_perf); int (*limits_get)(const struct scmi_protocol_handle *ph, u32 domain, --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 8440FC001DD for ; Thu, 13 Jul 2023 14:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjGMOSf (ORCPT ); Thu, 13 Jul 2023 10:18:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235231AbjGMOSO (ORCPT ); Thu, 13 Jul 2023 10:18:14 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E1826AF for ; Thu, 13 Jul 2023 07:18:13 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fbf1f6c771so1402027e87.1 for ; Thu, 13 Jul 2023 07:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257891; x=1691849891; 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=Gh+gKUS7IMi6ThhGwyG8WEdTRY9eZfCeAwrMiJcy0S0=; b=B4jDt0oDMLMSH/SjCfe9veKB/wikJeVpnaVVOr6QY/R3rdXFS1mrBMk5ZkOtzakvu5 LefhbCwCV9iVSCUImQ2+4PWSNcF4pqxTFnBUw6AsgGL8PvyEv24iA6JhcUO274GySsT0 FG3sHH75BKWfeeydaEXIl0L4ONvf6US5UTE/kF3HDBC2SmagQD4I7iqAQ4pQUe/pCffk iwFWefirSXoFAmEgbuYynMzK+/Viogj/kAIUlk68+SwsoFMboK9K9pfFLjLsol1tc4yl AKlk8kTJ3MM1OmWVV4c6mGeH9b7lE2eEJOcDdvwgdc2Icic6MsEEkVsOi/+/XBsq7Ssf 3DSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257891; x=1691849891; 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=Gh+gKUS7IMi6ThhGwyG8WEdTRY9eZfCeAwrMiJcy0S0=; b=SdxNvlMORru/ob8Za4w0mtpOVMSmRODfi8rkNdqSk59Bf+ZvP43L1ikU1ydZsr0IFn 0udMchW+MTDBHlVB4UZVJKj4Cm0yzncUn27q1yyNbHTQfykXzA021zg2Ks8PO2LGBdvZ PnXtAmcT48vbmlwXfShUVRcA3/HDc3kHF8uWWyPVivZk1PgiKPXXeBTSj7eiRn8Hd6Ox 3H7Y44phUT2UeC+w67QhSMiKQF+qDSRcqlS6gXYyDJa14QhrhsknajslzEgW8x13uRd4 ChyKATTiKP6tSf+7MjJK/nsOuLC27AHjiZsEhm63xfUFMy9mm9GDmLLprsp//4ohTZoM 89uA== X-Gm-Message-State: ABy/qLa4k3JVIA5O5sThunTZsc3JEsGAs0qaLFzSDeRWFAd4hPKWeUuj oup+AZh/iY1CyuIAMlzlKvoMKw== X-Google-Smtp-Source: APBJJlEz8giuIUF+FvZp4ShicPkXlGdGQnC1pcMvCg2XE1TwdbGx42cyBaN6G3kevsVYkpBLwkDfvg== X-Received: by 2002:a19:6419:0:b0:4f8:5bf7:db05 with SMTP id y25-20020a196419000000b004f85bf7db05mr1256418lfb.27.1689257891550; Thu, 13 Jul 2023 07:18:11 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:11 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 02/11] firmware: arm_scmi: Extend perf protocol ops to get information of a domain Date: Thu, 13 Jul 2023 16:17:29 +0200 Message-Id: <20230713141738.23970-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Similar to other protocol ops, it's useful for an scmi module driver to get some generic information of a performance domain. Therefore, let's add a new callback to provide this information. The information is currently limited to the name of the performance domain and whether the set-level operation is supported, although this can easily be extended if we find the need for it. Signed-off-by: Ulf Hansson --- Changes in v2: - New patch (replacing two earlier patches). --- drivers/firmware/arm_scmi/perf.c | 21 ++++++++++++++++----- include/linux/scmi_protocol.h | 8 ++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/p= erf.c index cf7f0de4d6db..f3ea96dd845c 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -124,7 +124,6 @@ struct scmi_msg_resp_perf_describe_levels { =20 struct perf_dom_info { bool set_limits; - bool set_perf; bool perf_limit_notify; bool perf_level_notify; bool perf_fastchannels; @@ -132,7 +131,7 @@ struct perf_dom_info { u32 sustained_freq_khz; u32 sustained_perf_level; u32 mult_factor; - char name[SCMI_MAX_STR_SIZE]; + struct scmi_perf_domain_info info; struct scmi_opp opp[MAX_OPPS]; struct scmi_fc_info *fc_info; }; @@ -209,7 +208,7 @@ scmi_perf_domain_attributes_get(const struct scmi_proto= col_handle *ph, flags =3D le32_to_cpu(attr->flags); =20 dom_info->set_limits =3D SUPPORTS_SET_LIMITS(flags); - dom_info->set_perf =3D SUPPORTS_SET_PERF_LVL(flags); + dom_info->info.set_perf =3D SUPPORTS_SET_PERF_LVL(flags); dom_info->perf_limit_notify =3D SUPPORTS_PERF_LIMIT_NOTIFY(flags); dom_info->perf_level_notify =3D SUPPORTS_PERF_LEVEL_NOTIFY(flags); dom_info->perf_fastchannels =3D SUPPORTS_PERF_FASTCHANNELS(flags); @@ -225,7 +224,8 @@ scmi_perf_domain_attributes_get(const struct scmi_proto= col_handle *ph, dom_info->mult_factor =3D (dom_info->sustained_freq_khz * 1000) / dom_info->sustained_perf_level; - strscpy(dom_info->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE); + strscpy(dom_info->info.name, attr->name, + SCMI_SHORT_NAME_MAX_SIZE); } =20 ph->xops->xfer_put(ph, t); @@ -237,7 +237,8 @@ scmi_perf_domain_attributes_get(const struct scmi_proto= col_handle *ph, if (!ret && PROTOCOL_REV_MAJOR(version) >=3D 0x3 && SUPPORTS_EXTENDED_NAMES(flags)) ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET, domain, - dom_info->name, SCMI_MAX_STR_SIZE); + dom_info->info.name, + SCMI_MAX_STR_SIZE); =20 return ret; } @@ -340,6 +341,15 @@ static int scmi_perf_num_domains_get(const struct scmi= _protocol_handle *ph) return pi->num_domains; } =20 +static const struct scmi_perf_domain_info * +scmi_perf_domain_info_get(const struct scmi_protocol_handle *ph, u32 domai= n) +{ + struct scmi_perf_info *pi =3D ph->get_priv(ph); + struct perf_dom_info *dom =3D pi->dom_info + domain; + + return &dom->info; +} + static int scmi_perf_mb_limits_set(const struct scmi_protocol_handle *ph, u32 domain, u32 max_perf, u32 min_perf) { @@ -695,6 +705,7 @@ scmi_power_scale_get(const struct scmi_protocol_handle = *ph) =20 static const struct scmi_perf_proto_ops perf_proto_ops =3D { .num_domains_get =3D scmi_perf_num_domains_get, + .domain_info_get =3D scmi_perf_domain_info_get, .limits_set =3D scmi_perf_limits_set, .limits_get =3D scmi_perf_limits_get, .level_set =3D scmi_perf_level_set, diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 71b39cbbdace..ed032fe83c28 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -97,11 +97,17 @@ struct scmi_clk_proto_ops { u32 clk_id); }; =20 +struct scmi_perf_domain_info { + char name[SCMI_MAX_STR_SIZE]; + bool set_perf; +}; + /** * struct scmi_perf_proto_ops - represents the various operations provided * by SCMI Performance Protocol * * @num_domains_get: gets the number of supported performance domains + * @domain_info_get: get the information of a performance domain * @limits_set: sets limits on the performance level of a domain * @limits_get: gets limits on the performance level of a domain * @level_set: sets the performance level of a domain @@ -122,6 +128,8 @@ struct scmi_clk_proto_ops { */ struct scmi_perf_proto_ops { int (*num_domains_get)(const struct scmi_protocol_handle *ph); + const struct scmi_perf_domain_info __must_check *(*domain_info_get) + (const struct scmi_protocol_handle *ph, u32 domain); int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain, u32 max_perf, u32 min_perf); int (*limits_get)(const struct scmi_protocol_handle *ph, u32 domain, --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 61066C001B0 for ; Thu, 13 Jul 2023 14:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231337AbjGMOTA (ORCPT ); Thu, 13 Jul 2023 10:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235288AbjGMOSP (ORCPT ); Thu, 13 Jul 2023 10:18:15 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF06212D for ; Thu, 13 Jul 2023 07:18:14 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so1359335e87.2 for ; Thu, 13 Jul 2023 07:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257893; x=1691849893; 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=hd+uTowpoGoaLjs+8GyD8zBwDxjZvMxPBML0/pIgiM4=; b=zwhhMOGvaCt1HHvjagwnxKjIxAW0y9o4DsUJLYY195zhF0YstHXRaHgAb4F+lVwmvM NpyDCkgtY0BX+vyiooweGe2WcJr3USF742hF9UJykoB59r4L5tCfH1IQMeYQw8S8TSaJ 8JH0+wDYwSdwemiG7d2cCCWt4KYEHZ3jVaHF2E9sL73gEQGAMixWSIdjTV6mqp7i7O7p lOr70qr3hw4PAY/SLXRxToU5RkLxgzJtlOZfq6xfpTDsbsinN0NZB4Hpu8Y5DaSHpEZW A7E8o/6BzJtLxnIhzOelslDTnLBYOeyg0k6pLwBQ9Wy4aIkwHOb+VCiEiYh3ugGjZ790 WGGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257893; x=1691849893; 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=hd+uTowpoGoaLjs+8GyD8zBwDxjZvMxPBML0/pIgiM4=; b=behOKblkeOHWvAxkWutPKXljYdEqHLV+W33VXhM21om5U7kaqz3R3SZrrrO6pAjJ0o 6J9MLlnS0CFK2NZwh/5ctdbG0Afun4nS02Hi5i7DPYjxvr66Did7EqrpxcNbbQpJrwpQ ECbb4BfaJeXoG2vNw2DjN4Tny9Tb5rOVGBqpvC0nftPp8G6UO+NzgBWbSGfQMUymrFYq Djo2MH4plJxXF+Bivxi3ZFzR8jCaXx/7KZEMQHh0kZZG5nxgweR1QHN2yc6F/yUpY4NF 5AaX2Rvk2S8r9Ek2fbpy25bm5X2C/aDRuZ47U20bfjY/Ijvry6v32elwWF0DLJKw8gYk YPeg== X-Gm-Message-State: ABy/qLbn4Fw0YjgRWrmIU7N5nx9E2naJ5yckIRYbYVPl3Dvek65bd/j6 F9dUeQGN6ELASPm3KOHtmi8w3g== X-Google-Smtp-Source: APBJJlFrQEjPQt+5/y+wdQoOfFaUfEE72mvDkJIp9j/oX0ZvtYqr5uSAVtOMMU6Nnu8hShdw/NVATQ== X-Received: by 2002:ac2:58f6:0:b0:4f7:6b72:3323 with SMTP id v22-20020ac258f6000000b004f76b723323mr1229474lfo.55.1689257892879; Thu, 13 Jul 2023 07:18:12 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:12 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 03/11] cpufreq: scmi: Prepare to move OF parsing of domain-id to cpufreq Date: Thu, 13 Jul 2023 16:17:30 +0200 Message-Id: <20230713141738.23970-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OF parsing of the clock domain specifier seems to better belong in the scmi cpufreq driver, rather than being implemented behind the generic ->device_domain_id() perf protocol ops. To prepare to remove the ->device_domain_id() ops, let's implement the OF parsing in the scmi cpufreq driver instead. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpufreq/scmi-cpufreq.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index f34e6382a4c5..7d05d48c0337 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -70,13 +70,24 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpu= freq_policy *policy, return 0; } =20 +static int scmi_cpu_domain_id(struct device *cpu_dev) +{ + struct of_phandle_args clkspec; + + if (of_parse_phandle_with_args(cpu_dev->of_node, "clocks", + "#clock-cells", 0, &clkspec)) + return -EINVAL; + + return clkspec.args[0]; +} + static int scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) { int cpu, domain, tdomain; struct device *tcpu_dev; =20 - domain =3D perf_ops->device_domain_id(cpu_dev); + domain =3D scmi_cpu_domain_id(cpu_dev); if (domain < 0) return domain; =20 @@ -88,7 +99,7 @@ scmi_get_sharing_cpus(struct device *cpu_dev, struct cpum= ask *cpumask) if (!tcpu_dev) continue; =20 - tdomain =3D perf_ops->device_domain_id(tcpu_dev); + tdomain =3D scmi_cpu_domain_id(tcpu_dev); if (tdomain =3D=3D domain) cpumask_set_cpu(cpu, cpumask); } @@ -104,7 +115,7 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned lon= g *power, unsigned long Hz; int ret, domain; =20 - domain =3D perf_ops->device_domain_id(cpu_dev); + domain =3D scmi_cpu_domain_id(cpu_dev); if (domain < 0) return domain; =20 @@ -209,7 +220,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *pol= icy) } =20 priv->cpu_dev =3D cpu_dev; - priv->domain_id =3D perf_ops->device_domain_id(cpu_dev); + priv->domain_id =3D scmi_cpu_domain_id(cpu_dev); =20 policy->driver_data =3D priv; policy->freq_table =3D freq_table; --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 79C8EC001DD for ; Thu, 13 Jul 2023 14:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbjGMOTF (ORCPT ); Thu, 13 Jul 2023 10:19:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235314AbjGMOSR (ORCPT ); Thu, 13 Jul 2023 10:18:17 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ACF1212D for ; Thu, 13 Jul 2023 07:18:16 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4fba86f069bso1358939e87.3 for ; Thu, 13 Jul 2023 07:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257894; x=1691849894; 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=edTXoMvhNuFH/nL1WC1npUwMJQVMfw3CQ3zP4/nOz8w=; b=nLEjBxXdgMUpb3KCbXWep74RoVZKaYfH4dDzOQsXLmnPx1pvm4cE+mXXPuVlMCc4y+ JukVUoe5asdozcZJ9n5eTiliyTycs/gBw5KlaRIlUvUCtWom4ZOytH4Rkqz/sOX7wRsw B7IeDJQfMhJgpa3GJuaY36TIUqk9Le01rwNaBfOQoBDnLxFtCZbGJxbi9+eyMgVz3UxW edrB4pvXYeyzq9KuIuCv3+hjV/3lJUqhWrv8y8niuEh/WkestWJquQ5XIhHA53ITvgVW RhnM+napAinuinQ4dwHLwukQGtoySCnpLr0MPODoar97MQq7rUZpf2ErQKpgwy9x5uOv Xwsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257894; x=1691849894; 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=edTXoMvhNuFH/nL1WC1npUwMJQVMfw3CQ3zP4/nOz8w=; b=Z8qgZRT+HmTyudSbJF3dGizRW5ttT0Vo7wcR2Qlv/cg/xo5kZQBvLiew7qg0irP/A+ nhXuen8MUQ/iySpFh/PnpR4dGMV7fgIbm0iH3+PyLedB+JVkNNraN+6ff1PFM/ARydCU qFkD4b29QrqmPvdofS9U1llbDJezd+K0dwOXUt+VUKaBysFKmVRdWcSvgidzta2TOUdW mDZh5dImgrFvTedvBH7eugQKTZqryT5NHw7F4wnL9jlu865GM2DP2H6aiDakYQ0iBWN6 2n2d9++cEktkPVk+Sr4py4SsRXWoIq6/Qfy12/p0KjmE/qVQR8Av7HlguaY6Kxctm0fI 3jPw== X-Gm-Message-State: ABy/qLbPOLhEizdkTYdvyqAk6tfI9SEvPGrEFsX9UioREIBj36eXO7ap OjYEG20XXHB9G2LElI5dGsDVcK5TVLoQ8HsIndA= X-Google-Smtp-Source: APBJJlFNXJ3at9poSaiKDKcrBrUCfItFY+Wqxh9WZOMaNxZfhW5W3LRXVUiRnEjrC1On/aEC0k79YA== X-Received: by 2002:ac2:5a50:0:b0:4fb:8de9:ac0e with SMTP id r16-20020ac25a50000000b004fb8de9ac0emr1310574lfn.1.1689257894500; Thu, 13 Jul 2023 07:18:14 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:13 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/11] firmware: arm_scmi: Align perf ops to use domain-id as in-parameter Date: Thu, 13 Jul 2023 16:17:31 +0200 Message-Id: <20230713141738.23970-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Most scmi_perf_proto_ops are already using an "u32 domain" as an in-parameter to indicate what performance domain we shall operate upon. However, some of the ops are using a "struct device *dev", which means that an additional OF parsing is needed each time the perf ops gets called, to find the corresponding domain-id. To avoid the above, but also to make the code more consistent, let's replace the in-parameter "struct device *dev" with an "u32 domain". Note that, this requires us to make some corresponding changes to the scmi cpufreq driver, so let's do that too. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpufreq/scmi-cpufreq.c | 14 +++++++++----- drivers/firmware/arm_scmi/perf.c | 18 +++++------------- include/linux/scmi_protocol.h | 6 +++--- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 7d05d48c0337..125e8a8421fb 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -137,7 +137,7 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned lon= g *power, =20 static int scmi_cpufreq_init(struct cpufreq_policy *policy) { - int ret, nr_opp; + int ret, nr_opp, domain; unsigned int latency; struct device *cpu_dev; struct scmi_data *priv; @@ -149,6 +149,10 @@ static int scmi_cpufreq_init(struct cpufreq_policy *po= licy) return -ENODEV; } =20 + domain =3D scmi_cpu_domain_id(cpu_dev); + if (domain < 0) + return domain; + priv =3D kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -187,7 +191,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *pol= icy) */ nr_opp =3D dev_pm_opp_get_opp_count(cpu_dev); if (nr_opp <=3D 0) { - ret =3D perf_ops->device_opps_add(ph, cpu_dev); + ret =3D perf_ops->device_opps_add(ph, cpu_dev, domain); if (ret) { dev_warn(cpu_dev, "failed to add opps to the device\n"); goto out_free_cpumask; @@ -220,7 +224,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *pol= icy) } =20 priv->cpu_dev =3D cpu_dev; - priv->domain_id =3D scmi_cpu_domain_id(cpu_dev); + priv->domain_id =3D domain; =20 policy->driver_data =3D priv; policy->freq_table =3D freq_table; @@ -228,14 +232,14 @@ static int scmi_cpufreq_init(struct cpufreq_policy *p= olicy) /* SCMI allows DVFS request for any domain from any CPU */ policy->dvfs_possible_from_any_cpu =3D true; =20 - latency =3D perf_ops->transition_latency_get(ph, cpu_dev); + latency =3D perf_ops->transition_latency_get(ph, domain); if (!latency) latency =3D CPUFREQ_ETERNAL; =20 policy->cpuinfo.transition_latency =3D latency; =20 policy->fast_switch_possible =3D - perf_ops->fast_switch_possible(ph, cpu_dev); + perf_ops->fast_switch_possible(ph, domain); =20 return 0; =20 diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/p= erf.c index f3ea96dd845c..6046c0eb5959 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -585,18 +585,14 @@ static int scmi_dev_domain_id(struct device *dev) } =20 static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, - struct device *dev) + struct device *dev, u32 domain) { - int idx, ret, domain; + int idx, ret; unsigned long freq; struct scmi_opp *opp; struct perf_dom_info *dom; struct scmi_perf_info *pi =3D ph->get_priv(ph); =20 - domain =3D scmi_dev_domain_id(dev); - if (domain < 0) - return domain; - dom =3D pi->dom_info + domain; =20 for (opp =3D dom->opp, idx =3D 0; idx < dom->opp_count; idx++, opp++) { @@ -618,14 +614,10 @@ static int scmi_dvfs_device_opps_add(const struct scm= i_protocol_handle *ph, =20 static int scmi_dvfs_transition_latency_get(const struct scmi_protocol_handle *ph, - struct device *dev) + u32 domain) { struct perf_dom_info *dom; struct scmi_perf_info *pi =3D ph->get_priv(ph); - int domain =3D scmi_dev_domain_id(dev); - - if (domain < 0) - return domain; =20 dom =3D pi->dom_info + domain; /* uS to nS */ @@ -685,12 +677,12 @@ static int scmi_dvfs_est_power_get(const struct scmi_= protocol_handle *ph, } =20 static bool scmi_fast_switch_possible(const struct scmi_protocol_handle *p= h, - struct device *dev) + u32 domain) { struct perf_dom_info *dom; struct scmi_perf_info *pi =3D ph->get_priv(ph); =20 - dom =3D pi->dom_info + scmi_dev_domain_id(dev); + dom =3D pi->dom_info + domain; =20 return dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr; } diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index ed032fe83c28..71072fe8ccc9 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -140,9 +140,9 @@ struct scmi_perf_proto_ops { u32 *level, bool poll); int (*device_domain_id)(struct device *dev); int (*transition_latency_get)(const struct scmi_protocol_handle *ph, - struct device *dev); + u32 domain); int (*device_opps_add)(const struct scmi_protocol_handle *ph, - struct device *dev); + struct device *dev, u32 domain); int (*freq_set)(const struct scmi_protocol_handle *ph, u32 domain, unsigned long rate, bool poll); int (*freq_get)(const struct scmi_protocol_handle *ph, u32 domain, @@ -150,7 +150,7 @@ struct scmi_perf_proto_ops { int (*est_power_get)(const struct scmi_protocol_handle *ph, u32 domain, unsigned long *rate, unsigned long *power); bool (*fast_switch_possible)(const struct scmi_protocol_handle *ph, - struct device *dev); + u32 domain); enum scmi_power_scale (*power_scale_get)(const struct scmi_protocol_handl= e *ph); }; =20 --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 888CAC001DD for ; Thu, 13 Jul 2023 14:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbjGMOTK (ORCPT ); Thu, 13 Jul 2023 10:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235328AbjGMOSS (ORCPT ); Thu, 13 Jul 2023 10:18:18 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63D98268D for ; Thu, 13 Jul 2023 07:18:17 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fb77f21c63so1389870e87.2 for ; Thu, 13 Jul 2023 07:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257895; x=1691849895; 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=8swgWEZzFMg1ioXnX70SnBjg0F7FWuFNmTlpHotRoZ8=; b=hCP8mCARoTgFbzFWJYb/xNDFksC1tIqoXQe2mpZlBsTTBMLamDrvONM159gJ3jzAbl nrYJiG/O3EomzWVHxXZwMFyxSGuTxXjKeRmjuK9PX+kI381y0q/OUOVod/Rnww8EohkL BJBH8luiBMkqcS1oRpxfNod9dw3ECYIvh6X9h6TM54u60Ci2cOr3jq5bpvgW4bFXNjnS RYA1dbBOGlNyW7XidVNuYXBEp0GzyG7vtnWsycWwLi5NOZZwQwstXezEnTUnOIujq6+f 2RMxPRdXy/apSSKuaAgfPeKrAEh6x3s3qtQLr2bpyb1qJEETY1rIARikzC7zFap2wrzT VjUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257895; x=1691849895; 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=8swgWEZzFMg1ioXnX70SnBjg0F7FWuFNmTlpHotRoZ8=; b=ikwMmimizQtECH31uWxnKiYKWywvdwroZJOl4MVr/44avxrrq97O8SQ8leWAp/OCAx Br6JAMMKHZsoDJDG4LqmVfS9tqdHjHY4ViVgmaPYzRj4Z1bo21K9SoztzN5dY+zKPWDN LYMqkGW0vysi89AwBhwQan37szYZA7H2lXntVlMuZlJDu4jORGnb/2ocnFXp3sL5vNfG JQ3fg2Q7p/bn1AxjhFaMKfLdhszN9VawI0PhJ0lLgw2ndHI0pNDxxhGZV98COKh6lOyW PSbtUsmL2arQ6ZZ8XvDNeFNphpVsD5P1SqxYpa3CGJZfc4IMkM1tqXGJyEii5FuCWAjn Lu5Q== X-Gm-Message-State: ABy/qLYnsDKOoyujlTySCW2Hi7zvWDUmAf6Q9X2ufAzBEEG/1iUFKbeN s+3S7EwpiGsbLwVKEKEbPfu2dw== X-Google-Smtp-Source: APBJJlGfSxoujTkP7falI08ZNJNb5RxBQyhfB12voLbucbg9J44kDqU6fl7o96FN5d1F40/zyFNy+w== X-Received: by 2002:a05:6512:2013:b0:4fa:f96c:745f with SMTP id a19-20020a056512201300b004faf96c745fmr1297853lfb.38.1689257895790; Thu, 13 Jul 2023 07:18:15 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:15 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/11] firmware: arm_scmi: Drop redundant ->device_domain_id() from perf ops Date: Thu, 13 Jul 2023 16:17:32 +0200 Message-Id: <20230713141738.23970-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There are no longer any users of the ->device_domain_id() ops in the scmi_perf_proto_ops, therefore let's remove it. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/firmware/arm_scmi/perf.c | 13 ------------- include/linux/scmi_protocol.h | 2 -- 2 files changed, 15 deletions(-) diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/p= erf.c index 6046c0eb5959..535174830946 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -572,18 +572,6 @@ static void scmi_perf_domain_init_fc(const struct scmi= _protocol_handle *ph, *p_fc =3D fc; } =20 -/* Device specific ops */ -static int scmi_dev_domain_id(struct device *dev) -{ - struct of_phandle_args clkspec; - - if (of_parse_phandle_with_args(dev->of_node, "clocks", "#clock-cells", - 0, &clkspec)) - return -EINVAL; - - return clkspec.args[0]; -} - static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, struct device *dev, u32 domain) { @@ -702,7 +690,6 @@ static const struct scmi_perf_proto_ops perf_proto_ops = =3D { .limits_get =3D scmi_perf_limits_get, .level_set =3D scmi_perf_level_set, .level_get =3D scmi_perf_level_get, - .device_domain_id =3D scmi_dev_domain_id, .transition_latency_get =3D scmi_dvfs_transition_latency_get, .device_opps_add =3D scmi_dvfs_device_opps_add, .freq_set =3D scmi_dvfs_freq_set, diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 71072fe8ccc9..7098a0be79b9 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -112,7 +112,6 @@ struct scmi_perf_domain_info { * @limits_get: gets limits on the performance level of a domain * @level_set: sets the performance level of a domain * @level_get: gets the performance level of a domain - * @device_domain_id: gets the scmi domain id for a given device * @transition_latency_get: gets the DVFS transition latency for a given d= evice * @device_opps_add: adds all the OPPs for a given device * @freq_set: sets the frequency for a given device using sustained freque= ncy @@ -138,7 +137,6 @@ struct scmi_perf_proto_ops { u32 level, bool poll); int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain, u32 *level, bool poll); - int (*device_domain_id)(struct device *dev); int (*transition_latency_get)(const struct scmi_protocol_handle *ph, u32 domain); int (*device_opps_add)(const struct scmi_protocol_handle *ph, --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 A8089C001DD for ; Thu, 13 Jul 2023 14:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjGMOTO (ORCPT ); Thu, 13 Jul 2023 10:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235335AbjGMOST (ORCPT ); Thu, 13 Jul 2023 10:18:19 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE961BE3 for ; Thu, 13 Jul 2023 07:18:18 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fb960b7c9dso1421139e87.0 for ; Thu, 13 Jul 2023 07:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257897; x=1691849897; 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=MR9071mGx80qY0kJZ8wG+4u/OTaITL09lIPAcVvKYoY=; b=hKjPdPLXD83qAxjuqN24j9TfFDVAxafvZ1Rb5x/hTQOS73gvGcjakwN4bsCP5GkbfC LHz4npRtg/wMvSOLGWv0EcXVFNMKBmQczi/3dNsvRHGrYgU3BHCVFtRiZ4Gh1rcqRUUE Ff96gg5AuHyBl/ew/fhyHt8ec0e0b/Hvr1U4MADn34sPUyia0VeVRS2EmEV9YiLbhv7G xbz2y6vv4hYzWCI4/WM3aGP7y4qcBV094Df+qhjiwRmleR6QPSrFEg5x1s1+g1+4ZJ9c jfdLHMbB4ZymEXIKwB6dW90yGUHbrmAnv77Z9/nXxScaVABZEFIOdP2X3vVzRTvQ4Jiz NvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257897; x=1691849897; 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=MR9071mGx80qY0kJZ8wG+4u/OTaITL09lIPAcVvKYoY=; b=KhUZMOhYsIvCd2kd9PXroyrvlNuTbToleAGZEWDkyv3EfXJzAKzIVMgIgoKIVJa5GK qKgUKH74pc5RybGKwaOA9YzXUSVjRTDvQDe/0bhCsBFipGSRjqwL9yf7Ug7Ot933Pci1 e8ZUpLFGXQyX1YvWniUEHezCakJ7V7QML6JAR5Y7O8BuaCw5+O72vXn0p8Dr5k+KI7Xd QDPFv8CIsEWjXBt1c2mdvlN6veErD6hKcrx7qAZzRKhVvp4duMaVYHRwc8cqDjuyAm9Z lBdK+Fncc3t0A5g+NYBTxDCxNAv0wW4Nd1LO0Vn32Fw2NmW9ZAJ6sEbpFq5TbQRLbDed WuWA== X-Gm-Message-State: ABy/qLYBZ92c7mfGIdNxL8DRmrJUed7OrRsmYbYpSZz6idrfm7vbM0Bb HJFipIF/YVRiWPnr3apOLO1lxw== X-Google-Smtp-Source: APBJJlEc8L+tzE/ZLwqPTWOj0SM2N8oRU5MLYlzz/leOWTlx7EW0n7Y1Nvozvqu4moF16Gs4iC5BIw== X-Received: by 2002:a05:6512:2253:b0:4fb:896d:bd70 with SMTP id i19-20020a056512225300b004fb896dbd70mr1398709lfu.46.1689257897246; Thu, 13 Jul 2023 07:18:17 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:16 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/11] cpufreq: scmi: Avoid one OF parsing in scmi_get_sharing_cpus() Date: Thu, 13 Jul 2023 16:17:33 +0200 Message-Id: <20230713141738.23970-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The domain-id for the cpu_dev has already been parsed at the point when scmi_get_sharing_cpus() is getting called. Let's pass it as an in-parameter to avoid the unnecessary OF parsing. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpufreq/scmi-cpufreq.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 125e8a8421fb..78f53e388094 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -82,15 +82,12 @@ static int scmi_cpu_domain_id(struct device *cpu_dev) } =20 static int -scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) +scmi_get_sharing_cpus(struct device *cpu_dev, int domain, + struct cpumask *cpumask) { - int cpu, domain, tdomain; + int cpu, tdomain; struct device *tcpu_dev; =20 - domain =3D scmi_cpu_domain_id(cpu_dev); - if (domain < 0) - return domain; - for_each_possible_cpu(cpu) { if (cpu =3D=3D cpu_dev->id) continue; @@ -163,7 +160,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *pol= icy) } =20 /* Obtain CPUs that share SCMI performance controls */ - ret =3D scmi_get_sharing_cpus(cpu_dev, policy->cpus); + ret =3D scmi_get_sharing_cpus(cpu_dev, domain, policy->cpus); if (ret) { dev_warn(cpu_dev, "failed to get sharing cpumask\n"); goto out_free_cpumask; --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 A2544C001DD for ; Thu, 13 Jul 2023 14:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbjGMOTR (ORCPT ); Thu, 13 Jul 2023 10:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235352AbjGMOSV (ORCPT ); Thu, 13 Jul 2023 10:18:21 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9404A1BE3 for ; Thu, 13 Jul 2023 07:18:20 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4fba86f069bso1359196e87.3 for ; Thu, 13 Jul 2023 07:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257899; x=1691849899; 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=s9WwOZgUsyJ02O9xqcLk3mdDSESLPPhW2QI/gJYTOt4=; b=M9raO96SgvoCm/JdBkRP8p6TPpuau6B/ZZDiNXGA+DBegEy+waxHEtlwO67t6/YEUk +20Zk6X3Cw4kka6owf2PGYcHQOVnTeaLlbgRJto3goP2SXvbasyhQ+P5alTBD2KwhUrc dxooYiYRBwV5ekx2sKC1GyWWbzqP1BEauktRwCCTzqeDwXN0umkn01WXAbvUFgSOyGwJ 63AxlKSIg9kGIq+aX3YV9LPiZAC0Yft0OfOxHLFM/20ljy1herti3SwtJNqi4erGHVlt fypDbPxXhKjY7mbQ807E9513sbvmNXYlzBX/D1cQuIRUnfWLxHmlFre7mhbsUxqWYZ/P 3WZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257899; x=1691849899; 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=s9WwOZgUsyJ02O9xqcLk3mdDSESLPPhW2QI/gJYTOt4=; b=GSE+QOzIP6/bDIS90hx8gsGdRIBEaDURJj48Roo6EXmsDvJ2KWbSM6TqDF5dDNKxiU VwWYckkr/zed6BIRh2y+MBwslfduZHo6u/klS5vEM3nqvbs2/TEddEJ53YZ7W5Ys5b2S W34IOKUG6ZwOiwOA/MOZVc6a3HivUngiNld+CLNhtr6tBb8JzGLDrAQs0Fg+LC9iOa5c W9S48QLOGrmiDBbcuT7cwbus28AnDbB4KgS5W+SkXF2uMZBiwh7a9djxmMJrCce2W2R2 wmr4LHP1M/ZvvDOyCHRTEcOqzEZMnuzYog7C6lqtQ7JMi8VfVkqcovAAos6fxh+jiobB fhXw== X-Gm-Message-State: ABy/qLYU3zyynbYf2pMhUvXcOlcKK+ujZX2wnQgecycrmesHqkzee7Xi KgZMKkgDKzIi7MfsxE/78/SVAg== X-Google-Smtp-Source: APBJJlGgCqPIPmApdnaooF6IBIyRZ7qe+5G0jNMJZ7HhyLs4btRaT1BD2DZjIb1cl2EZokOwHOa5zQ== X-Received: by 2002:ac2:58c5:0:b0:4fb:8ff2:f2d7 with SMTP id u5-20020ac258c5000000b004fb8ff2f2d7mr1240019lfo.45.1689257898720; Thu, 13 Jul 2023 07:18:18 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:17 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/11] PM: domains: Allow genpd providers to manage OPP tables directly by its FW Date: Thu, 13 Jul 2023 16:17:34 +0200 Message-Id: <20230713141738.23970-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In some cases the OPP tables aren't specified in device tree, but rather encoded in the FW. To allow a genpd provider to specify them dynamically instead, let's add a new genpd flag, GENPD_FLAG_OPP_TABLE_FW. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/base/power/domain.c | 11 ++++++----- include/linux/pm_domain.h | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 5cb2023581d4..c74edf80417f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -130,6 +130,7 @@ static const struct genpd_lock_ops genpd_spin_ops =3D { #define genpd_is_active_wakeup(genpd) (genpd->flags & GENPD_FLAG_ACTIVE_WA= KEUP) #define genpd_is_cpu_domain(genpd) (genpd->flags & GENPD_FLAG_CPU_DOMAIN) #define genpd_is_rpm_always_on(genpd) (genpd->flags & GENPD_FLAG_RPM_ALWAY= S_ON) +#define genpd_is_opp_table_fw(genpd) (genpd->flags & GENPD_FLAG_OPP_TABLE_= FW) =20 static inline bool irq_safe_dev_in_sleep_domain(struct device *dev, const struct generic_pm_domain *genpd) @@ -2328,7 +2329,7 @@ int of_genpd_add_provider_simple(struct device_node *= np, genpd->dev.of_node =3D np; =20 /* Parse genpd OPP table */ - if (genpd->set_performance_state) { + if (!genpd_is_opp_table_fw(genpd) && genpd->set_performance_state) { ret =3D dev_pm_opp_of_add_table(&genpd->dev); if (ret) return dev_err_probe(&genpd->dev, ret, "Failed to add OPP table\n"); @@ -2343,7 +2344,7 @@ int of_genpd_add_provider_simple(struct device_node *= np, =20 ret =3D genpd_add_provider(np, genpd_xlate_simple, genpd); if (ret) { - if (genpd->set_performance_state) { + if (!genpd_is_opp_table_fw(genpd) && genpd->set_performance_state) { dev_pm_opp_put_opp_table(genpd->opp_table); dev_pm_opp_of_remove_table(&genpd->dev); } @@ -2387,7 +2388,7 @@ int of_genpd_add_provider_onecell(struct device_node = *np, genpd->dev.of_node =3D np; =20 /* Parse genpd OPP table */ - if (genpd->set_performance_state) { + if (!genpd_is_opp_table_fw(genpd) && genpd->set_performance_state) { ret =3D dev_pm_opp_of_add_table_indexed(&genpd->dev, i); if (ret) { dev_err_probe(&genpd->dev, ret, @@ -2423,7 +2424,7 @@ int of_genpd_add_provider_onecell(struct device_node = *np, genpd->provider =3D NULL; genpd->has_provider =3D false; =20 - if (genpd->set_performance_state) { + if (!genpd_is_opp_table_fw(genpd) && genpd->set_performance_state) { dev_pm_opp_put_opp_table(genpd->opp_table); dev_pm_opp_of_remove_table(&genpd->dev); } @@ -2455,7 +2456,7 @@ void of_genpd_del_provider(struct device_node *np) if (gpd->provider =3D=3D &np->fwnode) { gpd->has_provider =3D false; =20 - if (!gpd->set_performance_state) + if (genpd_is_opp_table_fw(gpd) || !gpd->set_performance_state) continue; =20 dev_pm_opp_put_opp_table(gpd->opp_table); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index f776fb93eaa0..05ad8cefdff1 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -61,6 +61,10 @@ * GENPD_FLAG_MIN_RESIDENCY: Enable the genpd governor to consider its * components' next wakeup when determining the * optimal idle state. + * + * GENPD_FLAG_OPP_TABLE_FW: The genpd provider supports performance states, + * but its corresponding OPP tables are not + * described in DT, but are given directly by FW. */ #define GENPD_FLAG_PM_CLK (1U << 0) #define GENPD_FLAG_IRQ_SAFE (1U << 1) @@ -69,6 +73,7 @@ #define GENPD_FLAG_CPU_DOMAIN (1U << 4) #define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5) #define GENPD_FLAG_MIN_RESIDENCY (1U << 6) +#define GENPD_FLAG_OPP_TABLE_FW (1U << 7) =20 enum gpd_status { GENPD_STATE_ON =3D 0, /* PM domain is on */ --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 5DD8DC001B0 for ; Thu, 13 Jul 2023 14:19:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231539AbjGMOTT (ORCPT ); Thu, 13 Jul 2023 10:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbjGMOSY (ORCPT ); Thu, 13 Jul 2023 10:18:24 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE8AE2713 for ; Thu, 13 Jul 2023 07:18:21 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fb761efa7aso1341052e87.0 for ; Thu, 13 Jul 2023 07:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257900; x=1691849900; 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=B9RUZ+b+emtSv+giCmXNPmhFjp4/hvFKRq4dSR9PST4=; b=r86Mnb2sxhN41eDyo1Lz3DzPrPX5ROyFP2J8LlwjDP1AtlgU+TxSvGJvGeLL3wkoWe Cb/9weYQqYWEfbFh/CGQ0qj1uMrbTjRVm48CrwWAgz6Y1MMTsKH4gmUGrNeNyPmgnzoz I/lRNDtExpc8KFid2vfy61dek6hP6EL7lhcqHIg+6fNcbv8IyVCACsNT+TLUf24d1Wcd HxukzMnGtuRHc6Ed/GxXF3lVfclBTHVjen4UXtsoLBJcsF5ECT0Ib/252D7fRnXTQPsj bBZYHJvq76LatXZ4tmyrPlz9q2T5vpHcPMqavsHn6wsyfsqtqguhWOzDdUpPOw7yRDwr qWvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257900; x=1691849900; 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=B9RUZ+b+emtSv+giCmXNPmhFjp4/hvFKRq4dSR9PST4=; b=MIGUFMGaqBDDoYKBwCbYnHE30M6wQGr0iIjZWHE46T01CNygp7MYzKzfGVd9S2eU7q BRoqApnEacoDGNyNhWPbpRQI4SeifxGHoRhXFmMolA2AMGh5G7GIBXDc13HHSVGbtwR7 mkXsUVrjy+IPNAw4/ZQSHCUkZijEsxVI0ym+kvOaBaPVC+NUMEybtnbWS6P72e+pwCq9 umW8TaI2uOjfW3MPk94uPTGv8lat8iJUPWKSIKLRl79iUHN2MtGwecRHngwfXuy6nTUu TsUISETDmbZdvfmtkHvYX7HhpHZ+YGL9Y/F9DdJfeXJvtZOHz2wIsz0HRvxQ8TvxEJ6C 1t2w== X-Gm-Message-State: ABy/qLYub/shnwXEmM0ljiqC+fSpgPkSxOo76FocZpi4Nws0h4pg65yq wtt+262MF36w0NuXiFkFJWlPkQ== X-Google-Smtp-Source: APBJJlEtOIgr9v3RUPf+YyzUMe6ZSl4eV1/I1QKoIJip3wiMXOFRhWk3dok4wqm9bS/PAQBOgcgiZQ== X-Received: by 2002:a05:6512:31d3:b0:4f8:6d54:72fa with SMTP id j19-20020a05651231d300b004f86d5472famr1770618lfe.2.1689257900089; Thu, 13 Jul 2023 07:18:20 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:19 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org Subject: [PATCH v2 08/11] dt-bindings: firmware: arm,scmi: Extend bindings for protocol@13 Date: Thu, 13 Jul 2023 16:17:35 +0200 Message-Id: <20230713141738.23970-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The protocol@13 node is describing the performance scaling option for the ARM SCMI interface, as a clock provider. This is unnecessary limiting, as performance scaling is in many cases not limited to switching a clock's frequency. Therefore, let's extend the binding so the interface can be modelled as a generic performance domaintoo. The common way to describe this, is to use the "power-domain" DT bindings, so let's use that. Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: devicetree@vger.kernel.org Signed-off-by: Ulf Hansson --- Changes in v2: - Updated the DT binding to require "oneOf" #power-domain-cells or #clock-cells. --- .../devicetree/bindings/firmware/arm,scmi.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Doc= umentation/devicetree/bindings/firmware/arm,scmi.yaml index b138f3d23df8..563a87dfb31a 100644 --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml @@ -149,8 +149,15 @@ properties: '#clock-cells': const: 1 =20 - required: - - '#clock-cells' + '#power-domain-cells': + const: 1 + + oneOf: + - required: + - '#clock-cells' + + - required: + - '#power-domain-cells' =20 protocol@14: $ref: '#/$defs/protocol-node' --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 AC0E6C001DD for ; Thu, 13 Jul 2023 14:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230249AbjGMOTX (ORCPT ); Thu, 13 Jul 2023 10:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjGMOSZ (ORCPT ); Thu, 13 Jul 2023 10:18:25 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B66268D for ; Thu, 13 Jul 2023 07:18:23 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fb7589b187so1377342e87.1 for ; Thu, 13 Jul 2023 07:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257901; x=1691849901; 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=Wg9EddzRzHTbuaah4rEsbuvldd37lcTULk63OCghvz0=; b=sRupa9nPdIbMWXYR9MCQvdEIulLVqLZzb83+phUYqZ7V0BNqtYwpqb0E/sKibMuPxY roudsnBWyk9D/3eQJ/qWrj+pfW+lssaxpIg3lPzPuaWit/aq1F//KfdQCJgaGtZjowLN jKTKEaouaN+KhdTSH5KUjDpOmzMo4B32MIJ3Ckz64HW0XZ3qiGZUT61eNxB4l2jHIaHs rcKi4Sgyt8Iu9rl8yYt8bc+/EvLW+4beqqrvGRzA+3bay3pCB8IdcRhTLgQcfAs5qPG/ c+p0IvV5siP6cNE1MpWLIEo2VJSm8JJNppj/NPsrz5Za99OSC32JU+6NMgkeoJ1G4i5t lJNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257901; x=1691849901; 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=Wg9EddzRzHTbuaah4rEsbuvldd37lcTULk63OCghvz0=; b=S40so1Munb4Y24O/VTHO92Jn9cKsn2q6IOyTpOvfVylvwoFwn8pcG/VskprGz+y1XK 7dAO/E8ptQAeRgk4yNOm32IynEIk1RojyCqRbPsg+BSaRZigfy9ALTIT8hHpOjeQNFUH C/gw3bk3FpOl5R+Ee0FFyHiNAqpI6bOTVzKT+7d1EOMCPAlQEVzhQkegpEhNuIDqRnMj FsohjZi8RiwX86Ya6cRMfZNnxgPHHxGTKpM0ppYi3cC5ONiDvfy7iFrE49eXbK6vKYOA sOs2wNIIYKu0JZ70gbZhl8GO2fX2LZVsnwYPXFmc0TYO5EiNQY0xuLYyxRkOiezPK2rL GX/w== X-Gm-Message-State: ABy/qLbIP5QS0FFcP5BVf9TpR7klstY0L3kpOHkrE5rapfcpjuMq9J0d WzOJBB4b85Zh1/oo0XRNiEs3mg== X-Google-Smtp-Source: APBJJlHHHzCAd2s4FvXf9+E1P9nGND6+Ni1aJCIrFXUvM3sjBMcA/3X27DJnYsEzQEjeYqNLhjz6Vg== X-Received: by 2002:a05:6512:2251:b0:4f8:7568:e948 with SMTP id i17-20020a056512225100b004f87568e948mr1473269lfu.51.1689257901695; Thu, 13 Jul 2023 07:18:21 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:21 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/11] cpufreq: scmi: Add support to parse domain-id using #power-domain-cells Date: Thu, 13 Jul 2023 16:17:36 +0200 Message-Id: <20230713141738.23970-10-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The performance domain-id can be described in DT using the power-domains property or the clock property. The latter is already supported, so let's add support for the power-domains too. Signed-off-by: Ulf Hansson --- Changes in v2: - New patch. --- drivers/cpufreq/scmi-cpufreq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 78f53e388094..b42f43d9bd89 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -72,13 +72,19 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpu= freq_policy *policy, =20 static int scmi_cpu_domain_id(struct device *cpu_dev) { - struct of_phandle_args clkspec; + struct of_phandle_args domain_id; =20 if (of_parse_phandle_with_args(cpu_dev->of_node, "clocks", - "#clock-cells", 0, &clkspec)) - return -EINVAL; + "#clock-cells", 0, &domain_id)) { =20 - return clkspec.args[0]; + if (of_parse_phandle_with_args(cpu_dev->of_node, + "power-domains", + "#power-domain-cells", 0, + &domain_id)) + return -EINVAL; + } + + return domain_id.args[0]; } =20 static int --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 EEE17C001B0 for ; Thu, 13 Jul 2023 14:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231172AbjGMOTa (ORCPT ); Thu, 13 Jul 2023 10:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbjGMOS1 (ORCPT ); Thu, 13 Jul 2023 10:18:27 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 954C81BE3 for ; Thu, 13 Jul 2023 07:18:25 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4fb960b7c9dso1421405e87.0 for ; Thu, 13 Jul 2023 07:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257904; x=1691849904; 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=cmq/h80ovL13+V/r08VWoNgXJwdj+6X80/5vfDvf7TM=; b=FTghKfMqaBJoT1bpYiRyqVPCuQll3hXIEIstKsh+QL0vxd7oz0qt5Y6eWvlGbpX3cs +Sd8BfKgnQJ3Yhu6qkfcD0/MbRRwrSXCz/EVJxnPDtEzIVEnsS6PkrtlMc47dwiUNEbV i2x4Pqf2WgLDaZcHPlOAZ8aFYjJq3lq+ySiAg3q/feMEKSqgAO9Y3USRGtZ6iebdX+eA Jfmwa8w4Dkyxf0TvwTn1kfObZ/HLrM5Fg1leHhwlyXHTYmcZTqp0dEnp/QpuebVeHEku dqK1xcxWePk9lEoGTv+ED5vdPx42YpMsuewFMJgbJJ6QkHyEaE1DRBf0U2m7/3f7DGoG hMEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257904; x=1691849904; 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=cmq/h80ovL13+V/r08VWoNgXJwdj+6X80/5vfDvf7TM=; b=DqvznYQ6Jm7+T4PG0SyFOp6hZTPLxkpp2kFGue+UwHTp4Y2JMZLtFuIX4d0YsC4bGl BNLSHN7LS5ix5jfTR+HQfV46brq/g21xvZ2JILGcJrnDsxoxPgp4j0iskDoMCTbdbhUl v/uwGBddMTR/UqYN09er/v7cGTiLmotNKkh2Vz5nhMrOLbbvv/X1QWkazkv6p5Gu62fC mo+4ih9a/7qRYr+fWiy1xnOPde3dCRMftEAyDlxqnzEihT9BcN772vft5Q40+UxN1Frl 6GUQHkUqq7KNtg+iM3+2r5IlZ0+R6a0UJhWJN1omT6UPXsg9vFBraKO/xO2a4gFG+9B3 pL9g== X-Gm-Message-State: ABy/qLbRS+/Np+njzTVCvNrvQog/ILGetlh/PX6MzaUvMDcj6719pcMl y5gVgZt0FjSivzWClsvxVMysAQ== X-Google-Smtp-Source: APBJJlEw/r/rZ4KP7q3w8Znj84AUPeVdq+hFtHUzpqRpyzbbmKBt2AtXseIEaGeQQAU+CgyD20lUvA== X-Received: by 2002:a05:6512:2253:b0:4fb:896d:bd70 with SMTP id i19-20020a056512225300b004fb896dbd70mr1399041lfu.46.1689257903884; Thu, 13 Jul 2023 07:18:23 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:22 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/11] firmware: arm_scmi: Add the SCMI performance domain Date: Thu, 13 Jul 2023 16:17:37 +0200 Message-Id: <20230713141738.23970-11-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To enable support for performance scaling (DVFS) for generic devices with the SCMI performance protocol, let's add an SCMI performance domain. This is being modelled as a genpd provider, with support for performance scaling through genpd's ->set_performance_state() callback. Note that, this adds the initial support that allows consumer drivers for attached devices, to vote for a new performance state via calling the dev_pm_genpd_set_performance_state(). However, this should be avoided as it's in most cases preferred to use the OPP library to vote for a new OPP instead. The support using the OPP library isn't part of this change, but needs to be implemented from subsequent changes. Signed-off-by: Ulf Hansson --- Changes in v2: - Converted to use the new ->domain_info_get() callback. --- drivers/firmware/arm_scmi/Kconfig | 12 ++ drivers/firmware/arm_scmi/Makefile | 1 + drivers/firmware/arm_scmi/scmi_perf_domain.c | 155 +++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 drivers/firmware/arm_scmi/scmi_perf_domain.c diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/= Kconfig index ea0f5083ac47..706d1264d038 100644 --- a/drivers/firmware/arm_scmi/Kconfig +++ b/drivers/firmware/arm_scmi/Kconfig @@ -181,6 +181,18 @@ config ARM_SCMI_POWER_DOMAIN will be called scmi_pm_domain. Note this may needed early in boot before rootfs may be available. =20 +config ARM_SCMI_PERF_DOMAIN + tristate "SCMI performance domain driver" + depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) + default y + select PM_GENERIC_DOMAINS if PM + help + This enables support for the SCMI performance domains which can be + enabled or disabled via the SCP firmware. + + This driver can also be built as a module. If so, the module will be + called scmi_perf_domain. + config ARM_SCMI_POWER_CONTROL tristate "SCMI system power control driver" depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) diff --git a/drivers/firmware/arm_scmi/Makefile b/drivers/firmware/arm_scmi= /Makefile index b31d78fa66cc..afee66a65dcb 100644 --- a/drivers/firmware/arm_scmi/Makefile +++ b/drivers/firmware/arm_scmi/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D scmi-core.o obj-$(CONFIG_ARM_SCMI_PROTOCOL) +=3D scmi-module.o =20 obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) +=3D scmi_pm_domain.o +obj-$(CONFIG_ARM_SCMI_PERF_DOMAIN) +=3D scmi_perf_domain.o obj-$(CONFIG_ARM_SCMI_POWER_CONTROL) +=3D scmi_power_control.o =20 ifeq ($(CONFIG_THUMB2_KERNEL)$(CONFIG_CC_IS_CLANG),yy) diff --git a/drivers/firmware/arm_scmi/scmi_perf_domain.c b/drivers/firmwar= e/arm_scmi/scmi_perf_domain.c new file mode 100644 index 000000000000..4ed2401995be --- /dev/null +++ b/drivers/firmware/arm_scmi/scmi_perf_domain.c @@ -0,0 +1,155 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * SCMI performance domain support. + * + * Copyright (C) 2023 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include + +struct scmi_perf_domain { + struct generic_pm_domain genpd; + const struct scmi_perf_proto_ops *perf_ops; + const struct scmi_protocol_handle *ph; + const struct scmi_perf_domain_info *info; + u32 domain_id; +}; + +#define to_scmi_pd(pd) container_of(pd, struct scmi_perf_domain, genpd) + +static int +scmi_pd_set_perf_state(struct generic_pm_domain *genpd, unsigned int state) +{ + struct scmi_perf_domain *pd =3D to_scmi_pd(genpd); + int ret; + + if (!pd->info->set_perf) + return 0; + + ret =3D pd->perf_ops->level_set(pd->ph, pd->domain_id, state, true); + if (ret) + dev_warn(&genpd->dev, "Failed with %d when trying to set %d perf level", + ret, state); + + return ret; +} + +static int scmi_perf_domain_probe(struct scmi_device *sdev) +{ + struct device *dev =3D &sdev->dev; + const struct scmi_handle *handle =3D sdev->handle; + const struct scmi_perf_proto_ops *perf_ops; + struct scmi_protocol_handle *ph; + struct scmi_perf_domain *scmi_pd; + struct genpd_onecell_data *scmi_pd_data; + struct generic_pm_domain **domains; + int num_domains, i, ret =3D 0; + u32 perf_level; + + if (!handle) + return -ENODEV; + + /* The OF node must specify us as a power-domain provider. */ + if (!of_find_property(dev->of_node, "#power-domain-cells", NULL)) + return 0; + + perf_ops =3D handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PERF, &ph); + if (IS_ERR(perf_ops)) + return PTR_ERR(perf_ops); + + num_domains =3D perf_ops->num_domains_get(ph); + if (num_domains < 0) { + dev_warn(dev, "Failed with %d when getting num perf domains\n", + num_domains); + return num_domains; + } else if (!num_domains) { + return 0; + } + + scmi_pd =3D devm_kcalloc(dev, num_domains, sizeof(*scmi_pd), GFP_KERNEL); + if (!scmi_pd) + return -ENOMEM; + + scmi_pd_data =3D devm_kzalloc(dev, sizeof(*scmi_pd_data), GFP_KERNEL); + if (!scmi_pd_data) + return -ENOMEM; + + domains =3D devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); + if (!domains) + return -ENOMEM; + + for (i =3D 0; i < num_domains; i++, scmi_pd++) { + scmi_pd->info =3D perf_ops->domain_info_get(ph, i); + + scmi_pd->domain_id =3D i; + scmi_pd->perf_ops =3D perf_ops; + scmi_pd->ph =3D ph; + scmi_pd->genpd.name =3D scmi_pd->info->name; + scmi_pd->genpd.flags =3D GENPD_FLAG_OPP_TABLE_FW; + scmi_pd->genpd.set_performance_state =3D scmi_pd_set_perf_state; + + ret =3D perf_ops->level_get(ph, i, &perf_level, false); + if (ret) { + dev_dbg(dev, "Failed to get perf level for %s", + scmi_pd->genpd.name); + perf_level =3D 0; + } + + /* Let the perf level indicate the power-state too. */ + ret =3D pm_genpd_init(&scmi_pd->genpd, NULL, perf_level =3D=3D 0); + if (ret) + goto err; + + domains[i] =3D &scmi_pd->genpd; + } + + scmi_pd_data->domains =3D domains; + scmi_pd_data->num_domains =3D num_domains; + + ret =3D of_genpd_add_provider_onecell(dev->of_node, scmi_pd_data); + if (ret) + goto err; + + dev_set_drvdata(dev, scmi_pd_data); + dev_info(dev, "Initialized %d performance domains", num_domains); + return 0; +err: + for (i--; i >=3D 0; i--) + pm_genpd_remove(domains[i]); + return ret; +} + +static void scmi_perf_domain_remove(struct scmi_device *sdev) +{ + struct device *dev =3D &sdev->dev; + struct genpd_onecell_data *scmi_pd_data =3D dev_get_drvdata(dev); + int i; + + of_genpd_del_provider(dev->of_node); + + for (i =3D 0; i < scmi_pd_data->num_domains; i++) + pm_genpd_remove(scmi_pd_data->domains[i]); +} + +static const struct scmi_device_id scmi_id_table[] =3D { + { SCMI_PROTOCOL_PERF, "perf" }, + { }, +}; +MODULE_DEVICE_TABLE(scmi, scmi_id_table); + +static struct scmi_driver scmi_perf_domain_driver =3D { + .name =3D "scmi-perf-domain", + .probe =3D scmi_perf_domain_probe, + .remove =3D scmi_perf_domain_remove, + .id_table =3D scmi_id_table, +}; +module_scmi_driver(scmi_perf_domain_driver); + +MODULE_AUTHOR("Ulf Hansson "); +MODULE_DESCRIPTION("ARM SCMI perf domain driver"); +MODULE_LICENSE("GPL v2"); --=20 2.34.1 From nobody Sat Feb 7 07:25:57 2026 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 505A3C001B0 for ; Thu, 13 Jul 2023 14:19:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231567AbjGMOT0 (ORCPT ); Thu, 13 Jul 2023 10:19:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbjGMOS2 (ORCPT ); Thu, 13 Jul 2023 10:18:28 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A920D26AF for ; Thu, 13 Jul 2023 07:18:26 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4fb77f21c63so1390261e87.2 for ; Thu, 13 Jul 2023 07:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689257905; x=1691849905; 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=b2FGnkTFhckKy1B44O7jpGYAwsWcXuAkok3ADC0wZTc=; b=X9wOIS7sK7yvNtsVAiKkpFNNk91CbLAr4zI+HQyk3zRR1NPaiQCXoby+zXUMadvHK8 eX/kBeKhdi62T144tgbpLA+i4vU3JD1rER4gDSvMYAVjXOKlb6KcZ2ALQrBG1rdr3xHK k4l1Mjx8G1F/4Zimf5K0/Y/NND9tQtLfwV4oyU0JZygLjFASGWARJG2l+NLmRjNOF5cF iv4ZkELNEcHy3DO6s2+vG64KL7p7IznRyOL+8maZqCa2LRwZZ47Zb9h7dxjnwt+CG0UM 2rijsnRKyxFR9dml1ng5KX58W/MYvqPWXLjtfz2HUFuB/EU5xNVY0Ce7OvcGlyz54Hpc mAmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257905; x=1691849905; 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=b2FGnkTFhckKy1B44O7jpGYAwsWcXuAkok3ADC0wZTc=; b=TNRWWk4Ti8AOW0oQ/uagkZmiy1DcDQCuELgzqV5TDykZRbXDgsS8wVWJFI54qP0wK3 2rkIqOF0vpcVclCuZZqA17oumijkzw8lMvzp3Guis9IqeXb80ymj79LjOAxIczFEZhAq v4TuuFfatZ9/a9RvISAXboURY8W1k3ZB3M3dfv9HiqPUoOpF9PNcP1aLc0tzLt4CHQrM 7wwZ6szLOFwKa9eXp1xXFtEelS4Wxptf/izMYB4d/fl7l7OSdkn0jboTLeIN5v/BQzxt WKkR8tXlexCBPSA1GsFYX/skWAOxeAJfDRy+6e/Z0EPvpk+MA4DOPBKOc9HOgE+ez+Ap QuVA== X-Gm-Message-State: ABy/qLavGXmc7onznSAyHygrAg6zqAymgci5KM4D4P3svsjNsyR2HZgZ 97EPm/jLpSRwJzZDNH69lt9YbA== X-Google-Smtp-Source: APBJJlEe/LcOSdXGIs29m2hZJ6aDLIXECWIhX2RS15qAHOIH0lx4KMJaPzvxHM3/7G6hBrDa3Z7jsQ== X-Received: by 2002:ac2:43c4:0:b0:4f8:5f32:b1da with SMTP id u4-20020ac243c4000000b004f85f32b1damr1233186lfl.24.1689257905043; Thu, 13 Jul 2023 07:18:25 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1132426lfn.168.2023.07.13.07.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 07:18:24 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/11] cpufreq: scmi: Drop redundant ifdef in scmi_cpufreq_probe() Date: Thu, 13 Jul 2023 16:17:38 +0200 Message-Id: <20230713141738.23970-12-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org> References: <20230713141738.23970-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We have stubs for devm_of_clk_add_hw_provider(), so there should be no need to protect this with the '#ifdef CONFIG_COMMON_CLK'. Let's drop it to clean up the code a bit. Signed-off-by: Ulf Hansson --- Changes in v2: - New patch. --- drivers/cpufreq/scmi-cpufreq.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index b42f43d9bd89..ab967e520355 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -326,11 +326,9 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev) if (IS_ERR(perf_ops)) return PTR_ERR(perf_ops); =20 -#ifdef CONFIG_COMMON_CLK /* dummy clock provider as needed by OPP if clocks property is used */ if (of_property_present(dev->of_node, "#clock-cells")) devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL); -#endif =20 ret =3D cpufreq_register_driver(&scmi_cpufreq_driver); if (ret) { --=20 2.34.1