Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353729pxb; Mon, 20 Sep 2021 19:52:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs6nBHfkoOpyUAcqxDXhoQiQ/shaa+F7SiBPN5wexszmAbb/avsGOQU8LGN8vo7+gFmmXI X-Received: by 2002:a50:d88b:: with SMTP id p11mr7632758edj.287.1632192746784; Mon, 20 Sep 2021 19:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192746; cv=none; d=google.com; s=arc-20160816; b=hi577MUkagVKQ08FxXJxrofZZZ1gWajZ5cCDzuuyaQWff83HG6fwdbgXQ5FH7ccZ62 gWheGqW2NGZ3AX1PClshhwBOwdawkzq4/Lby70EXdrK2mlXtlwTTtU/nxKqBagudulvh AFdkSmD+sU98M1IjOs2Rp53D8x75NlQYtBv22smKUmMx+ZgpONsb/30D2uDSkkzW18oY ySJlzhlrzzZD6sR6cRxKRT5rhJWar8Osm5z5zrFKbvHTDxP2giUz1Bxz3SiIUoT51Tin 7ndvKAsB+HqMSTVLnplmA+DdnHalAj+LnPkFRcIv/wdDIUpq5+Redvr0z1QNgHUSgHFy xXBA== 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=+FZmtiKa+ja3BwfKFk/xyB2iNmm66QkZiYEznn1N33g=; b=kczAnAuxPUOTG6Kt82GLgVNIyfbepT8fyw5BpqncFzUWEBY+2l59x78/BKSIN0b0TZ 83i2O+2UjQk/5xnZMCJQAGTQHDxZzXJ7Wvzw3KKXlAb36rKm5ivPuMRpyeoQe68lKwPC c4eXMYl+axtYnY4iYbuVTmswqx5X1XCuDmfhOvSQEg+SPQNnjEkGljkHxd8qDHvkj1x2 kD1rIaBZd14Xkx9tFr1EKjqjdZrlP7SLEDydwm17kV1ZFDBs7fT8n5b5+Uoq7wUKhlOB pF+gHTkSK7zGl9x+Y5QqZxRrLCVjBdwBxZBrf3PTuTdz2YekysoH8aguWOSgSreXOgXq YcDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QYa7TyXH; 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 b13si17385669ejl.758.2021.09.20.19.52.03; Mon, 20 Sep 2021 19:52:26 -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=QYa7TyXH; 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 S1382965AbhITSnk (ORCPT + 99 others); Mon, 20 Sep 2021 14:43:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381515AbhITSia (ORCPT ); Mon, 20 Sep 2021 14:38:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E77961526; Mon, 20 Sep 2021 17:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159007; bh=zyxRADBY8AibZMZCvqLlk+7TZnMjJWiKSInp8UYynvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYa7TyXH7Yq/T9ihjTQ4QqvC9PL18CDYMlRjnEIl/VWbQXLLHpeCQEnglkQYoqLSM TOKrq6fMkxON+xwqsP59E58OsquoRB8/vS3mrsTyaBEjOxYjoBU1KimlCxI7yNoMVE e0OxHbUpQmFq1DeqTmzqmL8+REwQDP49fKTZinio= 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.14 026/168] drm/etnaviv: stop abusing mmu_context as FE running marker Date: Mon, 20 Sep 2021 18:42:44 +0200 Message-Id: <20210920163922.507844848@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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 @@ -569,6 +569,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; } @@ -631,6 +633,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) @@ -1364,7 +1368,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 { @@ -1573,7 +1577,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); @@ -1588,6 +1592,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;