Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2370079pxb; Mon, 20 Sep 2021 20:25:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHOUugiPlHTBxlI396Dzy07kG87TD8z/TdK/9UamE/p0tO/ke++ckOTXqSX7mhD9bFLUT7 X-Received: by 2002:a17:906:ece4:: with SMTP id qt4mr32492823ejb.250.1632194716568; Mon, 20 Sep 2021 20:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632194716; cv=none; d=google.com; s=arc-20160816; b=dUXCMvYr5cem5x2tJ4tUx5AubSIV9pCqJattNZLmvBJ32q/emBqzhs5gpFZyuJZUaR o/Z+QuoPLmfhgYxvlNxF9cZgZ9Uy9BVPN9zlPHs4SQltBQzdluRyziEg6JuLk2TcPc/n +f9IeoFsK10b/vXgnr/ZUOL5vALYqXV510JSy4iTaC5RKSxR4GesExXcW+bwCyBWI9EO 0yVsszAPtNlrYHyeWqVSMarT7pJswVDhUrnzzVn4EaAPOWE99YAAbaDoauu6lz5pwe2k ntY+rnputzoofzVBRnp5kM3zn4wl5eTC/qmqwN6+w7KY2R1qlazybs21Rh1EVBaSvIA9 hrxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rjMtXWvmSmdygYy1CepN5ov3ZLN0EKmI98Ohu39+1c0=; b=U8+xonJ2jSUgD8LYAgpFZc65vlSw+N8SwYFC/artocEymgmQlbbt5Jd1KNgAgO8MBT JzyaHoXP0AiWzrNg6xOVNhDjLKp/ZXClIplOXPmtNfI7N6Uc2ot5uEKlXz+y8PwCeMfQ ICjARQCNCrUNYJho3sx9vK8LjlaDc5RUH6+NXkyCiaJThi99IzsxlS+8sb9uyaufseDm erTrtp1NDYpGkPOdJNUf4tm02hZWpn8ymQgVF4fPGDt2uqALhUv/pQldCCe4YCHkYmR/ /oteNp4U5hWyPcPLef5tpNIWpduvmEJafjyo5HPBN0XVrI30Kn2w8sWN6lG+7AJna+en SwTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xsfujrRR; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si2282123edm.184.2021.09.20.20.24.53; Mon, 20 Sep 2021 20:25:16 -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=@linuxfoundation.org header.s=korg header.b=xsfujrRR; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378230AbhITSXk (ORCPT + 99 others); Mon, 20 Sep 2021 14:23:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:40566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376914AbhITSQY (ORCPT ); Mon, 20 Sep 2021 14:16:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 96CBD63294; Mon, 20 Sep 2021 17:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158534; bh=atZAGBDkX6ILrf9MLlVOJ86j5JEt248n9ugS8gApqKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xsfujrRRI6ZpEJ1jmsl2KP/ttZ16y2IZ+C4gnB1DDwx49xWHMz5nSA5LyB1tIYkJL TXHt9XeOoh0CRa31hRU1eVCx8MGSlvCbXPEwUYIJd2HUCZyRf7VAe8LCfrhtgJpWps MOeHx4VKxcZFk+2DtDEnEEZqVyuqRGUBgLYHNZr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Michael Walle , Marek Vasut , Christian Gmeiner Subject: [PATCH 5.4 201/260] drm/etnaviv: stop abusing mmu_context as FE running marker Date: Mon, 20 Sep 2021 18:43:39 +0200 Message-Id: <20210920163937.941401405@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stach commit 23e0f5a57d0ecec86e1fc82194acd94aede21a46 upstream. While the DMA frontend can only be active when the MMU context is set, the reverse isn't necessarily true, as the frontend can be stopped while the MMU state is kept. Stop treating mmu_context being set as a indication that the frontend is running and instead add a explicit property. Cc: stable@vger.kernel.org # 5.4 Signed-off-by: Lucas Stach Tested-by: Michael Walle Tested-by: Marek Vasut Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 10 ++++++++-- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -545,6 +545,8 @@ static int etnaviv_hw_reset(struct etnav /* We rely on the GPU running, so program the clock */ etnaviv_gpu_update_clock(gpu); + gpu->fe_running = false; + return 0; } @@ -607,6 +609,8 @@ void etnaviv_gpu_start_fe(struct etnaviv VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE | VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch)); } + + gpu->fe_running = true; } static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu) @@ -1306,7 +1310,7 @@ struct dma_fence *etnaviv_gpu_submit(str goto out_unlock; } - if (!gpu->mmu_context) { + if (!gpu->fe_running) { gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context); etnaviv_gpu_start_fe_idleloop(gpu); } else { @@ -1530,7 +1534,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) { - if (gpu->initialized && gpu->mmu_context) { + if (gpu->initialized && gpu->fe_running) { /* Replace the last WAIT with END */ mutex_lock(&gpu->lock); etnaviv_buffer_end(gpu); @@ -1545,6 +1549,8 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_iommu_context_put(gpu->mmu_context); gpu->mmu_context = NULL; + + gpu->fe_running = false; } gpu->exec_state = -1; --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -101,6 +101,7 @@ struct etnaviv_gpu { struct workqueue_struct *wq; struct drm_gpu_scheduler sched; bool initialized; + bool fe_running; /* 'ring'-buffer: */ struct etnaviv_cmdbuf buffer;