Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2164142lqb; Mon, 27 May 2024 09:46:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAUcJvVRHlwJXkojfcxHAr9Fh7wnoEElnSl2Aq2kxrY2Y5v6gFB3w8+ceUB8M9KE25wTYZH6/s5JvZzEhSo1i6qkmUudsAcVE7xq2iGg== X-Google-Smtp-Source: AGHT+IH3hABGmr/yENEe4nUhX8A4VZ3DaBh6+oqcNBL3jKwFqbUmNJHNsyYjm0Zs+AJ526Sce0gw X-Received: by 2002:a17:902:ea0f:b0:1f4:743f:ea8c with SMTP id d9443c01a7336-1f4743febe3mr83326285ad.9.1716828390603; Mon, 27 May 2024 09:46:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716828390; cv=pass; d=google.com; s=arc-20160816; b=aYNo/rTmzTlnSAmK2FVSFErlYoOqHR/S3pN/8SPwzES75nGBIuAkL8BXqhWl8JJ7Y5 LAjfTlhqhggEQKMa7IvK814FuvMWg4AiMOpdtOxed54BfUQuXPtcJMFxz9FQZvMVIU1C ToYMzqkA+xiIPZRsb56pSc/P924GBFaWGgxhEYoWadBMTnzBZrcvV+9NqnW5W76c0xZP 8PtghvI0Uzv2GvOetiXEnSb55lkDpWNhEj1LKibcdtEHOIgS6eZ+r6knOPk0m2aq3Qu0 1NRddkLQMlEq89j//u1NECK0C9AvLQ14FVlCRZvdHtqi/AUq1pYNfR7TwuXx7aXjcm8M ZuIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n4dDRpghB/7Ds2Nsx3TCLE4ryVNgv3p1UbyZJO2JpoQ=; fh=tsf/+3RY3twcGDw1y8pCRmIcT1Rw3jCoda8z5R4ZTxw=; b=BFGWq2cLiA7Sd7RoXRHlLIbRy+PNfohJz1TeJ9A06ukmHI6J/EjAImVytJJhDvHM0A n/TddI4F2wHT3bRwMX6XmhyI+693fctohLZLgCSLVdi9mJ2h4UkN1i5jZA01VkXkT67W FtZP1gzXgfamegVZTI4pdyijjf7k2FmJ+1NmCalwSsHZIIEzfYomNn/4IcuedJ7hiLf1 t9RmheFovH8WO5VzO32lNMuTlLUNyFqXI76zTxmhjHsG1RVHyGpIaoKCYchpBIoSfc5Q BZ/G4gEL48UAmz5Y8Yj2iovxr7PC6nxaFzoNcLUxI3RkdfvHB34ytaoegI8j/tHKBcvP Mu0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eCV01wOs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c7c5a08si64312975ad.172.2024.05.27.09.46.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eCV01wOs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1A98D286CE1 for ; Mon, 27 May 2024 16:02:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAA9516B739; Mon, 27 May 2024 15:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eCV01wOs" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 001E616B724; Mon, 27 May 2024 15:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825369; cv=none; b=NdHjSJhnUJyKpVodH1XH4VjdFa1fnqWpziJla+iDVqhBvSyusel0FiPh+hw/XByKEIBrgR7f2IdsBvqtOndQNCq8WHj05mg2jg5rmgo9yzz5q/3UE0BW1iD0A0RRFSvle9J/TA/3ZiuRDyUkXANABYy6d8xPb8hO2ccJ8xaL+c0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825369; c=relaxed/simple; bh=DqWMOx7aY2mWOJYhIi5ImacClV/1HB5ITtsBVRGw4cQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qN9Chmf/Cy8OeDbwWCTNZs/aP/2GFx22WTdhgpQqga2hWU2F7ySYPBFaGlDukx/FC7JN9cYJ7hkHUhAfjv2837qRKPKIa2woyzeAnWqcZUQI4WUA9obfIQHy8Khl+4xT7xLesVYLxFEM9/2vVwF/PGQVIMThwXBSyt3N4a54EeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eCV01wOs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CC00C32781; Mon, 27 May 2024 15:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716825368; bh=DqWMOx7aY2mWOJYhIi5ImacClV/1HB5ITtsBVRGw4cQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eCV01wOsd9fMnxNC4RpJkjN9zNa89IbhbWdgkR6gsxJJnYi2dMP9Y6nZ7m43ZdcPk NIYggWoIDVSyda73qhOUint+1o3UUasBisHeblWEa7DGTx/HWiltlnMW4ja//1Amha opmt7N4cx/2RVPcO+kHq2eaRJF/OnTWSe6+wGOWuj8/3o/ZnYm5i266WORR1zxYmm0 h82f1Vy0fKpehPSsxDHiiOb7Q0DZlo86BRnGtzjEAtTiylGjWqDvwJp0N7IWmBgilv HQEonV2fvfSktaAzUYnLbDsTTA+yGXUKT3GbA41EB1tzs6bhAYZH7CemAdovAONCqq OLGF/xLkRyKug== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Erico Nunes , Qiang Yu , Sasha Levin , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.6 06/16] drm/lima: add mask irq callback to gp and pp Date: Mon, 27 May 2024 11:54:57 -0400 Message-ID: <20240527155541.3865428-6-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240527155541.3865428-1-sashal@kernel.org> References: <20240527155541.3865428-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.32 Content-Transfer-Encoding: 8bit From: Erico Nunes [ Upstream commit 49c13b4d2dd4a831225746e758893673f6ae961c ] This is needed because we want to reset those devices in device-agnostic code such as lima_sched. In particular, masking irqs will be useful before a hard reset to prevent race conditions. Signed-off-by: Erico Nunes Signed-off-by: Qiang Yu Link: https://patchwork.freedesktop.org/patch/msgid/20240405152951.1531555-2-nunes.erico@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/lima/lima_bcast.c | 12 ++++++++++++ drivers/gpu/drm/lima/lima_bcast.h | 3 +++ drivers/gpu/drm/lima/lima_gp.c | 8 ++++++++ drivers/gpu/drm/lima/lima_pp.c | 18 ++++++++++++++++++ drivers/gpu/drm/lima/lima_sched.h | 1 + 5 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/lima/lima_bcast.c b/drivers/gpu/drm/lima/lima_bcast.c index fbc43f243c54d..6d000504e1a4e 100644 --- a/drivers/gpu/drm/lima/lima_bcast.c +++ b/drivers/gpu/drm/lima/lima_bcast.c @@ -43,6 +43,18 @@ void lima_bcast_suspend(struct lima_ip *ip) } +int lima_bcast_mask_irq(struct lima_ip *ip) +{ + bcast_write(LIMA_BCAST_BROADCAST_MASK, 0); + bcast_write(LIMA_BCAST_INTERRUPT_MASK, 0); + return 0; +} + +int lima_bcast_reset(struct lima_ip *ip) +{ + return lima_bcast_hw_init(ip); +} + int lima_bcast_init(struct lima_ip *ip) { int i; diff --git a/drivers/gpu/drm/lima/lima_bcast.h b/drivers/gpu/drm/lima/lima_bcast.h index 465ee587bceb2..cd08841e47879 100644 --- a/drivers/gpu/drm/lima/lima_bcast.h +++ b/drivers/gpu/drm/lima/lima_bcast.h @@ -13,4 +13,7 @@ void lima_bcast_fini(struct lima_ip *ip); void lima_bcast_enable(struct lima_device *dev, int num_pp); +int lima_bcast_mask_irq(struct lima_ip *ip); +int lima_bcast_reset(struct lima_ip *ip); + #endif diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c index 8dd501b7a3d0d..6cf46b653e810 100644 --- a/drivers/gpu/drm/lima/lima_gp.c +++ b/drivers/gpu/drm/lima/lima_gp.c @@ -212,6 +212,13 @@ static void lima_gp_task_mmu_error(struct lima_sched_pipe *pipe) lima_sched_pipe_task_done(pipe); } +static void lima_gp_task_mask_irq(struct lima_sched_pipe *pipe) +{ + struct lima_ip *ip = pipe->processor[0]; + + gp_write(LIMA_GP_INT_MASK, 0); +} + static int lima_gp_task_recover(struct lima_sched_pipe *pipe) { struct lima_ip *ip = pipe->processor[0]; @@ -344,6 +351,7 @@ int lima_gp_pipe_init(struct lima_device *dev) pipe->task_error = lima_gp_task_error; pipe->task_mmu_error = lima_gp_task_mmu_error; pipe->task_recover = lima_gp_task_recover; + pipe->task_mask_irq = lima_gp_task_mask_irq; return 0; } diff --git a/drivers/gpu/drm/lima/lima_pp.c b/drivers/gpu/drm/lima/lima_pp.c index a5c95bed08c09..54b208a4a768e 100644 --- a/drivers/gpu/drm/lima/lima_pp.c +++ b/drivers/gpu/drm/lima/lima_pp.c @@ -408,6 +408,9 @@ static void lima_pp_task_error(struct lima_sched_pipe *pipe) lima_pp_hard_reset(ip); } + + if (pipe->bcast_processor) + lima_bcast_reset(pipe->bcast_processor); } static void lima_pp_task_mmu_error(struct lima_sched_pipe *pipe) @@ -416,6 +419,20 @@ static void lima_pp_task_mmu_error(struct lima_sched_pipe *pipe) lima_sched_pipe_task_done(pipe); } +static void lima_pp_task_mask_irq(struct lima_sched_pipe *pipe) +{ + int i; + + for (i = 0; i < pipe->num_processor; i++) { + struct lima_ip *ip = pipe->processor[i]; + + pp_write(LIMA_PP_INT_MASK, 0); + } + + if (pipe->bcast_processor) + lima_bcast_mask_irq(pipe->bcast_processor); +} + static struct kmem_cache *lima_pp_task_slab; static int lima_pp_task_slab_refcnt; @@ -447,6 +464,7 @@ int lima_pp_pipe_init(struct lima_device *dev) pipe->task_fini = lima_pp_task_fini; pipe->task_error = lima_pp_task_error; pipe->task_mmu_error = lima_pp_task_mmu_error; + pipe->task_mask_irq = lima_pp_task_mask_irq; return 0; } diff --git a/drivers/gpu/drm/lima/lima_sched.h b/drivers/gpu/drm/lima/lima_sched.h index 6a11764d87b38..edf205be43699 100644 --- a/drivers/gpu/drm/lima/lima_sched.h +++ b/drivers/gpu/drm/lima/lima_sched.h @@ -80,6 +80,7 @@ struct lima_sched_pipe { void (*task_error)(struct lima_sched_pipe *pipe); void (*task_mmu_error)(struct lima_sched_pipe *pipe); int (*task_recover)(struct lima_sched_pipe *pipe); + void (*task_mask_irq)(struct lima_sched_pipe *pipe); struct work_struct recover_work; }; -- 2.43.0