mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Ketil Johnsen <ketil.johnsen@arm.com>
Cc: Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Akash Goel <akash.goel@arm.com>,
	Karunika Choo <karunika.choo@arm.com>,
	Lukas Zapolskas <lukas.zapolskas@arm.com>,
	Chris Diamand <chris.diamand@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>,
	Daniel Almeida <daniel.almeida@collabora.com>,
	Alice Ryhl <aliceryhl@google.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v5 10/13] drm/panthor: Use a copy of suspend buffer sizes
Date: Tue, 1 Dec 2026 12:07:20 +0100	[thread overview]
Message-ID: <20261201120720.7ffe5598@fedora1.home> (raw)
In-Reply-To: <20261116112601.3483649-11-ketil.johnsen@arm.com>

On Mon, 16 Nov 2026 12:25:58 +0100
Ketil Johnsen <ketil.johnsen@arm.com> wrote:

> Store the suspend buffer sizes (normal and protected) provided by FW
> after FW start. Unsafe to read directly from FW as these will return
> zero between FW load and FW start.
> 
> Signed-off-by: Ketil Johnsen <ketil.johnsen@arm.com>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> 
> ---
> 
> v5:
> - First version of this patch in this patch set.
> - This change was previously in a different patch in the set.
> ---
>  drivers/gpu/drm/panthor/panthor_fw.c    | 25 +++++++++++++++++++++++++
>  drivers/gpu/drm/panthor/panthor_fw.h    |  3 +++
>  drivers/gpu/drm/panthor/panthor_sched.c |  6 +++---
>  3 files changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
> index fc07796fc9ef7..b565b362f401f 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -255,6 +255,12 @@ struct panthor_fw {
>  	/** @iface: FW interfaces. */
>  	struct panthor_fw_iface iface;
>  
> +	/** @suspend_size: Size of regular suspend buffer */
> +	u32 suspend_size;
> +
> +	/** @protm_suspend_size: Size of protected suspend buffer size */
> +	u32 protm_suspend_size;
> +
>  	/** @watchdog: Collection of fields relating to the FW watchdog. */
>  	struct {
>  		/** @ping_work: Delayed work used to ping the FW. */
> @@ -549,6 +555,16 @@ panthor_fw_alloc_suspend_buf_mem(struct panthor_device *ptdev, size_t size)
>  					"FW suspend buffer");
>  }
>  
> +u32 panthor_fw_suspend_size(struct panthor_device *ptdev)
> +{
> +	return ptdev->fw->suspend_size;
> +}
> +
> +u32 panthor_fw_protm_suspend_size(struct panthor_device *ptdev)
> +{
> +	return ptdev->fw->protm_suspend_size;
> +}
> +
>  static u32 section_vm_map_flags(const struct panthor_fw_section *section)
>  {
>  	u32 cache_mode = section->flags &
> @@ -985,6 +1001,15 @@ static int panthor_init_csg_iface(struct panthor_device *ptdev,
>  		return -EINVAL;
>  	}
>  
> +	if (!csg_idx) {
> +		/* We make a copy of these sizes, as csg_iface can read these
> +		 * as zero during full GPU reset, between FW sections being
> +		 * reloaded and FW fully booted.
> +		 */
> +		ptdev->fw->suspend_size = csg_iface->control->suspend_size;
> +		ptdev->fw->protm_suspend_size = csg_iface->control->protm_suspend_size;
> +	}
> +
>  	if (csg_idx > 0) {
>  		struct panthor_fw_csg_iface *first_csg_iface =
>  			panthor_fw_get_csg_iface(ptdev, 0);
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.h b/drivers/gpu/drm/panthor/panthor_fw.h
> index 4eda8f8e714c1..b3bf00191a96b 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.h
> +++ b/drivers/gpu/drm/panthor/panthor_fw.h
> @@ -511,6 +511,9 @@ panthor_fw_alloc_queue_iface_mem(struct panthor_device *ptdev,
>  struct panthor_kernel_bo *
>  panthor_fw_alloc_suspend_buf_mem(struct panthor_device *ptdev, size_t size);
>  
> +u32 panthor_fw_suspend_size(struct panthor_device *ptdev);
> +u32 panthor_fw_protm_suspend_size(struct panthor_device *ptdev);
> +
>  struct panthor_vm *panthor_fw_vm(struct panthor_device *ptdev);
>  
>  void panthor_fw_pre_reset(struct panthor_device *ptdev, bool on_hang);
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index ca6aa6a55661a..9c78f04d4f30a 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -4058,7 +4058,7 @@ int panthor_group_create(struct drm_file *file,
>  	struct panthor_scheduler *sched = ptdev->scheduler;
>  	struct panthor_fw_csg_iface *csg_iface = panthor_fw_get_csg_iface(ptdev, 0);
>  	struct panthor_group *group = NULL;
> -	u32 gid, i, suspend_size;
> +	u32 gid, i;
>  	int ret;
>  
>  	if (group_args->pad)
> @@ -4109,8 +4109,8 @@ int panthor_group_create(struct drm_file *file,
>  		goto err_put_group;
>  	}
>  
> -	suspend_size = csg_iface->control->suspend_size;
> -	group->suspend_buf = panthor_fw_alloc_suspend_buf_mem(ptdev, suspend_size);
> +	group->suspend_buf =
> +		panthor_fw_alloc_suspend_buf_mem(ptdev, panthor_fw_suspend_size(ptdev));
>  	if (IS_ERR(group->suspend_buf)) {
>  		ret = PTR_ERR(group->suspend_buf);
>  		group->suspend_buf = NULL;


  reply	other threads:[~2026-12-01 11:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 11:25 [PATCH v5 00/13] drm/panthor: Protected mode support for Mali CSF GPUs Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 01/13] drm/panthor: De-duplicate FW memory section sync Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 02/13] drm/panthor: Minor scheduler refactoring Ketil Johnsen
2026-11-27 16:36   ` Steven Price
2026-11-16 11:25 ` [PATCH v5 03/13] drm/panthor: Pass drm_file instead of panthor_file Ketil Johnsen
2026-11-27 16:53   ` Steven Price
2026-11-16 11:25 ` [PATCH v5 04/13] drm/panthor: Don't allocate protm_suspend_buf Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 05/13] drm/panthor: Add support for entering and exiting protected mode Ketil Johnsen
2026-11-30 17:17   ` Boris Brezillon
2026-12-01 11:05   ` Boris Brezillon
2026-11-16 11:25 ` [PATCH v5 06/13] drm/panthor: New function for FW section map flags Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 07/13] drm/panthor: Keep size and VA in FW section obj Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 08/13] drm/panthor: Refactor GEM usage flags assignment Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 09/13] drm/panthor: Create kernel BO from existing GEM Ketil Johnsen
2026-11-16 11:25 ` [PATCH v5 10/13] drm/panthor: Use a copy of suspend buffer sizes Ketil Johnsen
2026-12-01 11:07   ` Boris Brezillon [this message]
2026-11-16 11:25 ` [PATCH v5 11/13] drm/panthor: Support FW init of protm Ketil Johnsen
2026-11-16 18:00   ` kernel test robot
2026-12-01 11:21   ` Boris Brezillon
2026-11-16 11:26 ` [PATCH v5 12/13] drm/panthor: Protm support for groups Ketil Johnsen
2026-11-16 11:26 ` [PATCH v5 13/13] drm/panthor: Bump version to expose protm feature Ketil Johnsen

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=20261201120720.7ffe5598@fedora1.home \
    --to=boris.brezillon@collabora.com \
    --cc=airlied@gmail.com \
    --cc=akash.goel@arm.com \
    --cc=aliceryhl@google.com \
    --cc=chris.diamand@arm.com \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karunika.choo@arm.com \
    --cc=ketil.johnsen@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lukas.zapolskas@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --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®