linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Bibby Hsieh <bibby.hsieh@mediatek.com>
To: David Airlie <airlied@linux.ie>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	<dri-devel@lists.freedesktop.org>,
	<linux-mediatek@lists.infradead.org>
Cc: drinkcat@chromium.org, Bibby Hsieh <bibby.hsieh@mediatek.com>,
	srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org,
	tfiga@chromium.org, CK Hu <ck.hu@mediatek.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/7] drm/mediatek: put "event" in critical section
Date: Tue, 26 Nov 2019 14:29:27 +0800	[thread overview]
Message-ID: <20191126062932.19773-3-bibby.hsieh@mediatek.com> (raw)
In-Reply-To: <20191126062932.19773-1-bibby.hsieh@mediatek.com>

The state->base.event variable would be access by thread context
in mtk_drm_crtc_atomic_begin() or by interrupt context in
mtk_drm_crtc_finish_page_flip(), so each part should be a critical
section. Fix it.

Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")

Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 68b92adc96bb..e38506d7a4e8 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -486,12 +486,15 @@ static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc,
 	if (mtk_crtc->event && state->base.event)
 		DRM_ERROR("new event while there is still a pending event\n");
 
+	spin_lock_irq(&crtc->dev->event_lock);
 	if (state->base.event) {
 		state->base.event->pipe = drm_crtc_index(crtc);
 		WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+		WARN_ON(mtk_crtc->event);
 		mtk_crtc->event = state->base.event;
 		state->base.event = NULL;
 	}
+	spin_unlock_irq(&crtc->dev->event_lock);
 }
 
 static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  parent reply	other threads:[~2019-11-26  6:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  6:29 [PATCH 0/7] drm/mediatek: fix cursor issue and apply CMDQ in Bibby Hsieh
2019-11-26  6:29 ` [PATCH 1/7] drm/mediatek: fix atomic_state reference counting Bibby Hsieh
2019-11-26  8:49   ` Daniel Vetter
2019-11-27  1:41     ` Bibby Hsieh
2019-11-27  9:56       ` Daniel Vetter
2019-11-28  2:34         ` Bibby Hsieh
2019-11-26  6:29 ` Bibby Hsieh [this message]
2019-11-26  6:29 ` [PATCH 3/7] drm/mediatek: use DRM core's atomic commit helper Bibby Hsieh
2019-11-26  6:29 ` [PATCH 4/7] drm/mediatek: handle events when enabling/disabling crtc Bibby Hsieh
2019-11-26  6:29 ` [PATCH 5/7] drm/mediatek: update cursors by using async atomic update Bibby Hsieh
2019-11-26  6:29 ` [PATCH 6/7] drm/mediatek: support CMDQ interface in ddp component Bibby Hsieh
2019-11-26  6:29 ` [PATCH 7/7] drm/mediatek: apply CMDQ control flow Bibby Hsieh

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=20191126062932.19773-3-bibby.hsieh@mediatek.com \
    --to=bibby.hsieh@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=ck.hu@mediatek.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=drinkcat@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=thierry.reding@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).