From nobody Sun Apr 19 09:10:55 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 F3DD3C433EF for ; Mon, 4 Jul 2022 09:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233609AbiGDJcH (ORCPT ); Mon, 4 Jul 2022 05:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231341AbiGDJbp (ORCPT ); Mon, 4 Jul 2022 05:31:45 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DFBDF71 for ; Mon, 4 Jul 2022 02:30:42 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 68so8421775pgb.10 for ; Mon, 04 Jul 2022 02:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=72m7epCKc8DRYc24vKvm2IZvvf4jAtJWITsZpUnezm8=; b=blWIqK+YPLczSwFFpFvxMHpuLKD1i7l9cU7XpIkKtx3GqDxZ1nKppBQcRJiBeJIWoi vUAbMikhw6SgBzcJZGW/Z8uj7FrOlsXLBNuzliHLqZGTc/OBose0BfSsMaFb/eL6Hale j0NdxRTKR9ZK8hGC7enZTehdi8jHAD9ZQrMVhc/YBmisGFHIvQSfzusArZQhM/BBCEPI IaJ3pK7bDpf2v/yk0iR35ugaE/U4HpuAG+KWT7ROHNkVcCRcfLp51tqCL2caDWkpNBkk dS3iF+yJQ3789yYqgAr2bHbLV8YPmczajP3WBXv6BtHqJ1SANsCXFlatzq1WjLKnlFBe t4hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=72m7epCKc8DRYc24vKvm2IZvvf4jAtJWITsZpUnezm8=; b=AUKMOh7a+46SUzcDt45e+vuhKQdK1AoVxqwUwg5Xb7oz4lSd+vm7d6+pbnDbD/Tyhs 08zZ81V7gxEK85F9BkH6ggJnXFMUz+YB7+7bHCYFKnMqHC/7vfsLyBpu26QywkcMYqGz 8Qs/pnE/Izw5+8qC17UokGQkb6jc2y5q1eVsZ2bsQP85KsNR2K0WQ1wPhDXzg9pcGTbv 0ut1PQgct8hrZkULX488uaHprGsUAVE6OQLwfAnKsGM5ZxQIo2q155J/tpKDIKjobYcE X4MzWrgc602IKN3up2TzZQhjZadA8vdh/N7ncRrEelFKoDgFv4lhIQohgxh4Z+e+PE6h gjRQ== X-Gm-Message-State: AJIora8/lEtMqoTThzPxQ2KQeYDDGyj98VTVmrPsgEVBCLYhSUxP9/RQ xkK73PmI3+9w2i+tmVklrbLoFA== X-Google-Smtp-Source: AGRyM1tD1ms854Jvb6ejo2BaDKtErbzQrX2QO6fPEHFSPxLfHTiJjwP3IyXM10WaCMCRe4iD+LdqxQ== X-Received: by 2002:a62:b514:0:b0:525:1ccd:4506 with SMTP id y20-20020a62b514000000b005251ccd4506mr34508280pfe.8.1656927041886; Mon, 04 Jul 2022 02:30:41 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id ms16-20020a17090b235000b001ef81bac701sm2926177pjb.42.2022.07.04.02.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:30:41 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue Cc: Leo Yan Subject: [PATCH v3 1/5] dt-bindings: interconnect: Update property for icc-rpm path tag Date: Mon, 4 Jul 2022 17:30:25 +0800 Message-Id: <20220704093029.1126609-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704093029.1126609-1-leo.yan@linaro.org> References: <20220704093029.1126609-1-leo.yan@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 support path tag in icc-rpm driver, the "#interconnect-cells" property is updated as enumerate values: 1 or 2. Setting to 1 means it is compatible with old DT binding that interconnect path only contains node id; if set to 2 for "#interconnect-cells" property, then the second specifier is used as a tag (e.g. vote for which buckets). Signed-off-by: Leo Yan Acked-by: Krzysztof Kozlowski --- .../devicetree/bindings/interconnect/qcom,rpm.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml b= /Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml index 8a676fef8c1d..cdfe419e7339 100644 --- a/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml +++ b/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml @@ -45,7 +45,12 @@ properties: - qcom,sdm660-snoc =20 '#interconnect-cells': - const: 1 + description: | + Number of interconnect specifier. Value: <1> is one cell in a + interconnect specifier for the interconnect node id, <2> requires + the interconnect node id and an extra path tag. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [ 1, 2 ] =20 clocks: minItems: 2 --=20 2.25.1 From nobody Sun Apr 19 09:10:55 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 97CE2C43334 for ; Mon, 4 Jul 2022 09:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233829AbiGDJcR (ORCPT ); Mon, 4 Jul 2022 05:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233643AbiGDJbv (ORCPT ); Mon, 4 Jul 2022 05:31:51 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3391DF95 for ; Mon, 4 Jul 2022 02:30:45 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d5so8043509plo.12 for ; Mon, 04 Jul 2022 02:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6WnlHr6IrouPH/wdi+y79keal1VSMpfo6gBqx2QqUOA=; b=Ifkvm7ECn8RZvQg8nAldNfFTarAyPRTePgZKiAGgjxU3ReqY6ok96bTDPAe0CwYIMt JvZafMLlhbWHqdw7tVHhV8MvsKRraA+NpP/NTJ0U0lteAT4j+ANPtKA6nwkQ3iKP6bs9 I+00IMKWGw9F5416FVk5OrFWKcn2I7EYNYSd74Qfw7Qhl1lIxktOajTK3yp2ghYn6Qo3 Vv6hIRWjTNo02XrS2afkS1kcKqqORAljlG0JlcLSfOJHAsWwYWu977LLnaeu0Gw+DLwr CRTQut88MUo2qef397e7NLmqUK9p9pX4XWaE+oQbOgdid4is2XNpKfPWacPmk3Kcig4/ 6d3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6WnlHr6IrouPH/wdi+y79keal1VSMpfo6gBqx2QqUOA=; b=auGki+InySwXELYiMzm5FDusEYBaIPqlBYH54j12CIBi5Yxu0+OAkN1LQD0GS2bdHc nS36wnre4t6haLuozf2Qz0uWypfBMXCHJDmY71r0OrzdZFG+vap9Zx73QXTAfTdkEyjy 4fPwoUp3sZKt7+paZZNpUdekc6kIGunWTqgEPg5bQ9w0IurItKA1Al6KwKu7vE+LfVRs QQg7ALkm55Y1v/pY6aVya3fQgB5Ks62fdJofTxBoDe6L8jf8V1t2yJcBEj4o+IHJebgy 2040jcQfd6/LG1aBAGGt3KRO2NnwMjo+sY0rCQCRYZoy7UCJQVMPuCxiZKnPX7PhSteI i0Yw== X-Gm-Message-State: AJIora9eKQ01VJG05oEiDW3wdD0GJ8w9kh0eSe9ZAjII6emwrnxyP3i5 xFxn9iAbOxnaULOzRfzuYJbAiQ== X-Google-Smtp-Source: AGRyM1tSu750n4sy7LLfIPs0ul9iYMz4ChNbnddSjJNKcigFusnScVnWxTBSGvUbn9GyGLa0JntRyw== X-Received: by 2002:a17:902:f792:b0:168:e97b:3c05 with SMTP id q18-20020a170902f79200b00168e97b3c05mr35305145pln.94.1656927044995; Mon, 04 Jul 2022 02:30:44 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id ms16-20020a17090b235000b001ef81bac701sm2926177pjb.42.2022.07.04.02.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:30:44 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue Cc: Leo Yan , Dmitry Baryshkov Subject: [PATCH v3 2/5] interconnect: qcom: Move qcom_icc_xlate_extended() to a common file Date: Mon, 4 Jul 2022 17:30:26 +0800 Message-Id: <20220704093029.1126609-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704093029.1126609-1-leo.yan@linaro.org> References: <20220704093029.1126609-1-leo.yan@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" since there have conflict between two headers icc-rpmh.h and icc-rpm.h, the function qcom_icc_xlate_extended() is declared in icc-rpmh.h thus it cannot be used by icc-rpm driver. Move the function to a new common file icc-common.c so that allow it to be called by multiple drivers. Signed-off-by: Leo Yan Reviewed-by: Dmitry Baryshkov --- drivers/interconnect/qcom/Makefile | 3 +++ drivers/interconnect/qcom/icc-common.c | 34 ++++++++++++++++++++++++++ drivers/interconnect/qcom/icc-common.h | 13 ++++++++++ drivers/interconnect/qcom/icc-rpmh.c | 26 +------------------- drivers/interconnect/qcom/icc-rpmh.h | 1 - drivers/interconnect/qcom/sm8450.c | 1 + 6 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 drivers/interconnect/qcom/icc-common.c create mode 100644 drivers/interconnect/qcom/icc-common.h diff --git a/drivers/interconnect/qcom/Makefile b/drivers/interconnect/qcom= /Makefile index 120e279a7427..8e357528185d 100644 --- a/drivers/interconnect/qcom/Makefile +++ b/drivers/interconnect/qcom/Makefile @@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 =20 +obj-$(CONFIG_INTERCONNECT_QCOM) +=3D interconnect_qcom.o + +interconnect_qcom-y :=3D icc-common.o icc-bcm-voter-objs :=3D bcm-voter.o qnoc-msm8916-objs :=3D msm8916.o qnoc-msm8939-objs :=3D msm8939.o diff --git a/drivers/interconnect/qcom/icc-common.c b/drivers/interconnect/= qcom/icc-common.c new file mode 100644 index 000000000000..0822ce207b5d --- /dev/null +++ b/drivers/interconnect/qcom/icc-common.c @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Linaro Ltd. + */ + +#include +#include + +#include "icc-common.h" + +struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec= , void *data) +{ + struct icc_node_data *ndata; + struct icc_node *node; + + node =3D of_icc_xlate_onecell(spec, data); + if (IS_ERR(node)) + return ERR_CAST(node); + + ndata =3D kzalloc(sizeof(*ndata), GFP_KERNEL); + if (!ndata) + return ERR_PTR(-ENOMEM); + + ndata->node =3D node; + + if (spec->args_count =3D=3D 2) + ndata->tag =3D spec->args[1]; + + if (spec->args_count > 2) + pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np); + + return ndata; +} +EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended); diff --git a/drivers/interconnect/qcom/icc-common.h b/drivers/interconnect/= qcom/icc-common.h new file mode 100644 index 000000000000..33bb2c38dff3 --- /dev/null +++ b/drivers/interconnect/qcom/icc-common.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2022 Linaro Ltd. + */ + +#ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__ +#define __DRIVERS_INTERCONNECT_QCOM_ICC_COMMON_H__ + +#include + +struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec= , void *data); + +#endif diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qc= om/icc-rpmh.c index 8acc8e67a332..114bb8f64573 100644 --- a/drivers/interconnect/qcom/icc-rpmh.c +++ b/drivers/interconnect/qcom/icc-rpmh.c @@ -11,6 +11,7 @@ #include =20 #include "bcm-voter.h" +#include "icc-common.h" #include "icc-rpmh.h" =20 /** @@ -100,31 +101,6 @@ int qcom_icc_set(struct icc_node *src, struct icc_node= *dst) } EXPORT_SYMBOL_GPL(qcom_icc_set); =20 -struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec= , void *data) -{ - struct icc_node_data *ndata; - struct icc_node *node; - - node =3D of_icc_xlate_onecell(spec, data); - if (IS_ERR(node)) - return ERR_CAST(node); - - ndata =3D kzalloc(sizeof(*ndata), GFP_KERNEL); - if (!ndata) - return ERR_PTR(-ENOMEM); - - ndata->node =3D node; - - if (spec->args_count =3D=3D 2) - ndata->tag =3D spec->args[1]; - - if (spec->args_count > 2) - pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np); - - return ndata; -} -EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended); - /** * qcom_icc_bcm_init - populates bcm aux data and connect qnodes * @bcm: bcm to be initialized diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qc= om/icc-rpmh.h index d29929461c17..04391c1ba465 100644 --- a/drivers/interconnect/qcom/icc-rpmh.h +++ b/drivers/interconnect/qcom/icc-rpmh.h @@ -131,7 +131,6 @@ struct qcom_icc_desc { int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, u32 peak_bw, u32 *agg_avg, u32 *agg_peak); int qcom_icc_set(struct icc_node *src, struct icc_node *dst); -struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec= , void *data); int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev); void qcom_icc_pre_aggregate(struct icc_node *node); int qcom_icc_rpmh_probe(struct platform_device *pdev); diff --git a/drivers/interconnect/qcom/sm8450.c b/drivers/interconnect/qcom= /sm8450.c index 7e3d372b712f..e821fd0b2f66 100644 --- a/drivers/interconnect/qcom/sm8450.c +++ b/drivers/interconnect/qcom/sm8450.c @@ -12,6 +12,7 @@ #include =20 #include "bcm-voter.h" +#include "icc-common.h" #include "icc-rpmh.h" #include "sm8450.h" =20 --=20 2.25.1 From nobody Sun Apr 19 09:10:55 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 1C8A8C433EF for ; Mon, 4 Jul 2022 09:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233934AbiGDJcZ (ORCPT ); Mon, 4 Jul 2022 05:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbiGDJbz (ORCPT ); Mon, 4 Jul 2022 05:31:55 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20561DFAC for ; Mon, 4 Jul 2022 02:30:48 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id 89-20020a17090a09e200b001ef7638e536so4841010pjo.3 for ; Mon, 04 Jul 2022 02:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5+gYIpHsZ47Eh2pxDFNpWAcmAPIFH2rD2QueXVUKLjQ=; b=mgBMEF9ODZQVkR0YPeFmJcFby++vP7ojHIFMqqx+DvfqjT3kpW7KO7iLyqperK/CUo x5+4XGTli0eCQ7UpSlKIG6Vh11JVxKp+qdGHcJ3cugE8cED5ueVouaMEdauKYMUDdq3t ZIV4UfGY7+yK6GmAkl8Og/F7HLgQSfPteSH1iMU022QTtbxLhHQVcgxXKYUIMdO4Lv/0 sabtJLaaz4PY4P1dMf4wFa41IvycwjsLNxxDz0pIl19K04ISQ1lfm7O4wQKQDinJwX6J 3z+VVGQ/rBdZdmkOqVWcsW3d0ymOWgNzuLxY4UxkqJl8K3yHLVX9Hls/i9Zec++XaVFL iOMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5+gYIpHsZ47Eh2pxDFNpWAcmAPIFH2rD2QueXVUKLjQ=; b=hICEyEX98iugWkPnu68DAxuWr4sRDROh7YPMsZ9iOkX0v36NgvZ7AK0WW1t1fPMiAG edagiYQsRBPZQww+xJhUgDhoEV8FowjsXIOusJ7pL2j1br2i5FsjD/zI7ySl8Z30rXxh Ngz+kmSMr+mm4scgfKssCOISW9c201dNx7cIat6X6HgoRdEGoqYW0OxzVtaibivV20bn s38W8mI7zQ1dmuVRvkKuyi63A+bzD3Y1cbZAxTmo2Kn4al4DMMq9NM8uJfjHFMRnlwn6 2Voat6iFfpg/mufPfACcTtkjiyKu9fda9yd7gErcsEKSdgepANa809QLYJkxF5+gofAr aUUg== X-Gm-Message-State: AJIora+of5S6wJTE6VneMkdJf5p/CiOeqjgJ6ehIWx0RdeMvfRWPmApO 4R0X09TRFVzavGsDl+nFuonU6g== X-Google-Smtp-Source: AGRyM1sdnDHSYRH4NlqHGYzbbvTM5xpNo8iXR0ZGdgHks69aGD8NIipFy0fxwGyfLgMPdlHQS0nUhQ== X-Received: by 2002:a17:90a:e391:b0:1ef:83c2:2527 with SMTP id b17-20020a17090ae39100b001ef83c22527mr7387822pjz.94.1656927048045; Mon, 04 Jul 2022 02:30:48 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id ms16-20020a17090b235000b001ef81bac701sm2926177pjb.42.2022.07.04.02.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:30:47 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue Cc: Leo Yan , Dmitry Baryshkov Subject: [PATCH v3 3/5] interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended() Date: Mon, 4 Jul 2022 17:30:27 +0800 Message-Id: <20220704093029.1126609-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704093029.1126609-1-leo.yan@linaro.org> References: <20220704093029.1126609-1-leo.yan@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" This commit changes to use callback qcom_icc_xlate_extended(). This is a preparation for population path tags from the interconnect DT binding, it doesn't introduce functionality change for the existed DT binding without path tags. Signed-off-by: Leo Yan Reviewed-by: Dmitry Baryshkov --- drivers/interconnect/qcom/icc-rpm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qco= m/icc-rpm.c index 7e8bcbb2f5db..8c9d5cc7276c 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -16,6 +16,7 @@ #include =20 #include "smd-rpm.h" +#include "icc-common.h" #include "icc-rpm.h" =20 /* QNOC QoS */ @@ -414,7 +415,7 @@ int qnoc_probe(struct platform_device *pdev) provider->dev =3D dev; provider->set =3D qcom_icc_set; provider->aggregate =3D icc_std_aggregate; - provider->xlate =3D of_icc_xlate_onecell; + provider->xlate_extended =3D qcom_icc_xlate_extended; provider->data =3D data; =20 ret =3D icc_provider_add(provider); --=20 2.25.1 From nobody Sun Apr 19 09:10:55 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 B516BC43334 for ; Mon, 4 Jul 2022 09:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233504AbiGDJcf (ORCPT ); Mon, 4 Jul 2022 05:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233838AbiGDJb5 (ORCPT ); Mon, 4 Jul 2022 05:31:57 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB169DFC5 for ; Mon, 4 Jul 2022 02:30:51 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id r22so1532507pgr.2 for ; Mon, 04 Jul 2022 02:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YZw35i4tD7dQYkHhZWLzGB0BrtXzLncPfNzT7OZ+gHQ=; b=zJLfFWR50xifb017AbS4VLlMX9D5KIZO7zGbryzvst11rcydT9/znH6sJj5AqXVOb5 /nIgm3nUcfeWghxNPrldN9qyh7+8xfKW5d+PooJ/QDD2dkBHp55fMHlKVlaOSyiDoicN MtyUT3a2vrIwZYhdD/JpcKYfrLtg0G7P4QmNdaK3tD4JSje1eoGdU8Hj3hi6YPqWgyWi vxglTCiwSuzKdvvX2A5w/5eBhx3u8J8SNNkrd1/IE9WxR9h+UTbDb8Ez3uFcTvMKtqcm 6u8Zk4kk4NMYRr/WlJeQN5eb8BhX1sZNu8japfKHad5YmwogJ+UurSBF2v+fOZQrH1/c T5fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YZw35i4tD7dQYkHhZWLzGB0BrtXzLncPfNzT7OZ+gHQ=; b=fzQgFIoARnn2DKwFMmS7hMtIbdn2g6Dw55YK2TW8OygqV05bkQ0s92xoj6Xvm+ERTD jkWsTEyhBYjjCPpcX9nhbk4DYJU9Tr2X6cG0qeRq4wBFxprmy1npmWcPP+Q54XorfXko NJnII31GTbGybCE2u15crMRjTLmi9EMUeUhRHAa1ejHKo62VOm43yguaOTDqaJBa2gjU VQ10xxui25qpfv6HM1CwWcdDxZjkH9+KwAkwkzEQ2lAnFN5Hw3bip4qRJqFyrF95VyNA r/b8nzh3+sxNSRbGLW9nBQdaDwe81UzRKiIISNTJz6KUqZ0oKVpxtnApf4UujpbXtWmN 4Ljw== X-Gm-Message-State: AJIora+bF7fm6ptzJqbyvgmWqMuTsO8NDy34KG6xGvgeReSsdjBD7L+H JOpyMHNUYRIqTx4UXB7b8Syp+A== X-Google-Smtp-Source: AGRyM1scHocx0l8bITgGQYxRUu6bQxD8HFtyLboo6Uj6MK+WxTdK+yuP2/xv+Dhbg8EdtoH4ZbTfKA== X-Received: by 2002:a63:481a:0:b0:411:7951:cbcd with SMTP id v26-20020a63481a000000b004117951cbcdmr24429313pga.66.1656927050901; Mon, 04 Jul 2022 02:30:50 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id ms16-20020a17090b235000b001ef81bac701sm2926177pjb.42.2022.07.04.02.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:30:50 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue Cc: Leo Yan Subject: [PATCH v3 4/5] interconnect: qcom: icc-rpm: Support multiple buckets Date: Mon, 4 Jul 2022 17:30:28 +0800 Message-Id: <20220704093029.1126609-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704093029.1126609-1-leo.yan@linaro.org> References: <20220704093029.1126609-1-leo.yan@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 current interconnect rpm driver uses a single aggregate bandwidth to calculate the clock rates for both active and sleep clocks; therefore, it has no chance to separate bandwidth requests for these two kinds of clocks. This patch studies the implementation from interconnect rpmh driver to support multiple buckets. The rpmh driver provides three buckets for AMC, WAKE, and SLEEP; this driver only needs to use WAKE and SLEEP buckets, but we keep the same way with rpmh driver, this can allow us to reuse the DT binding and avoid to define duplicated data structures. This patch introduces two callbacks: qcom_icc_pre_bw_aggregate() is used to clean up bucket values before aggregate bandwidth requests, and qcom_icc_bw_aggregate() is to aggregate bandwidth for buckets. Signed-off-by: Leo Yan --- drivers/interconnect/qcom/icc-rpm.c | 51 ++++++++++++++++++++++++++++- drivers/interconnect/qcom/icc-rpm.h | 6 ++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qco= m/icc-rpm.c index 8c9d5cc7276c..b025fc6b97c9 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -254,6 +254,54 @@ static int __qcom_icc_set(struct icc_node *n, struct q= com_icc_node *qn, return 0; } =20 +/** + * qcom_icc_rpm_pre_bw_aggregate - cleans up values before re-aggregate re= quests + * @node: icc node to operate on + */ +static void qcom_icc_pre_bw_aggregate(struct icc_node *node) +{ + struct qcom_icc_node *qn; + size_t i; + + qn =3D node->data; + for (i =3D 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + qn->sum_avg[i] =3D 0; + qn->max_peak[i] =3D 0; + } +} + +/** + * qcom_icc_bw_aggregate - aggregate bw for buckets indicated by tag + * @node: node to aggregate + * @tag: tag to indicate which buckets to aggregate + * @avg_bw: new bw to sum aggregate + * @peak_bw: new bw to max aggregate + * @agg_avg: existing aggregate avg bw val + * @agg_peak: existing aggregate peak bw val + */ +static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_b= w, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + size_t i; + struct qcom_icc_node *qn; + + qn =3D node->data; + + if (!tag) + tag =3D QCOM_ICC_TAG_ALWAYS; + + for (i =3D 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + if (tag & BIT(i)) { + qn->sum_avg[i] +=3D avg_bw; + qn->max_peak[i] =3D max_t(u32, qn->max_peak[i], peak_bw); + } + } + + *agg_avg +=3D avg_bw; + *agg_peak =3D max_t(u32, *agg_peak, peak_bw); + return 0; +} + static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) { struct qcom_icc_provider *qp; @@ -414,7 +462,8 @@ int qnoc_probe(struct platform_device *pdev) INIT_LIST_HEAD(&provider->nodes); provider->dev =3D dev; provider->set =3D qcom_icc_set; - provider->aggregate =3D icc_std_aggregate; + provider->pre_aggregate =3D qcom_icc_pre_bw_aggregate; + provider->aggregate =3D qcom_icc_bw_aggregate; provider->xlate_extended =3D qcom_icc_xlate_extended; provider->data =3D data; =20 diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qco= m/icc-rpm.h index ebee9009301e..a49af844ab13 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -6,6 +6,8 @@ #ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H #define __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H =20 +#include + #define RPM_BUS_MASTER_REQ 0x73616d62 #define RPM_BUS_SLAVE_REQ 0x766c7362 =20 @@ -65,6 +67,8 @@ struct qcom_icc_qos { * @links: an array of nodes where we can go next while traversing * @num_links: the total number of @links * @buswidth: width of the interconnect between a node and the bus (bytes) + * @sum_avg: current sum aggregate value of all avg bw requests + * @max_peak: current max aggregate value of all peak bw requests * @mas_rpm_id: RPM id for devices that are bus masters * @slv_rpm_id: RPM id for devices that are bus slaves * @qos: NoC QoS setting parameters @@ -75,6 +79,8 @@ struct qcom_icc_node { const u16 *links; u16 num_links; u16 buswidth; + u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; + u64 max_peak[QCOM_ICC_NUM_BUCKETS]; int mas_rpm_id; int slv_rpm_id; struct qcom_icc_qos qos; --=20 2.25.1 From nobody Sun Apr 19 09:10:55 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 5B34AC433EF for ; Mon, 4 Jul 2022 09:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233963AbiGDJeZ (ORCPT ); Mon, 4 Jul 2022 05:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233882AbiGDJb7 (ORCPT ); Mon, 4 Jul 2022 05:31:59 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 597FCDFD6 for ; Mon, 4 Jul 2022 02:30:54 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id a15so8427692pfv.13 for ; Mon, 04 Jul 2022 02:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mOcKN2QE8NoS+NlXFqyzvr6uXu60h5tTF9oQlF/WJLc=; b=KILEUB0HZOxwkq5/XBeqjn/uei8YrkNrsJVZViPmOdE2EraFxs3gPVlS9vaVFq0XsV xyilJcHWtyG1L6ky2NJLYlqtWCz5pz9rwz8N2XqcIN6xzN5JMbDz4j45LRocgI6xjf5Q xPiPdfHH1DUNY6GGxTSz6SlQLuWWdgw7Md/KsLQ0v8utLsy0q+ZMkq+BbxntG8pZ+hSa cd4cbVLrBZTXVniEh8tK7lRVrIPmjEqGB6bKca0jeduHPKZ/X1OTqn8CgHgtA4WWReS6 e1pUIl2I5ma9I2/6Mjx5WNsCc0XSG+gYr4I/GyOYsEdOj4FRn9hJR7qiqRpmf2nf2Db2 gegg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mOcKN2QE8NoS+NlXFqyzvr6uXu60h5tTF9oQlF/WJLc=; b=3VN9X9ljx1q/tuuCgklXqTsYPZ5iArzesGdvbdhL63nx0iesZk0QKqRzX58XCOFiti ELWoaH3XcPgGgBsbldQkJcF6Ibk2gyOI3s5XQ7Kl7YIxwYDV9Z5MPtfCMrp6pIiNib2W z7BXgs6TXz6arIFS9MT28fCsK5Gfpf4v4qKh3zAzOxMLZN/f41CkZPN4+F1dnMbzcckU iJMTPmhGyWf39A7SQNVGNLgTeP/MXEPvxD/JNM1v1Z2PPPIe2FFYDEElHAiopfIYtrmg PFBGOpE3dHenJSbDxQY5NBbw/SoJ9ARiWjPCinQh6IvJA9wGETnnNB6YaOkTeAawFoZJ DIqA== X-Gm-Message-State: AJIora9cLjCBrMdgoRiSmmyT/21fIp4cYxcc/FBOAq+/dslbBrX5zGZO O1eStq4cMkUrnI92mTt4yvNoYQ== X-Google-Smtp-Source: AGRyM1vbOAdyX1y53+MovHgyFoSWwnefAVPm2My0x0WH3rIth0QFaye33BFc8w+KNPH6F45CqTuocg== X-Received: by 2002:a63:69c9:0:b0:411:994d:1e12 with SMTP id e192-20020a6369c9000000b00411994d1e12mr20645259pgc.383.1656927053749; Mon, 04 Jul 2022 02:30:53 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id ms16-20020a17090b235000b001ef81bac701sm2926177pjb.42.2022.07.04.02.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:30:53 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue Cc: Leo Yan Subject: [PATCH v3 5/5] interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values Date: Mon, 4 Jul 2022 17:30:29 +0800 Message-Id: <20220704093029.1126609-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704093029.1126609-1-leo.yan@linaro.org> References: <20220704093029.1126609-1-leo.yan@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" This commit uses buckets for support bandwidth and clock rates. It introduces a new function qcom_icc_bus_aggregate() to calculate the aggregate average and peak bandwidths for every bucket, and also it calculates the maximum aggregate values across all buckets. The maximum aggregate values are used to calculate the final bandwidth requests. And we can set the clock rate per bucket, we use SLEEP bucket as default bucket if a platform doesn't enable the interconnect path tags in DT binding; otherwise, we use WAKE bucket to set active clock and use SLEEP bucket for other clocks. So far we don't use AMC bucket. Signed-off-by: Leo Yan --- drivers/interconnect/qcom/icc-rpm.c | 80 ++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qco= m/icc-rpm.c index b025fc6b97c9..4b932eb807c7 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -302,18 +302,62 @@ static int qcom_icc_bw_aggregate(struct icc_node *nod= e, u32 tag, u32 avg_bw, return 0; } =20 +/** + * qcom_icc_bus_aggregate - aggregate bandwidth by traversing all nodes + * @provider: generic interconnect provider + * @agg_avg: an array for aggregated average bandwidth of buckets + * @agg_peak: an array for aggregated peak bandwidth of buckets + * @max_agg_avg: pointer to max value of aggregated average bandwidth + * @max_agg_peak: pointer to max value of aggregated peak bandwidth + */ +static void qcom_icc_bus_aggregate(struct icc_provider *provider, + u64 *agg_avg, u64 *agg_peak, + u64 *max_agg_avg, u64 *max_agg_peak) +{ + struct icc_node *node; + struct qcom_icc_node *qn; + int i; + + /* Initialise aggregate values */ + for (i =3D 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + agg_avg[i] =3D 0; + agg_peak[i] =3D 0; + } + + *max_agg_avg =3D 0; + *max_agg_peak =3D 0; + + /* + * Iterate nodes on the interconnect and aggregate bandwidth + * requests for every bucket. + */ + list_for_each_entry(node, &provider->nodes, node_list) { + qn =3D node->data; + for (i =3D 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + agg_avg[i] +=3D qn->sum_avg[i]; + agg_peak[i] =3D max_t(u64, agg_peak[i], qn->max_peak[i]); + } + } + + /* Find maximum values across all buckets */ + for (i =3D 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + *max_agg_avg =3D max_t(u64, *max_agg_avg, agg_avg[i]); + *max_agg_peak =3D max_t(u64, *max_agg_peak, agg_peak[i]); + } +} + static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) { struct qcom_icc_provider *qp; struct qcom_icc_node *src_qn =3D NULL, *dst_qn =3D NULL; struct icc_provider *provider; - struct icc_node *n; u64 sum_bw; u64 max_peak_bw; u64 rate; - u32 agg_avg =3D 0; - u32 agg_peak =3D 0; + u64 agg_avg[QCOM_ICC_NUM_BUCKETS], agg_peak[QCOM_ICC_NUM_BUCKETS]; + u64 max_agg_avg, max_agg_peak; int ret, i; + int bucket; =20 src_qn =3D src->data; if (dst) @@ -321,12 +365,11 @@ static int qcom_icc_set(struct icc_node *src, struct = icc_node *dst) provider =3D src->provider; qp =3D to_qcom_provider(provider); =20 - list_for_each_entry(n, &provider->nodes, node_list) - provider->aggregate(n, 0, n->avg_bw, n->peak_bw, - &agg_avg, &agg_peak); + qcom_icc_bus_aggregate(provider, agg_avg, agg_peak, &max_agg_avg, + &max_agg_peak); =20 - sum_bw =3D icc_units_to_bps(agg_avg); - max_peak_bw =3D icc_units_to_bps(agg_peak); + sum_bw =3D icc_units_to_bps(max_agg_avg); + max_peak_bw =3D icc_units_to_bps(max_agg_peak); =20 ret =3D __qcom_icc_set(src, src_qn, sum_bw); if (ret) @@ -337,12 +380,23 @@ static int qcom_icc_set(struct icc_node *src, struct = icc_node *dst) return ret; } =20 - rate =3D max(sum_bw, max_peak_bw); - - do_div(rate, src_qn->buswidth); - rate =3D min_t(u64, rate, LONG_MAX); - for (i =3D 0; i < qp->num_clks; i++) { + /* + * Use WAKE bucket for active clock, otherwise, use SLEEP bucket + * for other clocks. If a platform doesn't set interconnect + * path tags, by default use sleep bucket for all clocks. + * + * Note, AMC bucket is not supported yet. + */ + if (!strcmp(qp->bus_clks[i].id, "bus_a")) + bucket =3D QCOM_ICC_BUCKET_WAKE; + else + bucket =3D QCOM_ICC_BUCKET_SLEEP; + + rate =3D icc_units_to_bps(max(agg_avg[bucket], agg_peak[bucket])); + do_div(rate, src_qn->buswidth); + rate =3D min_t(u64, rate, LONG_MAX); + if (qp->bus_clk_rate[i] =3D=3D rate) continue; =20 --=20 2.25.1