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: 105805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1172518vqr; Fri, 9 Jun 2023 13:43:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5OzR6ND/SZaYAJrN2RMY9PxBRrJL4VBieSe+jrg/HS8ubwjpQwUpOXMerw2xjAIwiRfTns X-Received: by 2002:a17:90a:1c:b0:253:572f:79b2 with SMTP id 28-20020a17090a001c00b00253572f79b2mr1743666pja.36.1686343391858; Fri, 09 Jun 2023 13:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686343391; cv=none; d=google.com; s=arc-20160816; b=emzRbXdBWB7Fo2GeBO3jjx3RtpE94RFAe8Ogf/4PwtWrsN9mdAS7HzBowMcQYEnGyH SQoznmIlUc146YEE6mPaRfpf3mQzQ5azNj/B5UA4CcZMayS/nkpWQJRdQn5yDj/2xv/3 h68kDarl6A30LmvKbB3bwncEDWjjZ3DsTtYYb3eT4IUXj6PcXx1OE5S27l+AIpZxv1j7 TQbgxaDZkTgW4GIdrzEDkI8SX//Jre4vYcxhbVngZVUssO8M4GFWmW1mqPpQkfHfFHhC 6aLG/1QAha3177Wa+9HMLcgEERZcT7He0Hz0HvJzC77CpcbYOSn0+ASsFAzzWCJEEHUs Lkbw== 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=vmYWhMRGgLXZoI1ABShhg+YyRzFiX4C+vqZEWikGuSU=; b=vKC6MrSo9Nc+q/Aiw9IH3FxkLI9vwGzptNO0vyL+q2j2VLm8AJDM1VAKwr+2HxTeRv WkKRU78XnqfkNa/xP2v1i7lDRPsaPnL5JREd9RzVpNcdmOqZDjPa12eilURV/gXuIPhU UDONhTBPdTZ1N4qxSiwd6YNN1mXm9naQRwlMs2OghuHtEgIFMmQC3Fdb06dYAfZu3V/y CiBVa4uMlhJ8vrrU/KaZT4gUz80xYMWPCxzknP/6scx4mbLHJsT7PkXtnkUwRSf4vU51 r/gMT+Ak1RBGdlo20T5eIw6bakzUB4q5odrkzbkj7sCd+MB5KtwBcVGv/9ISVg2JC3XG gFsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aoS2FRuL; 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 m6-20020a17090a414600b00252733f522asi4851804pjg.109.2023.06.09.13.42.59; Fri, 09 Jun 2023 13:43:11 -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=aoS2FRuL; 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 S232659AbjFIUV1 (ORCPT + 99 others); Fri, 9 Jun 2023 16:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232632AbjFIUUv (ORCPT ); Fri, 9 Jun 2023 16:20:51 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F69D3C21 for ; Fri, 9 Jun 2023 13:19:59 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f4e71a09a7so2793099e87.1 for ; Fri, 09 Jun 2023 13:19:58 -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=glWMGjhVtVIKzWRkQLGSVvRrSsOTl903RFPB+gQzYQcBOuyAYMVghRS0teJdv06leS yHZcVTWmzRxmzEALHMxKcNBhyhgOrXvwpBBEtrX+CNNOdgiU4ssoh4NKmKIK7pcPpbtF VkDKN6NUvx7u8ky3ZVXyFS9P/ugxWVjekId5sEKsaMCgfqxEzOWBrDlD4B548B72Vpvc AJQ+Z4WDrfNwcMDDty3hCvTavhyycd1gY8hDvGqXYpfIY9CEsP+0DtAmbWnv2t8d/+5K 1YIgJZS3oLCSMC4xPckZZS3fLuEeM5ZeeXcRh1GcJnrTcYICnt7JjgbKftyOLJBbogtu Ce3g== X-Gm-Message-State: AC+VfDwYbH8rnNjSF/zpDYsr93oq0xdjhDtoEArk/bIRTRznSjBiWum1 rnZ4UgI1L1XRwEPIj9b+SFwnSQ== 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= 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=unavailable 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?1768259208876203175?= X-GMAIL-MSGID: =?utf-8?q?1768259208876203175?= 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; }