Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp219228pxa; Fri, 14 Aug 2020 02:08:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHf/LoUY4HF0R3fK1crxVh+1r9N/cXjOBCOhOjxlA8P04cl+tcUswy5isJJEHJt25qSs7I X-Received: by 2002:a17:906:ecf9:: with SMTP id qt25mr1512203ejb.478.1597396088582; Fri, 14 Aug 2020 02:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597396088; cv=none; d=google.com; s=arc-20160816; b=q9Lv3JIT8BjvOsobeiQgKmHWkw6Dx9ehY7nAeWjF3qHxhINbPjUawMgGfU2vLAvara 4pTYVZ4vSa5cGtj3Ydhl6mfFSEn7uSHg8T19eQPCHLUnX+1usLFp0E3pBXugG5pDh3mi ZB+cArJPow2nyM9WoMkN94utK40GYSkbWlrScvlZtzPcNOiWM6LeB6c/Dp44W42yzua6 qWWE/1upR90OQw4Mm84+rFnZJ5ASYqUNjGF61vPNtSay02LfFFwpls7DekrANku+n1kE J7ZKhNoGUXnRigNnXhYO2hW4oJcNQAA0xQK0884lxfA0SqD2XbBOBNkkiUwYODXA5juK 3uOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dRT5IxQW31/cWLOlxefHWhvflnlqyP6TcqmdhPBQu3E=; b=FtX0/ctS/6DyG6k4K2A/anRkPAsgvu6OMp1qXSm49GJYku8ypgUp3fizG2mgDMAWxf dCXopQsaFuqPB5BuWHMnzBStBPtW+pilB7fAwEQHM9+ztwnZtVwt9EWoOHixk6Hu8ulB rPNOE4fXwNZpRFBcSsZ3SrhUa+NXYGkp9ZzK2OG+y+r5vbmO5knBS+jTjqUxFFiduwMP +GLKWt+nkmIelhoKnEV3o0yVYPZ5JFc+bYkewstdIhHKmw93nHrXLVuNmX0NKrMEX1lH TijPFpSkYu50L19gqdcyyxAyxotMAKflBm9v8VTkU5U6R4oj4hFYz0R9RrXc1l6QZfSX WA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gpvcCjXt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si5310746ejg.69.2020.08.14.02.07.45; Fri, 14 Aug 2020 02:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gpvcCjXt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbgHNJFi (ORCPT + 99 others); Fri, 14 Aug 2020 05:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbgHNJFf (ORCPT ); Fri, 14 Aug 2020 05:05:35 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C4FC061383 for ; Fri, 14 Aug 2020 02:05:35 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id 9so6863310wmj.5 for ; Fri, 14 Aug 2020 02:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dRT5IxQW31/cWLOlxefHWhvflnlqyP6TcqmdhPBQu3E=; b=gpvcCjXtfa5TJBoLojYNhodiFxl3dssIiiPpW649i3FkUCzofAQNFBgI2yb253DFIC lBiYPbCeC8SxI6QDBwFngeQb2jQjKlPzBkCouDkvqswPWCnJrwQA7gX5a1I15kJLOqfG F9I7Ysi0hU6EnabUyIBQv44uT/aWJP/pWQOoMdzsDK1qz7I+uo8c8YOkspG3natl9Ead KDYP5Rr2ZcGnl+L+xFTFbf3IOb3vLs38Zh+Sm+RR1u65PV6jaJZF/MH2DvtgSKCU8NPT UgkQdQthlDrYbN8RZglMawQqC0ZePiKF2SQr7eWH4+kyt5z11uirIIWYkCijVD+H1B3c EGxA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=dRT5IxQW31/cWLOlxefHWhvflnlqyP6TcqmdhPBQu3E=; b=SajfeMY1O/UXy9sqE99VD2qUGBrWfvG4v1ovbe9QOcS69t4F5yJbwZlX5/vDC6TAw5 WJ4iebTB74/99l5S3jEn+pl82myH6gTbqBYhx12IzVRXNGeaAVoE9D0ZavLpw0mohU9i MqvFwLDW4RemcTKg3UUVUZhDSdI8m63dZlEImff6sPcQo6N3jGBqgQpAuyUTv58lCAZf 2cs44E8Zry+1yyDRh+/OG+Ka+d0P1wIWGwjfQiGpoJyQxqUAsIwMCqtu5L/kxCzrKzSM YXblhnk5CX2N74LACSesElpoiOv4LhSJ9Su4AS5I/bYc3KD7gZ8Rwu7qn5bM7B8fuKKH 0b5g== X-Gm-Message-State: AOAM532Kzrf/pt1XtW84ABA3cBshX77LdbunK5TvFwDt1zcSrZJVSU1O eOYIBFCSEGhuS3YTj5qOsPSMhw/aZsV36w== X-Received: by 2002:a1c:38b:: with SMTP id 133mr1580959wmd.153.1597395933750; Fri, 14 Aug 2020 02:05:33 -0700 (PDT) Received: from localhost.localdomain (62-178-82-229.cable.dynamic.surfer.at. [62.178.82.229]) by smtp.gmail.com with ESMTPSA id m14sm14046745wrx.76.2020.08.14.02.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 02:05:33 -0700 (PDT) From: Christian Gmeiner To: linux-kernel@vger.kernel.org Cc: cphealy@gmail.com, Christian Gmeiner , Lucas Stach , Russell King , David Airlie , Daniel Vetter , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 3/4] drm/etnaviv: add total hi bandwidth perfcounter Date: Fri, 14 Aug 2020 11:05:03 +0200 Message-Id: <20200814090512.151416-4-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200814090512.151416-1-christian.gmeiner@gmail.com> References: <20200814090512.151416-1-christian.gmeiner@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These two perf counters represent the total read and write GPU bandwidth in terms of 64bits. The used sequence was taken from Vivante kernel driver. Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 35 ++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index 782732e6ce72..b37459f022d7 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -69,6 +69,29 @@ static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, return value; } +static u32 pipe_reg_read(struct etnaviv_gpu *gpu, + const struct etnaviv_pm_domain *domain, + const struct etnaviv_pm_signal *signal) +{ + u32 clock = gpu_read(gpu, VIVS_HI_CLOCK_CONTROL); + u32 value = 0; + unsigned i; + + for (i = 0; i < gpu->identity.pixel_pipes; i++) { + clock &= ~(VIVS_HI_CLOCK_CONTROL_DEBUG_PIXEL_PIPE__MASK); + clock |= VIVS_HI_CLOCK_CONTROL_DEBUG_PIXEL_PIPE(i); + gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, clock); + value += gpu_read(gpu, signal->data); + } + + /* switch back to pixel pipe 0 to prevent GPU hang */ + clock &= ~(VIVS_HI_CLOCK_CONTROL_DEBUG_PIXEL_PIPE__MASK); + clock |= VIVS_HI_CLOCK_CONTROL_DEBUG_PIXEL_PIPE(0); + gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, clock); + + return value; +} + static u32 hi_total_cycle_read(struct etnaviv_gpu *gpu, const struct etnaviv_pm_domain *domain, const struct etnaviv_pm_signal *signal) @@ -102,8 +125,18 @@ static const struct etnaviv_pm_domain doms_3d[] = { .name = "HI", .profile_read = VIVS_MC_PROFILE_HI_READ, .profile_config = VIVS_MC_PROFILE_CONFIG2, - .nr_signals = 5, + .nr_signals = 7, .signal = (const struct etnaviv_pm_signal[]) { + { + "TOTAL_READ_BYTES8", + VIVS_HI_PROFILE_READ_BYTES8, + &pipe_reg_read, + }, + { + "TOTAL_WRITE_BYTES8", + VIVS_HI_PROFILE_WRITE_BYTES8, + &pipe_reg_read, + }, { "TOTAL_CYCLES", 0, -- 2.26.2