From patchwork Tue Jul 4 15:03:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698992 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 CB244EB64DA for ; Tue, 4 Jul 2023 15:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjGDPEB (ORCPT ); Tue, 4 Jul 2023 11:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjGDPEA (ORCPT ); Tue, 4 Jul 2023 11:04:00 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185DE10DA for ; Tue, 4 Jul 2023 08:03:58 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b6c5ede714so69185121fa.1 for ; Tue, 04 Jul 2023 08:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483036; x=1691075036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZC0/5bXEsuHujngkcxb69wPizikqv0P8Uq9N9rSIaSc=; b=rrDHjT1XdohbcAEb7K/I45P6WCTri8lRvdqh3U1QdxZ/OUDMVh/obCczQoyxUHIxhm C4Ww9VKXvnn4H4JfqMi+mUBaYbvvemW7181yFoUzLMHW8SIk3MT7zla3qY8zpgF7MAa4 lUGL+5Y3JfcpTJbsoHAZO5eS9QKDA6oB0n2bU5+MWA2uYZq+uwtJxx9zo5bUSKSKnvdD 7VUs5FoyCQDWEGESI5puZ8yDV1UpLbwUodPjp6igqx06YqMaMYN/B51Rx/59I+Yf9oHV 6O9Jo68S7N4P/eQafgYzjlrW5B/gmWIYfRZH8PP7HzzZFNTnux+y7hkI6/+aVJ8WQPkT 72nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483036; x=1691075036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZC0/5bXEsuHujngkcxb69wPizikqv0P8Uq9N9rSIaSc=; b=TTj5L6pYGaPzquZA2py5mgysx2SnGDLYrHmc3KXjw/OaFCL+tvDJUDLFX7kXZ71Bes Hjf1qXz+neQUm1eL30YWybfy+YmXH2qWTJjYQNjbvKQwO8+i5fDbQ6JhUTDFFVPF+dLU sORL62FR2vobgkaG4nti2voF2V3vsQD4VA965RjMKcwDdG7numrpvIjqlgoq9JskEZ1t Vl51grtdUioy6QXJz6vyZsVw9H4kdIK9eAjYVIBTWMy9WJxniOkQR8NObh8nBlPX/blR iSOEAbIMmx5oYBnMkVghgDei2zqsoo7q3ZzGFtpa98ev9eGV1rR7vvUwrAXhZ/Fprpw5 DoMQ== X-Gm-Message-State: AC+VfDyGT3upv1wk+ODpUgOh6kxx1dsEeoU7OzZLsjZzY13126U5dk7w h0f7CKYo91uSV25PR3W9UAEiew== X-Google-Smtp-Source: ACHHUZ6Z6+YzUGt6Z0XsYxLyOrcysDN2d2wGK/OHEBQBcN1Z6cxNKGbIrIhPPmdtll8oMChE0BI+tw== X-Received: by 2002:a05:651c:1309:b0:2b6:9f54:af9a with SMTP id u9-20020a05651c130900b002b69f54af9amr6875576lja.8.1688483036141; Tue, 04 Jul 2023 08:03:56 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:03:55 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Konrad Dybcio Subject: [PATCH v2 01/14] drm/msm/dpu: drop enum dpu_core_perf_data_bus_id Date: Tue, 4 Jul 2023 18:03:41 +0300 Message-Id: <20230704150354.159882-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Drop the leftover of bus-client -> interconnect conversion, the enum dpu_core_perf_data_bus_id. Fixes: cb88482e2570 ("drm/msm/dpu: clean up references of DPU custom bus scaling") Reviewed-by: Konrad Dybcio Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index e3795995e145..29bb8ee2bc26 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -14,19 +14,6 @@ #define DPU_PERF_DEFAULT_MAX_CORE_CLK_RATE 412500000 -/** - * enum dpu_core_perf_data_bus_id - data bus identifier - * @DPU_CORE_PERF_DATA_BUS_ID_MNOC: DPU/MNOC data bus - * @DPU_CORE_PERF_DATA_BUS_ID_LLCC: MNOC/LLCC data bus - * @DPU_CORE_PERF_DATA_BUS_ID_EBI: LLCC/EBI data bus - */ -enum dpu_core_perf_data_bus_id { - DPU_CORE_PERF_DATA_BUS_ID_MNOC, - DPU_CORE_PERF_DATA_BUS_ID_LLCC, - DPU_CORE_PERF_DATA_BUS_ID_EBI, - DPU_CORE_PERF_DATA_BUS_ID_MAX, -}; - /** * struct dpu_core_perf_params - definition of performance parameters * @max_per_pipe_ib: maximum instantaneous bandwidth request From patchwork Tue Jul 4 15:03:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698993 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 F2BBDC0015E for ; Tue, 4 Jul 2023 15:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbjGDPEC (ORCPT ); Tue, 4 Jul 2023 11:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjGDPEA (ORCPT ); Tue, 4 Jul 2023 11:04:00 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEA7010CF for ; Tue, 4 Jul 2023 08:03:58 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b5e7dba43cso92125061fa.1 for ; Tue, 04 Jul 2023 08:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483037; x=1691075037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NjoI3Dx1Y7JEO/QjjX2Gq34JkRG4tKXD0+CPY31Fy3E=; b=mnlRrEYkT1bLTpjdSK3/SYPxwdfahLX/mA2DCiGjVRVrwWVAmO1HzFdVn/6bWm0Ng3 JCB9IdVKH2/S9Iatr/GJ653jQQRbrtW1iaR+h+/QQQ+Y9yZJIT0n9mzJJkL6vXoJ3qUF Nxt0v8JaIlHu1EMSXtJrrW/i3scdz50zmlB8gOyQI3UMn9XVvtU6Wa9duFjdaeLtSlx8 cm6hj8aIHcj2gNWFx/zp2q/N46Z+jTCXXWLotENrtAUEIECfFFRSozCzSAu+AAsBEuP5 KwZGJUVu6SQBvujwi87Pg1WFrb/Cv5txzKL97atlq5GEEorPs6hZ3k7LQW/eM5RW/W0p A70w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483037; x=1691075037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NjoI3Dx1Y7JEO/QjjX2Gq34JkRG4tKXD0+CPY31Fy3E=; b=I68NRWXFTPeGrDmCAw+OrroKvLzU0k11ltSrHjUGDO8SPanditsRCtXrSP5cmPZpci Vhn2bGd2fiocFMd3W1szmu4uzj4jObag98969DkUAP61Eo+1ivT20k4yPQUeZ2qClRAj XnlRhT9N/3F6/YEmEt3W5V5MBu0A4wwervk5tvqQmD57lmDRweAIA0sgSDFW5VwJgspq OLS4x9S2wmE5g1SCO8ZVYzrHcU6O09I5ak7sN4i9Vw4Ep9Xz7hvEIMFrJUhPfcahj8bs L0qZSTEipBmjNPd1ep9z3QSLOo/1tvB7aXpkUTSqrZ/8ePcQBeu3ZKRvHTCWn2KlICAN be5g== X-Gm-Message-State: ABy/qLaYEc+gMMsxW5KONbGJL3ucLtvTstMv4ZKXcW4LZH57XSAF1brL q72RzoHw2wRH0u2/5RYPeo7vjg== X-Google-Smtp-Source: APBJJlEIpyGmPKFAyIMvvdNdb1Ujx+ZPnxW2uFUNINEv2423vq4210IYOn5QzypLYX/RQ6fr20NjxA== X-Received: by 2002:a2e:9147:0:b0:2b6:b942:aaf8 with SMTP id q7-20020a2e9147000000b002b6b942aaf8mr9801084ljg.30.1688483036977; Tue, 04 Jul 2023 08:03:56 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:03:56 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 02/14] drm/msm/dpu: core_perf: extract bandwidth aggregation function Date: Tue, 4 Jul 2023 18:03:42 +0300 Message-Id: <20230704150354.159882-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation to refactoring the dpu_core_perf debugfs interface, extract the bandwidth aggregation function from _dpu_core_perf_crtc_update_bus(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 1d9d83d7b99e..333dcfe57800 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -206,33 +206,38 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, return 0; } -static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, - struct drm_crtc *crtc) +static void dpu_core_perf_aggregate(struct drm_device *ddev, + enum dpu_crtc_client_type curr_client_type, + struct dpu_core_perf_params *perf) { - struct dpu_core_perf_params perf = { 0 }; - enum dpu_crtc_client_type curr_client_type - = dpu_crtc_get_client_type(crtc); - struct drm_crtc *tmp_crtc; struct dpu_crtc_state *dpu_cstate; - int i, ret = 0; - u64 avg_bw; + struct drm_crtc *tmp_crtc; - drm_for_each_crtc(tmp_crtc, crtc->dev) { + drm_for_each_crtc(tmp_crtc, ddev) { if (tmp_crtc->enabled && - curr_client_type == - dpu_crtc_get_client_type(tmp_crtc)) { + curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); - perf.max_per_pipe_ib = max(perf.max_per_pipe_ib, - dpu_cstate->new_perf.max_per_pipe_ib); + perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, + dpu_cstate->new_perf.max_per_pipe_ib); - perf.bw_ctl += dpu_cstate->new_perf.bw_ctl; + perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; - DRM_DEBUG_ATOMIC("crtc=%d bw=%llu paths:%d\n", - tmp_crtc->base.id, - dpu_cstate->new_perf.bw_ctl, kms->num_paths); + DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", + tmp_crtc->base.id, + dpu_cstate->new_perf.bw_ctl); } } +} + +static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, + struct drm_crtc *crtc) +{ + struct dpu_core_perf_params perf = { 0 }; + int i, ret = 0; + u64 avg_bw; + + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); if (!kms->num_paths) return 0; From patchwork Tue Jul 4 15:03:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699735 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 62E00C001DB for ; Tue, 4 Jul 2023 15:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbjGDPEC (ORCPT ); Tue, 4 Jul 2023 11:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231574AbjGDPEA (ORCPT ); Tue, 4 Jul 2023 11:04:00 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A2310D3 for ; Tue, 4 Jul 2023 08:03:59 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b69ea3b29fso91951271fa.3 for ; Tue, 04 Jul 2023 08:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483038; x=1691075038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ln26l+vUCSi4edYTgivRAGgTHzh3pendnmUbrCgVtyc=; b=eRPnUEHtJHryVOVqJkVGBYwQ5UYzMkQXRYAtS45KefIqb3KipgCoIaBlKL7bRSXHdm nlE8Oj/LwmEJN7iE4bOOMVagZffzebpZrnP33/W7ISTIktbe5Z/4cB4eZZfJYA2RwtgL pgDSH6GTSf9kFMA30f+mQK6nP1oAG6e8l/0eiMVf9cPGsRag8F2eGDba7o0Ff7w+qNmT TXJMZp4iZ3LT3+n/jjJbdlYcET+54RhKDFjNognSLbCP1EXgPhSnhJKAGhcVdFtBa2uG Om4rOzTBtPZT5uV0wBRpKgm8iTLl2ejQ3ftxCkgAl7udHQ4AOIgFVSKavYj13aT41kr7 PmLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483038; x=1691075038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ln26l+vUCSi4edYTgivRAGgTHzh3pendnmUbrCgVtyc=; b=TA8xyt9x8JRk1qTpCrFlxbTpHaf+22IhMW8BYAcMiJZpOQndidWe3tCY2QTzysZKCA 70d3UibwsliKdTWMgeG46qqB/+0K+qUai4nAzprZSXG0fQfeyXmqTCQ0Fuanbtc3IDyX 0NqJ59zJIYICKhldb3V1r2AAJHXtZtb5jLeZDKfSgifddhkZ7fn5t9AAhA/Uc5qaac0s 4yLetQ+dDqvPZNDLdXgOoPjBPI7mCTstU5BkgqpxOfGwtKj6i4Ut+Yil8iewG3HmFnl0 96WNR/PPsQA1QIMMObNv889atHzuoDwbpD13KzzU9FjW9+MrN7JAeyFKnYsZlIismNzL UMrQ== X-Gm-Message-State: ABy/qLYdbyouB10lO7hrxDZzfYV9uCAlO2YCc3fuImR/GNE3MPdSsCNy gr8ZVQB49T0MuTg+xOP/yvijfw== X-Google-Smtp-Source: APBJJlFyv1W/R/7VTQdE5dFiynY7eN0awEen8if6H2sa7Oz0cOji+wA2SPd82jd9tMhVfbJkx4Xe/g== X-Received: by 2002:a2e:96cc:0:b0:2b6:cc12:4cf3 with SMTP id d12-20020a2e96cc000000b002b6cc124cf3mr9703950ljj.48.1688483037903; Tue, 04 Jul 2023 08:03:57 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:03:57 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 03/14] drm/msm/dpu: core_perf: bail earlier if there are no ICC paths Date: Tue, 4 Jul 2023 18:03:43 +0300 Message-Id: <20230704150354.159882-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Skip bandwidth aggregation and return early if there are no interconnect paths defined for the DPU device. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 333dcfe57800..05d340aa18c5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -237,11 +237,11 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, int i, ret = 0; u64 avg_bw; - dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); - if (!kms->num_paths) return 0; + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + avg_bw = perf.bw_ctl; do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/ From patchwork Tue Jul 4 15:03:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699734 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 3A46EC001DD for ; Tue, 4 Jul 2023 15:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231455AbjGDPED (ORCPT ); Tue, 4 Jul 2023 11:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231544AbjGDPEB (ORCPT ); Tue, 4 Jul 2023 11:04:01 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63C1E10D7 for ; Tue, 4 Jul 2023 08:04:00 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b6a6f224a1so93405981fa.1 for ; Tue, 04 Jul 2023 08:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483038; x=1691075038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qQpKCEoX0wDzwvYtZYOLMhBvx89hv9TtO2VMOF5Zspg=; b=Fh58xcazFXTUzyc8r0oX4IBOKM//UEAi7Y6plvcvhYv9M/mwHD5Vul93ZR7uGB5Mra ugI3Qn4u+kmNHpZX2zDhvEnXugDh80c1H1NRkGjFJWqquTdxqLpdIiecSTpAaJPblfeM ZDKZBVATFsfnzhndGfFrAwrVbshtvGgKhbHRK9kvVUD3KTsXEJgCzX1C7zwG7U4NdUrj zS2H1ocVe9ENd70bvgtJ5ZQ8QYM537xi+5R6pG4N9NPnVLZEvaXOPghbWcLRD0k2H82Z xy5I8R6AziE+VQXXp+HoehGxRz9SalCx5nS9xVkdeYF4M5Ek1dozE/ArjgpTObVVhZFL dLBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483038; x=1691075038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qQpKCEoX0wDzwvYtZYOLMhBvx89hv9TtO2VMOF5Zspg=; b=HrMB4MmsdsRYiGBq8lnN0XkLYyddc5l2D+lhV8INz5pZErzmqaRlN/N3iaE/Uai6NK Evuog1GQz4bFM6Yy9mzldvEnEerKBjmcNPW51ZckGNR/+Z8soFMZReCos+pVVNi5PRph B8GwtpLrokknHTswLk/TQImYYmyRjwJrZpqGeySKi0E8i0Vwm/qI8cREEqoWJFVCIVet E3jW5nolDwxH8TgimiEHW4qtWLCAzFBNP7sN8qx0QDYsSZCm6U5BHhYp0E9Ndm+bJNKR CKq43QjfP9RdnVe1JTB+jBxNie1oo7ugNqB0Ku2b9uz4gfvUYDNCFbGtvUsUTiEDH+ZW I6+A== X-Gm-Message-State: ABy/qLbgjTOLl5BB5m9p/nLrXM3fcKG/sAnPLNESVLD/b9fE7Pl9vQF0 PwIm/2bAwy3TO9cKKaeeWCb6fSJ4/KxGIF557WE= X-Google-Smtp-Source: APBJJlGMau+M1IPRe0LLa+OiSRSSXpJ7LRZBRGrij57L1EhIqkGSrinmzBwHq/qSTRH1JvfByTCRUg== X-Received: by 2002:a2e:8ec3:0:b0:2b6:d631:a1a0 with SMTP id e3-20020a2e8ec3000000b002b6d631a1a0mr8366988ljl.12.1688483038765; Tue, 04 Jul 2023 08:03:58 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:03:58 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 04/14] drm/msm/dpu: drop separate dpu_core_perf_tune overrides Date: Tue, 4 Jul 2023 18:03:44 +0300 Message-Id: <20230704150354.159882-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The values in struct dpu_core_perf_tune are fixed per the core perf mode. Drop the 'tune' values and substitute them with known values when performing perf management. Note: min_bus_vote was not used at all, so it is just silently dropped. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 29 ++++++++----------- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 4 --- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 05d340aa18c5..348550ac7e51 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -235,7 +235,7 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, { struct dpu_core_perf_params perf = { 0 }; int i, ret = 0; - u64 avg_bw; + u32 avg_bw; if (!kms->num_paths) return 0; @@ -291,10 +291,16 @@ void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc) static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms) { - u64 clk_rate = kms->perf.perf_tune.min_core_clk; + u64 clk_rate; struct drm_crtc *crtc; struct dpu_crtc_state *dpu_cstate; + if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) + return kms->perf.fix_core_clk_rate; + + if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) + return kms->perf.max_core_clk_rate; + drm_for_each_crtc(crtc, kms->dev) { if (crtc->enabled) { dpu_cstate = to_dpu_crtc_state(crtc->state); @@ -305,11 +311,6 @@ static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms) } } - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) - clk_rate = kms->perf.fix_core_clk_rate; - - DRM_DEBUG_ATOMIC("clk:%llu\n", clk_rate); - return clk_rate; } @@ -397,6 +398,8 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, if (update_clk) { clk_rate = _dpu_core_perf_get_core_clk_rate(kms); + DRM_DEBUG_ATOMIC("clk:%llu\n", clk_rate); + trace_dpu_core_perf_update_clk(kms->dev, stop_req, clk_rate); clk_rate = min(clk_rate, kms->perf.max_core_clk_rate); @@ -418,7 +421,6 @@ static ssize_t _dpu_core_perf_mode_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct dpu_core_perf *perf = file->private_data; - const struct dpu_perf_cfg *cfg = perf->catalog->perf; u32 perf_mode = 0; int ret; @@ -433,14 +435,9 @@ static ssize_t _dpu_core_perf_mode_write(struct file *file, DRM_INFO("fix performance mode\n"); } else if (perf_mode == DPU_PERF_MODE_MINIMUM) { /* run the driver with max clk and BW vote */ - perf->perf_tune.min_core_clk = perf->max_core_clk_rate; - perf->perf_tune.min_bus_vote = - (u64) cfg->max_bw_high * 1000; DRM_INFO("minimum performance mode\n"); } else if (perf_mode == DPU_PERF_MODE_NORMAL) { /* reset the perf tune params to 0 */ - perf->perf_tune.min_core_clk = 0; - perf->perf_tune.min_bus_vote = 0; DRM_INFO("normal performance mode\n"); } perf->perf_tune.mode = perf_mode; @@ -456,10 +453,8 @@ static ssize_t _dpu_core_perf_mode_read(struct file *file, char buf[128]; len = scnprintf(buf, sizeof(buf), - "mode %d min_mdp_clk %llu min_bus_vote %llu\n", - perf->perf_tune.mode, - perf->perf_tune.min_core_clk, - perf->perf_tune.min_bus_vote); + "mode %d\n", + perf->perf_tune.mode); return simple_read_from_buffer(buff, count, ppos, buf, len); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 29bb8ee2bc26..c965dfbc3007 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -29,13 +29,9 @@ struct dpu_core_perf_params { /** * struct dpu_core_perf_tune - definition of performance tuning control * @mode: performance mode - * @min_core_clk: minimum core clock - * @min_bus_vote: minimum bus vote */ struct dpu_core_perf_tune { u32 mode; - u64 min_core_clk; - u64 min_bus_vote; }; /** From patchwork Tue Jul 4 15:03:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698991 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 6F445C001E0 for ; Tue, 4 Jul 2023 15:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbjGDPED (ORCPT ); Tue, 4 Jul 2023 11:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjGDPEC (ORCPT ); Tue, 4 Jul 2023 11:04:02 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC0D10D8 for ; Tue, 4 Jul 2023 08:04:01 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2b69923a715so88381781fa.0 for ; Tue, 04 Jul 2023 08:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483039; x=1691075039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dVBXyrFdIkopLRLb6Grc/paJlGJi3BPT4fGEsbFMO5s=; b=vTYFTcqwoKzA37LP5kgGmv6Q7MRWkJfDdwM7uA8r4nDoNW+Hrgj+/qCCeq2AYgjTET 0Z1tva04iVqfMd3+9tpP2PFQAk9FVoewnyUv62qKTuE6h4NCxXj9my66W/NkgWXiDQ9T MXGhapOakDmtksqQP/wJz5d3YBeTHjrfe+eSlWaQlifC5wY2EIRWS5ipOnA3N4bDAlpa rShvvgItPSylTcy9GYoVMhMdThAlqeP0Ji/Rsso6pFskQekfImZk8uU4a+oeNgY5tLw8 75Lcxn0qrIQN9tVR0MS7vE5qSmWm4fTR2Fi4mjn3Q3UfCl8ZAhQndiVF5PnCgc7xeJ+K AVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483039; x=1691075039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dVBXyrFdIkopLRLb6Grc/paJlGJi3BPT4fGEsbFMO5s=; b=BudSj2+2drB28r5MKOsYR2TALr497hvBnL/hERqPVocsWSRfw0JiFHustDu0OKYJPI d84G2QzfKHXJMR4X1PihSpESW2Redm3G1plf+7cP1OWcKUWhENEMT+UptTa6XXQBvKEy uKK357gFi9XrhOZA3Ua/V5YO7JHIzjAAVH2c8rcDyopC6608ilpQ41AMENCFg51cZK9y 0mqrtXfS3Zr3taNbogvuknT0bygQXW2Aaa9+9BIR7a8Y1jNrRtXM7ApcD1EQfaWpVdCL CJfuyGznRpzNIsjF4eArveMljyYSwSm7oXTeBeVCUt05b+4m6OtusxKViG+zv1+CVK+/ +CMw== X-Gm-Message-State: ABy/qLYTUehnKDkith2cDlc1uv0vrfQZ5RBGEv4Hub2oNRsU8nGUcmpM bywlQLzrgAaSwy5R9fzcRDgaoA== X-Google-Smtp-Source: APBJJlFhs2TWohEyXM7WfY4+XrDHcNsc3HfHMCZncPI2bnOYUqpoQNfNoCXKOKQ8rK8aDHVYQz7gtw== X-Received: by 2002:a2e:90c2:0:b0:2b6:ac18:aaae with SMTP id o2-20020a2e90c2000000b002b6ac18aaaemr10376531ljg.11.1688483039460; Tue, 04 Jul 2023 08:03:59 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:03:59 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 05/14] drm/msm/dpu: handle perf mode in _dpu_core_perf_crtc_update_bus() Date: Tue, 4 Jul 2023 18:03:45 +0300 Message-Id: <20230704150354.159882-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Move perf mode handling for the bandwidth to _dpu_core_perf_crtc_update_bus() rather than overriding per-CRTC data and then aggregating known values. Note, this changes the fix_core_ab_vote. Previously it would be multiplied per the CRTC number, now it will be used directly for interconnect voting. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 348550ac7e51..42c03a5f1f3e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -116,21 +116,9 @@ static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms, return; } - memset(perf, 0, sizeof(struct dpu_core_perf_params)); - - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) { - perf->bw_ctl = 0; - perf->max_per_pipe_ib = 0; - perf->core_clk_rate = 0; - } else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) { - perf->bw_ctl = kms->perf.fix_core_ab_vote; - perf->max_per_pipe_ib = kms->perf.fix_core_ib_vote; - perf->core_clk_rate = kms->perf.fix_core_clk_rate; - } else { - perf->bw_ctl = _dpu_core_perf_calc_bw(kms, crtc); - perf->max_per_pipe_ib = kms->catalog->perf->min_dram_ib; - perf->core_clk_rate = _dpu_core_perf_calc_clk(kms, crtc, state); - } + perf->bw_ctl = _dpu_core_perf_calc_bw(kms, crtc); + perf->max_per_pipe_ib = kms->catalog->perf->min_dram_ib; + perf->core_clk_rate = _dpu_core_perf_calc_clk(kms, crtc, state); DRM_DEBUG_ATOMIC( "crtc=%d clk_rate=%llu core_ib=%llu core_ab=%llu\n", @@ -236,17 +224,28 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, struct dpu_core_perf_params perf = { 0 }; int i, ret = 0; u32 avg_bw; + u32 peak_bw; if (!kms->num_paths) return 0; - dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) { + avg_bw = 0; + peak_bw = 0; + } else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) { + avg_bw = kms->perf.fix_core_ab_vote; + peak_bw = kms->perf.fix_core_ib_vote; + } else { + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + + avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ + peak_bw = perf.max_per_pipe_ib; + } - avg_bw = perf.bw_ctl; - do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/ + avg_bw /= kms->num_paths; for (i = 0; i < kms->num_paths; i++) - icc_set_bw(kms->path[i], avg_bw, perf.max_per_pipe_ib); + icc_set_bw(kms->path[i], avg_bw, peak_bw); return ret; } From patchwork Tue Jul 4 15:03:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698990 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 22DF7EB64D9 for ; Tue, 4 Jul 2023 15:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbjGDPEE (ORCPT ); Tue, 4 Jul 2023 11:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231544AbjGDPED (ORCPT ); Tue, 4 Jul 2023 11:04:03 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20A95E6 for ; Tue, 4 Jul 2023 08:04:02 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b6994a8ce3so84792481fa.1 for ; Tue, 04 Jul 2023 08:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483040; x=1691075040; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j+aq1OFXpf6G4H+BcGCSA0YL933rxkAV4l8sCcsEZis=; b=kXqNbmDflyvlxSx/8Rxgxa3xl2Z07elSrH3JpkankgIT7FrzGdcA7mYlbzfsHTWmYo pET1u6dnJuES4DmSg+qrQJOxQtHDWtMRgm0rec5RwVU4XJaLWjZIRjuJePuRWJH+lY+M fNugozyvnotBtqAzASefM+bcs2PSgYptOIBXiNuT8K0Wf9Qi0yP8loXGAsa1OzlN3E6+ CTOljsTgLTlYA//5a9R1ECZtwGVPQjQTWBJXmAUdIq9ujozTxCKVU62XJL5u7dXk5Wwj ZaCtWG5ccK50E4CTDivHLXsVLyJI2fOw2joWCokbiVIgm3VErUa3V95PvdMSrctAfcOn 87fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483040; x=1691075040; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j+aq1OFXpf6G4H+BcGCSA0YL933rxkAV4l8sCcsEZis=; b=jOiOlYv5d2QIKZbH++xLGgx7U8vPGvtoS0rsm0xZrDAkMXED3xD5LSnKbO1R3K1bvN hWdsz0dqzwfAFe3zH/BB4MygFCXnjmlMGGIZcAOuZkk3acU3G2SVTQcv9W+wTBXjiI4m ctxL1oibUyerefXDWsBQEQq2N69skHg+DNVnMFgKXbDuImj9ikgHPc+/eRBAUoBTpcQO MmHBFIGlEkb+4RBe9qhd1YjguDU8rnW332TpN3CA7ltn0RIyNMb1bHcuu4w31YFrNC9W J/HzlKPef0k5S3LgU0nkJSXI8ayKP6ACx2amdKx50WQb0CR6NRzwQ86FM1elTP932rO+ 380A== X-Gm-Message-State: ABy/qLZMUgMhvVsan6Dh9dYAMer/P0yqcZukf2Cv3JHuwAjSkJZp0Byb ju9GwlwFA6xe3M1lGU61TjH8nw== X-Google-Smtp-Source: APBJJlHHe490LvEGHTlSi9065fHYlPgN0olmh74EqKOJJUaIUc6IiWX0RLYGd7CBpnAIQIFXbc0RZw== X-Received: by 2002:a2e:910c:0:b0:2b6:a22f:9fb9 with SMTP id m12-20020a2e910c000000b002b6a22f9fb9mr9419715ljg.27.1688483040418; Tue, 04 Jul 2023 08:04:00 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:03:59 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 06/14] drm/msm/dpu: rework core_perf debugfs overrides Date: Tue, 4 Jul 2023 18:03:46 +0300 Message-Id: <20230704150354.159882-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently debugfs provides separate 'modes' to override calculated MDP_CLK rate and interconnect bandwidth votes. Change that to allow overriding individual values (e.g. one can override just clock or just average bandwidth vote). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 87 ++----------------- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 10 --- 2 files changed, 9 insertions(+), 88 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 42c03a5f1f3e..23a29f159eff 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -17,20 +17,6 @@ #include "dpu_crtc.h" #include "dpu_core_perf.h" -/** - * enum dpu_perf_mode - performance tuning mode - * @DPU_PERF_MODE_NORMAL: performance controlled by user mode client - * @DPU_PERF_MODE_MINIMUM: performance bounded by minimum setting - * @DPU_PERF_MODE_FIXED: performance bounded by fixed setting - * @DPU_PERF_MODE_MAX: maximum value, used for error checking - */ -enum dpu_perf_mode { - DPU_PERF_MODE_NORMAL, - DPU_PERF_MODE_MINIMUM, - DPU_PERF_MODE_FIXED, - DPU_PERF_MODE_MAX -}; - /** * _dpu_core_perf_calc_bw() - to calculate BW per crtc * @kms: pointer to the dpu_kms @@ -229,18 +215,16 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, if (!kms->num_paths) return 0; - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) { - avg_bw = 0; - peak_bw = 0; - } else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) { + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + + avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ + peak_bw = perf.max_per_pipe_ib; + + if (kms->perf.fix_core_ab_vote) avg_bw = kms->perf.fix_core_ab_vote; - peak_bw = kms->perf.fix_core_ib_vote; - } else { - dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); - avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ - peak_bw = perf.max_per_pipe_ib; - } + if (kms->perf.fix_core_ib_vote) + peak_bw = kms->perf.fix_core_ib_vote; avg_bw /= kms->num_paths; @@ -294,12 +278,9 @@ static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms) struct drm_crtc *crtc; struct dpu_crtc_state *dpu_cstate; - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) + if (kms->perf.fix_core_clk_rate) return kms->perf.fix_core_clk_rate; - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) - return kms->perf.max_core_clk_rate; - drm_for_each_crtc(crtc, kms->dev) { if (crtc->enabled) { dpu_cstate = to_dpu_crtc_state(crtc->state); @@ -416,54 +397,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, #ifdef CONFIG_DEBUG_FS -static ssize_t _dpu_core_perf_mode_write(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) -{ - struct dpu_core_perf *perf = file->private_data; - u32 perf_mode = 0; - int ret; - - ret = kstrtouint_from_user(user_buf, count, 0, &perf_mode); - if (ret) - return ret; - - if (perf_mode >= DPU_PERF_MODE_MAX) - return -EINVAL; - - if (perf_mode == DPU_PERF_MODE_FIXED) { - DRM_INFO("fix performance mode\n"); - } else if (perf_mode == DPU_PERF_MODE_MINIMUM) { - /* run the driver with max clk and BW vote */ - DRM_INFO("minimum performance mode\n"); - } else if (perf_mode == DPU_PERF_MODE_NORMAL) { - /* reset the perf tune params to 0 */ - DRM_INFO("normal performance mode\n"); - } - perf->perf_tune.mode = perf_mode; - - return count; -} - -static ssize_t _dpu_core_perf_mode_read(struct file *file, - char __user *buff, size_t count, loff_t *ppos) -{ - struct dpu_core_perf *perf = file->private_data; - int len; - char buf[128]; - - len = scnprintf(buf, sizeof(buf), - "mode %d\n", - perf->perf_tune.mode); - - return simple_read_from_buffer(buff, count, ppos, buf, len); -} - -static const struct file_operations dpu_core_perf_mode_fops = { - .open = simple_open, - .read = _dpu_core_perf_mode_read, - .write = _dpu_core_perf_mode_write, -}; - int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) { struct dpu_core_perf *perf = &dpu_kms->perf; @@ -488,8 +421,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) (u32 *)&catalog->perf->min_llcc_ib); debugfs_create_u32("min_dram_ib", 0600, entry, (u32 *)&catalog->perf->min_dram_ib); - debugfs_create_file("perf_mode", 0600, entry, - (u32 *)perf, &dpu_core_perf_mode_fops); debugfs_create_u64("fix_core_clk_rate", 0600, entry, &perf->fix_core_clk_rate); debugfs_create_u64("fix_core_ib_vote", 0600, entry, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index c965dfbc3007..1b791b170c6b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -26,14 +26,6 @@ struct dpu_core_perf_params { u64 core_clk_rate; }; -/** - * struct dpu_core_perf_tune - definition of performance tuning control - * @mode: performance mode - */ -struct dpu_core_perf_tune { - u32 mode; -}; - /** * struct dpu_core_perf - definition of core performance context * @dev: Pointer to drm device @@ -42,7 +34,6 @@ struct dpu_core_perf_tune { * @core_clk: Pointer to the core clock * @core_clk_rate: current core clock rate * @max_core_clk_rate: maximum allowable core clock rate - * @perf_tune: debug control for performance tuning * @enable_bw_release: debug control for bandwidth release * @fix_core_clk_rate: fixed core clock request in Hz used in mode 2 * @fix_core_ib_vote: fixed core ib vote in bps used in mode 2 @@ -55,7 +46,6 @@ struct dpu_core_perf { struct clk *core_clk; u64 core_clk_rate; u64 max_core_clk_rate; - struct dpu_core_perf_tune perf_tune; u32 enable_bw_release; u64 fix_core_clk_rate; u64 fix_core_ib_vote; From patchwork Tue Jul 4 15:03:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699733 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 D14CBC001DF for ; Tue, 4 Jul 2023 15:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbjGDPEF (ORCPT ); Tue, 4 Jul 2023 11:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjGDPEE (ORCPT ); Tue, 4 Jul 2023 11:04:04 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0728910CA for ; Tue, 4 Jul 2023 08:04:03 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b6a0d91e80so93118171fa.3 for ; Tue, 04 Jul 2023 08:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483041; x=1691075041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2xfPypxFqykUBs8DXR2db7NbjKez4rMFtYrZsmQ/UkM=; b=nZnOYoZOKaEVk6NkhRGdHZMAK3aQGPlGERb2FVf6omw09wam7MNXh1mQ09dQXnzZWE PtPRG3SR7dXHoTLnKpISbitH8wkOtx1oMCOMPZupiHnoCwooE0xWqlktY5DkpWYzYRm+ u73LoIwAkrZQqrwk8PR6ONbvnQ5QqA6nYU4L9Bc//vZSm661ymh2tigyMcMi9em+aWnm h4UaH7l+NVnZ1GR66PjRKko+HcnUyYfDLi+UHzAXW2BgFIxe7oqDE2eIoKbViCM2Ec/D s2LSEnjUs1mzZJk5VU3fhBHPmwAEp5MDhIRqIAlXbOxztwP/sKKJPTwXS7grbeMZhzKH XuOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483041; x=1691075041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2xfPypxFqykUBs8DXR2db7NbjKez4rMFtYrZsmQ/UkM=; b=LFniBs4L+uVc1byck7bEslxfP5u5Ou5HWl8AjVWFTMOmKniTCqs662yWN8iTyeiukR +L+aEgmPUdWLYdbf+v5XBnpewSVWhGlllqKKUD5TNNmub2+DhZbwa1C19V5V4BsPFsko wTjSVSgUUI/27uWrsEwdKEXkXjEmt+oeDh0gf5fe67HdkrDoTz7ps7PmSYdQpc/02xGv NQ6VAYRO1M4OcTs+wO8RF+Iv3EXtAQ2R7Ohw/Wi/dYnZ7haEB5nnH0FMREfp6rOX2E51 OvCuZh+hVlF06DJtORjil7nw205ptneuuBnhodVISjJa703qZSqX3FxOa5wQvfI9+Upq Ljiw== X-Gm-Message-State: ABy/qLYBhC5sq3vADDLhGtnGtBCxk3r3UOzIDh6qIA3RealWbbZifF1C UgBN1olUfUnThBeXcW5s+gqcRQ== X-Google-Smtp-Source: APBJJlHgdDuWNvb36YPG861rnaXrGdDxH9+okUmR51RjD8IMJWomcZXD0a/OJqm2yabBWZ84AjrHsA== X-Received: by 2002:a2e:9159:0:b0:2b4:78f6:d335 with SMTP id q25-20020a2e9159000000b002b478f6d335mr10684449ljg.8.1688483041140; Tue, 04 Jul 2023 08:04:01 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:00 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Konrad Dybcio Subject: [PATCH v2 07/14] drm/msm/dpu: drop dpu_core_perf_params::max_per_pipe_ib Date: Tue, 4 Jul 2023 18:03:47 +0300 Message-Id: <20230704150354.159882-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The max_per_pipe_ib is a constant across all CRTCs and is read from the catalog. Drop corresponding calculations and read the value directly at icc_set_bw() time. Suggested-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 17 +++++------------ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 -- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 23a29f159eff..fe4d7e08ac1d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -103,13 +103,12 @@ static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms, } perf->bw_ctl = _dpu_core_perf_calc_bw(kms, crtc); - perf->max_per_pipe_ib = kms->catalog->perf->min_dram_ib; perf->core_clk_rate = _dpu_core_perf_calc_clk(kms, crtc, state); DRM_DEBUG_ATOMIC( - "crtc=%d clk_rate=%llu core_ib=%llu core_ab=%llu\n", + "crtc=%d clk_rate=%llu core_ab=%llu\n", crtc->base.id, perf->core_clk_rate, - perf->max_per_pipe_ib, perf->bw_ctl); + perf->bw_ctl); } int dpu_core_perf_crtc_check(struct drm_crtc *crtc, @@ -192,9 +191,6 @@ static void dpu_core_perf_aggregate(struct drm_device *ddev, curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); - perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, - dpu_cstate->new_perf.max_per_pipe_ib); - perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", @@ -218,7 +214,7 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ - peak_bw = perf.max_per_pipe_ib; + peak_bw = kms->catalog->perf->min_dram_ib; if (kms->perf.fix_core_ab_vote) avg_bw = kms->perf.fix_core_ab_vote; @@ -333,15 +329,12 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, * 2. new bandwidth vote - "ab or ib vote" is lower * than current vote at end of commit or stop. */ - if ((params_changed && ((new->bw_ctl > old->bw_ctl) || - (new->max_per_pipe_ib > old->max_per_pipe_ib))) || - (!params_changed && ((new->bw_ctl < old->bw_ctl) || - (new->max_per_pipe_ib < old->max_per_pipe_ib)))) { + if ((params_changed && new->bw_ctl > old->bw_ctl) || + (!params_changed && new->bw_ctl < old->bw_ctl)) { DRM_DEBUG_ATOMIC("crtc=%d p=%d new_bw=%llu,old_bw=%llu\n", crtc->base.id, params_changed, new->bw_ctl, old->bw_ctl); old->bw_ctl = new->bw_ctl; - old->max_per_pipe_ib = new->max_per_pipe_ib; update_bus = true; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 1b791b170c6b..4f362bb6a520 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -16,12 +16,10 @@ /** * struct dpu_core_perf_params - definition of performance parameters - * @max_per_pipe_ib: maximum instantaneous bandwidth request * @bw_ctl: arbitrated bandwidth request * @core_clk_rate: core clock rate request */ struct dpu_core_perf_params { - u64 max_per_pipe_ib; u64 bw_ctl; u64 core_clk_rate; }; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 1edf2b6b0a26..ff5d306b95ed 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1400,8 +1400,6 @@ static int dpu_crtc_debugfs_state_show(struct seq_file *s, void *v) seq_printf(s, "core_clk_rate: %llu\n", dpu_crtc->cur_perf.core_clk_rate); seq_printf(s, "bw_ctl: %llu\n", dpu_crtc->cur_perf.bw_ctl); - seq_printf(s, "max_per_pipe_ib: %llu\n", - dpu_crtc->cur_perf.max_per_pipe_ib); return 0; } From patchwork Tue Jul 4 15:03:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699732 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 79D8CC00528 for ; Tue, 4 Jul 2023 15:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231593AbjGDPEF (ORCPT ); Tue, 4 Jul 2023 11:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231585AbjGDPEE (ORCPT ); Tue, 4 Jul 2023 11:04:04 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA3910D3 for ; Tue, 4 Jul 2023 08:04:03 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2b5c231c23aso92382131fa.0 for ; Tue, 04 Jul 2023 08:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483042; x=1691075042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4OmpW03IM72nopc7RqY4/FXVDSlVzzZJgcKrKtH7fe0=; b=PxRZS+JrgkzEdLNOzrmbJtDt6JlLldsrDvAu3ZQOsKSQ7aOfS0oX4K84cIZGte/l83 eBqHLlAHVfz4JG7A4stUTV8yUWcYUrp81vUwdcwdLVUoiH/sZzROMEzGNTjJ6s9JqNDk 21PbXHaX/8UeJKU2Ks0gE5yIW8Dc8G5OBAWiZAKtljdidx+Sc+InE/s0jDC6IzRMHDqj 0/hKcfGj9LKRdRtaUj5WuC7u+BJhLzsTBTYqpDaSgMjBGyr7T8m3ai2G4+WNBpfaAXg7 a+orj2NkPN98jVoijL0EQIbM5+OEJRl1rph2xX2avDcUXt3Yy8Te4VdwiXsCmZAeut7I hAbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483042; x=1691075042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4OmpW03IM72nopc7RqY4/FXVDSlVzzZJgcKrKtH7fe0=; b=ICgo2HG8aC4RS/xlQ8qnyNzeApV4SLqM2+LKd7Y4HnvGbbWOLgd8KZmKgKtCzhkk77 ndSVZeEEp+vyjZ7h8P98YTnSO797eHQ29jdcVdgmIyNvrMNlwqLBESv1WA1pGFyZnYiN wNtcv0bwF21Di6lXcNv2xcHVar1Ab7I60u2CbRq+v/g0H9XvXKnlVc240B9EXjievIqB OCxPlvstq2UvhwEH2e549GydcCz8i3hQPu+E5+F7Y7sfnyA7ttfLryzXpQtyHVbAx0B2 JQZ0iL0BsN03iqqTsatMt5s8ZGu6YruMqrJ55NTiPPZz7X4xHd8sPaWSx8uY72XeR/5t /gSw== X-Gm-Message-State: ABy/qLaJdaUIfHaNxljVfhEPWxFYoBPMFl0+1l5Y5dE7SviCaeFR7maE XELSA9qTWhT4dIswerpKYW8sJQ== X-Google-Smtp-Source: APBJJlFevKH1/FZGiODB7UDLxIkzFthcFVqPh4QOyv9WqNiniAjhGZdy4LYOnX/5zIzz7PlzcZIuDg== X-Received: by 2002:a2e:681a:0:b0:2b6:e196:68c4 with SMTP id c26-20020a2e681a000000b002b6e19668c4mr5685092lja.39.1688483041891; Tue, 04 Jul 2023 08:04:01 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:01 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Konrad Dybcio Subject: [PATCH v2 08/14] drm/msm/dpu: rework indentation in dpu_core_perf Date: Tue, 4 Jul 2023 18:03:48 +0300 Message-Id: <20230704150354.159882-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org dpu_core_perf.c contains several multi-line conditions which are hard to comprehent because of the indentation. Rework the identation of these conditions to make it easier to understand them. Reviewed-by: Abhinav Kumar Acked-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index fe4d7e08ac1d..bdd00c3af1c6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -146,8 +146,8 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, drm_for_each_crtc(tmp_crtc, crtc->dev) { if (tmp_crtc->enabled && - (dpu_crtc_get_client_type(tmp_crtc) == - curr_client_type) && (tmp_crtc != crtc)) { + dpu_crtc_get_client_type(tmp_crtc) == curr_client_type && + tmp_crtc != crtc) { struct dpu_crtc_state *tmp_cstate = to_dpu_crtc_state(tmp_crtc->state); @@ -338,10 +338,8 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, update_bus = true; } - if ((params_changed && - (new->core_clk_rate > old->core_clk_rate)) || - (!params_changed && - (new->core_clk_rate < old->core_clk_rate))) { + if ((params_changed && new->core_clk_rate > old->core_clk_rate) || + (!params_changed && new->core_clk_rate < old->core_clk_rate)) { old->core_clk_rate = new->core_clk_rate; update_clk = true; } From patchwork Tue Jul 4 15:03:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698989 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 1F1E9EB64DA for ; Tue, 4 Jul 2023 15:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231604AbjGDPEH (ORCPT ); Tue, 4 Jul 2023 11:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231585AbjGDPEF (ORCPT ); Tue, 4 Jul 2023 11:04:05 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6877710D5 for ; Tue, 4 Jul 2023 08:04:04 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b6afc1ceffso93713801fa.0 for ; Tue, 04 Jul 2023 08:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483042; x=1691075042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jgbI3/ffvPjsCqNx8ewaFdwoK+9AdPqtzj3Q+tVUb5U=; b=OQ8pCacqKiTD1fLThyZjjM3X0PkTUn1r8tJW/c1EySI8bjE4uMg5q6aQ9aOw6VoLQ2 OC07GXpLibFZ9U+gfUAzV4l2LTMdFmgsoE78T1EQ0EsXvfg8QVzjjOKgjn7k/IpU75S3 6kzQrgt5owX9ecjXH+8sKvazE70uGeT0/KB8fpKDZ6nZE+/7Iq6r8EErLro6LblaPqxU 52kwES/nLo41T4r2z/HFUfs7NFmFfYlvyyTn5M7A4aqB+ux4dXqkYULrZpbrNB5Pz66v c7iUijRTtw/HfB6ELCe2uovaU2HcN7cc/YuWGoaPB4Spbnq3ansbVvfWXnQbrN11fNE5 FDQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483042; x=1691075042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jgbI3/ffvPjsCqNx8ewaFdwoK+9AdPqtzj3Q+tVUb5U=; b=KNL47SGj8SUgrGO8aFK3/UKvLZmex38Xx1UXG2OdZ4PuZzlSUTGiS3tqF3VMWmu86H hMUO07xlsj3/wjBZMn1AzNU1kNzZD5jcYzZXVxqdgJSaoifqSOQksfL1u4lOqvdO6aC7 ZFj422c8jFBM39x2flM3a8+I0rGqYaxXPCL5GiVZ2CMQOMJ6Scr+os4PxU1y1cx9V5dh xP2nBVV3qA3j06xgqJxH220yQCFu8VtrIRGnrf4B1PwiW4kDbe8PEOX5aJzYr/AbU4/1 agBDn4vTZTNFPGCbLdnRh26mqsBRRpFgNx970gvMsZVlB0lD92LURpxM2TKX5wKwke4z w9Xw== X-Gm-Message-State: ABy/qLb6al8zDJFRa5ia+VQhBnqL2DSUJvKQou3DE4Vz8snRZ8bAQIeh N8eKnJh4hyp36cdZKoQ08AfOJw== X-Google-Smtp-Source: APBJJlFMnoc1b9eLxuuCunUAGD8TDuqDPjHziarv4Vjz179l1NtFxdd0i59BUvUJgbsarprcnVzPlQ== X-Received: by 2002:a2e:94c3:0:b0:2b6:df8a:d44b with SMTP id r3-20020a2e94c3000000b002b6df8ad44bmr5659368ljh.36.1688483042723; Tue, 04 Jul 2023 08:04:02 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:02 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 09/14] drm/msm/dpu: drop the dpu_core_perf_crtc_update()'s stop_req param Date: Tue, 4 Jul 2023 18:03:49 +0300 Message-Id: <20230704150354.159882-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The stop_req is true only in the dpu_crtc_disable() case, when crtc->enable has already been set to false. This renders the stop_req argument useless. Remove it completely. Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 ++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index bdd00c3af1c6..f15efaaaf9fa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -291,7 +291,7 @@ static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms) } int dpu_core_perf_crtc_update(struct drm_crtc *crtc, - int params_changed, bool stop_req) + int params_changed) { struct dpu_core_perf_params *new, *old; bool update_bus = false, update_clk = false; @@ -315,13 +315,13 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, dpu_crtc = to_dpu_crtc(crtc); dpu_cstate = to_dpu_crtc_state(crtc->state); - DRM_DEBUG_ATOMIC("crtc:%d stop_req:%d core_clk:%llu\n", - crtc->base.id, stop_req, kms->perf.core_clk_rate); + DRM_DEBUG_ATOMIC("crtc:%d enabled:%d core_clk:%llu\n", + crtc->base.id, crtc->enabled, kms->perf.core_clk_rate); old = &dpu_crtc->cur_perf; new = &dpu_cstate->new_perf; - if (crtc->enabled && !stop_req) { + if (crtc->enabled) { /* * cases for bus bandwidth update. * 1. new bandwidth vote - "ab or ib vote" is higher @@ -351,7 +351,7 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, } trace_dpu_perf_crtc_update(crtc->base.id, new->bw_ctl, - new->core_clk_rate, stop_req, update_bus, update_clk); + new->core_clk_rate, !crtc->enabled, update_bus, update_clk); if (update_bus) { ret = _dpu_core_perf_crtc_update_bus(kms, crtc); @@ -371,7 +371,7 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, DRM_DEBUG_ATOMIC("clk:%llu\n", clk_rate); - trace_dpu_core_perf_update_clk(kms->dev, stop_req, clk_rate); + trace_dpu_core_perf_update_clk(kms->dev, !crtc->enabled, clk_rate); clk_rate = min(clk_rate, kms->perf.max_core_clk_rate); ret = dev_pm_opp_set_rate(&kms->pdev->dev, clk_rate); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 4f362bb6a520..0b8c527f489e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -63,11 +63,10 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, * dpu_core_perf_crtc_update - update performance of the given crtc * @crtc: Pointer to crtc * @params_changed: true if crtc parameters are modified - * @stop_req: true if this is a stop request * return: zero if success, or error code otherwise */ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, - int params_changed, bool stop_req); + int params_changed); /** * dpu_core_perf_crtc_release_bw - release bandwidth of the given crtc diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ff5d306b95ed..214229d11e3e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -718,7 +718,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event) void dpu_crtc_complete_commit(struct drm_crtc *crtc) { trace_dpu_crtc_complete_commit(DRMID(crtc)); - dpu_core_perf_crtc_update(crtc, 0, false); + dpu_core_perf_crtc_update(crtc, 0); _dpu_crtc_complete_flip(crtc); } @@ -884,7 +884,7 @@ static void dpu_crtc_atomic_flush(struct drm_crtc *crtc, return; /* update performance setting before crtc kickoff */ - dpu_core_perf_crtc_update(crtc, 1, false); + dpu_core_perf_crtc_update(crtc, 1); /* * Final plane updates: Give each plane a chance to complete all @@ -1100,7 +1100,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, atomic_set(&dpu_crtc->frame_pending, 0); } - dpu_core_perf_crtc_update(crtc, 0, true); + dpu_core_perf_crtc_update(crtc, 0); drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) dpu_encoder_register_frame_event_callback(encoder, NULL, NULL); From patchwork Tue Jul 4 15:03:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698988 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 CAB0FC001DB for ; Tue, 4 Jul 2023 15:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231610AbjGDPEI (ORCPT ); Tue, 4 Jul 2023 11:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231615AbjGDPEH (ORCPT ); Tue, 4 Jul 2023 11:04:07 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2836110CA for ; Tue, 4 Jul 2023 08:04:05 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b6f9edac8dso9748661fa.3 for ; Tue, 04 Jul 2023 08:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483043; x=1691075043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HDgrNStW4Ac/FWj3/7ye1MA3iDkfpt5tbCAwpxZ603w=; b=pAtZpyLYqx8z8qmYXduzZPnwfOjxHBSj8AyIjexB7eOgefzmNdgR96/HcLGaQUuDZb FLamT+znK6e/ikJiLy80wgl38fzHqaZhJ2tX5O/Q1VF8h9l08j6aeDTIxv2Cv26OwOaz 6pA20EDxUjGjISdqofh71TfF171YCbZJpGcSxRPNOQ5h9NTAbY9y4G4asFRU4nWeJcZi IKLosGwYi4YXmPibR8vtKFd0wVMnM+caCO3fEqq3nBk0CsTpzmut4mKpmURjBIM7zYeJ WcAxQYbVZFh6vtZXXt6X4N/OMN7ySnS2ruPga2LPZpQ4uXUUrDdt+BUAbHmu0c98Cs1V VEzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483043; x=1691075043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HDgrNStW4Ac/FWj3/7ye1MA3iDkfpt5tbCAwpxZ603w=; b=TabmMR+1BVfZVjrFAmMQwjs0j4jKwquqNLBi7gHsU4uQMs3cfNwHqbrBVUtKR9oMQh uVuvrIP9BWptZHgJHuSqdNtr6iDDMONVI7H/QrF3pqHTzdACHeikY465sTwFyqpioPlX C6wdKYfWXCq36ra02RwvYH8slFHv5fexATXE5m2jeTr+nFegr8bYNG3wnYqyaqHy035n mVRDErVVeJcqVrNUmYy7hzhn3vS5OFu3EtLhZ95Lm0IR+M4FSKChlPfMUiMGIhmNOulV C9kwxH8bpECPGKJwkv+fnXFLXno3oyenrgBnC9/9SK7BLK3FxtShynmCOQ57RyW/RLD1 Z1eQ== X-Gm-Message-State: ABy/qLZcXX4T5SHOgswrlPbxqZyVHjcZ6mHXTqO2LJTAJJ7vf+NwfaxH kwgy7oUqCFkml3Hi8h4093dpbg== X-Google-Smtp-Source: APBJJlFB/plDqrxl3IkEcOmRFgWfHM5KSLpmaomd/brp3qmz9LIqpIplvn3Efk4d1pGvrjUH7RNiFw== X-Received: by 2002:a2e:81d3:0:b0:2b6:ef5d:965c with SMTP id s19-20020a2e81d3000000b002b6ef5d965cmr3023199ljg.44.1688483043446; Tue, 04 Jul 2023 08:04:03 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:03 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Konrad Dybcio Subject: [PATCH v2 10/14] drm/msm/dpu: use dpu_perf_cfg in DPU core_perf code Date: Tue, 4 Jul 2023 18:03:50 +0300 Message-Id: <20230704150354.159882-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Simplify dpu_core_perf code by using only dpu_perf_cfg instead of using full-featured catalog data. Acked-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 58 +++++++------------ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 8 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- 3 files changed, 27 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index f15efaaaf9fa..e9c7d398d9cb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -19,11 +19,11 @@ /** * _dpu_core_perf_calc_bw() - to calculate BW per crtc - * @kms: pointer to the dpu_kms + * @perf_cfg: performance configuration * @crtc: pointer to a crtc * Return: returns aggregated BW for all planes in crtc. */ -static u64 _dpu_core_perf_calc_bw(struct dpu_kms *kms, +static u64 _dpu_core_perf_calc_bw(const struct dpu_perf_cfg *perf_cfg, struct drm_crtc *crtc) { struct drm_plane *plane; @@ -39,7 +39,7 @@ static u64 _dpu_core_perf_calc_bw(struct dpu_kms *kms, crtc_plane_bw += pstate->plane_fetch_bw; } - bw_factor = kms->catalog->perf->bw_inefficiency_factor; + bw_factor = perf_cfg->bw_inefficiency_factor; if (bw_factor) { crtc_plane_bw *= bw_factor; do_div(crtc_plane_bw, 100); @@ -50,12 +50,12 @@ static u64 _dpu_core_perf_calc_bw(struct dpu_kms *kms, /** * _dpu_core_perf_calc_clk() - to calculate clock per crtc - * @kms: pointer to the dpu_kms + * @perf_cfg: performance configuration * @crtc: pointer to a crtc * @state: pointer to a crtc state * Return: returns max clk for all planes in crtc. */ -static u64 _dpu_core_perf_calc_clk(struct dpu_kms *kms, +static u64 _dpu_core_perf_calc_clk(const struct dpu_perf_cfg *perf_cfg, struct drm_crtc *crtc, struct drm_crtc_state *state) { struct drm_plane *plane; @@ -76,7 +76,7 @@ static u64 _dpu_core_perf_calc_clk(struct dpu_kms *kms, crtc_clk = max(pstate->plane_clk, crtc_clk); } - clk_factor = kms->catalog->perf->clk_inefficiency_factor; + clk_factor = perf_cfg->clk_inefficiency_factor; if (clk_factor) { crtc_clk *= clk_factor; do_div(crtc_clk, 100); @@ -92,18 +92,18 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc) return to_dpu_kms(priv->kms); } -static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms, +static void _dpu_core_perf_calc_crtc(const struct dpu_perf_cfg *perf_cfg, struct drm_crtc *crtc, struct drm_crtc_state *state, struct dpu_core_perf_params *perf) { - if (!kms || !kms->catalog || !crtc || !state || !perf) { + if (!perf_cfg || !crtc || !state || !perf) { DPU_ERROR("invalid parameters\n"); return; } - perf->bw_ctl = _dpu_core_perf_calc_bw(kms, crtc); - perf->core_clk_rate = _dpu_core_perf_calc_clk(kms, crtc, state); + perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc); + perf->core_clk_rate = _dpu_core_perf_calc_clk(perf_cfg, crtc, state); DRM_DEBUG_ATOMIC( "crtc=%d clk_rate=%llu core_ab=%llu\n", @@ -120,6 +120,7 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, struct dpu_crtc_state *dpu_cstate; struct drm_crtc *tmp_crtc; struct dpu_kms *kms; + const struct dpu_perf_cfg *perf_cfg; if (!crtc || !state) { DPU_ERROR("invalid crtc\n"); @@ -127,10 +128,7 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, } kms = _dpu_crtc_get_kms(crtc); - if (!kms->catalog) { - DPU_ERROR("invalid parameters\n"); - return 0; - } + perf_cfg = kms->perf.perf_cfg; /* we only need bandwidth check on real-time clients (interfaces) */ if (dpu_crtc_get_client_type(crtc) == NRT_CLIENT) @@ -139,7 +137,7 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, dpu_cstate = to_dpu_crtc_state(state); /* obtain new values */ - _dpu_core_perf_calc_crtc(kms, crtc, state, &dpu_cstate->new_perf); + _dpu_core_perf_calc_crtc(perf_cfg, crtc, state, &dpu_cstate->new_perf); bw_sum_of_intfs = dpu_cstate->new_perf.bw_ctl; curr_client_type = dpu_crtc_get_client_type(crtc); @@ -162,7 +160,7 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, bw = DIV_ROUND_UP_ULL(bw_sum_of_intfs, 1000); DRM_DEBUG_ATOMIC("calculated bandwidth=%uk\n", bw); - threshold = kms->catalog->perf->max_bw_high; + threshold = perf_cfg->max_bw_high; DRM_DEBUG_ATOMIC("final threshold bw limit = %d\n", threshold); @@ -214,7 +212,7 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ - peak_bw = kms->catalog->perf->min_dram_ib; + peak_bw = kms->perf.perf_cfg->min_dram_ib; if (kms->perf.fix_core_ab_vote) avg_bw = kms->perf.fix_core_ab_vote; @@ -248,12 +246,6 @@ void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc) return; } - kms = _dpu_crtc_get_kms(crtc); - if (!kms->catalog) { - DPU_ERROR("invalid kms\n"); - return; - } - dpu_crtc = to_dpu_crtc(crtc); if (atomic_dec_return(&kms->bandwidth_ref) > 0) @@ -307,10 +299,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, } kms = _dpu_crtc_get_kms(crtc); - if (!kms->catalog) { - DPU_ERROR("invalid kms\n"); - return -EINVAL; - } dpu_crtc = to_dpu_crtc(crtc); dpu_cstate = to_dpu_crtc_state(crtc->state); @@ -391,7 +379,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) { struct dpu_core_perf *perf = &dpu_kms->perf; - const struct dpu_mdss_cfg *catalog = perf->catalog; struct dentry *entry; entry = debugfs_create_dir("core_perf", parent); @@ -403,15 +390,15 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) debugfs_create_u32("enable_bw_release", 0600, entry, (u32 *)&perf->enable_bw_release); debugfs_create_u32("threshold_low", 0600, entry, - (u32 *)&catalog->perf->max_bw_low); + (u32 *)&perf->perf_cfg->max_bw_low); debugfs_create_u32("threshold_high", 0600, entry, - (u32 *)&catalog->perf->max_bw_high); + (u32 *)&perf->perf_cfg->max_bw_high); debugfs_create_u32("min_core_ib", 0600, entry, - (u32 *)&catalog->perf->min_core_ib); + (u32 *)&perf->perf_cfg->min_core_ib); debugfs_create_u32("min_llcc_ib", 0600, entry, - (u32 *)&catalog->perf->min_llcc_ib); + (u32 *)&perf->perf_cfg->min_llcc_ib); debugfs_create_u32("min_dram_ib", 0600, entry, - (u32 *)&catalog->perf->min_dram_ib); + (u32 *)&perf->perf_cfg->min_dram_ib); debugfs_create_u64("fix_core_clk_rate", 0600, entry, &perf->fix_core_clk_rate); debugfs_create_u64("fix_core_ib_vote", 0600, entry, @@ -432,17 +419,16 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf) perf->max_core_clk_rate = 0; perf->core_clk = NULL; - perf->catalog = NULL; perf->dev = NULL; } int dpu_core_perf_init(struct dpu_core_perf *perf, struct drm_device *dev, - const struct dpu_mdss_cfg *catalog, + const struct dpu_perf_cfg *perf_cfg, struct clk *core_clk) { perf->dev = dev; - perf->catalog = catalog; + perf->perf_cfg = perf_cfg; perf->core_clk = core_clk; perf->max_core_clk_rate = clk_get_rate(core_clk); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 0b8c527f489e..4490120d11d4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -28,7 +28,7 @@ struct dpu_core_perf_params { * struct dpu_core_perf - definition of core performance context * @dev: Pointer to drm device * @debugfs_root: top level debug folder - * @catalog: Pointer to catalog configuration + * @perf_cfg: Platform-specific performance configuration * @core_clk: Pointer to the core clock * @core_clk_rate: current core clock rate * @max_core_clk_rate: maximum allowable core clock rate @@ -40,7 +40,7 @@ struct dpu_core_perf_params { struct dpu_core_perf { struct drm_device *dev; struct dentry *debugfs_root; - const struct dpu_mdss_cfg *catalog; + const struct dpu_perf_cfg *perf_cfg; struct clk *core_clk; u64 core_clk_rate; u64 max_core_clk_rate; @@ -84,12 +84,12 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf); * dpu_core_perf_init - initialize the given core performance context * @perf: Pointer to core performance context * @dev: Pointer to drm device - * @catalog: Pointer to catalog + * @perf_cfg: Pointer to platform performance configuration * @core_clk: pointer to core clock */ int dpu_core_perf_init(struct dpu_core_perf *perf, struct drm_device *dev, - const struct dpu_mdss_cfg *catalog, + const struct dpu_perf_cfg *perf_cfg, struct clk *core_clk); struct dpu_kms; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index aa8499de1b9f..6e62606e32de 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1115,7 +1115,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms->hw_vbif[vbif->id] = hw; } - rc = dpu_core_perf_init(&dpu_kms->perf, dev, dpu_kms->catalog, + rc = dpu_core_perf_init(&dpu_kms->perf, dev, dpu_kms->catalog->perf, msm_clk_bulk_get_clock(dpu_kms->clocks, dpu_kms->num_clocks, "core")); if (rc) { DPU_ERROR("failed to init perf %d\n", rc); From patchwork Tue Jul 4 15:03:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699731 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 21BFDC001B1 for ; Tue, 4 Jul 2023 15:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbjGDPEI (ORCPT ); Tue, 4 Jul 2023 11:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231613AbjGDPEH (ORCPT ); Tue, 4 Jul 2023 11:04:07 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0B7710CF for ; Tue, 4 Jul 2023 08:04:05 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2b69f216c73so84789311fa.3 for ; Tue, 04 Jul 2023 08:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483044; x=1691075044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jFGHfGqaywYGdFojOEDzLMab/0n9ifuE6031kMHcPH8=; b=V5WVR8U5s3n3OPkS+P+dn55gCnC04keNoIO8kQa85f5uLPR/IiUTQR2plVQvoum1kK YoeNtW7hFRnoDj82NuDNEtONdbQ7xVyXYtDUZYJQc3VSe9W5GqZeI1h8RSrp5//SNGAy j1puIcBWvKSSQVp94qnQxvh6f2b54EVVljAU0+GZDFWI7QD1TG57XGpgP7dMxBC/PeLs uuocNALJCjiKpnGRulDxsDJI2MELxs9lScOe2OP+V34xuActiha/Icgh2AIs/135D5C/ aQb7KXrK7hyb2kOiPW976Ls2u5hMoBdlawwPDS7Vzi1IxeRIbSiILIb24r3SBnnw9Lws SCxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483044; x=1691075044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jFGHfGqaywYGdFojOEDzLMab/0n9ifuE6031kMHcPH8=; b=fIFCYeXH0V+KU1Tf9SLlBQvtYsNzsu17OzlJPcjtol3i/cipUXv1Tbl70VpCh0HrMx 27lHrBdWJxxGvjmj1Zt5O99TIRwwb5WGuVOE+lTGfoEI85YKnDwH8e6Zo5nRma3+/hHN uN69E4aAGfgYjTDgpghbNGJkidW2F8XBuBy75+UXDvG90lBLVEiIvle9w3Dwgos7qOK0 fM2ZksO/h6mtjfsuGP4WqzbY66pHu5S3e//sxJz7pmhEGqtWPzGM+ezS6Y12jL4BKlcB ASRKn1kxJb1oN/YeAH6t/oxyCbPoJOgxC5fa6xVMKFFITO9kWQGBpev8wzTMD7+oILzA KgHg== X-Gm-Message-State: ABy/qLYqc95gRyRriAcSdL3clgD0XETC99ZkRoVHLY72Q0xGvdgMSX/W Gv8vbl6esr6XQrJpAdL6DC+z4Q== X-Google-Smtp-Source: APBJJlGyFBB6rzGAJ29n1eMGAYBz7q2UVklYzmzs4swgrVmk+tbs0tUIRlQlifOGLx+jJFTsKrhj4Q== X-Received: by 2002:a2e:7008:0:b0:2b6:d48a:5dc3 with SMTP id l8-20020a2e7008000000b002b6d48a5dc3mr8755908ljc.39.1688483044226; Tue, 04 Jul 2023 08:04:04 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:03 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Konrad Dybcio Subject: [PATCH v2 11/14] drm/msm/dpu: remove unused fields from struct dpu_core_perf Date: Tue, 4 Jul 2023 18:03:51 +0300 Message-Id: <20230704150354.159882-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Remove dpu_core_perf::dev and dpu_core_perf::debugfs_root fields, they are not used by the code. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 3 --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 6 ------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index e9c7d398d9cb..906611f6b879 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -419,15 +419,12 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf) perf->max_core_clk_rate = 0; perf->core_clk = NULL; - perf->dev = NULL; } int dpu_core_perf_init(struct dpu_core_perf *perf, - struct drm_device *dev, const struct dpu_perf_cfg *perf_cfg, struct clk *core_clk) { - perf->dev = dev; perf->perf_cfg = perf_cfg; perf->core_clk = core_clk; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 4490120d11d4..7c5142aca4ee 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -26,8 +26,6 @@ struct dpu_core_perf_params { /** * struct dpu_core_perf - definition of core performance context - * @dev: Pointer to drm device - * @debugfs_root: top level debug folder * @perf_cfg: Platform-specific performance configuration * @core_clk: Pointer to the core clock * @core_clk_rate: current core clock rate @@ -38,8 +36,6 @@ struct dpu_core_perf_params { * @fix_core_ab_vote: fixed core ab vote in bps used in mode 2 */ struct dpu_core_perf { - struct drm_device *dev; - struct dentry *debugfs_root; const struct dpu_perf_cfg *perf_cfg; struct clk *core_clk; u64 core_clk_rate; @@ -83,12 +79,10 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf); /** * dpu_core_perf_init - initialize the given core performance context * @perf: Pointer to core performance context - * @dev: Pointer to drm device * @perf_cfg: Pointer to platform performance configuration * @core_clk: pointer to core clock */ int dpu_core_perf_init(struct dpu_core_perf *perf, - struct drm_device *dev, const struct dpu_perf_cfg *perf_cfg, struct clk *core_clk); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 6e62606e32de..631b6b679bae 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1115,7 +1115,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms->hw_vbif[vbif->id] = hw; } - rc = dpu_core_perf_init(&dpu_kms->perf, dev, dpu_kms->catalog->perf, + rc = dpu_core_perf_init(&dpu_kms->perf, dpu_kms->catalog->perf, msm_clk_bulk_get_clock(dpu_kms->clocks, dpu_kms->num_clocks, "core")); if (rc) { DPU_ERROR("failed to init perf %d\n", rc); From patchwork Tue Jul 4 15:03:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699730 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 068D2EB64D9 for ; Tue, 4 Jul 2023 15:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231613AbjGDPEJ (ORCPT ); Tue, 4 Jul 2023 11:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjGDPEH (ORCPT ); Tue, 4 Jul 2023 11:04:07 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78BB10D3 for ; Tue, 4 Jul 2023 08:04:06 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b6adef5c22so88217591fa.3 for ; Tue, 04 Jul 2023 08:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483045; x=1691075045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pieIq/XM9siLESliq0xx7Knpb1NBYGOxDjjAn9WsS/M=; b=CWlijt14kw2HIgnQK5fxNHhe+kXCKIcLqH+lH3+4nCKfIfyt8Q85XYKpvnrHYWsGQW 0eeMiibs8whB3yOosB12jxDpa5fEDY7JX3wOm+xoPOmrD8FvQbjWgoK0OuE9ODoHhvEH 5cg5adZyJUOzOBXMfRmvm7qZGE13T4HeF+mjhissQNfvIxkdIlyav/tDLbU+jMY+woMn wJnDi5e/nPb671x4tAtytsUTaMYRwxQIZjtwfUchi7QTL/Aj0huOmjgzogBLLGpN0rG1 JtXm8rgkZsDrxzE+BDfIrQkHBjPrNNIsfsfAHiOE8mD6VwidFfAieBKVVXsxFUtX8b/Z ZHgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483045; x=1691075045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pieIq/XM9siLESliq0xx7Knpb1NBYGOxDjjAn9WsS/M=; b=HDJvcYx7OuUpoECYjo3TyNlCfAVCVa9e71gL6kr1czAVcuD+ozu2jUzjNr8m3QknIJ xtV8SkGShVSLAcwBeTojByRSb21MIvLDBUqPxA/u04C2zkoMR0SvsJpgcAd8ITdWo3TK 1N8avoEwGINY3bpsG0CkFdGX2AJA1j8DIwJ9g1DL9hGXobw/ptI88sU3ZuKJghIcPG3o VDpNr1yVWM+vuQ8bcDDE4dDdtH+9gACogJyO/jGtKPhxhEws2rXgu8AMLVeTHcLK7FKP +jSMk/fb31xGRTIGf3crGpySXpGPf84jc4AL2E+bfuToC4Su7kJjA4Q2tljnohoZzzQf przw== X-Gm-Message-State: ABy/qLag8BOxvVm0ggXs0cXZf76RV6tSfDxEwTfutcqbP6TCxpcWYEnQ 82d9e8Z7RISnNUYmC/2yX68oLw== X-Google-Smtp-Source: APBJJlFpjYVEzi31is0y37Cyyn8jOydRM6m4hsZ/CgTlRBLNAm9swggAuLlZTFcFc8ekiEyNjB3zig== X-Received: by 2002:a2e:8605:0:b0:2b6:df71:cff1 with SMTP id a5-20020a2e8605000000b002b6df71cff1mr7082394lji.52.1688483044987; Tue, 04 Jul 2023 08:04:04 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:04 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 12/14] drm/msm/dpu: core_perf: remove extra clk_round_rate() call Date: Tue, 4 Jul 2023 18:03:52 +0300 Message-Id: <20230704150354.159882-13-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The dev_pm_opp_set_rate() already contains a call for clk_round_rate for the passed value. Stop calling it manually from _dpu_core_perf_get_core_clk_rate(). It is slightly incorrect to call it this way, as we should round the final calculated clock rate rather than rounding all the intermediate values. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 906611f6b879..d533b63f90f6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -274,8 +274,6 @@ static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms) dpu_cstate = to_dpu_crtc_state(crtc->state); clk_rate = max(dpu_cstate->new_perf.core_clk_rate, clk_rate); - clk_rate = clk_round_rate(kms->perf.core_clk, - clk_rate); } } From patchwork Tue Jul 4 15:03:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 698987 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 B6169EB64DD for ; Tue, 4 Jul 2023 15:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjGDPEK (ORCPT ); Tue, 4 Jul 2023 11:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbjGDPEI (ORCPT ); Tue, 4 Jul 2023 11:04:08 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B68C10D5 for ; Tue, 4 Jul 2023 08:04:07 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b6a0d91e80so93119211fa.3 for ; Tue, 04 Jul 2023 08:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483045; x=1691075045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K014LgLyPe4aW6ZNHxa+7j6rHR32DjhGHYOOx4vKvz0=; b=cW/atZ9p/Z1NbJFRIGf7Y8+A8+yEdtUDWR9e9FUVpr/4X9EiNjcwcUQQyBNFXrYzg9 +deMu81Lfp9/bcfjw5PHlunXr4S5+SCO7lN9OgHuBUexgv7gMuXp8NWjhNjoOKwf7cDO FXvKyQUKaGaXDZAI9J8d7Zs4xBzIuBGbS3G+ZKaH0rBWXJds6seTLzBouxgf1NX23HFm Kb09fCviq+qaqa2dk324LKQB4jc1ypFais6nV4xphl1H6JsSZnKFVflYDIaIctv0AzbN 8/6X49tBTheNixTm7Z0sfnU+lKxWNHKu/2myypQaTIh/qmmBfJia90wobWJGgnV9PbSG me4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483045; x=1691075045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K014LgLyPe4aW6ZNHxa+7j6rHR32DjhGHYOOx4vKvz0=; b=jF5aGNDzBgkvm2Plh08kSa135uO6Ty2UfQ+1Y4a09cErjomplZrUSUZw0WgH+WI/96 5ar542crfM2Y8SllUE45J7NRx0+/igXbNN/i6rrgXpBTsjgtlZ0ecFbGRyxaXOwe2hfw 6jKw/oorU1JmAMvEGXMNbz2/RSRTowjy4pLuYZCFBuA73GiRfJ6zFmvM3gYrwCmt2Rmq +EnsaqVMcyl0kzRAOPvrsGjQd7dZWDNdtAXgJHX07/Zcs8k2TNrfRRDf7MSRpUUuZULK XjDiMgPiRqt31/ADabhWRmyJnCNTo+7j07dNKKV5kq3BzHw9WmHaImsJReFY2VZ9bcHV M3mg== X-Gm-Message-State: ABy/qLZxXx6sqGceT73J2s2VkqiGmo5zADDjiFpUwWXhSho+/zkbP0QZ g8o9D4dY7vc6AU9XOiWaoW36Aw== X-Google-Smtp-Source: APBJJlFL6tCE43hAXSFHpFC901y1JpvL+F43NmKcBa6ZbOeviRZX7bqDm3EOf7P0JSAFnwXnrnMQdw== X-Received: by 2002:a2e:8885:0:b0:2b5:80e0:f18e with SMTP id k5-20020a2e8885000000b002b580e0f18emr9572371lji.3.1688483045753; Tue, 04 Jul 2023 08:04:05 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:05 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 13/14] drm/msm/dpu: move max clock decision to dpu_kms. Date: Tue, 4 Jul 2023 18:03:53 +0300 Message-Id: <20230704150354.159882-14-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org dpu_core_perf should not make decisions on the maximum possible core clock rate. Pass the value from dpu_kms_hw_init(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 11 ++--------- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 8 ++------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 13 +++++++++++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index d533b63f90f6..608c915a2cab 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -416,21 +416,14 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf) } perf->max_core_clk_rate = 0; - perf->core_clk = NULL; } int dpu_core_perf_init(struct dpu_core_perf *perf, const struct dpu_perf_cfg *perf_cfg, - struct clk *core_clk) + unsigned long max_core_clk_rate) { perf->perf_cfg = perf_cfg; - perf->core_clk = core_clk; - - perf->max_core_clk_rate = clk_get_rate(core_clk); - if (!perf->max_core_clk_rate) { - DPU_DEBUG("optional max core clk rate, use default\n"); - perf->max_core_clk_rate = DPU_PERF_DEFAULT_MAX_CORE_CLK_RATE; - } + perf->max_core_clk_rate = max_core_clk_rate; return 0; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 7c5142aca4ee..df1fcf28f2a9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -12,8 +12,6 @@ #include "dpu_hw_catalog.h" -#define DPU_PERF_DEFAULT_MAX_CORE_CLK_RATE 412500000 - /** * struct dpu_core_perf_params - definition of performance parameters * @bw_ctl: arbitrated bandwidth request @@ -27,7 +25,6 @@ struct dpu_core_perf_params { /** * struct dpu_core_perf - definition of core performance context * @perf_cfg: Platform-specific performance configuration - * @core_clk: Pointer to the core clock * @core_clk_rate: current core clock rate * @max_core_clk_rate: maximum allowable core clock rate * @enable_bw_release: debug control for bandwidth release @@ -37,7 +34,6 @@ struct dpu_core_perf_params { */ struct dpu_core_perf { const struct dpu_perf_cfg *perf_cfg; - struct clk *core_clk; u64 core_clk_rate; u64 max_core_clk_rate; u32 enable_bw_release; @@ -80,11 +76,11 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf); * dpu_core_perf_init - initialize the given core performance context * @perf: Pointer to core performance context * @perf_cfg: Pointer to platform performance configuration - * @core_clk: pointer to core clock + * @max_core_clk_rate: Maximum core clock rate */ int dpu_core_perf_init(struct dpu_core_perf *perf, const struct dpu_perf_cfg *perf_cfg, - struct clk *core_clk); + unsigned long max_core_clk_rate); struct dpu_kms; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 631b6b679bae..f01b2278c01a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1011,11 +1011,14 @@ unsigned long dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name) return clk_get_rate(clk); } +#define DPU_PERF_DEFAULT_MAX_CORE_CLK_RATE 412500000 + static int dpu_kms_hw_init(struct msm_kms *kms) { struct dpu_kms *dpu_kms; struct drm_device *dev; int i, rc = -EINVAL; + unsigned long max_core_clk_rate; u32 core_rev; if (!kms) { @@ -1115,8 +1118,14 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms->hw_vbif[vbif->id] = hw; } - rc = dpu_core_perf_init(&dpu_kms->perf, dpu_kms->catalog->perf, - msm_clk_bulk_get_clock(dpu_kms->clocks, dpu_kms->num_clocks, "core")); + /* TODO: use the same max_freq as in dpu_kms_hw_init */ + max_core_clk_rate = dpu_kms_get_clk_rate(dpu_kms, "core"); + if (!max_core_clk_rate) { + DPU_DEBUG("max core clk rate not determined, using default\n"); + max_core_clk_rate = DPU_PERF_DEFAULT_MAX_CORE_CLK_RATE; + } + + rc = dpu_core_perf_init(&dpu_kms->perf, dpu_kms->catalog->perf, max_core_clk_rate); if (rc) { DPU_ERROR("failed to init perf %d\n", rc); goto perf_err; From patchwork Tue Jul 4 15:03:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 699729 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 644EAEB64DA for ; Tue, 4 Jul 2023 15:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231483AbjGDPEL (ORCPT ); Tue, 4 Jul 2023 11:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231615AbjGDPEJ (ORCPT ); Tue, 4 Jul 2023 11:04:09 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BEB510CA for ; Tue, 4 Jul 2023 08:04:08 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2b5c2433134so71909521fa.0 for ; Tue, 04 Jul 2023 08:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688483046; x=1691075046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3xZk5vPk29uIzS1RfjK4BQWFnQ4bvdjXpPHBXHvz4II=; b=NYmiUxpvSBe4mTOK8eLkgFsavb3DP2IC2R4Qi1euCOF3BQjEU+n02DzCTCerxqyiKc axiNoOfGlOwEwEh7j4LoM0FEl8qRwQj9E1ngesL1BlJAqVpG3Zfo9cEHyhYpgDBx6nEk Er6HTxocnXgjch+Fx8VeT6mBmxjveQ9m0ST7bEq/bvLaAzx+EwJaZbSgbgLVbXJoLn+Z NQru2E4W+9Xi2j9e4AVhZnsOqJZ3oi0oas11lMWTXItbQlxf8z2rTdGtGLHT7kUwtXc9 FCO/fx7dsyKoZH2AtdevK9UuLLt5PophfiFO10Styur0sAl8JvpqLSmah3K8cyZAarnT aIAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688483046; x=1691075046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3xZk5vPk29uIzS1RfjK4BQWFnQ4bvdjXpPHBXHvz4II=; b=iuLBbOLRcRmRN/2GOYjy2SX/5QybvoaHdFLgPhVTCob3Hbsedhy33Ua8Ca3e3y0tU7 gCyiUg2s662KMU0wXP3SSi4k8bDTObCdEc1026AgRVilS6qDD189OoCaAdI7fCMdlUoI V3ghV+YfmvHDutNTKzIQvbXgTEwxQpDmylQfUPtH23MW6p+3+rS6iO87if1Z0nih+Qw2 tong3EAcKnrBLXoRVZhXoIfvOjYQzjh22Zv8oU0j/WJI03qfPhL3p9aozrwNwfNDfp3B 5FoBxRG6IdxGALNiI0X+bA01qOVyo+NpyKFR5Xd/xYdEhzJcU3sCS6cZdM4OXJFtlNqG yy/g== X-Gm-Message-State: ABy/qLbfPrb8bvEVNJESWHy3exv5skiZXRkLoeWrTtalnWtTsirYylhx cqF+duL1cU/e1UNiMipgmjPoSA== X-Google-Smtp-Source: APBJJlGlVAmws/zMk7QPQqjvFWIeZD/9Vb6AMtK23TVaTRNSUSWpkJJOJAyRpJOGtp+pssjCwgW/Pg== X-Received: by 2002:a2e:8951:0:b0:2b5:8b02:1000 with SMTP id b17-20020a2e8951000000b002b58b021000mr5575166ljk.8.1688483046494; Tue, 04 Jul 2023 08:04:06 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id j10-20020a2e850a000000b002b6ca539d92sm3337354lji.138.2023.07.04.08.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 08:04:06 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Konrad Dybcio Subject: [PATCH v2 14/14] drm/msm/dpu: drop dpu_core_perf_destroy() Date: Tue, 4 Jul 2023 18:03:54 +0300 Message-Id: <20230704150354.159882-15-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> References: <20230704150354.159882-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This function does nothing, just clears several data pointers. Drop it now. Acked-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 10 ---------- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 6 ------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 - 3 files changed, 17 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 608c915a2cab..4b8127932e13 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -408,16 +408,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) } #endif -void dpu_core_perf_destroy(struct dpu_core_perf *perf) -{ - if (!perf) { - DPU_ERROR("invalid parameters\n"); - return; - } - - perf->max_core_clk_rate = 0; -} - int dpu_core_perf_init(struct dpu_core_perf *perf, const struct dpu_perf_cfg *perf_cfg, unsigned long max_core_clk_rate) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index df1fcf28f2a9..a5a9c3389718 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -66,12 +66,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, */ void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc); -/** - * dpu_core_perf_destroy - destroy the given core performance context - * @perf: Pointer to core performance context - */ -void dpu_core_perf_destroy(struct dpu_core_perf *perf); - /** * dpu_core_perf_init - initialize the given core performance context * @perf: Pointer to core performance context diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index f01b2278c01a..44b0daf70c4e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1171,7 +1171,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) return 0; drm_obj_init_err: - dpu_core_perf_destroy(&dpu_kms->perf); hw_intr_init_err: perf_err: power_error: