lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250815102539.39711-1-steven.price@arm.com>
Date: Fri, 15 Aug 2025 11:25:39 +0100
From: Steven Price <steven.price@....com>
To: Boris Brezillon <boris.brezillon@...labora.com>,
	Liviu Dudau <liviu.dudau@....com>,
	Daniel Stone <daniel@...ishbar.org>
Cc: dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org,
	Karunika Choo <karunika.choo@....com>,
	Chia-I Wu <olvaffe@...il.com>,
	Steven Price <steven.price@....com>
Subject: [PATCH] drm/panthor: Remove dead code in mmu_hw_do_operation_locked

The only callers to mmu_hw_do_operation_locked() pass an 'op' of either
AS_COMAND_FLUSH_MEM or AS_COMMAND_FLUSH_PT. So remove the code paths
that test for other operations and add a drm_WARN_ON() to catch the
posibility of others appearing the future.

Suggested-by: Daniel Stone <daniel@...ishbar.org>
Signed-off-by: Steven Price <steven.price@....com>
---
 drivers/gpu/drm/panthor/panthor_mmu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index 367c89aca558..b16f44aec725 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -612,17 +612,12 @@ static int mmu_hw_do_operation_locked(struct panthor_device *ptdev, int as_nr,
 	 * power it up
 	 */
 
-	if (op != AS_COMMAND_UNLOCK)
-		lock_region(ptdev, as_nr, iova, size);
+	drm_WARN_ON(&ptdev->base,
+		    op != AS_COMMAND_FLUSH_MEM && op != AS_COMMAND_FLUSH_PT);
 
-	if (op == AS_COMMAND_FLUSH_MEM || op == AS_COMMAND_FLUSH_PT)
-		return mmu_hw_do_flush_on_gpu_ctrl(ptdev, as_nr, op);
+	lock_region(ptdev, as_nr, iova, size);
 
-	/* Run the MMU operation */
-	write_cmd(ptdev, as_nr, op);
-
-	/* Wait for the flush to complete */
-	return wait_ready(ptdev, as_nr);
+	return mmu_hw_do_flush_on_gpu_ctrl(ptdev, as_nr, op);
 }
 
 static int mmu_hw_do_operation(struct panthor_vm *vm,
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ