From patchwork Wed Feb 22 21:47:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp829941wrd; Wed, 22 Feb 2023 13:50:23 -0800 (PST) X-Google-Smtp-Source: AK7set9bd7mmFmkLO/zEliMziC0RcNrb1qT1rDv2vst8xM8kMPKFQq0IWw6B/nGy/VMrbSy9Jvom X-Received: by 2002:aa7:c70b:0:b0:4af:6a7e:9218 with SMTP id i11-20020aa7c70b000000b004af6a7e9218mr920660edq.42.1677102623173; 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=K2hUdOGdjadtJAK+wos8GENhY4JQQVksn8SNsjqvgaeNIW+G+PtQkXOzaQjgr6xrlT cZ8G+8fPcvBhTyo8/lJj81V7hwvayhj1kX+zpHJhgKpXMcwXJA3A+q6hQSrOomZAQdyi 6rZToxwofdVu1DSI9f2dHJ1l9H8TQtU8baQMhAUZH0F9wfRsmQhiMC5eY11SZM9oUm/3 1TslsaEC5Htm2TIaH7ww5bBQs7TjKfGH+b8hK12Zj6dUHc53jFVuaE79hGnlMbK4a/yx wsyFEzi5A4gvCUzI43yA0niMvmIypIXbGYA3Mx2J5XDdeB51ClXdu0JCEAMvl9YKDsHX If2w== 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=h4TOwLOMt599To1JExzRPWtUssAyU9NR4zE3oZiUZ+A=; b=F4I1ofrtL9iDlqpx+dIjcUQT7BrDC6rR46RRVaAaxbbOuYq9dm1z6kt4lVQVks/Hrd SbrEgDeVVJJdTWxwpPRgewZc7hcYY/2D6ukAC9dFQsfXgkPq8MpJFYBDK5De36TrEL0V VZuFXIOtvQXCI/LkiZzev0Y7zH5MOSMAEUse7u/srrmUTShrV3dqVf9e0wLAnxbPqQd5 eS79M3hnusD0TX9JsoH21V+CLyErWu+8bt70Rs2+2a1mzLg0Nsi+fQkXYkEGGeQF56Qm tSqYqCl58yXj96peIDlc2/cdt+X9PF3tKLeoxWELKXoxczpCXoeXxMJNVin/GjOKYcxQ BFYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vIL6E4WB; 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-20020a50ed87000000b004accbc4a5absi10309977edr.110.2023.02.22.13.49.58; 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=vIL6E4WB; 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 S230434AbjBVVrY (ORCPT + 99 others); Wed, 22 Feb 2023 16:47:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbjBVVrT (ORCPT ); Wed, 22 Feb 2023 16:47:19 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0AF439CEE for ; Wed, 22 Feb 2023 13:47:17 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id n2so8608173lfb.12 for ; Wed, 22 Feb 2023 13:47:17 -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=h4TOwLOMt599To1JExzRPWtUssAyU9NR4zE3oZiUZ+A=; b=vIL6E4WB430uGyuj0lUufFhuF3CQGdR7a0e2PL3GMslNGEyrtQDEjXZMeY3345jFvp HWO1elZEKOm+pdo7JkxplbSgn5GGT34/qsUrVg5t3ihU77eXSDx2zTE4mgNMLojm4Vhx MdFudMtuetf1KVuDIDp2jxF4OkeULi7JyBNPMTzKYXq5LG/SSSgT5fbUvFF05j26AqtB vyJ5II7jzDWQna98MFh0FBBYs5NK6pS0E66bRO+Rwax/We5NU19WGLzypCiJm5ckFhWj h5nAwqCUTPyF4bDoylbIKOJYICX2AvqMnOwvsjcFpGkZjXqjxcyQL1aUDCPiMnXWzTX7 vQTQ== 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=h4TOwLOMt599To1JExzRPWtUssAyU9NR4zE3oZiUZ+A=; b=iEkDF9y68iZp2uCjAVM/mO6Q9r6zjsNumkNAoOHaAKj9Hf/D6sd9ULOGEqHk5epm3O SYf0OAX7g3jomxfLB2hGYbzr/XkCluO42/bcZ8HwRK5M14PKjXiIEo1k8xl8N9vuoRIA 794xZwUCRjrM9dB0SupwxnwCeyOQ3fDmj3XneVm5rHALeZroD4fmuWFGn5TquK0z2wVZ XPtyFeeAF+7VhnA554xBtf59TeOZYDBiBYTTaTk/RsDKA2VL1C36/HmJe/pRRfJRDhef SPCSZJ+vphL23fEJUPF8UbiCqKBzm7C97WEYkk6ibZvCR03LIaKUQ2PZW0WSIzd/EMvH Lp+Q== X-Gm-Message-State: AO0yUKXjIbw1l8/JcVnzoS7jDbZ+EViw/R+9aUt7Vn/n4nnQBCwGYR2L i9JfJ/XsNXMjuRl5YeUfkLjZ4Q== X-Received: by 2002:ac2:521b:0:b0:4da:8838:31d9 with SMTP id a27-20020ac2521b000000b004da883831d9mr2808196lfl.8.1677102436200; Wed, 22 Feb 2023 13:47:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 13:47:15 -0800 (PST) From: Konrad Dybcio Date: Wed, 22 Feb 2023 22:47:12 +0100 Subject: [PATCH 3/5] drm/msm/a3xx: Implement .gpu_busy MIME-Version: 1.0 Message-Id: <20230222-konrad-longbois-next-v1-3-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=1323; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=i47Ky4BsxixFNiVTtrlkGNfUWp9lquZtebebI9yr3wY=; b=v8h6Dm7DVQ7sOt5Zbr5iRrvE0ULoDp8T5pjmqb2KYeBnxk5vKNo9UlQ2/Sso9Qhla9hLMw4Up0kT 4+nWOquwCwmoF65CjP0+7f/xpuDb4iBQzCNUnkIRlGCnRE4TyxfE 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?1758569560252586201?= X-GMAIL-MSGID: =?utf-8?q?1758569560252586201?= Add support for gpu_busy on a3xx, which is required for devfreq support. Signed-off-by: Konrad Dybcio Tested-by: Dmitry Baryshkov #ifc6410 Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c index 948785ed07bb..c86b377f6f0d 100644 --- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c @@ -477,6 +477,16 @@ static struct msm_gpu_state *a3xx_gpu_state_get(struct msm_gpu *gpu) return state; } +static u64 a3xx_gpu_busy(struct msm_gpu *gpu, unsigned long *out_sample_rate) +{ + u64 busy_cycles; + + busy_cycles = gpu_read64(gpu, REG_A3XX_RBBM_PERFCTR_RBBM_1_LO); + *out_sample_rate = clk_get_rate(gpu->core_clk); + + return busy_cycles; +} + static u32 a3xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring) { ring->memptrs->rptr = gpu_read(gpu, REG_AXXX_CP_RB_RPTR); @@ -498,6 +508,7 @@ static const struct adreno_gpu_funcs funcs = { #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP) .show = adreno_show, #endif + .gpu_busy = a3xx_gpu_busy, .gpu_state_get = a3xx_gpu_state_get, .gpu_state_put = adreno_gpu_state_put, .create_address_space = adreno_create_address_space,