From: Boris Brezillon <boris.brezillon@collabora.com>
To: Akash Goel <akash.goel@arm.com>
Cc: liviu.dudau@arm.com, steven.price@arm.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
mihail.atanassov@arm.com, ketil.johnsen@arm.com,
florent.tomasin@arm.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
daniel@ffwll.ch, nd@arm.com
Subject: Re: [PATCH 2/3] drm/panthor: Explicitly set the coherency mode
Date: Thu, 24 Oct 2024 17:51:27 +0200 [thread overview]
Message-ID: <20241024175127.6c3fcf88@collabora.com> (raw)
In-Reply-To: <20241024145432.934086-3-akash.goel@arm.com>
On Thu, 24 Oct 2024 15:54:31 +0100
Akash Goel <akash.goel@arm.com> wrote:
> This commit fixes the potential misalignment between the value of device
> tree property "dma-coherent" and default value of COHERENCY_ENABLE
> register.
> Panthor driver didn't explicitly program the COHERENCY_ENABLE register
> with the desired coherency mode. The default value of COHERENCY_ENABLE
> register is implementation defined, so it may not be always aligned with
> the "dma-coherent" property value.
> The commit also checks the COHERENCY_FEATURES register to confirm that
> the coherency protocol is actually supported or not.
>
> Signed-off-by: Akash Goel <akash.goel@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_device.c | 22 +++++++++++++++++++++-
> drivers/gpu/drm/panthor/panthor_gpu.c | 9 +++++++++
> 2 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> index 4082c8f2951d..984615f4ed27 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.c
> +++ b/drivers/gpu/drm/panthor/panthor_device.c
> @@ -22,6 +22,24 @@
> #include "panthor_regs.h"
> #include "panthor_sched.h"
>
> +static int panthor_gpu_coherency_init(struct panthor_device *ptdev)
> +{
> + ptdev->coherent = device_get_dma_attr(ptdev->base.dev) == DEV_DMA_COHERENT;
> +
> + if (!ptdev->coherent)
> + return 0;
> +
> + /* Check if the ACE-Lite coherency protocol is actually supported by the GPU.
> + * ACE protocol has never been supported for command stream frontend GPUs.
> + */
> + if ((gpu_read(ptdev, GPU_COHERENCY_FEATURES) &
> + GPU_COHERENCY_PROT_BIT(ACE_LITE)))
> + return 0;
> +
> + drm_err(&ptdev->base, "Coherency not supported by the device");
> + return -ENOTSUPP;
> +}
> +
> static int panthor_clk_init(struct panthor_device *ptdev)
> {
> ptdev->clks.core = devm_clk_get(ptdev->base.dev, NULL);
> @@ -156,7 +174,9 @@ int panthor_device_init(struct panthor_device *ptdev)
> struct page *p;
> int ret;
>
> - ptdev->coherent = device_get_dma_attr(ptdev->base.dev) == DEV_DMA_COHERENT;
> + ret = panthor_gpu_coherency_init(ptdev);
> + if (ret)
> + return ret;
>
> init_completion(&ptdev->unplug.done);
> ret = drmm_mutex_init(&ptdev->base, &ptdev->unplug.lock);
> diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
> index 5251d8764e7d..1e24f08a519a 100644
> --- a/drivers/gpu/drm/panthor/panthor_gpu.c
> +++ b/drivers/gpu/drm/panthor/panthor_gpu.c
> @@ -77,6 +77,12 @@ static const struct panthor_model gpu_models[] = {
> GPU_IRQ_RESET_COMPLETED | \
> GPU_IRQ_CLEAN_CACHES_COMPLETED)
>
> +static void panthor_gpu_coherency_set(struct panthor_device *ptdev)
> +{
> + gpu_write(ptdev, GPU_COHERENCY_PROTOCOL,
> + ptdev->coherent ? GPU_COHERENCY_PROT_BIT(ACE_LITE) : GPU_COHERENCY_NONE);
> +}
> +
> static void panthor_gpu_init_info(struct panthor_device *ptdev)
> {
> const struct panthor_model *model;
> @@ -365,6 +371,9 @@ int panthor_gpu_l2_power_on(struct panthor_device *ptdev)
> hweight64(ptdev->gpu_info.shader_present));
> }
>
> + /* Set the desired coherency mode before the power up of L2 */
> + panthor_gpu_coherency_set(ptdev);
> +
> return panthor_gpu_power_on(ptdev, L2, 1, 20000);
> }
>
next prev parent reply other threads:[~2024-10-24 15:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 14:54 [PATCH 0/3] drm/panthor: Coherency related fixes Akash Goel
2024-10-24 14:54 ` [PATCH 1/3] drm/panthor: Update memattr programing to align with GPU spec Akash Goel
2024-10-24 15:49 ` Boris Brezillon
2024-10-25 9:24 ` Liviu Dudau
2024-10-25 12:31 ` Boris Brezillon
2024-10-25 10:03 ` Steven Price
2024-10-24 14:54 ` [PATCH 2/3] drm/panthor: Explicitly set the coherency mode Akash Goel
2024-10-24 15:51 ` Boris Brezillon [this message]
2024-10-25 9:29 ` Liviu Dudau
2024-10-25 10:03 ` Steven Price
2024-10-24 14:54 ` [PATCH 3/3] drm/panthor: Prevent potential overwrite of buffer objects Akash Goel
2024-10-24 15:39 ` Boris Brezillon
2024-10-31 21:42 ` Akash Goel
2024-11-04 11:16 ` Boris Brezillon
2024-11-04 12:49 ` Akash Goel
2024-11-04 13:41 ` Boris Brezillon
2024-10-30 15:46 ` [PATCH 0/3] drm/panthor: Coherency related fixes Boris Brezillon
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=20241024175127.6c3fcf88@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=akash.goel@arm.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=florent.tomasin@arm.com \
--cc=ketil.johnsen@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mihail.atanassov@arm.com \
--cc=mripard@kernel.org \
--cc=nd@arm.com \
--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 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.