Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp219313pxa; Fri, 14 Aug 2020 02:08:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVXO4BuJNCAgT52AT3tCysRJVOUksR/i56Yx2MM/6hPNOJ5aE/raW4z6z8mPsOd5wmhPPQ X-Received: by 2002:a17:906:e289:: with SMTP id gg9mr1553130ejb.448.1597396097708; Fri, 14 Aug 2020 02:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597396097; cv=none; d=google.com; s=arc-20160816; b=d3+hXsqqTzIS6PElUONheJh2xo6KxhsAgv8Ta1OT1odIQvyOMrb3IU5Jq0gky+2IYX eEfDomTjDVeV77P8ktYkTKvLc6NLeDZZGAN1RW4/msKzglxbwDefNKiqyzTFlcWz07fD 9vEyu5SdgJpR4ls3wMGmpl0HpjLJfT/TWhLyFCZAX0ebCGS/bDkkXu652LSEjSVlwSou uN5fhs87aRm6HNs6MB3cxZgRRmUCoSkombuNj8lY0I0UhvlFO9hb6L4ioFMWxSL+tZGi wEDhRH3kevQ+0p0feoM1+Be8UNYgYxSw5qTIf1+D+fV92LFgO515+7Sv5ZJaI2mJyaUC 9nJA== 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=Awajj0R47lm6sx57tIr1UrmZ8iRE0Zm6ScsJs7CwSFQ=; b=GlaIXhmE7SIVBD3MNg1NsI6mR2V2DejDdk1RmHlua/TMhbmcSQvsEg2YFAqDCazyXa 8K8+5A/R0FIHRXJoum3PANaI22Y2QzQm1V3XhNNjMmdpsSugEj7pNGN6gC88of2Oju15 gzn/lzBHaur4SyQIBIxVWXYhT13YOiaBIxuNMQluzqXxHEWMK/NtSbDjaLhTxr+XgLVu VvSJN8lY1/W26EoMIGg7lobTjsLHR5nUVQAPdBu/xVSqk7iILB7UgeFTXt0bnMnnTXH/ Aj2bdEREdsZn3Czj0b8aG4IhN+Xw4ICi5CB504nLW8NpkPR/1h45U5GhmWVlh0hMhIrt 8ymA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JXmQmEJM; 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 w1si4798530ejc.440.2020.08.14.02.07.54; Fri, 14 Aug 2020 02:08:17 -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=JXmQmEJM; 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 S1727886AbgHNJFn (ORCPT + 99 others); Fri, 14 Aug 2020 05:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbgHNJFj (ORCPT ); Fri, 14 Aug 2020 05:05:39 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A445AC061383 for ; Fri, 14 Aug 2020 02:05:38 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id t14so7305495wmi.3 for ; 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=Ea/nufDzvjF7FEBuqTbNYaP5Z3h0HTRtoUa5e6dxZb6+/Yv3ewjilOOs121uyLFxKs 2ytKt6rYyabrRW+K2QvGLuy1HoefZ24Upx8tK5+nm8LMI5AHj2nyOvHXmynkD1LVRzzq qcDTykC44DYHM8O5niXj16Ruk7Vcl2kmdcoMWBcURB/havk2L7Ea+W+7e9FjLKvoSIqV eYpT/Eia/U7n57wNDH22qG6x+32IMQaNGXq6Pf3DDfdt3Gk+sqZDl8pI2AfAN4bAk7dl mlHc0M3YKBYcUk5aNMrDyGgXC935g+yBznXW2nE7INvCSI5TLEmvXedDvYDBlq9t54cF GkYQ== X-Gm-Message-State: AOAM532g1pcTiwaUplqn8/jwzX2HQ8FkO/1Qpm1K2gczbijA7hcRzjVd uChbQTU46v/QJVsdF98BfMAlGWpexQrydg== 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 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 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.26.2