[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPaKu7TT_Uph+ccNQ4q2+y9Pbmm-nLnPOgsLwEuZGnON26EStg@mail.gmail.com>
Date: Thu, 2 Oct 2025 17:46:39 -0700
From: Chia-I Wu <olvaffe@...il.com>
To: Steven Price <steven.price@....com>
Cc: Boris Brezillon <boris.brezillon@...labora.com>, Liviu Dudau <liviu.dudau@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Grant Likely <grant.likely@...aro.org>, Heiko Stuebner <heiko@...ech.de>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/10] drm/panthor: rename and document lock_region
On Thu, Oct 2, 2025 at 3:41 AM Steven Price <steven.price@....com> wrote:
>
> On 16/09/2025 22:08, Chia-I Wu wrote:
> > Rename lock_region to mmu_hw_cmd_lock.
> >
> > Signed-off-by: Chia-I Wu <olvaffe@...il.com>
> > ---
> > drivers/gpu/drm/panthor/panthor_mmu.c | 15 ++++++++++++---
> > 1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> > index d3af4f79012b4..8600d98842345 100644
> > --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> > @@ -545,8 +545,17 @@ static int write_cmd(struct panthor_device *ptdev, u32 as_nr, u32 cmd)
> > return status;
> > }
> >
> > -static void lock_region(struct panthor_device *ptdev, u32 as_nr,
> > - u64 region_start, u64 size)
> > +/**
> > + * mmu_hw_cmd_lock() - Issue a LOCK command
> > + * @ptdev: Device.
> > + * @as_nr: AS to issue command to.
> > + * @region_start: Start of the region.
> > + * @size: Size of the region.
> > + *
> > + * Issue a LOCK command to invalidate MMU caches and block future transactions
> > + * for a region.
>
> The LOCK command doesn't invalidate the caches - that's the UNLOCK
> command. LOCK just blocks any memory accesses that target the region.
>
> [I guess the hardware implementation might flush TLBs to achieve the
> block, but that's an implementation detail and shouldn't be relied upon].
Hm, for LOCK, the doc I have says "MMU caches are invalidated." And
for UNLOCK, there is actually no invalidation when the region is
LOCK'ed.
> I'm also not entirely clear what the benefit of this rename is? It's a
> static function in a xxx_mmu.c file so it's fairly obvious this going to
> MMU HW related. I also feel "_region" in the name makes it obvious that
> there is a memory range that is affected by the lock.
A big part of this file is for in-memory page tables. "mmu_hw_" prefix
is used by some functions that write the regs. This (and following)
renames prefix other such functions by "mmu_hw_" for consistency.
Then there are "mmu_hw_cmd_FOO" for each hw cmd FOO. That's why the
"_region' part gets dropped.
>
> Thanks,
> Steve
>
> > + */
> > +static void mmu_hw_cmd_lock(struct panthor_device *ptdev, u32 as_nr, u64 region_start, u64 size)
> > {
> > u8 region_width;
> > u64 region;
> > @@ -609,7 +618,7 @@ static int mmu_hw_do_operation_locked(struct panthor_device *ptdev, int as_nr,
> > * power it up
> > */
> >
> > - lock_region(ptdev, as_nr, iova, size);
> > + mmu_hw_cmd_lock(ptdev, as_nr, iova, size);
> >
> > ret = mmu_hw_wait_ready(ptdev, as_nr);
> > if (ret)
>
Powered by blists - more mailing lists