From: Liviu Dudau <liviu.dudau@arm•com>
To: Ketil Johnsen <ketil.johnsen@arm•com>
Cc: "David Airlie" <airlied@gmail•com>,
"Simona Vetter" <simona@ffwll•ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux•intel.com>,
"Maxime Ripard" <mripard@kernel•org>,
"Thomas Zimmermann" <tzimmermann@suse•de>,
"Jonathan Corbet" <corbet@lwn•net>,
"Shuah Khan" <skhan@linuxfoundation•org>,
"Sumit Semwal" <sumit.semwal@linaro•org>,
"Benjamin Gaignard" <benjamin.gaignard@collabora•com>,
"Brian Starkey" <Brian.Starkey@arm•com>,
"John Stultz" <jstultz@google•com>,
"T.J. Mercier" <tjmercier@google•com>,
"Christian König" <christian.koenig@amd•com>,
"Boris Brezillon" <boris.brezillon@collabora•com>,
"Steven Price" <steven.price@arm•com>,
"Daniel Almeida" <daniel.almeida@collabora•com>,
"Alice Ryhl" <aliceryhl@google•com>,
"Matthias Brugger" <matthias.bgg@gmail•com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora•com>,
dri-devel@lists•freedesktop.org, linux-doc@vger•kernel.org,
linux-kernel@vger•kernel.org, linux-media@vger•kernel.org,
linaro-mm-sig@lists•linaro.org,
linux-arm-kernel@lists•infradead.org,
linux-mediatek@lists•infradead.org
Subject: Re: [PATCH 3/8] drm/panthor: De-duplicate FW memory section sync
Date: Tue, 12 May 2026 14:37:21 +0100 [thread overview]
Message-ID: <agMtEXOqPGEwKuwt@e142607> (raw)
In-Reply-To: <20260505140516.1372388-4-ketil.johnsen@arm.com>
On Tue, May 05, 2026 at 04:05:09PM +0200, Ketil Johnsen wrote:
> Handle the sync to device of FW memory sections inside
> panthor_fw_init_section_mem() so that the callers do not have to.
>
> This small improvement is also critical for protected FW sections,
> so we avoid issuing memory transactions to protected memory from
> CPU running in normal mode.
>
> Signed-off-by: Ketil Johnsen <ketil.johnsen@arm•com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm•com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_fw.c | 22 ++++++----------------
> 1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
> index be0da5b1f3abf..0d07a133dc3af 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -446,6 +446,7 @@ static void panthor_fw_init_section_mem(struct panthor_device *ptdev,
> struct panthor_fw_section *section)
> {
> bool was_mapped = !!section->mem->kmap;
> + struct sg_table *sgt;
> int ret;
>
> if (!section->data.size &&
> @@ -464,6 +465,11 @@ static void panthor_fw_init_section_mem(struct panthor_device *ptdev,
>
> if (!was_mapped)
> panthor_kernel_bo_vunmap(section->mem);
> +
> + /* An sgt should have been requested when the kernel BO was GPU-mapped. */
> + sgt = to_panthor_bo(section->mem->obj)->dmap.sgt;
> + if (!drm_WARN_ON_ONCE(&ptdev->base, !sgt))
> + dma_sync_sgtable_for_device(ptdev->base.dev, sgt, DMA_TO_DEVICE);
> }
>
> /**
> @@ -626,7 +632,6 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
> section_size = hdr.va.end - hdr.va.start;
> if (section_size) {
> u32 cache_mode = hdr.flags & CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_MASK;
> - struct panthor_gem_object *bo;
> u32 vm_map_flags = 0;
> u64 va = hdr.va.start;
>
> @@ -663,14 +668,6 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
> }
>
> panthor_fw_init_section_mem(ptdev, section);
> -
> - bo = to_panthor_bo(section->mem->obj);
> -
> - /* An sgt should have been requested when the kernel BO was GPU-mapped. */
> - if (drm_WARN_ON_ONCE(&ptdev->base, !bo->dmap.sgt))
> - return -EINVAL;
> -
> - dma_sync_sgtable_for_device(ptdev->base.dev, bo->dmap.sgt, DMA_TO_DEVICE);
> }
>
> if (hdr.va.start == CSF_MCU_SHARED_REGION_START)
> @@ -724,17 +721,10 @@ panthor_reload_fw_sections(struct panthor_device *ptdev, bool full_reload)
> struct panthor_fw_section *section;
>
> list_for_each_entry(section, &ptdev->fw->sections, node) {
> - struct sg_table *sgt;
> -
> if (!full_reload && !(section->flags & CSF_FW_BINARY_IFACE_ENTRY_WR))
> continue;
>
> panthor_fw_init_section_mem(ptdev, section);
> -
> - /* An sgt should have been requested when the kernel BO was GPU-mapped. */
> - sgt = to_panthor_bo(section->mem->obj)->dmap.sgt;
> - if (!drm_WARN_ON_ONCE(&ptdev->base, !sgt))
> - dma_sync_sgtable_for_device(ptdev->base.dev, sgt, DMA_TO_DEVICE);
> }
> }
>
> --
> 2.43.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2026-05-12 13:38 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 14:05 [PATCH 0/8] drm/panthor: Protected mode support for Mali CSF GPUs Ketil Johnsen
2026-05-05 14:05 ` [PATCH 1/8] dma-heap: Add proper kref handling on dma-buf heaps Ketil Johnsen
2026-05-05 15:20 ` Boris Brezillon
2026-05-05 15:39 ` Maxime Ripard
2026-05-05 16:40 ` Boris Brezillon
2026-05-07 15:33 ` Maxime Ripard
2026-05-05 14:05 ` [PATCH 2/8] dma-heap: Provide accessors so that in-kernel drivers can allocate dmabufs from specific heaps Ketil Johnsen
2026-05-05 15:45 ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 3/8] drm/panthor: De-duplicate FW memory section sync Ketil Johnsen
2026-05-05 15:47 ` Boris Brezillon
2026-05-12 13:37 ` Liviu Dudau [this message]
2026-05-05 14:05 ` [PATCH 4/8] drm/panthor: Add support for protected memory allocation in panthor Ketil Johnsen
2026-05-05 16:15 ` Boris Brezillon
2026-05-07 9:02 ` Marcin Ślusarz
2026-05-07 11:53 ` Boris Brezillon
2026-05-12 13:47 ` Liviu Dudau
2026-05-12 14:11 ` Boris Brezillon
2026-05-12 15:38 ` Liviu Dudau
2026-05-13 19:31 ` Chia-I Wu
2026-05-18 7:16 ` Boris Brezillon
2026-05-19 0:36 ` Chia-I Wu
2026-05-19 7:39 ` Boris Brezillon
2026-05-19 8:49 ` Ketil Johnsen
2026-05-19 17:07 ` Chia-I Wu
2026-05-19 17:29 ` Boris Brezillon
2026-05-19 9:52 ` [Linaro-mm-sig] " Maxime Ripard
2026-05-19 11:37 ` Boris Brezillon
2026-05-06 10:08 ` Maxime Ripard
2026-05-06 10:50 ` Boris Brezillon
2026-05-06 13:12 ` Maxime Ripard
2026-05-06 15:05 ` Boris Brezillon
2026-05-07 13:39 ` Thierry Reding
2026-05-06 12:43 ` Nicolas Frattaroli
2026-05-06 13:31 ` Maxime Ripard
2026-05-06 12:28 ` Nicolas Frattaroli
2026-05-05 14:05 ` [PATCH 5/8] drm/panthor: Minor scheduler refactoring Ketil Johnsen
2026-05-05 16:19 ` Boris Brezillon
2026-05-06 10:33 ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 6/8] drm/panthor: Explicit expansion of locked VM region Ketil Johnsen
2026-05-05 16:32 ` Boris Brezillon
2026-05-06 15:14 ` Nicolas Frattaroli
2026-05-07 14:54 ` Nicolas Frattaroli
2026-05-05 14:05 ` [PATCH 7/8] drm/panthor: Add support for entering and exiting protected mode Ketil Johnsen
2026-05-05 17:11 ` Boris Brezillon
2026-05-06 8:51 ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 8/8] drm/panthor: Expose protected rendering features Ketil Johnsen
2026-05-06 9:14 ` Boris Brezillon
2026-05-07 8:47 ` Marcin Ślusarz
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=agMtEXOqPGEwKuwt@e142607 \
--to=liviu.dudau@arm$(echo .)com \
--cc=Brian.Starkey@arm$(echo .)com \
--cc=airlied@gmail$(echo .)com \
--cc=aliceryhl@google$(echo .)com \
--cc=angelogioacchino.delregno@collabora$(echo .)com \
--cc=benjamin.gaignard@collabora$(echo .)com \
--cc=boris.brezillon@collabora$(echo .)com \
--cc=christian.koenig@amd$(echo .)com \
--cc=corbet@lwn$(echo .)net \
--cc=daniel.almeida@collabora$(echo .)com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=jstultz@google$(echo .)com \
--cc=ketil.johnsen@arm$(echo .)com \
--cc=linaro-mm-sig@lists$(echo .)linaro.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-doc@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-media@vger$(echo .)kernel.org \
--cc=linux-mediatek@lists$(echo .)infradead.org \
--cc=maarten.lankhorst@linux$(echo .)intel.com \
--cc=matthias.bgg@gmail$(echo .)com \
--cc=mripard@kernel$(echo .)org \
--cc=simona@ffwll$(echo .)ch \
--cc=skhan@linuxfoundation$(echo .)org \
--cc=steven.price@arm$(echo .)com \
--cc=sumit.semwal@linaro$(echo .)org \
--cc=tjmercier@google$(echo .)com \
--cc=tzimmermann@suse$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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