drivers/gpu/drm/panthor/panthor_mmu.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
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@fooishbar.org>
Signed-off-by: Steven Price <steven.price@arm.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
Hi Steven, On Fri, 15 Aug 2025 at 11:25, Steven Price <steven.price@arm.com> wrote: > 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. Thanks! I think it would make sense to also inline mmu_hw_do_flush_on_gpu_ctrl() here though. Cheers, Daniel
On 15/08/2025 12:17, Daniel Stone wrote: > Hi Steven, > > On Fri, 15 Aug 2025 at 11:25, Steven Price <steven.price@arm.com> wrote: >> 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. > > Thanks! I think it would make sense to also inline > mmu_hw_do_flush_on_gpu_ctrl() here though. True, I'll have a go at a proper rewrite of that function to make it more coherent. Thanks, Steve
© 2016 - 2025 Red Hat, Inc.