From patchwork Fri Jun 9 20:19:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 691400 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 636AFC7EE25 for ; Fri, 9 Jun 2023 20:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232578AbjFIUVW (ORCPT ); Fri, 9 Jun 2023 16:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjFIUUs (ORCPT ); Fri, 9 Jun 2023 16:20:48 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 265003C17 for ; Fri, 9 Jun 2023 13:19:57 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4f6170b1486so2804641e87.0 for ; Fri, 09 Jun 2023 13:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686341981; x=1688933981; 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=vmYWhMRGgLXZoI1ABShhg+YyRzFiX4C+vqZEWikGuSU=; b=aoS2FRuLLi4i32p8vtgOLOsua+64TQXYYD8mAzeCG2GGmNZomy/OSwC+zym4aEkYFA o3uaKUXKoP+Nynvi0mfjKQL3YXlwyM3Y8Co/9HWAm3wla+udP4p7wAtYhJouINjLPxd7 MtBaiPi1aO11XWrRBI1VTHvR0bd0WLqm4RFzqmMSQIrDMe1GpG5xX/HX2aT5xBE67y7v 53gJlA/4lJ6aWQUxW129yLCMSh8GHMGWa5YZ9YpTvmUDu5N8PlbBAVBdv7A6BcwzIwvV fAeZxFRxXejj4uffc4cjslLEqT19GLbhftNHS2TypkVhoRsZWjXEzHYSwqkgv+EyKlrY aQeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686341981; x=1688933981; 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=vmYWhMRGgLXZoI1ABShhg+YyRzFiX4C+vqZEWikGuSU=; b=B4lR+42Ex3gIqFj4HWKoG5jalptHgZ/WkBwUvEp3UoBytIzkSCKiuIVBT70J/tiaGa aMBZSithAjkFEnhxGxXpASF3oJ6gKZwUw2IsNBMD//lBltXoBs7tznT6tSAX3x5rPhSV UsWbQLWUytIhcEh9v1iRkVS3Esw8kp/dnlzEOtugwt2U7IFEYmKNhb3tx5wAqVwQ6L6O nvyRKuim2f2Z69JpwLt9JmNsunWqbaIBg1pueOZeHL3zB7wSKdf34N9mx1DsvkK5Rqx1 qorQKNO9QWvg2jeIH1s/I2MwVfwKAQRWO6x5Xrkt5d81yDksOjQvryI1WPciDkSTTxK+ McCw== X-Gm-Message-State: AC+VfDwRFYZ22fLKMkQWWflX+CcrG+2BG42Oh9xJHeKTNI+YlssZAZbh SFZLAGe8st48zkCFbKK3VSZtXA== X-Google-Smtp-Source: ACHHUZ7TVrcRyT2gstHciUOlDZ6FONnb58ZhGbc/ZrfQfBqfHEIMv2rxmVEfsuK4CnlUWyO12rPEuw== X-Received: by 2002:a19:650f:0:b0:4f2:147b:7ee with SMTP id z15-20020a19650f000000b004f2147b07eemr962074lfb.20.1686341981759; Fri, 09 Jun 2023 13:19:41 -0700 (PDT) Received: from [192.168.1.101] (abyj190.neoplus.adsl.tpnet.pl. [83.9.29.190]) by smtp.gmail.com with ESMTPSA id b18-20020ac25632000000b004f628eb7884sm641349lff.232.2023.06.09.13.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 13:19:41 -0700 (PDT) From: Konrad Dybcio Date: Fri, 09 Jun 2023 22:19:25 +0200 Subject: [PATCH v2 20/22] interconnect: qcom: icc-rpm: Set bandwidth on both contexts MIME-Version: 1.0 Message-Id: <20230526-topic-smd_icc-v2-20-e5934b07d813@linaro.org> References: <20230526-topic-smd_icc-v2-0-e5934b07d813@linaro.org> In-Reply-To: <20230526-topic-smd_icc-v2-0-e5934b07d813@linaro.org> To: Andy Gross , Bjorn Andersson , Michael Turquette , Stephen Boyd , Georgi Djakov , Leo Yan , Evan Green Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686341953; l=3312; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=BnpOasAWNUlC0HYMHtz/YUrMasNWc4yTZHYlYhnZUIY=; b=Ex8CjHQLM6jrNxlbfeAWTJw/U3/ilAj8+qe6Y+cMW/CxYt369wOElnpni0xdTWv/oMkX0EALb JKfIX7LhWdlB0IEqdXM0yoRqLlpEvdtmVgK+PZLsykbSb6mxNHl0Nnc X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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") 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 3ac47b818afe..ac719013077e 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -205,34 +205,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; + } } } @@ -337,7 +342,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; @@ -351,14 +355,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; }