From patchwork Thu Feb 23 10:52:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp247434wrd; Thu, 23 Feb 2023 02:57:05 -0800 (PST) X-Google-Smtp-Source: AK7set/8nse3eLOn8279w+JukhrRP2RYxpWAlLkWRx1TkT++X8pMsTMvqLedxM2/t5dguv4ZMCul X-Received: by 2002:a17:906:10da:b0:8b1:94cc:10b1 with SMTP id v26-20020a17090610da00b008b194cc10b1mr18822135ejv.7.1677149825490; Thu, 23 Feb 2023 02:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677149825; cv=none; d=google.com; s=arc-20160816; b=rZffxjuHITzQZ6mN/qsc1x+OWF1n6lrrGMY5ygcX0gtTycIbQj2rOF2f2xFZzc31+N ZGlHr+PxAcGGjCN5z+3nn2O5jkqrr65/gmUaITyHFyOu0wIieDzIczBqR3Miy55QhtT3 I+HzGN/cISDtKBxN0QS7P4gSoLSI0YkZDtIVAIewKDey79B65Mwdt1MhM6eliRR8eS6S dviwYctLL1w21TBv4qTO9vn/I+ICmYNYlPunuuz3oc8TmkQk9iITCEw/AW3D/JpBmyzh WkEbZxIxb+sEBNzcReGyNWBggzEzSZzdRCTEVq81oiE86PSmPhzaaUR975IxhT6WHrdf YHeg== 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=4RozdFg8UcjNGaMEUfY94uV2Q1ptXwQxOYUwNdKHWzQ=; b=a3EpRR/fbQCVAGZDxjJvPnDSXtRhUpQh52pqNz6Tfh8MKzyTnNMI45kEL5YAxH0c1Z FUwBTb4H7W6uCzIp4tlAymdgBpbGBj5dH+iErEPtrU0BWogebQcMXPHjDQqKykIg4x6M e5Yu41xxweEBDHIOaCPRbzuLirKmo0MRYSinzGKPXKHW0jis5+un3vNphw0BJ84SecQc 87sLfkotHqzYzQkBOCWYn8GksRnfi6F2NJuRXACPG0E/WTpo8tuWrX1mSKdpNppcoBjf QXh4LXW3IiU0odf2SkiP4yKU+ewI3/mvgrt6bT14lZ+zEtGkgG3JZ6xTa55yEvH7mDWG hM3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGxvm6bl; 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 l10-20020aa7d94a000000b004ace74aa18esi5055734eds.402.2023.02.23.02.56.42; Thu, 23 Feb 2023 02:57:05 -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=GGxvm6bl; 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 S233945AbjBWKwY (ORCPT + 99 others); Thu, 23 Feb 2023 05:52:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233860AbjBWKwM (ORCPT ); Thu, 23 Feb 2023 05:52:12 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D745D5A3BB for ; Thu, 23 Feb 2023 02:52:10 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id i9so13106358lfc.6 for ; Thu, 23 Feb 2023 02:52:10 -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=4RozdFg8UcjNGaMEUfY94uV2Q1ptXwQxOYUwNdKHWzQ=; b=GGxvm6blqyc89yQk58xauwymRokHUWjtnfkAy0M5C/kAVwDVTzl5V5K3cPOqw/6Wz2 I+SFohN/OEwGh2D1YA9QotnOOOtXEozSgwQ5LYVWUzsf1+Ad3VGPeDwANoTmFyPhHz+L h1EFNvVz2N4El2qWdqCvQZ4Nx1n+SU+VA5embliA1uijST9wNBP992di58UohE6MNHH2 hUPJKKiB+MaldLPl1+y9bvMNtzP0SfmJIyrULtEccFk0uapq+TSBo9VtVbCE0hsLro9Z 6TJ2P83GdNGwPWEEBFqffGr2lN1qOMiyW8o46ZsEr+MdVSbwgIWoMW+sQ4exqOCKF9k0 WmQw== 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=4RozdFg8UcjNGaMEUfY94uV2Q1ptXwQxOYUwNdKHWzQ=; b=p8cMOe0JZmpPg+/WrfjIDyTQ9C+ys+xg1PYUoTdfLHJLp6nyJlG8aIKZdWmzbH2y1p LeK5ufPrKWz9+5EXtT9GVuHodY0IEkCD+6Sdm5aZQ/NKNYnvHsIH0oNS85BRxsHAFQNG 7IpqqXZsYdcdnGlOTkWtlkVj3Ya44vneIqCAwJACyKOxRAvh+OJgb/p1YjIB0ESfwS94 AL75u+FiI1BR+f+rdq63UMGz5sgWYZZX2v2Z2qO9pKKjdagunZj0Gm9UvRGQX5XdBLKT anRMpT+FFEpv0gPnX3lLbRXZL8S/+GTyidzB12wttYp31marguL9m18V7/E8J0G03iOf 9Btg== X-Gm-Message-State: AO0yUKX02RSQJ5TCRdPWHFsF5fGbP60v6g4dQPcw+0xZeWGz0ZC8ucq8 4+zFY7deslWZyidfRtngiLwumg== X-Received: by 2002:a05:6512:7b:b0:4dd:a053:3c0b with SMTP id i27-20020a056512007b00b004dda0533c0bmr992258lfo.42.1677149530231; Thu, 23 Feb 2023 02:52:10 -0800 (PST) Received: from [192.168.1.101] (abxi151.neoplus.adsl.tpnet.pl. [83.9.2.151]) by smtp.gmail.com with ESMTPSA id m25-20020ac24ad9000000b004cf07a0051csm262304lfp.228.2023.02.23.02.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 02:52:09 -0800 (PST) From: Konrad Dybcio Date: Thu, 23 Feb 2023 11:52:01 +0100 Subject: [PATCH v3 5/7] drm/msm/a3xx: Implement .gpu_busy MIME-Version: 1.0 Message-Id: <20230223-topic-opp-v3-5-5f22163cd1df@linaro.org> References: <20230223-topic-opp-v3-0-5f22163cd1df@linaro.org> In-Reply-To: <20230223-topic-opp-v3-0-5f22163cd1df@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=1677149522; l=1452; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=sAA92dCqoQlGesDQKUB68UAlcg2YIqQbh8UmjiEN524=; b=2jM+T/p9ilIYyJLFdFVnqDFZlEMAxUjw5IY/bXTDdO3ddLKvpMDcoDN5is+J8/ZT0+M8fbi/up0Z PVqxIs+gC4KVk5kRrpXOogK84F17HfLU9lulIvcI7CWczCEmjCw6 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=ham 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?1758619055029110865?= X-GMAIL-MSGID: =?utf-8?q?1758619055029110865?= Add support for gpu_busy on a3xx, which is required for devfreq support. Tested-by: Dmitry Baryshkov #ifc6410 Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- 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,