From patchwork Fri Aug 14 09:05:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 11713869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A425613B1 for ; Fri, 14 Aug 2020 09:05:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 820E4207DA for ; Fri, 14 Aug 2020 09:05:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CKD0gHxk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 820E4207DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 039516E3B0; Fri, 14 Aug 2020 09:05:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE95D6E2E4; Fri, 14 Aug 2020 09:05:27 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id g8so6872049wmk.3; Fri, 14 Aug 2020 02:05:27 -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=VWo7qfLl0wE2i8zg/BhTlkJQXxIbQK+FJtPUS8AfL7g=; b=CKD0gHxkwv1aBbvAQxLbB0lfmGaTIXlyHM3IqNHHj4IZZ0xUW1gTSf/qil/iLu4/Y2 fnToPx6+QVVz0M7gnOS8X9qGFkd4xjV2/T1w0JFywwO3CmgFLWMKtKPOzK8oZF55+/ZP cc0xM5H5yppRMbmyfOXY+D0d020uRVnMpV2j/zHRwWGSkxDlCvnUxSRFTC0jt6EeQQmj 26TVykKdPLJoPSKzutdZqNASsJpsOx6/UtQ86UjMr1TsbTLok+nJGvOjSMv4o/ld56Dq sd4vCcAKuWfGPE2AtY+T6BnOjUN+K0eoNYLIW4PSYFEo5q6tzCvD8FNFaievhUStX/Gd 0lDQ== 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=VWo7qfLl0wE2i8zg/BhTlkJQXxIbQK+FJtPUS8AfL7g=; b=B2W3QrTYpBp00LUqIrvemmoFYmKNPqaUIbJECIGf6N4oj6yfBrulQcZuwUgE7rVD3r qzCDqJqsmhcrtIlNopCcpdqwGwlp3ZwRvn7Dp5dkRpQuuhkWe6h5YigbT5dKqeR+cHxe NfGpwFxN246rIylT7iX7u1yyyLxaSG3+YTY3CekhMKqqWc1ALrxmGR7CVsW8nUE+V1pl YN6sZCYoSI83tYyW8up8haFi8mfnhZw+3sXGBz/dhv9Kmrg9nDIrm0AXbhI+evK7UrD8 uN92AOKyASfkPIXkv2zma3RYtHBZQ/El0LjE1Avquam8uOZPGYOOEtvWcqHKhIHaMuZm GGiA== X-Gm-Message-State: AOAM533TW020RRHJdN+GfT3jzS+XQfE9TbqQtsRLa4TgoyMd2o97tRTl ao/urMf+ToDDhMOo5R2UPB4= X-Google-Smtp-Source: ABdhPJw2g4VEAD+4yHIaD8SWwebBs3rsYJIxKje6Ym86s4qaoAkLOx0vC+saak3csaS+5g51xCGDwA== X-Received: by 2002:a1c:2854:: with SMTP id o81mr1572302wmo.61.1597395926454; Fri, 14 Aug 2020 02:05:26 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 02:05:24 -0700 (PDT) From: Christian Gmeiner To: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] drm/etnaviv: rename pipe_reg_read(..) Date: Fri, 14 Aug 2020 11:05:01 +0200 Message-Id: <20200814090512.151416-2-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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Russell King , cphealy@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" pipe_reg_read(..) iterates over all pixel pipes, selects a perf counter register and sums the actual perf counter value. Rename the function to reflect more what it is actual doing. Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index 75f9db8f7bec..1f0402f7a7de 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -46,7 +46,7 @@ static u32 perf_reg_read(struct etnaviv_gpu *gpu, return gpu_read(gpu, domain->profile_read); } -static u32 pipe_reg_read(struct etnaviv_gpu *gpu, +static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, const struct etnaviv_pm_domain *domain, const struct etnaviv_pm_signal *signal) { @@ -141,22 +141,22 @@ static const struct etnaviv_pm_domain doms_3d[] = { { "PIXEL_COUNT_KILLED_BY_COLOR_PIPE", VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_KILLED_BY_COLOR_PIPE, - &pipe_reg_read + &pipe_perf_reg_read }, { "PIXEL_COUNT_KILLED_BY_DEPTH_PIPE", VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_KILLED_BY_DEPTH_PIPE, - &pipe_reg_read + &pipe_perf_reg_read }, { "PIXEL_COUNT_DRAWN_BY_COLOR_PIPE", VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_DRAWN_BY_COLOR_PIPE, - &pipe_reg_read + &pipe_perf_reg_read }, { "PIXEL_COUNT_DRAWN_BY_DEPTH_PIPE", VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_DRAWN_BY_DEPTH_PIPE, - &pipe_reg_read + &pipe_perf_reg_read } } }, @@ -184,32 +184,32 @@ static const struct etnaviv_pm_domain doms_3d[] = { { "VS_INST_COUNTER", VIVS_MC_PROFILE_CONFIG0_SH_VS_INST_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "RENDERED_VERTICE_COUNTER", VIVS_MC_PROFILE_CONFIG0_SH_RENDERED_VERTICE_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "VTX_BRANCH_INST_COUNTER", VIVS_MC_PROFILE_CONFIG0_SH_VTX_BRANCH_INST_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "VTX_TEXLD_INST_COUNTER", VIVS_MC_PROFILE_CONFIG0_SH_VTX_TEXLD_INST_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "PXL_BRANCH_INST_COUNTER", VIVS_MC_PROFILE_CONFIG0_SH_PXL_BRANCH_INST_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "PXL_TEXLD_INST_COUNTER", VIVS_MC_PROFILE_CONFIG0_SH_PXL_TEXLD_INST_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read } } }, @@ -237,17 +237,17 @@ static const struct etnaviv_pm_domain doms_3d[] = { { "DEPTH_CLIPPED_COUNTER", VIVS_MC_PROFILE_CONFIG1_PA_DEPTH_CLIPPED_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "TRIVIAL_REJECTED_COUNTER", VIVS_MC_PROFILE_CONFIG1_PA_TRIVIAL_REJECTED_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read }, { "CULLED_COUNTER", VIVS_MC_PROFILE_CONFIG1_PA_CULLED_COUNTER, - &pipe_reg_read + &pipe_perf_reg_read } } }, @@ -400,7 +400,7 @@ static const struct etnaviv_pm_domain doms_2d[] = { { "PIXELS_RENDERED_2D", VIVS_MC_PROFILE_CONFIG0_PE_PIXELS_RENDERED_2D, - &pipe_reg_read + &pipe_perf_reg_read } } } From patchwork Fri Aug 14 09:05:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 11713871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 014871392 for ; Fri, 14 Aug 2020 09:05:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3399207DA for ; Fri, 14 Aug 2020 09:05:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IaeMj5Yr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3399207DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9104A6E3CB; Fri, 14 Aug 2020 09:05:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F2C56E3B5; Fri, 14 Aug 2020 09:05:31 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id g75so7301318wme.4; Fri, 14 Aug 2020 02:05:31 -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=FRiW1Elr/x8IcnH5oDivRHtQDqhp3psZM/q1XqqJd+8=; b=IaeMj5YrQjmeSYlQymZF5ltHBecSzZN1LBxijJpTup6E+ri1rV9KZciVcKE9+xX9Zr zqqex1do9T8NRAOAnsvEe9SCUVdbZ5vgkeWNFiAiG5oOe7yf1WJSWeE/+TTjig4g0CGO C8iby88ZvVnUaBImRH7Eh7NIiWZJMua5dZnMS9NazDHKFwWL86qsQKyazcNcWOy/4Qte /Il56dDTM3YH21sIZOKzgi73ULtlzvxHnV0XL0oaFdfgxA8uY33eT/OkMXFaWg1NaKvE NSZx1QF5gZhixel8bKXip8GrL6yzBW82e7yt+3uRV4UR8YcS2SrRRYfiemMrm7SnUYS+ CywA== 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=FRiW1Elr/x8IcnH5oDivRHtQDqhp3psZM/q1XqqJd+8=; b=my4gi1ldzastk25H9gdy74j/JxLzW+t9xB6FO/NOKfF7ARhoqYbO6xvx4U36mTbrkU C5WYxLPS8w7+DdmC7cItmXLCZmLfvCMUM+iPRwHLBgiOFWm3iWjoHnzPjlnd1SWpz8pk ceay/hVbpd5CaSbXeT1IE5lpdZeyLz96OBwkzo6UAgv5XVUKfq0Croaj/4WSGeUfC2Zz 9Y328DDEX+bVQiUBfP3x78E5isnn3doCu9Q7pmWB1rpVrXpaY1nBHW1sDg+m1QuNlLiC xssAfr6C4nyN74ReXlmQDMnGgtcRhmS8oC2Vo9mD1XoyJ+5AcJwUP9Hp2WTGKxqdbo1n aAaQ== X-Gm-Message-State: AOAM530Ykf8FbPkZ8g91QgMZKT35Ac1AFADgmpQ9IkZjn/ZH5LIVlhTl LhhdaTQLS8+uEDe/b5cbREk= X-Google-Smtp-Source: ABdhPJxcA0z3DyBBeEfPBHlnZCHhDaVgwVd4ie4kjFb6CqHsvDp8ta/YN5s9RU5snoxuowNrYSXomw== X-Received: by 2002:a05:600c:4112:: with SMTP id j18mr1573533wmi.187.1597395929922; Fri, 14 Aug 2020 02:05:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 02:05:29 -0700 (PDT) From: Christian Gmeiner To: linux-kernel@vger.kernel.org Subject: [PATCH 2/4] drm/etnaviv: call perf_reg_read(..) Date: Fri, 14 Aug 2020 11:05:02 +0200 Message-Id: <20200814090512.151416-3-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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Russell King , cphealy@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the open coded access pattern with a function call. Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index 1f0402f7a7de..782732e6ce72 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -58,8 +58,7 @@ static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, 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); - gpu_write(gpu, domain->profile_config, signal->data); - value += gpu_read(gpu, domain->profile_read); + value += perf_reg_read(gpu, domain, signal); } /* switch back to pixel pipe 0 to prevent GPU hang */ From patchwork Fri Aug 14 09:05:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 11713873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDBC81392 for ; Fri, 14 Aug 2020 09:05:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAD1D20866 for ; Fri, 14 Aug 2020 09:05:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gpvcCjXt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAD1D20866 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD2236EB13; Fri, 14 Aug 2020 09:05:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 36F826EB13; Fri, 14 Aug 2020 09:05:35 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id k20so7301553wmi.5; 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=h6FrMtCiicq8SMMKZfwx4xzoiq+cgbltv4M8CjvgUHP186WgMD5L/UzyCUB3Y2zV0e vvHwmVN5gUbKTsaFUIDUY82YZIDswcG+WkM+pIzNVrHq8Fr/k1X3AqJdMsRxWsz79Wsc qBlDuwcII4xoBQmeKPQ6QoJwrPRyNcmUSOkUYbblJEOMQMcpN7N4CcIrxRE6ECjyjtOW oa7rNVOP7IVDQNpAGvxqh05VzcL57hz/i/vaGOnLuBqpX3ikZcC4esegDC6JS8Z8w9Jj kHyIYvGLtBd0Z8LdOzC23Ubyk2LfVS1LVq2t/VNThp4LUg2q8w00kK/6OZBCaA8bM6B/ 2VDw== X-Gm-Message-State: AOAM533fSQYjL+DjkU/PcoHwlyOjhjVifU0PPzNnQEVB4FLhbrmR4m7a M5ACZMIuomVRC6muxBI1Yxk= X-Google-Smtp-Source: ABdhPJxFOVHTXeF5CW+md3xRzIj05YXUjn0KLfX6SFojUdOXMVIJ6AB7QEqc/h1xOAQRM/T/Ef0U8g== 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Russell King , cphealy@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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, From patchwork Fri Aug 14 09:05:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 11713875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8129A13B1 for ; Fri, 14 Aug 2020 09:05:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EEF3207DA for ; Fri, 14 Aug 2020 09:05:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JXmQmEJM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EEF3207DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 145FA6EB19; Fri, 14 Aug 2020 09:05:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F1116EB19; Fri, 14 Aug 2020 09:05:38 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 184so7321420wmb.0; Fri, 14 Aug 2020 02:05:38 -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=Awajj0R47lm6sx57tIr1UrmZ8iRE0Zm6ScsJs7CwSFQ=; b=JXmQmEJMupkWHWGlNYPwlcrexoKuEmdGptmBbT5gBV/GOjX8tatJOc76QTr2x3v5HA TSdDeJmSJkwDeAkDKNFjlzClsETHNRLp0S/pDX7sypwGMN0tkX5MtrteI4dldDlanJSr pLHrUoKchuGY+mTV3SeYfSlPU4KRqPvz7oTP/6tr3LZqFEMsQmT+JA16tU6WkfMWFeEe pGM+cTQajkI5MSBfcdh/FLEO3m9jUuCgpFk1uh9aJbkt/iu+YHJ/98fAQ3Aya5gVqwMr ukR1Vy0mbrR9pgP82KZLcyiXPuRJ8pHoxHBEaa1X3g8IgMbjsWyKb6A3RVqj+502id0b m6Dw== 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=Awajj0R47lm6sx57tIr1UrmZ8iRE0Zm6ScsJs7CwSFQ=; b=pgXYqdUPPBiPWHM6P+fBcUZfci/m/AuaH2QjFJIV2s8fQ3YVVdQBUGmhqCdhiM6IT1 HlizUvj92y2aLHT7Y9LlEXYgkrodM0ZoJHFOLQUddr0ZRUUYYP44FAZimKKW51DcFKwx 3jGpLZ/nsRwOXOiofu0s7DxLWpI+7/VVzB2GzhVSKhyFpwqsxvbkFhgoq6iAMP/tK1i5 xIVU6H858iAaQl4PYqq9/KC9ChBaPc8RUnMqjVGsrAStCbHc+ooBDwt8qCkKLiHLnTV4 ES8XecMvhxrhjfao7nIdLQ9jsZDbPle8vnVFJpf/NNDtLl1yIgU6IQdKmlngOzkBM2vS itiQ== X-Gm-Message-State: AOAM533zDmdCTLxIhWcK/X9GzAgVj8H00768a3ZhfQwHHHcRotBWFCbF 6Cw2eUXISmW954aneqBaVks= X-Google-Smtp-Source: ABdhPJxqi5bXP8Npuw6YVikeX86l73CGaSFxvFOB8f9irFOzcMaelqhYY2g9h8/LDa36mTZSvAYICg== X-Received: by 2002:a1c:4d0d:: with SMTP id o13mr1730642wmh.118.1597395936789; Fri, 14 Aug 2020 02:05:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 02:05:35 -0700 (PDT) From: Christian Gmeiner To: linux-kernel@vger.kernel.org Subject: [PATCH 4/4] drm/etnaviv: add pipe_select(..) helper Date: Fri, 14 Aug 2020 11:05:04 +0200 Message-Id: <20200814090512.151416-5-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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Russell King , cphealy@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the open coded pixel pipe selection pattern with a function. Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index b37459f022d7..bafdfe49c1d8 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -46,6 +46,14 @@ static u32 perf_reg_read(struct etnaviv_gpu *gpu, return gpu_read(gpu, domain->profile_read); } +static inline void pipe_select(struct etnaviv_gpu *gpu, u32 clock, unsigned pipe) +{ + clock &= ~(VIVS_HI_CLOCK_CONTROL_DEBUG_PIXEL_PIPE__MASK); + clock |= VIVS_HI_CLOCK_CONTROL_DEBUG_PIXEL_PIPE(pipe); + + gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, clock); +} + static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, const struct etnaviv_pm_domain *domain, const struct etnaviv_pm_signal *signal) @@ -55,16 +63,12 @@ static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, 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); + pipe_select(gpu, clock, i); value += perf_reg_read(gpu, domain, signal); } /* 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); + pipe_select(gpu, clock, 0); return value; } @@ -78,16 +82,12 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu, 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); + pipe_select(gpu, clock, i); 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); + pipe_select(gpu, clock, 0); return value; }