Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2137018lqb; Mon, 27 May 2024 09:01:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFeKdbTxMOxScd38r3h7DbkbrFcOxcQ3f0V95hVi8/GmrXYoOVNEkZCeQcdK53yaKUhQgekqzCX/o42YKFKsyD/qsftcT0xJwzgC3psQ== X-Google-Smtp-Source: AGHT+IGMnQLhj61LCCTPVanAV8AMK7oMTHIwsVD1wUzmCFcQmlbeka2jyu6BpVzUzpQhE1Jc7wdw X-Received: by 2002:a17:90b:109:b0:2bf:f246:287a with SMTP id 98e67ed59e1d1-2bff24629d5mr1140850a91.44.1716825665426; Mon, 27 May 2024 09:01:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716825665; cv=pass; d=google.com; s=arc-20160816; b=IZRtRJ0YI5ReB+t3tCa8xXn5WFNLuBziOMT2GJm7Rky7oKwj2/P40cvrPsMKOg/KLX Ik+9wBC6bNQwLVf+ZcmDPEZoE+DhHj5ry9xepEc/lxxX9uNWOUsToQIKFPGmQFHrVWgH ydageo5Id/O7MSd/ug2dQE1PSxFb1oZaUoUvib/JThr9/95Jp3I2XKVWRW+wPc9dLx3X 7uWV6hGvSYKuJuRf0Mhv9PZnjIP2WtsEyKvORIFk8i3R8CD6+lLP/IK1FXBr7YzzABJt EplzTcSPQI2lAEcgSqo6cN4JgnoM1reXjQ5NAdwlabuNqIiuEEJtjFvyNA29V9Bb5OFN 4p8Q== 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=9M1CVZ4+x974AN1A5x3O28do6XPpBxB+hI2PKsz635E=; fh=tsf/+3RY3twcGDw1y8pCRmIcT1Rw3jCoda8z5R4ZTxw=; b=s2T3DoDet041gdbNuqw7icNTYT8/YUJ31IaGWYdd4PdbPvJA6ftXGDzjTq9vAw+DxE CqhitWDz16+T7oWwdlBJkqdsPtlFC9EP+ia1fr5Z9XuzQkeGOW++F/grYPNkuPvgbbw8 /r3xlp/BzZ15RWyQm1l7R6TcOZa9Dj4staNYM7RhEe7NFr/gAKve2Dcq6BciHxfpFMM5 hjFINx5DyG8/qLHxz8MDoqZ9vZzbq25RWuX623bI34Q8StjZFhKllZhYPRatke66N9qC Fq7cB6UYLF9zPJ/2BE/V802kobOT40NojBWb6udjKCSWCdq2NS6kmXLsOY55A0u4dCvA fJiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="laRt2/bJ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191109-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf73ce5583si5460265a91.150.2024.05.27.09.01.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:01:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="laRt2/bJ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191109-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 138A228EE5D for ; Mon, 27 May 2024 15:53:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E45915F330; Mon, 27 May 2024 15:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="laRt2/bJ" 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 543A915F306; Mon, 27 May 2024 15:52:13 +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=1716825134; cv=none; b=Gh3pbdAv6nbJNhpSOXazj9+JyyBou0LIlchPQ1nZYcS5lRdY0Uw92IYtvRvtjI28JxOp5AHU/t6vHwQEGagh1IaY++ccDFKKOQpAw5sFetxIrJasXrWNtJvVmN9wPed9RZPzf292yalTWd91LPoyDoefVT8rYXd2NCMMqZMxJeE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825134; c=relaxed/simple; bh=4qGzyDgggI9vY/tAHYyyyh3GGYNJZYIMcr3Sj0JRccw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RL31BjP1m2hQFvPeapo8I66XMhY71pnqBfJpA0oWvmhlQhw0tbmvVb1T3ItIlA2AtvzHPThTxtKOZsJNkaBiFhx4QcdFk8NQxAdkQH8Uy7s61UqOJ+uIJmtHLCVbUZteJKlTAKKF+RKBba+NE1fakkGhcn4/bxipWsNwgjcEKIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=laRt2/bJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CDF8C4AF07; Mon, 27 May 2024 15:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716825133; bh=4qGzyDgggI9vY/tAHYyyyh3GGYNJZYIMcr3Sj0JRccw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=laRt2/bJqQ9keB9HdlBAcaJ5cB9yQnMkwT1NXj9JGuNihY1KvjOWMnE+yEBVs86DY iDnNOQnrjJBkTFi+8+4GFA02JsTuOe3mxshQs+VMnOhdIOD/cu+D89UogDC4pcmwy1 z2oVYFq7P9OMWLUwnLBdHPoRngvjZPkCeU+7cUEQTG1F19t+HWh17Se+QQGu4nueZG RbmMkKrs3gpJNPyH9+yg89aMuMPWsX+RFUq8I1P8ti0wrEAgdf2UG6ot33kxCQVo9F l9ffkujHJkgwbSyewqWGLKfdTp/osvYjtfSLz2QiTpjZA02Wc+jkd6JZ3fmf2JD3Av dgsBrrxsBEzIg== 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.9 10/23] drm/lima: add mask irq callback to gp and pp Date: Mon, 27 May 2024 11:50:11 -0400 Message-ID: <20240527155123.3863983-10-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240527155123.3863983-1-sashal@kernel.org> References: <20240527155123.3863983-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.9.2 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 6b354e2fb61d4..e15295071533b 100644 --- a/drivers/gpu/drm/lima/lima_gp.c +++ b/drivers/gpu/drm/lima/lima_gp.c @@ -233,6 +233,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]; @@ -365,6 +372,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 d0d2db0ef1ce8..a4a2ffe6527c2 100644 --- a/drivers/gpu/drm/lima/lima_pp.c +++ b/drivers/gpu/drm/lima/lima_pp.c @@ -429,6 +429,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) @@ -437,6 +440,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; @@ -468,6 +485,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 6bd4f3b701091..85b23ba901d53 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