From patchwork Thu Feb 23 01:47:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp57596wrd; Wed, 22 Feb 2023 17:52:40 -0800 (PST) X-Google-Smtp-Source: AK7set+s+Mf1b0nzFHNNm6TdVozcPfDCxQ+uu/wzh2LJD+FdE6Ed4sEf1/NygqQtVghbLm1AJbcd X-Received: by 2002:a05:6402:783:b0:4ab:1625:908d with SMTP id d3-20020a056402078300b004ab1625908dmr10343299edy.16.1677117160760; Wed, 22 Feb 2023 17:52:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677117160; cv=none; d=google.com; s=arc-20160816; b=F0VjGB3mL8S0AJRijDxpps2OCXaL2ZELw0FsVIrBIGM44Q9YK6qRItVd9f/mRtHF7O N3uSEbyL9e31hG+xt4rUJ1HNU0+pf06MvBtVkg4CUHYVQxxF0BlAGPwJmkaIUE9s5aQt Tnwp2W/PtOPea+ClBoLfQn2JQtmuAXibHz4d3aXgK+xQGakIn8t7o0sV8PRbqunqAMZf nPMLZKKicol0frvwShuJPs1Z73iH69l15EIz9P/1CNWxfXjZ7vxWjUhBez9+4gxTM6ON FRvo6YJzDPbtUwP2s+9eHd4DecjvuNpbRC0HDfYuF/Ytiq03AiRDGJeW+fm/q8h7cBeo ggKQ== 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=EdVj0NmcMUbp27TFh76rJWfj30WoxdkWSOBuxpu+ahSCqolX6PLq61cxBTe+6haGaj 0O/qUr54eOTZfBwxwyMQZD6Ik49aFakOicqfn4P3vVYAPtE4RzWVIAJWOoVzv1QtwX6q eY2ubcgGrA/WWjWSKkip8+w1azBMK4dsE60Le5qBc9SPivuHKOHrc8prXlrCmSxS8vn2 naShMFRURtdoTnBlsK5ZzPybnvgCyB32YmQHlnPlE2DuwWR/y9/3OxlZHTI2+OZE0ASE 0Goy52gWmNedftfTuz06v9XHH7GTOGm96oHoXJnYNS3kRsIO6f0iOcmpynlMob8iF+k+ Nqig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=esohPNul; 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 e16-20020a056402149000b004af6a174397si1568407edv.231.2023.02.22.17.52.18; Wed, 22 Feb 2023 17:52:40 -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=esohPNul; 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 S233057AbjBWBr5 (ORCPT + 99 others); Wed, 22 Feb 2023 20:47:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232981AbjBWBrs (ORCPT ); Wed, 22 Feb 2023 20:47:48 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31FEB43446 for ; Wed, 22 Feb 2023 17:47:46 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id bp25so12613661lfb.0 for ; Wed, 22 Feb 2023 17:47:46 -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=esohPNulw2M7Ju+p/HyTXssOZPF43TTgdrx9PSZfSpeex+8N4B7DBUkRzpDp48A09v DaOM/jOmfgSoxNXBbdwRIwrxK1fhe7sI1RtggfazHsUl/aTcPiOIcRn+4LB+HLLalwhJ +TnDmrtffCDZ/mpmathGjIFtgVSyJNkAtPnaiaQWRbQT6sj7UUdmPaBFD0M6XbR8I97l UQzEmubUTAq+cm1eN7YokQ8N29SudFC9aZvbaHcvB/aZBOu9KnN07fBLC5M2LLvkr3mT fDiC2g9CsNgFyndqQSsUr0JV4BZDOLKKHPxTMeswaq6N2Euw4K8xfPBNdYgc3LhKbE9S Faig== 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=GB7qV4DoJprJDpdU3JO5k1iOgAX0Sj35QMA4vYjOg9eouf37IhcED2tfCOfCJ508Vn RxDM36WDyr/b+dOSBo2ir1gZrckIFIwxjeHtp9sSEjI6tH1tOwjVmVyHh8Il9iBEfEIh UfoKV2hTbWIlLx7lqiS0iPOH73E74J/XTAiFKaPCU3PXDjqq6IDgg4Gpo5MSGMBJjj4w I35u9SwUU5dW+/gKGLb+MYYUbPxlaANE7CJuq6X1+I7c4eMXQmeq93QcaEflCEXWjM80 ZDAkbolSzzp/So2B7Lo13j8eBqgXC1MSMAQUrRZF6Yfp9IxqwamHSdTe/ElF/x9TMLyt FgNA== X-Gm-Message-State: AO0yUKXi6GsNdP6UcEzR+epyyRm3cmOdb8pGCmZeznbrOCmiG/h5+TcF s0Suat7ka8ID3HZkcuurfkKcjw== X-Received: by 2002:a19:f005:0:b0:4a4:68b9:19f6 with SMTP id p5-20020a19f005000000b004a468b919f6mr3708824lfc.30.1677116864589; Wed, 22 Feb 2023 17:47:44 -0800 (PST) Received: from [192.168.1.101] (abxi151.neoplus.adsl.tpnet.pl. [83.9.2.151]) by smtp.gmail.com with ESMTPSA id 12-20020ac2482c000000b004dc807b904bsm427376lft.120.2023.02.22.17.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 17:47:44 -0800 (PST) From: Konrad Dybcio Date: Thu, 23 Feb 2023 02:47:40 +0100 Subject: [PATCH v2 4/6] drm/msm/a3xx: Implement .gpu_busy MIME-Version: 1.0 Message-Id: <20230223-topic-opp-v2-4-24ed24cd7358@linaro.org> References: <20230223-topic-opp-v2-0-24ed24cd7358@linaro.org> In-Reply-To: <20230223-topic-opp-v2-0-24ed24cd7358@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=1677116858; l=1452; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=sAA92dCqoQlGesDQKUB68UAlcg2YIqQbh8UmjiEN524=; b=GVnaZnlQ6N+BD1eAG7ueoV0GF0HZZ3QeXEdiAAHLSxSj/otEEt/esgibqfS+fVabGvCIunPtJz75 w8iUO2JPBBZO7i/A1THaoFJbtoSTtLJ5z0wq/ODIxwXqLY6lcU75 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?1758584803915638362?= X-GMAIL-MSGID: =?utf-8?q?1758584803915638362?= 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,