From patchwork Wed Jul 31 21:30:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 11069597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6863F13A4 for ; Wed, 31 Jul 2019 21:30:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AA1C26E40 for ; Wed, 31 Jul 2019 21:30:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F09C26E51; Wed, 31 Jul 2019 21:30:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0401326E47 for ; Wed, 31 Jul 2019 21:30:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11D6F6E2FF; Wed, 31 Jul 2019 21:30:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F95F898A8; Wed, 31 Jul 2019 21:30:40 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id p13so71218888wru.10; Wed, 31 Jul 2019 14:30:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lIC8WXBn9gYMYudhBdaehgGJpFnqVd5arerypTueokk=; b=PwaIdNv3mUE4MT6CcNecIF7EXhswAHngGFJuWmo+V8sLb5OdmSlvTVfE8ox40+a0Ni nV3llfpmZAohHOrIYNSw53G6IiWQYzeiLP0OLKch9efyYbc3yw0m25/YdzHsnsnkybDp oW+CyXqSKRP9k7XhdQfX07Pi3zOio0GnYg1hZXwZ0UanH4zxqFL+rCMMh1Vfb7qci07Z Iq4mlUlbNMsAQk4GvjsL+XFKWtVKWO2IHXXD6VVuiP6clqZClOkm/S68fb/9ywaDglTu meJKHdxRfU6M0Pjnz/h0Q/7fG8P1vV2RmGDUlApe/4oWsvGjgRC0ZVrHZWFiAeiVpffT PG/A== X-Gm-Message-State: APjAAAWSLlEz+QgZnz//E8AokVkDGYH1a8Gah6AyeQ5IWJZG1vrNa5iK gxaHzT2+wgeABp5iVmYQV8l4Fvw8pDc= X-Google-Smtp-Source: APXvYqyveAa2FVb2m0XFaHYyXhL4lxOlO8wJvqrQ6ORbvGCY6+oT//MFWPVRerGiuJNbuKAm8+goxg== X-Received: by 2002:adf:80e1:: with SMTP id 88mr48928974wrl.127.1564608638369; Wed, 31 Jul 2019 14:30:38 -0700 (PDT) Received: from localhost.localdomain ([62.178.82.229]) by smtp.gmail.com with ESMTPSA id y16sm151126124wrg.85.2019.07.31.14.30.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 14:30:37 -0700 (PDT) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH] etnaviv: perfmon: fix total and idle HI cyleces readout Date: Wed, 31 Jul 2019 23:30:34 +0200 Message-Id: <20190731213034.3984-1-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lIC8WXBn9gYMYudhBdaehgGJpFnqVd5arerypTueokk=; b=J2DAMVUbvFRqroHoWt09aG25bjB7/2tMf7dsbCKZvatXolwXBIEEtPl1jD6dwaIF89 f58a7ddlnS2JWcSzPj6sWbB6PWio0T2OczcxuY5AD/S1cqyCqA5XH31aTNzSn7ogWKFb vHp/0ZJTqWyeWxGjGnpOGm+q7dQvVPIUfPkdl9ZpuKfZsf/qeb2YRbB+Y2Y1himuAwaK R/6yZRaY+Wp3OALnrPPy3Q20wPHYzL3qrs7q4L+DkjULMhLyM9h4w1AE7IO9NEhLWYXC JDBQHANGiE7SDTqINDWh+jOrfXkV0W9STzgy7Duv+UiMis/RHCl9mcV8sTh6DOIWwfcj cTAg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: etnaviv@lists.freedesktop.org, cphealy@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP As seen at CodeAurora's linux-imx git repo in imx_4.19.35_1.0.0 branch. Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 44 +++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index 06e6d3ee1c34..3c74b1273ea9 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -4,6 +4,7 @@ * Copyright (C) 2017 Zodiac Inflight Innovations */ +#include "common.xml.h" #include "etnaviv_gpu.h" #include "etnaviv_perfmon.h" #include "state_hi.xml.h" @@ -35,13 +36,6 @@ struct etnaviv_pm_domain_meta { u32 nr_domains; }; -static u32 simple_reg_read(struct etnaviv_gpu *gpu, - const struct etnaviv_pm_domain *domain, - const struct etnaviv_pm_signal *signal) -{ - return gpu_read(gpu, signal->data); -} - static u32 perf_reg_read(struct etnaviv_gpu *gpu, const struct etnaviv_pm_domain *domain, const struct etnaviv_pm_signal *signal) @@ -75,6 +69,34 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu, return value; } +static u32 hi_total_cycle_read(struct etnaviv_gpu *gpu, + const struct etnaviv_pm_domain *domain, + const struct etnaviv_pm_signal *signal) +{ + u32 reg = VIVS_HI_PROFILE_TOTAL_CYCLES; + + if (gpu->identity.model == chipModel_GC880 || + gpu->identity.model == chipModel_GC2000 || + gpu->identity.model == chipModel_GC2100) + reg = VIVS_MC_PROFILE_CYCLE_COUNTER; + + return gpu_read(gpu, reg); +} + +static u32 hi_total_idle_cycle_read(struct etnaviv_gpu *gpu, + const struct etnaviv_pm_domain *domain, + const struct etnaviv_pm_signal *signal) +{ + u32 reg = VIVS_HI_PROFILE_IDLE_CYCLES; + + if (gpu->identity.model == chipModel_GC880 || + gpu->identity.model == chipModel_GC2000 || + gpu->identity.model == chipModel_GC2100) + reg = VIVS_HI_PROFILE_TOTAL_CYCLES; + + return gpu_read(gpu, reg); +} + static const struct etnaviv_pm_domain doms_3d[] = { { .name = "HI", @@ -84,13 +106,13 @@ static const struct etnaviv_pm_domain doms_3d[] = { .signal = (const struct etnaviv_pm_signal[]) { { "TOTAL_CYCLES", - VIVS_HI_PROFILE_TOTAL_CYCLES, - &simple_reg_read + 0, + &hi_total_cycle_read }, { "IDLE_CYCLES", - VIVS_HI_PROFILE_IDLE_CYCLES, - &simple_reg_read + 0, + &hi_total_idle_cycle_read }, { "AXI_CYCLES_READ_REQUEST_STALLED",