From: Liviu Dudau <liviu.dudau@arm.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Steven Price <steven.price@arm.com>,
Akash Goel <akash.goel@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Chia-I Wu <olvaffe@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] drm/panthor: Move cache-flush after UPDATE(UNMAPPED)
Date: Fri, 16 Oct 2026 11:41:23 +0100 [thread overview]
Message-ID: <atH_UwhLuO5len3n@e142607> (raw)
In-Reply-To: <20260924-panthor-mmu-fixes-v1-3-e25f9b106466@collabora.com>
On Thu, Sep 24, 2026 at 02:30:45PM +0200, Boris Brezillon wrote:
> Right now, there's a theoretical window during which the GPU can populate
> the cache with data from a VM that's about to be evicted through the
> UPDATE(UNMAPPED) command.
> In practice this won't happen (hence the absence of Fixes tag) because
> when panthor_mmu_as_disable() is called, the VM is guaranteed to be idle
> (no active CSG pointing to this VM), but as we say, better safe than
> sorry.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index 038a092fd08c..bb71274aa36b 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -631,12 +631,6 @@ static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr)
> panthor_mmu_irq_disable_events(&ptdev->mmu->irq,
> panthor_mmu_as_fault_mask(ptdev, as_nr));
>
> - /* Flush+invalidate RW caches, invalidate RO ones. */
> - ret = panthor_gpu_flush_caches(ptdev, CACHE_CLEAN | CACHE_INV,
> - CACHE_CLEAN | CACHE_INV, 0);
> - if (ret)
> - return ret;
> -
> if (vm && vm->locked_region.size) {
> /* Unlock the region if there's a lock pending. */
> ret = as_send_cmd_and_wait(ptdev, vm->as.id, AS_COMMAND_UNLOCK);
> @@ -648,7 +642,18 @@ static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr)
> gpu_write64(mmu->iomem, AS_MEMATTR(as_nr), 0);
> gpu_write64(mmu->iomem, AS_TRANSCFG(as_nr), AS_TRANSCFG_ADRMODE_UNMAPPED);
>
> - return as_send_cmd_and_wait(ptdev, as_nr, AS_COMMAND_UPDATE);
> + ret = as_send_cmd_and_wait(ptdev, as_nr, AS_COMMAND_UPDATE);
> + if (ret)
> + return ret;
> +
> + /* Flush+invalidate RW caches after we've unmapped, to make sure any
> + * cacheline eviction is effective before we potentially return
> + * memory pointed by this VM to the system. This needs to be done
> + * after the UPDATE(UNMAPPED) operation to guarantee that not further
> + * PT-walk can pull VM data into the cache.
> + */
> + return panthor_gpu_flush_caches(ptdev, CACHE_CLEAN | CACHE_INV,
> + CACHE_CLEAN | CACHE_INV, 0);
> }
>
> static u32 panthor_mmu_fault_mask(struct panthor_device *ptdev, u32 value)
>
> --
> 2.55.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2026-10-16 10:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 12:30 [PATCH 0/3] drm/panthor: Misc MMU fixes/robustness improvements Boris Brezillon
2026-09-24 12:30 ` [PATCH 1/3] drm/panthor: Don't invalidate OTHER caches Boris Brezillon
2026-10-16 10:37 ` Liviu Dudau
2026-09-24 12:30 ` [PATCH 2/3] drm/panthor: Fully disable the AS even if it's going to be re-assigned Boris Brezillon
2026-10-16 10:38 ` Liviu Dudau
2026-09-24 12:30 ` [PATCH 3/3] drm/panthor: Move cache-flush after UPDATE(UNMAPPED) Boris Brezillon
2026-10-16 10:41 ` Liviu Dudau [this message]
2026-10-16 12:25 ` [PATCH 0/3] drm/panthor: Misc MMU fixes/robustness improvements Liviu Dudau
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=atH_UwhLuO5len3n@e142607 \
--to=liviu.dudau@arm.com \
--cc=airlied@gmail.com \
--cc=akash.goel@arm.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=olvaffe@gmail.com \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®