From patchwork Wed Feb 22 21:47:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp829946wrd; Wed, 22 Feb 2023 13:50:23 -0800 (PST) X-Google-Smtp-Source: AK7set84GuIlffdFJCbAc39n1Pcqs9ccM5cinwzCdWobPJN/jr4hfx1KG3lDl+Q6b9nshZ8qLyyN X-Received: by 2002:a17:906:f212:b0:8a9:f870:d25b with SMTP id gt18-20020a170906f21200b008a9f870d25bmr17058423ejb.15.1677102623658; Wed, 22 Feb 2023 13:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677102623; cv=none; d=google.com; s=arc-20160816; b=dokJEUaznCJOROHRSEg261bw2kE4Z77NYnNWyzjgIMMHTaOsNT3wXUgl9HBBemX4bm ZpBWl99WNNMpCs5FJII+LhYCQhMt03XgSKfyj1gnN0TWYAoXCEaiMlMANBLut1pDiMcG vMU7djBj2VHNmX0XjaPT7CKL6ol74Zo7RO5mhDzBNQCQFvqd3Rd/SDtEOygV5maPbCeD trZVMwQW9RHSbvb0gVvCVZCWpLxLuSaWmn+qgNsOk0gy8v7AnVsQPIOxlzUSD2dj1OPR S1fBLz+kHDQzGCnoG93alfR2+KTo5R9sOPJh84BQZTPQU+6atQEFukucjazZD808ZgnE xvxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SBObAXrrIUPtcxXkSYb1/MPep4XlGTpRKBjzQvdnZZw=; b=stH610G0bVxDN8sNQPoR7HxK1gkjz2e/rpmBZdL1oUKHWvyV47dp5HGFmYxuopvJEy GwQMFIrn4eiO6LhcL+79hnq70VISJEhpUA4wf1+svKimMl20jbYiB1ieFtFutRT7xSZ9 MM19HuV1iOtGU4JHB6VImQmvgjmS155wtFZyQzX4zTtG0EFhpclHS+rpSKSoQKkgWSOy iYniEfaRNr7Np3TSHYJlA/ivuBGZjjjnZNv3ha0fv9vBcsYH4LKu233SMNQuBppwlhnk ELi/vX6o74UrY1rySERv40wgTFvL631bffBE/WJlRGKGrjOiB78E+Gy4ue/4bhOTbGKy draQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DYSfqZcq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a50ed87000000b004ac8e6409a1si13548458edr.91.2023.02.22.13.49.59; Wed, 22 Feb 2023 13:50:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DYSfqZcq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232896AbjBVVr2 (ORCPT + 99 others); Wed, 22 Feb 2023 16:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbjBVVrU (ORCPT ); Wed, 22 Feb 2023 16:47:20 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 432C646162 for ; Wed, 22 Feb 2023 13:47:19 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id f41so11853632lfv.13 for ; Wed, 22 Feb 2023 13:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SBObAXrrIUPtcxXkSYb1/MPep4XlGTpRKBjzQvdnZZw=; b=DYSfqZcq1BWpH+P2IBd79HjNKdKOG3b8AjS3DIzytdnEhbqpWN/TgFGuXhJ9HI12Q3 gSc2dvaycy+N3a8rxLUr/kQpz58VcT8cFeD/FRCfbo0gsX7gLrs/YBKoX8xQoP7Mlz4u 37JNW1PJvoQ3RHem/XqNNt/Aty2SzoY5HsD9GY3oIXWgGIiJd6n+dRV+AmxOVsCWe7OX pwJAmELMnjZLaSsdC4s8lT98kyXkPA5J8S0erUdGXVJXyLVO25+VIaCEOOqg8cD5XuV0 1In1RxBkjZi1Fx5cIh1DqgkQ4E0WF6yPIcFufuu3YgMeoAfB5j8nywnzViKwwkXISnlv BeoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SBObAXrrIUPtcxXkSYb1/MPep4XlGTpRKBjzQvdnZZw=; b=NC1kUy+liesrpCox/lsfOgycitt18RVRv7tbTZtkyVGRkyB/Zh60vi/6q4q+Qtlu5h Fl0GhO4BmKZ62etKKaa4dp/87fY+dm2iYWalSIKLB+53bB4WlDwd4wGx+CIrumajOHRQ LGYvamoPnNPzN3AaC/9vKnKyqd++XsCU1M9siMSLsfRowEQXOXxaFoPWrw8crBh6bP5c tt7AgwjkvAXfCzPSAgA67kRS5oIWasLwv3tGUArYF5kQ87Z3F6MiqXEiYp4iXFCLirZb x5VH3d7lxMMekE2FVwbaqlGnU2dZxN3XmPJ+3sYhlOsr8+M+PTs0PrDZEIfdZL6+KyAp IAXQ== X-Gm-Message-State: AO0yUKUA4haKFysu/rH4tYH7NNXnKGOys8AF+QJ5KXxTKHMCqRIaMYIr pAwP5Soss6gVo6x57o/1sTat6A== X-Received: by 2002:ac2:568d:0:b0:4db:1b30:e634 with SMTP id 13-20020ac2568d000000b004db1b30e634mr2851991lfr.65.1677102437491; Wed, 22 Feb 2023 13:47:17 -0800 (PST) Received: from [192.168.1.101] (abxi151.neoplus.adsl.tpnet.pl. [83.9.2.151]) by smtp.gmail.com with ESMTPSA id c23-20020ac244b7000000b004db5081e3f7sm505126lfm.46.2023.02.22.13.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 13:47:17 -0800 (PST) From: Konrad Dybcio Date: Wed, 22 Feb 2023 22:47:13 +0100 Subject: [PATCH 4/5] drm/msm/a4xx: Implement .gpu_busy MIME-Version: 1.0 Message-Id: <20230222-konrad-longbois-next-v1-4-01021425781b@linaro.org> References: <20230222-konrad-longbois-next-v1-0-01021425781b@linaro.org> In-Reply-To: <20230222-konrad-longbois-next-v1-0-01021425781b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1677102430; l=1318; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=MauCU/9YqXIm/dt7dtytFcQBPIj8IAOvGMxFT4S8Dyc=; b=QP/b0QG4Xziuy8NNeXVPRPJH7YGpUoSLjur6u0R/Y4RiCLZ1iUjbF/PJzlgL6+eqAwD9/vnnCxZG rE5QRKXECnql9QRhMyM73Qpy3yERT9D7erzVd9cu5uOP/HjMtgUw X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758569560312955308?= X-GMAIL-MSGID: =?utf-8?q?1758569560312955308?= Add support for gpu_busy on a4xx, which is required for devfreq support. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c index 3e09d3a7a0ac..715436cb3996 100644 --- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c @@ -611,6 +611,16 @@ static int a4xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) return 0; } +static u64 a4xx_gpu_busy(struct msm_gpu *gpu, unsigned long *out_sample_rate) +{ + u64 busy_cycles; + + busy_cycles = gpu_read64(gpu, REG_A4XX_RBBM_PERFCTR_RBBM_1_LO); + *out_sample_rate = clk_get_rate(gpu->core_clk); + + return busy_cycles; +} + static u32 a4xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring) { ring->memptrs->rptr = gpu_read(gpu, REG_A4XX_CP_RB_RPTR); @@ -632,6 +642,7 @@ static const struct adreno_gpu_funcs funcs = { #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP) .show = adreno_show, #endif + .gpu_busy = a4xx_gpu_busy, .gpu_state_get = a4xx_gpu_state_get, .gpu_state_put = adreno_gpu_state_put, .create_address_space = adreno_create_address_space,