From patchwork Wed Jun 14 18:04:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 108113 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp155012vqr; Wed, 14 Jun 2023 11:43:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4pPrrb+Z2RnvOBdkQqW21aYpBtLgU5Hj0p45Ja23bwEn4+Nl8idH+yY09TBYPK9RBGvZJW X-Received: by 2002:a17:90a:13c6:b0:25b:8c02:13f4 with SMTP id s6-20020a17090a13c600b0025b8c0213f4mr1995762pjf.38.1686768203575; Wed, 14 Jun 2023 11:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686768203; cv=none; d=google.com; s=arc-20160816; b=T3M34eVTLmOMOos9vaN2vC6mXxMJsCxST+ml3iZdFuEzouCJebTSdC9jjK3ZxpiHGo mBMer+YDekcXwW1J4tPMvFDXI1a9wHrCVkLN0B8m0+kMSi/GbWlqzV4n0wZZcc3lUfno UXDtc3Ldrw/ANc+tVBwAzXEvGz/oYhkkANj14LHRDLtCDCapn1BYd4+JJ1gpLanHLw3k 4Nx+HNMUONF15ImvNj6b44hispuLazMkPWSwdavMOyS8ezxI/VHFj3LFxnCJ/NjrEN+H ZhL12kpfrkl1sfI73nT1yRvqDTsgb/1/sZbWt7e2p529lg1LLlWGTvUMAEe9JDm61W4t 7BwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=p7wfrKtOuiG3iOR2rZXazcj4Xb5KmwKNQQmAN1Tw0Tc=; b=G8BQTqnTlf/EZ5cj2hjlKHh7ajWm83V3pKtkmYWF3DCsqS1ClzfZ1Getbqvu3in6O/ 2HFdmQ7t0koifxpNk4o3Vh4oVVu8yA4S2Y6BQpl3VjENjD3sDFTQUrsxU8YkeVUOaqJC xhCHYSbgUiZQlF1/vabM8YjRLrnktVxHJFcsp8o6nIV4evcGusA2obPNnN9GtZLLwtUZ wqpt3VcZ51N1cKJok9eQg8rawO2OVqlIJKz9byqNcOp4owxrJFOG/FDoJGTuhT3NhC63 6L0H04kRVXzzupUtFTwWqlQZ2yVaRG91j6GPc3V3hQpx4VVz+vN6LDLbcC+IrzqHnG8b ZYYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dtaa1qLd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a17090a948700b0024686879af0si6713522pjo.169.2023.06.14.11.42.56; Wed, 14 Jun 2023 11:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dtaa1qLd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242074AbjFNSHM (ORCPT + 99 others); Wed, 14 Jun 2023 14:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241570AbjFNSFO (ORCPT ); Wed, 14 Jun 2023 14:05:14 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB002118 for ; Wed, 14 Jun 2023 11:05:05 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f63ab1ac4aso9007950e87.0 for ; Wed, 14 Jun 2023 11:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686765904; x=1689357904; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=p7wfrKtOuiG3iOR2rZXazcj4Xb5KmwKNQQmAN1Tw0Tc=; b=dtaa1qLdBJn9FVCuq6V7om4iAj14TdzP2WZ15HKihThdEmIg0Dew2TaKK0g/4z5YgA XyEf6BzRjNqWyTVrYX1cRiOEBuLQsRm0lJ/CyniRtH72K/HoBzVOrhzQ+ZlPm0YiuZPe sScQZhRE5d03EFjnGm1HUIP9SdkaYAs2W3YqdcD0XJvEbks3hejQ1aDgQ2aKiEFzwtXm NYqdcb2PWedk3+/m3OJNe3IvYPfLG4LEysaGxwvoGNd9+Kv5gIWcJGxtFMNFDBY/8KSw Wbkcij3KZwrvRQ98GKYfk33eEkx4bzltiltZlffupHSmzlFoBXgwiZ2YCjcwAio1pVRJ UBPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686765904; x=1689357904; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p7wfrKtOuiG3iOR2rZXazcj4Xb5KmwKNQQmAN1Tw0Tc=; b=lFUMpfIOorsTxyZOtpA4+8cjLBfbqJb3yhysrqRaOOmSK30MiTg5UFvjMkjJgkFRya tQOo4WF4zj9IpU/VOleOOoPooyJCZTcKgPf9Mc7tG3IdOfcVyCF5+922bJzb3yK3AHLk amEVnhO+RLNTE4mvT14dioQUp/1IDLo33sa+RA6nIT7lCJ/pICV/CQ22ckXYb6/3m43h FdKwUvEmv76p8Mr90QsKDhdeb4DHmNljY5ZB/JekoDRNBBepRCUjjRgozgxvnGBX4esO lS+Gj+Z1popiuv1wzrg9EeJC1VCuseQkN6o7h5YKrkGfkVyYu3ajoiWF926Vw8+KSOPu fiNQ== X-Gm-Message-State: AC+VfDzTd9NSXwmExfgb9gSE5YBV8DitREcON5wZJvjdxCVYtwfuEoi+ mNbr580BBg/D2qNBwfdeE4JHlw== X-Received: by 2002:a19:4316:0:b0:4f1:866d:9b01 with SMTP id q22-20020a194316000000b004f1866d9b01mr7179579lfa.3.1686765904196; Wed, 14 Jun 2023 11:05:04 -0700 (PDT) Received: from [192.168.1.101] (abyj190.neoplus.adsl.tpnet.pl. [83.9.29.190]) by smtp.gmail.com with ESMTPSA id l18-20020a19c212000000b004eff1f7f206sm2224053lfc.9.2023.06.14.11.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 11:05:03 -0700 (PDT) From: Konrad Dybcio Date: Wed, 14 Jun 2023 20:04:39 +0200 Subject: [PATCH v6 20/22] interconnect: qcom: icc-rpm: Set bandwidth on both contexts MIME-Version: 1.0 Message-Id: <20230526-topic-smd_icc-v6-20-263283111e66@linaro.org> References: <20230526-topic-smd_icc-v6-0-263283111e66@linaro.org> In-Reply-To: <20230526-topic-smd_icc-v6-0-263283111e66@linaro.org> To: Andy Gross , Bjorn Andersson , Michael Turquette , Stephen Boyd , Georgi Djakov , Leo Yan , Evan Green , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, Konrad Dybcio , Stephan Gerhold X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686765873; l=3364; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=bsPoz7/6rYieWdNaInRGuWSci4TnSHDkv7Qn8EyapGs=; b=S0bXzGhxJVHt1NWjywKU1NnF7/fNUBDhII8jxTuDH6VA+zH5Zm1LDmj068/IUYsd6DdIrd4FG GYcLSuL+QrUDfnyyuftgMnVilv4IAXYPfvduTC+q2qceBw+I/oBsgdB X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768704655943883692?= X-GMAIL-MSGID: =?utf-8?q?1768704655943883692?= Up until now, for some reason we've only been setting bandwidth values on the active-only context. That pretty much meant that RPM could lift all votes when entering sleep mode. Or never sleep at all. That in turn could potentially break things like USB wakeup, as the connection between APSS and SNoC/PNoC would simply be dead. Set the values appropriately. Fixes: 30c8fa3ec61a ("interconnect: qcom: Add MSM8916 interconnect provider driver") Reviewed-by: Stephan Gerhold Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 54 +++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 5f3bbe7e6a0d..928dc27c1d93 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -204,34 +204,39 @@ static int qcom_icc_qos_set(struct icc_node *node) } } -static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 sum_bw) +static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 *bw) { - int ret = 0; + int ret, rpm_ctx = 0; + u64 bw_bps; if (qn->qos.ap_owned) return 0; - if (qn->mas_rpm_id != -1) { - ret = qcom_icc_rpm_smd_send(QCOM_SMD_RPM_ACTIVE_STATE, - RPM_BUS_MASTER_REQ, - qn->mas_rpm_id, - sum_bw); - if (ret) { - pr_err("qcom_icc_rpm_smd_send mas %d error %d\n", - qn->mas_rpm_id, ret); - return ret; + for (rpm_ctx = 0; rpm_ctx < QCOM_SMD_RPM_STATE_NUM; rpm_ctx++) { + bw_bps = icc_units_to_bps(bw[rpm_ctx]); + + if (qn->mas_rpm_id != -1) { + ret = qcom_icc_rpm_smd_send(rpm_ctx, + RPM_BUS_MASTER_REQ, + qn->mas_rpm_id, + bw_bps); + if (ret) { + pr_err("qcom_icc_rpm_smd_send mas %d error %d\n", + qn->mas_rpm_id, ret); + return ret; + } } - } - if (qn->slv_rpm_id != -1) { - ret = qcom_icc_rpm_smd_send(QCOM_SMD_RPM_ACTIVE_STATE, - RPM_BUS_SLAVE_REQ, - qn->slv_rpm_id, - sum_bw); - if (ret) { - pr_err("qcom_icc_rpm_smd_send slv %d error %d\n", - qn->slv_rpm_id, ret); - return ret; + if (qn->slv_rpm_id != -1) { + ret = qcom_icc_rpm_smd_send(rpm_ctx, + RPM_BUS_SLAVE_REQ, + qn->slv_rpm_id, + bw_bps); + if (ret) { + pr_err("qcom_icc_rpm_smd_send slv %d error %d\n", + qn->slv_rpm_id, ret); + return ret; + } } } @@ -336,7 +341,6 @@ 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; - u64 sum_bw; u64 active_rate, sleep_rate; u64 agg_avg[QCOM_SMD_RPM_STATE_NUM], agg_peak[QCOM_SMD_RPM_STATE_NUM]; u64 max_agg_avg; @@ -350,14 +354,12 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) qcom_icc_bus_aggregate(provider, agg_avg, agg_peak, &max_agg_avg); - sum_bw = icc_units_to_bps(max_agg_avg); - - ret = qcom_icc_rpm_set(src_qn, sum_bw); + ret = qcom_icc_rpm_set(src_qn, agg_avg); if (ret) return ret; if (dst_qn) { - ret = qcom_icc_rpm_set(dst_qn, sum_bw); + ret = qcom_icc_rpm_set(dst_qn, agg_avg); if (ret) return ret; }