[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADL8D3Ykxbz7W=Av774sk9HaEnvneLNZcxmGsGaL2XDEFgpzAw@mail.gmail.com>
Date: Mon, 21 Oct 2024 11:14:53 -0400
From: Jon Cormier <jcormier@...ticallink.com>
To: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Cc: Devarsh Thakkar <devarsht@...com>, Jyri Sarha <jyri.sarha@....fi>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH 6/7] drm/tidss: Fix race condition while handling
interrupt registers
On Mon, Oct 21, 2024 at 10:08 AM Tomi Valkeinen
<tomi.valkeinen@...asonboard.com> wrote:
>
> From: Devarsh Thakkar <devarsht@...com>
>
> The driver has a spinlock for protecting the irq_masks field and irq
> enable registers. However, the driver misses protecting the irq status
> registers which can lead to races.
>
> Take the spinlock when accessing irqstatus too.
>
> Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")
> Cc: stable@...r.kernel.org
> Signed-off-by: Devarsh Thakkar <devarsht@...com>
> [Tomi: updated the desc]
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
> ---
> drivers/gpu/drm/tidss/tidss_dispc.c | 4 ++++
> drivers/gpu/drm/tidss/tidss_irq.c | 2 ++
> 2 files changed, 6 insertions(+)
Reviewed-by: Jonathan Cormier <jcormier@...ticallink.com>
Tested an equivalent patch for several weeks.
Tested-by: Jonathan Cormier <jcormier@...ticallink.com>
>
> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
> index 515f82e8a0a5..07f5c26cfa26 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c
> @@ -2767,8 +2767,12 @@ static void dispc_init_errata(struct dispc_device *dispc)
> */
> static void dispc_softreset_k2g(struct dispc_device *dispc)
> {
> + unsigned long flags;
> +
> + spin_lock_irqsave(&dispc->tidss->wait_lock, flags);
> dispc_set_irqenable(dispc, 0);
> dispc_read_and_clear_irqstatus(dispc);
> + spin_unlock_irqrestore(&dispc->tidss->wait_lock, flags);
>
> for (unsigned int vp_idx = 0; vp_idx < dispc->feat->num_vps; ++vp_idx)
> VP_REG_FLD_MOD(dispc, vp_idx, DISPC_VP_CONTROL, 0, 0, 0);
> diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
> index 3cc4024ec7ff..8af4682ba56b 100644
> --- a/drivers/gpu/drm/tidss/tidss_irq.c
> +++ b/drivers/gpu/drm/tidss/tidss_irq.c
> @@ -60,7 +60,9 @@ static irqreturn_t tidss_irq_handler(int irq, void *arg)
> unsigned int id;
> dispc_irq_t irqstatus;
>
> + spin_lock(&tidss->wait_lock);
> irqstatus = dispc_read_and_clear_irqstatus(tidss->dispc);
> + spin_unlock(&tidss->wait_lock);
>
> for (id = 0; id < tidss->num_crtcs; id++) {
> struct drm_crtc *crtc = tidss->crtcs[id];
>
> --
> 2.43.0
>
Powered by blists - more mailing lists