From patchwork Sat Apr 16 15:40:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 562921 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 9E324C433EF for ; Sat, 16 Apr 2022 15:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232438AbiDPPnG (ORCPT ); Sat, 16 Apr 2022 11:43:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbiDPPnD (ORCPT ); Sat, 16 Apr 2022 11:43:03 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73679433B5 for ; Sat, 16 Apr 2022 08:40:31 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id bg9so11240265pgb.9 for ; Sat, 16 Apr 2022 08:40:31 -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=MLiyvZcLIUnaVPXblBwx9+1eET/plc8foqRJgpRSeUo=; b=SiCgVARYhgTmE574/ks7bfySHsHCa75Ed7+PW4wt0YORpyGdyiqXC+XNiirg0Dw9jn HjZpIKzu153NIOr5xxptZE/ESJV1IDLbBiMYtToZnyI5rZpKQQ+kaw7BYHmZJUDFq8u1 p7vMHTkx1h4ydSKoB31ia0CtaAfgg/lsUab2snaIbYmDrBBxtEMx18jEnxIuyIYcjuS5 AyExSjdS8ojML3jjv0m7jhqBHi7fpvalDEvMeEgUWrM1WBf0h8/ZeSaJ6L5VOVOQx6d6 w+E8/I11bIYsbMipF4KtRCC64RHe8I59E8oyerooYrlJnKVVRsFCkt8EakZt7kXSnRh1 X1YA== 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=MLiyvZcLIUnaVPXblBwx9+1eET/plc8foqRJgpRSeUo=; b=os/eWHZjSwY2Qmhp4wgg+7JlIt2yjrzDRVvCgGi82c3mSYgfUFPQwQKjUyxMpuPl1i TPpioloNBFEv+8AT7bvdDzNEsxSt5agv0lMVLnKoLNsbvtB/3VU0VuV9yGUWLQR4Fu19 aC/PDcC5IGZ+Txm3xbRrglZHqxtdPSz837+AMDa7fbq76SSXUbS2aRuXVczySOAYLVCm hL++/kfe/9n2PLs4cXiEwWw4jeGFoiN41hDVSxmmq4UcOolphorvISzTGwjTpkk+aptg 0Qa4aRPnl7EI7kOC0IywEXjYnvJVvLSHTuqLPVU7cZOCEs+Cc2sSClBUs04xgvnkqn+L 3JDA== X-Gm-Message-State: AOAM530+lI8oKfnsc6asfI+XbHTIpRlYs2uvt9CfuB8gp1J2EbGNZJ3U iwRIorlIB8unnyD41awk5h3z1g== X-Google-Smtp-Source: ABdhPJx5XKw3cl8ll2dro4UYoS+fk0a53QJruoeWYW8gH4r+D9d0PHhg/1q1oq319RL8SOJa0/iBVw== X-Received: by 2002:a05:6a00:8c9:b0:4fe:ecc:9bcd with SMTP id s9-20020a056a0008c900b004fe0ecc9bcdmr3950760pfu.34.1650123630920; Sat, 16 Apr 2022 08:40:30 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm6358681pfh.174.2022.04.16.08.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 08:40:30 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , Bryan O'Donoghue , Dmitry Baryshkov , 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 v1 1/5] dt-bindings: interconnect: Update property for icc-rpm path tag Date: Sat, 16 Apr 2022 23:40:09 +0800 Message-Id: <20220416154013.1357444-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220416154013.1357444-1-leo.yan@linaro.org> References: <20220416154013.1357444-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 doesn't contain tag, if set to 2 for "#interconnect-cells" property, then the second specifier in the interconnect path indicates the voting is for which buckets. Signed-off-by: Leo Yan --- Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml b/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml index 89853b482513..7464a50804db 100644 --- a/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml +++ b/Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml @@ -118,7 +118,7 @@ allOf: - qcom,msm8939-snoc-mm '#interconnect-cells': - const: 1 + enum: [ 1, 2 ] clock-names: items: From patchwork Sat Apr 16 15:40:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 562646 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 78481C433F5 for ; Sat, 16 Apr 2022 15:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232448AbiDPPnJ (ORCPT ); Sat, 16 Apr 2022 11:43:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbiDPPnI (ORCPT ); Sat, 16 Apr 2022 11:43:08 -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 0DAF8433B5 for ; Sat, 16 Apr 2022 08:40:36 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso10561101pjj.2 for ; Sat, 16 Apr 2022 08:40:36 -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=tgYVWdpY8CyuL5sDrlDO53qb/SZkB70TcEHgXhi98kg=; b=HRHo8e+OvKKl2H/ZwkgeMRfgFcUARjiWX9d58xRm8WRINkMgt4+btg9kPhRn0qp8F5 XIamOUTabF4G2xGFvVm6uknoulkQmLxnJzLjPtYqzWjW0FLsHfy9Woq8z0W1Zfj4Qh3l xgCzl/wE1dM7FSdjiriNP2OBm9dO6x6fY6hM1NUDQHxWBbETIHIKgUwzyydJIkODiy0S zpcBB0tne1xjsJjj8ZX7b8lQbKeAsLqUBnsMIcb0mnSX5FVosdRat1hZoVc/6GIYDfRM 8m2rR31/MMAzLnAVkkJnahb4ICwo42YfAmLW8LBe81amkWeyMSJsw4b3jvqQfm1e4h2r v+qA== 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=tgYVWdpY8CyuL5sDrlDO53qb/SZkB70TcEHgXhi98kg=; b=4AB3cfOX1lmYkL94d5rTHKW1p1/2IWUHqUawwTREKFzc5+yRfgu14lwvcKlH5DUtyo skq6wszbNbXjx0hA8morqiLgsobWcvK0wr499sR//crXQ1gGiLnctb12bzqlNW4dCVKZ McinTpVzTVXUxJ9ZvKD0QWPDK/jnuQYVmee7QjLweCcNUculcOBfFSO9LJpK825kUywW rGSEzu3R5XYBpUY6s8RrYhfnmig1Dgg4Ca80bTFAU5leKd0u4za1i0dVWcJplO5YTz7C EWOv7uNHMzCaV3rfxPpVNzr0dPZdARIFk5Xfs9UNcXbIvvY/pxZpZZxsUfetumCoMF8B xA7Q== X-Gm-Message-State: AOAM530mE6qhgVVosuAz8UIE1F6ZU7koCiGu4vY4ySqG7g3eGDSgwnlf 0WW5TBVOKxdsARU1CHXr4M5cAQ== X-Google-Smtp-Source: ABdhPJyQ11yTE/VF6mFuaO/EuvqcXW4BsaFTSPdsJPfdrJjCldUpUDXCaaSWQVvDLELiohPIvHD0gA== X-Received: by 2002:a17:902:c944:b0:158:de4a:6975 with SMTP id i4-20020a170902c94400b00158de4a6975mr3802627pla.131.1650123635432; Sat, 16 Apr 2022 08:40:35 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm6358681pfh.174.2022.04.16.08.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 08:40:34 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , Bryan O'Donoghue , Dmitry Baryshkov , 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 v1 2/5] interconnect: qcom: Move qcom_icc_xlate_extended() to a common file Date: Sat, 16 Apr 2022 23:40:10 +0800 Message-Id: <20220416154013.1357444-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220416154013.1357444-1-leo.yan@linaro.org> References: <20220416154013.1357444-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 ceae9bb566c6..bbb3d6daaad1 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 2c8e12549804..9a0ac85d2a84 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 4bfc060529ba..84acc540a5f7 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 8d99ee6421df..23045cf17e37 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 Sat Apr 16 15:40:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 562920 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 A04ECC4332F for ; Sat, 16 Apr 2022 15:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232459AbiDPPnO (ORCPT ); Sat, 16 Apr 2022 11:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232449AbiDPPnN (ORCPT ); Sat, 16 Apr 2022 11:43:13 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97FD843AD9 for ; Sat, 16 Apr 2022 08:40:40 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id n11-20020a17090a73cb00b001d1d3a7116bso1364324pjk.0 for ; Sat, 16 Apr 2022 08:40:40 -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=HJhN+lqO5QfhYgAtNvvwhhSwf96KYqEAp+AGuYIx/Sg=; b=i2te6qXoU//4cdVhxTEwWC9pQ+FLUAN01QKcchdcuodcAJwbfhQJllgw/eQUEYwalY ILoiuc4BF9gWt1XbnAm0LhhIQD6RfAttYt9HcuEI0J5K0hVmhKB1JUCdRIZiNrQCqS9q J80ddrHOUtp7OHmoRmomb/Vzt7fb1Leh+vbFuuNYejIOflz1QH5yuM7W+RxF/FF0wVkJ ctb7uB3TCHVsQkpa99GO5b7hKLTaEngL2zA3Ufp2xUZSgTUSsjdNgGit9OGLNjul/9mb xJQihTCDh9//bSbHJlxHiCD6R8mNiLnjYPzSR7/qjD3ViL8vn2G0FIbXYnbd90f9P/o8 jxBA== 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=HJhN+lqO5QfhYgAtNvvwhhSwf96KYqEAp+AGuYIx/Sg=; b=34suRnm6+0jFN46T38+HGC0uh8UgBsOm0IUq7Zffr8IIJeQT4DYIWrRJn1oe/Fr2Xr lVdq5sROnNTTNitQeoH3bJ/dPhMA692ohcaiiRoJgWtYqbma6BQrANF4BOMNV30rm7V3 pqHMx1HIJVfLq+QgsBAflj+9QP1WbjYHaVvWqYvDJOBY8RnLL720/BVkR7aCiV1kovNK NIyxz4HkRXWeG0mIqqiIImR0Ksx/A5wk5w1Uvx1ly/vTH5jdFeOtFuR/zdDJ426T/Wg+ tORbbRYvVHqFK0BO+ObXs40YR+wofLKACB9aDZn7rXxFAUSV6PcAA3iN+dgFDhcdXppk /Gsg== X-Gm-Message-State: AOAM533Gfe3WIsUcG8QNv7hz+Gd+26HZKJ+qA1uT2jcvBgF24da1thEc ZT+mywWJ5ylmxmbRXRnb/jMWGg== X-Google-Smtp-Source: ABdhPJyHueERVmn+pCpI9GEtlGf3EdPV3lE8dAHtr7BQ2HucdY5SkmFUF8jn57BKT9OWp0AFFTW7lA== X-Received: by 2002:a17:902:7e85:b0:158:c12f:d662 with SMTP id z5-20020a1709027e8500b00158c12fd662mr3733805pla.141.1650123639924; Sat, 16 Apr 2022 08:40:39 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm6358681pfh.174.2022.04.16.08.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 08:40:39 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , Bryan O'Donoghue , Dmitry Baryshkov , 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 v1 3/5] interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended() Date: Sat, 16 Apr 2022 23:40:11 +0800 Message-Id: <20220416154013.1357444-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220416154013.1357444-1-leo.yan@linaro.org> References: <20220416154013.1357444-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 45d23aaeabf6..2ffaf9ba08f9 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 */ @@ -395,7 +396,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 Sat Apr 16 15:40:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 562645 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 1D7E9C433F5 for ; Sat, 16 Apr 2022 15:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232452AbiDPPnS (ORCPT ); Sat, 16 Apr 2022 11:43:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232455AbiDPPnR (ORCPT ); Sat, 16 Apr 2022 11:43:17 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2035143AD5 for ; Sat, 16 Apr 2022 08:40:45 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id i24-20020a17090adc1800b001cd5529465aso9237422pjv.0 for ; Sat, 16 Apr 2022 08:40: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=pX4HjQ3ivemJ1iGijdmhH5B9H0Rvrrgm3X88jva/bN0=; b=ZnmRPloUsbpuCgCElVmAT2qCfPiIHMHTOHu32lcyex9OkH/tkXg8iP7dZYV3y1ridR bZN92FcYLJsDaqcPzOAjISj8AU1tSLlmh8hKEbPbVr9BvikAywjadWXI3ZpfLjYkTnjC ecr0a+1uXOkN9yP+J7So7OaGVl1DHiPgnCDrVNhtCFLjBpYqyinls2rKwQ3XDlGlYOf1 /+bI4oDH1baZRj3SinTxatyydbjk3ICYLZYWIjopfPhbRUjORYb5w7IXjtCJgIID2a6z kGgfyts2apleJis6U+xSXcRdnormK/rv3aLN94aXv7zSJKXwv73B9OCsyoEh9qcOvzPI CFPg== 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=pX4HjQ3ivemJ1iGijdmhH5B9H0Rvrrgm3X88jva/bN0=; b=PI0xD0eXD/9CtHOxEm9ja01dzox0D3j5Sgbi935H3LEJY2DXMpO4lbFL37huYAk9Pt EwkOWUIQ8BbPj8i4JTvkJEFXML3fxvmGE3to3nhgrhS8gGJgEsfa2hK3vbNqJEiQTQQH Nw8QjTxoNpuIpApfuDEZdYya4EkIW6EhI5tecb9B21QAHKxrBJSD4hcciK4FLA++lezP Wm26Z+V8rwYZGR9VldIC7qKahfXn7s4Z7I89Yu5YJYjHhnhpJWyEzqksL+G0Kd5dZtI+ 86p+btN8DjVBRh6ypgwIxy4KdUIjuUkqk/XvXPKaBWoyByNEL5zaeJsR6bKSWMwR0ept OfRg== X-Gm-Message-State: AOAM530QicU26+WbuCQRAZIOk1cKHggTt3JPJk1B2W3E8eTtIn1AHjFy aH2EiHaAWUTJUj9PHlxr6wThhg== X-Google-Smtp-Source: ABdhPJz0Sh63ihtTleKIFh9pi3M/2idU3a3wqfMXKb0pasbW9De65odsEA68NEdgwQvgcai+ipeJrw== X-Received: by 2002:a17:90a:b10c:b0:1cb:9e27:5005 with SMTP id z12-20020a17090ab10c00b001cb9e275005mr4375069pjq.241.1650123644465; Sat, 16 Apr 2022 08:40:44 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm6358681pfh.174.2022.04.16.08.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 08:40:43 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , Bryan O'Donoghue , Dmitry Baryshkov , 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 v1 4/5] interconnect: qcom: icc-rpm: Support multiple buckets Date: Sat, 16 Apr 2022 23:40:12 +0800 Message-Id: <20220416154013.1357444-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220416154013.1357444-1-leo.yan@linaro.org> References: <20220416154013.1357444-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 also 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 2ffaf9ba08f9..41c108a96ea7 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -234,6 +234,54 @@ static int qcom_icc_rpm_set(int mas_rpm_id, int slv_rpm_id, u64 sum_bw) return ret; } +/** + * 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; @@ -395,7 +443,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 f6c4ac960102..e8ee29ea132f 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 Sat Apr 16 15:40:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 562919 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 89E28C433EF for ; Sat, 16 Apr 2022 15:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbiDPPn0 (ORCPT ); Sat, 16 Apr 2022 11:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbiDPPnY (ORCPT ); Sat, 16 Apr 2022 11:43:24 -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 D460F43AEA for ; Sat, 16 Apr 2022 08:40:49 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 125so11258252pgc.11 for ; Sat, 16 Apr 2022 08:40:49 -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=U5d0zYZ5+/Tkvm61fQS6okbc7Mh/5Bl30pRUEHW+V10=; b=oSFmSrkpPKvO9fbkYCk3UdWDdX/mtlRloZeotCBLoIWSWfHiAKegibFwinUMtfz1qB shDnTy0WmJClr2IOacTGrFkl022+olnKdy18nMYZlMalZLe3Oc8l8pk/f9uAzbjvNTRO 53ZMPSQ/efIO3yZ+V4WJjzFpZZOymdo2Ysx5IydbOC5xMTGVamcpVsWK2uZEtyBz8DEQ GOP7ukqmu93EdT2IHOKwXF+vgB5Hlgboy4sHZuzXiKnNEE666nd6ny/pUhh4bgDxior0 QDGhSUhrQrxl41zX0OtLomtHsQD5n0wS9SC9EtL/P1Zcv7UfNBcwfPhVcH5MQflsa6no VWDA== 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=U5d0zYZ5+/Tkvm61fQS6okbc7Mh/5Bl30pRUEHW+V10=; b=uPDenQLknL9XexDsXGfuyZDZNXT99aDRYCC/3fnIDu0wSTZQlAJ9BbrO392Tlalued 8Q/r2r6PKbd8UzEt/LfaDvfL94zO9Ag64lOLIPu2e4XpswNbz9gUiPOnrXnjManq7xqs mGNI3VfE1MA2Bg9eEn1V7soKbUC7Tv4qUpiC+xJ8dz3cZNjGwCffPXJ5mgkoRiqK7EK3 db/KyqnCLGJu3fYntRTvB0RLUp5G2khz9Sl18Z6SHgtbcM7lRA9GY7dmGr9qsEq3NbsB Q4uCNcxHgmxxO7ZJwQGP5u5P5rb5jByoI/v+1L8tEm/tifWUwjWjFiNPXm2KZ4x9tVOW 5MOQ== X-Gm-Message-State: AOAM532sHlq+YrKNo5DYsnH7jWmjQaanRTKSlQ6cIXkkj6+vGKlWHPZ0 FzsjXgnGg/lC5oidA9tqrJvwzXwWa3tMxztiS5wp+g== X-Google-Smtp-Source: ABdhPJwD7nKEqOCPfjWoGBGIhtOXB1UHAVlIYGzQsWeQMBVdVCX96tWC47BU4QdMtgGQ8SsoCLDI4Q== X-Received: by 2002:aa7:9afc:0:b0:50a:4b33:a1d6 with SMTP id y28-20020aa79afc000000b0050a4b33a1d6mr3895374pfp.30.1650123649231; Sat, 16 Apr 2022 08:40:49 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm6358681pfh.174.2022.04.16.08.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 08:40:48 -0700 (PDT) From: Leo Yan To: Andy Gross , Bjorn Andersson , Georgi Djakov , Rob Herring , Krzysztof Kozlowski , Bryan O'Donoghue , Dmitry Baryshkov , 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 v1 5/5] interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values Date: Sat, 16 Apr 2022 23:40:13 +0800 Message-Id: <20220416154013.1357444-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220416154013.1357444-1-leo.yan@linaro.org> References: <20220416154013.1357444-1-leo.yan@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This patch changes to use bucket value to set bandwidth and clock rates. This patch introduces 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 41c108a96ea7..c1705b6a6b15 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -282,29 +282,72 @@ 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 *qn; 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; qn = src->data; 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); if (!qn->qos.ap_owned) { /* send bandwidth request message to the RPM processor */ @@ -318,12 +361,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, 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, qn->buswidth); + rate = min_t(u64, rate, LONG_MAX); + if (qp->bus_clk_rate[i] == rate) continue;