From patchwork Thu Jun 30 05:57:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 586582 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 64CC8CCA480 for ; Thu, 30 Jun 2022 05:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbiF3F6R (ORCPT ); Thu, 30 Jun 2022 01:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbiF3F6P (ORCPT ); Thu, 30 Jun 2022 01:58:15 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943E923F for ; Wed, 29 Jun 2022 22:58:12 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id w24so17753171pjg.5 for ; Wed, 29 Jun 2022 22:58:12 -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=gNI2eErAlbnR33nd0lAZVKjou66LXCn6ck0SwxHv5j4=; b=d5+O04srINiHMfVNndzpsa6dNc8jJ5xaDyO5vi6a0dFIecI/i37uzbcZo+hqiDz8SX ZPAiQNVFjdhW25SzvxGfbZqLlpUJdYRZtW905YwHk3mvZOrTxzBE02a/vPIkz+hoYyGf 53zP+cQt/oYmN7A+1gGnp8pKV89GoBjHeOs+k40TTB0EGj5beyrYGx7Ue7Djk/1pReSm vddAG4P9uHV2dvOKfacbSaxrfAWH4fjrgKg/ga1D72uvEYNpd2ka9cDsLZANOXgIjPeY 9mEr3kBVR9ahZAs9Hvf6+kCYkKYd1j4jQEgJoSPfQjc/QUKzFYD2e0zLfLJFMpYDVbyY tRPg== 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=gNI2eErAlbnR33nd0lAZVKjou66LXCn6ck0SwxHv5j4=; b=Dcc9XZyvd3azQv8LIWLzz+LFtiY8n/V7IiOgQIfGGrhVK34RDyWtcbtpHafkRyl+9B 5rTLDgABG9kjlG21U3zxyuIdWFsdx/yC33QXSHOaPRVGLyA7WAxrmdUIYX1n7jwxqP/1 PAre5F80Ad5wfxCLf/PoVD6n/rWotB5Qs2vEjbHFVyHzztTeQTm84jVAhsXo3ghbsaHp XBUCckvumxaiiamrHioyBdi41cNtdrgVR2mXPtjps9aDWZMAbjW1+p99w3AadhzBbUhD K7xgYvOKFJFmr+pmdseuO9zET4eLILK+Fvm3kX52g0NWj6yfpPDqrwiQPNUBFY8D7+cx xVeQ== X-Gm-Message-State: AJIora8ZQjYM45cVlQgp8N9nlYqcz5XzjBWnFoUQ/7xgbEpbsDpE82t2 DPgJKmAlN4cB6V2gPpmbSR+MUw== X-Google-Smtp-Source: AGRyM1sp43RP8loICF5kakWaLmA+jQrwb5s0TO/6VgBGlMCeg7CSpnVA2fI5eiiDTD58heB5y3Mobw== X-Received: by 2002:a17:90b:4a03:b0:1ed:2071:e8c with SMTP id kk3-20020a17090b4a0300b001ed20710e8cmr10354265pjb.216.1656568691964; Wed, 29 Jun 2022 22:58:11 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id b14-20020a17090a550e00b001e31f4cc977sm3309288pji.56.2022.06.29.22.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 22:58:11 -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 Cc: Leo Yan Subject: [PATCH v2 1/5] dt-bindings: interconnect: Update property for icc-rpm path tag Date: Thu, 30 Jun 2022 13:57:18 +0800 Message-Id: <20220630055723.704605-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630055723.704605-1-leo.yan@linaro.org> References: <20220630055723.704605-1-leo.yan@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- .../devicetree/bindings/interconnect/qcom,rpm.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml b/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml index 8a676fef8c1d..16df305ea243 100644 --- a/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml +++ b/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml @@ -45,7 +45,11 @@ properties: - qcom,sdm660-snoc '#interconnect-cells': - const: 1 + description: + '1' is one cell in a interconnect specifier for the interconnect + node id, or '2' requires the interconnect node id and an extra + path tag. + enum: [ 1, 2 ] clocks: minItems: 2 From patchwork Thu Jun 30 05:57:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 586581 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 42F7AC43334 for ; Thu, 30 Jun 2022 05:58:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiF3F6V (ORCPT ); Thu, 30 Jun 2022 01:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbiF3F6T (ORCPT ); Thu, 30 Jun 2022 01:58:19 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0EDD83 for ; Wed, 29 Jun 2022 22:58:15 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id m14-20020a17090a668e00b001ee6ece8368so1800217pjj.3 for ; Wed, 29 Jun 2022 22:58:15 -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=Gu3xvYiMouqlwZpc9/SkH6JQqvVSCOyz8MLUd5itR13depoSpnvcPr3dOMYJzktbiF lceoCUDuu8wqeRw8FLCVW8Dw6zofkzFuXjm32pB1rGj3NXxBciFb15NI/PcrOQWag2Qb X00oTwnPyCjh9Q9rvs+S2R77RtkdkvVMmXZ5vFYJtBCy8ilLP/lQDSzOoqanup5X9TEz MkL2rJM409RL7ppDjdS2NdVtoVc+W42XthkRaycBtwoBZupBeMw0d3ICYGny3vz57Kni 85c8WCJCT0Y7rraZJzNBOTCMQbkltu5an+VcD1L0YlFHmgmriaF4qHvaLlb28J1jX4eJ 7Jpw== 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=7sLT16U3ZtT5Ty3iK3XQTdXhcMaIeNtzfGQF7GcRotJLarcd7mUw8Yys0HJs0k3pXp 0/m3YeALmAVEsqE+LEWIOHI33vTxYCmHNcEG9Rpw7jh3OjCtOxVDMjDtZ9F/TTB7GpWR 39qhuW48/cS9aWYu2OcGYPu5wP0ust4tVuCRntoxfkQ3zbJ7v9vDKXqJI6R/GGHmHXhi JeUKQkA+K2rKoG7kgknXmncMvOimsodPP5i9jPl3x/L3thbHS0SR8iHydqlqVdXPm8OL 4FA5mOBAwXSulXNfi1CEzhGJJsEwHe6GSuEMzlg5D1B8S70bgZfCR078Sc6FARGpMnfB XElA== X-Gm-Message-State: AJIora8P3XpKbsonoRdyMnK6fRasTzNWJa07MILgry8Da/bdIIyEiKwi AIua2aItqhN/zC9DrxYlQyXHpg== X-Google-Smtp-Source: AGRyM1tFYvtMedQBveBDorOasCM1TNMj/Lv00Kb+GhciVBDFT4eW3NXi3u9THxGKm+9jPDQZE/mqKw== X-Received: by 2002:a17:90b:4b48:b0:1ec:fc87:691c with SMTP id mi8-20020a17090b4b4800b001ecfc87691cmr10124494pjb.120.1656568694991; Wed, 29 Jun 2022 22:58:14 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id b14-20020a17090a550e00b001e31f4cc977sm3309288pji.56.2022.06.29.22.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 22:58:14 -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 Cc: Leo Yan , Dmitry Baryshkov Subject: [PATCH v2 2/5] interconnect: qcom: Move qcom_icc_xlate_extended() to a common file Date: Thu, 30 Jun 2022 13:57:19 +0800 Message-Id: <20220630055723.704605-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630055723.704605-1-leo.yan@linaro.org> References: <20220630055723.704605-1-leo.yan@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 +obj-$(CONFIG_INTERCONNECT_QCOM) += interconnect_qcom.o + +interconnect_qcom-y := icc-common.o icc-bcm-voter-objs := bcm-voter.o qnoc-msm8916-objs := msm8916.o qnoc-msm8939-objs := 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 = of_icc_xlate_onecell(spec, data); + if (IS_ERR(node)) + return ERR_CAST(node); + + ndata = kzalloc(sizeof(*ndata), GFP_KERNEL); + if (!ndata) + return ERR_PTR(-ENOMEM); + + ndata->node = node; + + if (spec->args_count == 2) + ndata->tag = 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/qcom/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 #include "bcm-voter.h" +#include "icc-common.h" #include "icc-rpmh.h" /** @@ -100,31 +101,6 @@ int qcom_icc_set(struct icc_node *src, struct icc_node *dst) } EXPORT_SYMBOL_GPL(qcom_icc_set); -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 = of_icc_xlate_onecell(spec, data); - if (IS_ERR(node)) - return ERR_CAST(node); - - ndata = kzalloc(sizeof(*ndata), GFP_KERNEL); - if (!ndata) - return ERR_PTR(-ENOMEM); - - ndata->node = node; - - if (spec->args_count == 2) - ndata->tag = 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/qcom/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 #include "bcm-voter.h" +#include "icc-common.h" #include "icc-rpmh.h" #include "sm8450.h" From patchwork Thu Jun 30 05:57:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 586145 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 1E39AC433EF for ; Thu, 30 Jun 2022 05:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232524AbiF3F6X (ORCPT ); Thu, 30 Jun 2022 01:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbiF3F6W (ORCPT ); Thu, 30 Jun 2022 01:58:22 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0616EA5 for ; Wed, 29 Jun 2022 22:58:18 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id x1-20020a17090abc8100b001ec7f8a51f5so1857374pjr.0 for ; Wed, 29 Jun 2022 22:58:18 -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=VS39FgceRCVipIQogedEwFgAvy76jT2W0c4CCyo+PPlTZ+QmI4LuhhM5ya3OhUWgWF QPvSs0x8ZBrkGUEbnsTwwk+hTcepX62ot6CeQYGJa4CGvLU+DCyb8NimPa/IrxPKfKc2 biY1yU6Ik/GLFoi7O2JpRFUigsurzegwUbhqweNzdN84a6ZP+z1zEm7OPxlMocj3ZayL kPm3w/mh3QkHZvUL74aMKZcdARNsvXczHQbrlgZplcslom4R9KZ1S/ab7tJPyIGnxFA0 /2EPSY2vue/DvhZYkKbi76YVmTfYQfvXoPQ3BE7kumPvexU6GeJHZtmxqmZm6Wk3Fx/l l44g== 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=BhL6GcX5fvrPQKCpAK5fqsqxeixHsqFgraAMbo7JigSVAUuVuinaEnfh3TveiSfqkd atmvPBVSfrQfYM45WICO8zkkXQWPXaklfb1TYE8F9V68aUOI4xzcgjOUu8PtfqJ3Rg7j AdRI1Ez7X7S/qK0wyqy4QrILxeA+oMcqvfkagKndAD9RaQu/Vk8AbEvO2Sb7dRimttZt pxfsDFWBSuaYlnlMevDLGG/3+a1nudIXETQeBk5PSTD+sUimg36Wxw1421RDaRnvCUA5 2wwjK5cke7pzHravY7Li0m5v1U2nOrUJjy98UTgiLcqb+pljTRn0fdzwuCrjiClejlyO A8LA== X-Gm-Message-State: AJIora/uKmeiIxkosOcKJBxeY8aEq0jUoR6AcwGwNRblVoLGfPNlVhp/ i84G1veAorN+ba/YJYd7w8govw== X-Google-Smtp-Source: AGRyM1tnxFIiHLBlvCMuIDhD6msTNejBsQvf+bkwYfMoJ42aiYgUpwvzjCg/xjcSPx12/zKVCAfeQw== X-Received: by 2002:a17:90b:248b:b0:1ec:9869:59a0 with SMTP id nt11-20020a17090b248b00b001ec986959a0mr8110417pjb.37.1656568698192; Wed, 29 Jun 2022 22:58:18 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id b14-20020a17090a550e00b001e31f4cc977sm3309288pji.56.2022.06.29.22.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 22:58:17 -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 Cc: Leo Yan , Dmitry Baryshkov Subject: [PATCH v2 3/5] interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended() Date: Thu, 30 Jun 2022 13:57:20 +0800 Message-Id: <20220630055723.704605-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630055723.704605-1-leo.yan@linaro.org> References: <20220630055723.704605-1-leo.yan@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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/qcom/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 #include "smd-rpm.h" +#include "icc-common.h" #include "icc-rpm.h" /* QNOC QoS */ @@ -414,7 +415,7 @@ int qnoc_probe(struct platform_device *pdev) provider->dev = dev; provider->set = qcom_icc_set; provider->aggregate = icc_std_aggregate; - provider->xlate = of_icc_xlate_onecell; + provider->xlate_extended = qcom_icc_xlate_extended; provider->data = data; ret = icc_provider_add(provider); From patchwork Thu Jun 30 05:57:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 586580 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 191DCC433EF for ; Thu, 30 Jun 2022 05:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232672AbiF3F6c (ORCPT ); Thu, 30 Jun 2022 01:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232512AbiF3F6X (ORCPT ); Thu, 30 Jun 2022 01:58:23 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DE3D85 for ; Wed, 29 Jun 2022 22:58:21 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d17so17123149pfq.9 for ; Wed, 29 Jun 2022 22:58:21 -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=MnrkkkQngsd882Zalre1QkUMe2ArvPJYExWnuAXbTuXsuU2qRxNOE5BVO1bfkeE1Re puXMlzWxtZ35+ltaHCe+oT8MWh8sKhbBMn8NR6K4m8xfG90bn0nlzaTglNagAg3JEE+J UTr/DVFQix0Z5NVe3RO+R8qPtVmQwR7RWW4TBe5IHR+QiUJR4ga6QZLCqR3aVFcqlSWu giLINCkQ8dMjmoqg1R0Ayj7DSzy9TODnxJzSNE767uqfRvp1zjHgtMLXzRiRKH44Sbpp 9v0Psj1iendUbddbUSqzWmcmtr6qg3K8euV3dZi3F7cVY05hPVukCNBooEOKPgCY8pFC SPEA== 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=ALpML0rAF+oqgC17s2qsFou60ievU/rkUSDnyYUjMgtLR/PcQrs1rsd5vtN6JBJC9o NKhNICH4qAKJIi5cRRfmKBrim3aoojaCPXg9CD+qKQ6wOglbQOh+1kzOEVbiFE7Gxs5s cxrMxy+52DFWKGyDKOFvGzJkcM36Up/jfukadmfG80xw7+t5Kblh3isiho8WaYqW1hKB TUo5od9+bBnsqiv1HdIewukScLsYx5/1H11gJ8+cUxHkExNA6daApTrYsnXc/P6eaptp ibWAHGo4Mf2lyB4cmsB04F460YMItnMDv43WcWLmrLL5AHl/6fAopcxzv5Rh74I22hMc LdVQ== X-Gm-Message-State: AJIora9d5/RvXT7/7z5XNSzof3jEujTohGnyTck6UQ3UeY8cUaf9LAvP OU4vzVAMdLX+ICV20O198n060htvFBFxX/2nR/w= X-Google-Smtp-Source: AGRyM1s0pbVgYymjRA/AoQmD/YyxHMpMN4XE9vLP38BnWLV3SpmI5t3mWSuoR8Dl1JLjDFosnOFnlg== X-Received: by 2002:a63:8949:0:b0:40d:44d6:423e with SMTP id v70-20020a638949000000b0040d44d6423emr6141673pgd.525.1656568700955; Wed, 29 Jun 2022 22:58:20 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id b14-20020a17090a550e00b001e31f4cc977sm3309288pji.56.2022.06.29.22.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 22:58:20 -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 Cc: Leo Yan Subject: [PATCH v2 4/5] interconnect: qcom: icc-rpm: Support multiple buckets Date: Thu, 30 Jun 2022 13:57:21 +0800 Message-Id: <20220630055723.704605-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630055723.704605-1-leo.yan@linaro.org> References: <20220630055723.704605-1-leo.yan@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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/qcom/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 qcom_icc_node *qn, return 0; } +/** + * qcom_icc_rpm_pre_bw_aggregate - cleans up values before re-aggregate requests + * @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 = node->data; + for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + qn->sum_avg[i] = 0; + qn->max_peak[i] = 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_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + size_t i; + struct qcom_icc_node *qn; + + qn = node->data; + + if (!tag) + tag = QCOM_ICC_TAG_ALWAYS; + + for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + if (tag & BIT(i)) { + qn->sum_avg[i] += avg_bw; + qn->max_peak[i] = max_t(u32, qn->max_peak[i], peak_bw); + } + } + + *agg_avg += avg_bw; + *agg_peak = 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 = dev; provider->set = qcom_icc_set; - provider->aggregate = icc_std_aggregate; + provider->pre_aggregate = qcom_icc_pre_bw_aggregate; + provider->aggregate = qcom_icc_bw_aggregate; provider->xlate_extended = qcom_icc_xlate_extended; provider->data = data; diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/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 +#include + #define RPM_BUS_MASTER_REQ 0x73616d62 #define RPM_BUS_SLAVE_REQ 0x766c7362 @@ -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; From patchwork Thu Jun 30 05:57:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 586144 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 28DBFCCA481 for ; Thu, 30 Jun 2022 05:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbiF3F6d (ORCPT ); Thu, 30 Jun 2022 01:58:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232566AbiF3F60 (ORCPT ); Thu, 30 Jun 2022 01:58:26 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C93D5F40 for ; Wed, 29 Jun 2022 22:58:24 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id m2so16111986plx.3 for ; Wed, 29 Jun 2022 22:58:24 -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=pZjsRZTAwDlI6M2jOs66KZmBv8r8btKEibDsbfGgZSpidDHtmMDdj6IC77PdRTCtqt p6uBX2yhxuwyhTrdxYbhL1BA8hOxIBCmJvd+WJ151KUlBRSyqdx8RXwGZIAm578e7gm8 fTumnZDyFspv0s9uN93zk+/M+quP154g5IbRGFKaqFw1If+UahOcYIcK50KX+PPr69xt c9CYNWVgY/B9FYW0KvmnfHzZsMUuqljPikr1xXTraKp694O7k7vmK6GtE9adBR7Vy0SE iJPpvqpBotCziNebA1k74r5bF59nrsAfeBFpwa5iRyG7x3sj9b/V2QQ38vpWeLWJ7J1s hdQg== 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=Q78GuozTG+3NiHIaylLA2GeQ9CdV15heY0+Q40SaLJTXNtTVP1AomKw61xqGCDlov0 hkk+OKylZNMro6mehZNTx5n817imFjDOZrBR1Ri4k65kqLUKcZQr7IgSFNIfWqnSVHlp fchmrV7K7aHxNkaoXgWszEM6efNdhkOPn/sAIx3BjGlyd3ZoFRSNxyj4m3QNetMqe1nI iM4cfqNWYsZUZwQSwfoN22fljfCltpeb5bzbiSItdxomfBofI1SLt9/vd7To7ryS76Ge 9VjigedZNszXmmpYYMBkl9emkd/VOSsqCSJZKa3eO9DILiCpIXasdxQAqG/goqCqUhKC ksGA== X-Gm-Message-State: AJIora9tTC3VOA0Ih69xZikHvVSFwAOWtyLDjdvnVu2XICEvZTPCbEcv TXpCf1MBTtd3wavIy3PfYRElphJ4ibXWzC9hggo= X-Google-Smtp-Source: AGRyM1vqhX+FQ8dE0YoXIV3JRUBlBXZSr4HU0Fid4k1/qav4hqj7bVmuCBytiMOacAgz/y291CanFw== X-Received: by 2002:a17:903:41d2:b0:16a:2cc4:4824 with SMTP id u18-20020a17090341d200b0016a2cc44824mr13069024ple.112.1656568703771; Wed, 29 Jun 2022 22:58:23 -0700 (PDT) Received: from leo-build-box.lan ([154.3.32.171]) by smtp.gmail.com with ESMTPSA id b14-20020a17090a550e00b001e31f4cc977sm3309288pji.56.2022.06.29.22.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 22:58:23 -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 Cc: Leo Yan Subject: [PATCH v2 5/5] interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values Date: Thu, 30 Jun 2022 13:57:22 +0800 Message-Id: <20220630055723.704605-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220630055723.704605-1-leo.yan@linaro.org> References: <20220630055723.704605-1-leo.yan@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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/qcom/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 *node, u32 tag, u32 avg_bw, return 0; } +/** + * 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 = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + agg_avg[i] = 0; + agg_peak[i] = 0; + } + + *max_agg_avg = 0; + *max_agg_peak = 0; + + /* + * Iterate nodes on the interconnect and aggregate bandwidth + * requests for every bucket. + */ + list_for_each_entry(node, &provider->nodes, node_list) { + qn = node->data; + for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + agg_avg[i] += qn->sum_avg[i]; + agg_peak[i] = max_t(u64, agg_peak[i], qn->max_peak[i]); + } + } + + /* Find maximum values across all buckets */ + for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + *max_agg_avg = max_t(u64, *max_agg_avg, agg_avg[i]); + *max_agg_peak = 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 = NULL, *dst_qn = NULL; struct icc_provider *provider; - struct icc_node *n; u64 sum_bw; u64 max_peak_bw; u64 rate; - u32 agg_avg = 0; - u32 agg_peak = 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; src_qn = src->data; if (dst) @@ -321,12 +365,11 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) provider = src->provider; qp = to_qcom_provider(provider); - 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); - sum_bw = icc_units_to_bps(agg_avg); - max_peak_bw = icc_units_to_bps(agg_peak); + sum_bw = icc_units_to_bps(max_agg_avg); + max_peak_bw = icc_units_to_bps(max_agg_peak); ret = __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; } - rate = max(sum_bw, max_peak_bw); - - do_div(rate, src_qn->buswidth); - rate = min_t(u64, rate, LONG_MAX); - for (i = 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 = QCOM_ICC_BUCKET_WAKE; + else + bucket = QCOM_ICC_BUCKET_SLEEP; + + rate = icc_units_to_bps(max(agg_avg[bucket], agg_peak[bucket])); + do_div(rate, src_qn->buswidth); + rate = min_t(u64, rate, LONG_MAX); + if (qp->bus_clk_rate[i] == rate) continue;