Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp298416ybt; Fri, 19 Jun 2020 02:11:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhTL0mfpAayzyf/lL7IeT+pu+xJXAbbH8+x+GbQ0SLiQbnmG7hIL01hYKbvO+djanmaMMU X-Received: by 2002:a17:906:1cd3:: with SMTP id i19mr2581244ejh.321.1592557874021; Fri, 19 Jun 2020 02:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592557874; cv=none; d=google.com; s=arc-20160816; b=XBqgjaXA0UX+hp30ItAGu2AB58VqkSZ//hfUHWD7XRkpMXKGEMxKHSYTfsZSh3LNec /U9B2AI0bHyDDNq6QNDFeVHvTyWlNyt8n8fm1VJgwD1P4f0Afa8SR2llzMcuQ2VslcH2 wqnZaimMYauvJQLhVs5SHTY1dswhqlLgyl7h+m+Sq30YxeydpktowjKOv9F0yrq6Wl1D or6cu5IWfqraw3xPVuKo0cUUP6Q/FJ3Te16DiHBqOrGfQjjpFi6C2QAFMN2c8eSKtsQQ 1mPSRsV7npMMac4tELz6QDLsVG29UjvMc/BLaV5rNfDY9DAc3jArZy4s5Dn3YnIzN6tu QIxA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=jKz+IWNu/f3NZvrB+SdPfBv3OzHcK72M1nrXuJrY8CE=; b=ZxUl7YtYWDXImE330KS0azasWnRwTJgL4Xfa9D0GJX4GFPlYBwRyNlxEpbuseBuSzG 5ERfV2D3+yi1Tn+/Zu3tZ16sBXufqRbtizI/SVirQX5aQleNMSoMUCak9sCtLSeWAVyx waHAn04AYEWkr2jFVF5+j6SWK/4zAokNVuynrPQFB+wDaB7giSwBvfLRhD8YlUjS4lcf PD3bMyeeZVSo14ATZwsPM7cVv0eIPsAAndMEQwd9TIyWkJN+Mj8MBzX63loOSR78zdnV uJbysWye1T96FgiGFuu8FpmXlzc6lUnxyCpkahKrYW7Jq5XZ4m7F0CwvkqPRM9sPtjAw z8+g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si3550027ejd.311.2020.06.19.02.10.51; Fri, 19 Jun 2020 02:11:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731559AbgFSIwa (ORCPT + 99 others); Fri, 19 Jun 2020 04:52:30 -0400 Received: from foss.arm.com ([217.140.110.172]:48188 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729474AbgFSIw3 (ORCPT ); Fri, 19 Jun 2020 04:52:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DDAEB2B; Fri, 19 Jun 2020 01:52:28 -0700 (PDT) Received: from [192.168.1.84] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C21CB3F71F; Fri, 19 Jun 2020 01:52:27 -0700 (PDT) Subject: Re: [PATCH 1/2] panfrost: Make sure GPU is powered on when reading GPU_LATEST_FLUSH_ID To: Tomeu Vizoso , LKML Cc: Rob Herring , Alyssa Rosenzweig , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org References: <20200611085900.49740-1-tomeu.vizoso@collabora.com> From: Steven Price Message-ID: <2bd3f3c6-aa6f-4082-c2e4-949509c2ebae@arm.com> Date: Fri, 19 Jun 2020 09:52:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200611085900.49740-1-tomeu.vizoso@collabora.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/06/2020 09:58, Tomeu Vizoso wrote: > Bifrost devices do support the flush reduction feature, so on first job > submit we were trying to read the register while still powered off. > > If the GPU is powered off, the feature doesn't bring any benefit, so > don't try to read. > > Signed-off-by: Tomeu Vizoso Reviewed-by: Steven Price > --- > drivers/gpu/drm/panfrost/panfrost_gpu.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c > index f2c1ddc41a9b..e0f190e43813 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c > +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #include "panfrost_device.h" > #include "panfrost_features.h" > @@ -368,7 +369,16 @@ void panfrost_gpu_fini(struct panfrost_device *pfdev) > > u32 panfrost_gpu_get_latest_flush_id(struct panfrost_device *pfdev) > { > - if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) > - return gpu_read(pfdev, GPU_LATEST_FLUSH_ID); > + u32 flush_id; > + > + if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) { > + /* Flush reduction only makes sense when the GPU is kept powered on between jobs */ > + if (pm_runtime_get_if_in_use(pfdev->dev)) { > + flush_id = gpu_read(pfdev, GPU_LATEST_FLUSH_ID); > + pm_runtime_put(pfdev->dev); > + return flush_id; > + } > + } > + > return 0; > } >