From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Boris Brezillon" <boris.brezillon@collabora.com>,
"Steven Price" <steven.price@arm.com>,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: dri-devel@lists.freedesktop.org, Akash Goel <akash.goel@arm.com>,
Chia-I Wu <olvaffe@gmail.com>,
kernel@collabora.com
Subject: Re: [PATCH v2 3/3] drm/panthor: Unlock the locked region before disabling an AS
Date: Wed, 3 Dec 2025 12:47:35 +0100 [thread overview]
Message-ID: <20251203124735.61e7af54@fedora> (raw)
In-Reply-To: <20251203110527.367089-4-boris.brezillon@collabora.com>
On Wed, 3 Dec 2025 12:05:27 +0100
Boris Brezillon <boris.brezillon@collabora.com> wrote:
> An AS can be disabled in the middle of a VM operation (VM being
> evicted from an AS slot, for instance). In that case, we need the
> locked section to be unlocked before releasing the slot.
>
> v2:
> - Add an lockdep_assert_held() in panthor_mmu_as_disable()
> - Collect R-bs
>
> Fixes: 6e2d3b3e8589 ("drm/panthor: Add support for atomic page table updates")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index 3644af1a8e56..493e6428d478 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -588,14 +588,27 @@ static int panthor_mmu_as_enable(struct panthor_device *ptdev, u32 as_nr,
> static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr,
> bool recycle_slot)
> {
> + struct panthor_vm *vm = ptdev->mmu->as.slots[as_nr].vm;
> int ret;
>
> + lockdep_assert_held(&ptdev->mmu->as.slots_lock);
> +
> /* Flush+invalidate RW caches, invalidate RO ones. */
> ret = panthor_gpu_flush_caches(ptdev, CACHE_CLEAN | CACHE_INV,
> CACHE_CLEAN | CACHE_INV, CACHE_INV);
> if (ret)
> return ret;
>
> + if (vm && vm->locked_region.size) {
> + /* Unlock the region if there a lock pending. */
> + ret = as_send_cmd_and_wait(ptdev, vm->as.id, AS_COMMAND_UNLOCK);
> + if (ret)
> + return ret;
> +
> + vm->locked_region.start = 0;
> + vm->locked_region.size = 0;
Actually, resetting the locked_region range triggers the WARN_ON()s in
the vm_[un]map_pages() path, so I'll get rid of that in v3.
> + }
> +
> /* If the slot is going to be used immediately, don't bother changing
> * the config.
> */
prev parent reply other threads:[~2025-12-03 11:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 11:05 [PATCH v2 0/3] drm/panthor: Fix regressions introduced recently Boris Brezillon
2025-12-03 11:05 ` [PATCH v2 1/3] drm/panthor: Drop a WARN_ON() in group_free_queue() Boris Brezillon
2025-12-03 11:05 ` [PATCH v2 2/3] drm/panthor: Make sure caches are flushed/invalidated when an AS is recycled Boris Brezillon
2025-12-03 11:05 ` [PATCH v2 3/3] drm/panthor: Unlock the locked region before disabling an AS Boris Brezillon
2025-12-03 11:47 ` Boris Brezillon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251203124735.61e7af54@fedora \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=akash.goel@arm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=liviu.dudau@arm.com \
--cc=olvaffe@gmail.com \
--cc=steven.price@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.