From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B467CCCF2DF for ; Mon, 19 Oct 2026 08:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2L+09F9hyYJBtW2+9gGxzTO7Q7byd/UcjK8R6Uj43ZY=; b=2G4zih2UH/raoU/OOpasDErgAw P0IOoE6FiAhB8yPzQ5wbYPpy/RdqUhsiIhXCqzlv6CJdmIXGv33Tw0ezCX6tfDdIy1sYs2sXT4IEo 07x/gf4PWO4MFnaAFUl6UN0fPFI+5ZWPUM9+66bMGsrJcKVRijRHZmMMg7EUxAGNsuGbUA41qAAUN E/MsjfkLmX0xHMkUadti1l0eo6veGa4y6/EKhNKlRTVoI6OCfww+vcu3O9EltWMySMgjiestkCaW1 81x/rsE3GexgYkag0CBfbpZVaiQNjPfDmqVSD5ptpj86IgSPgRKM4Ol8vyaKh7TyAMDKjVUZYBf7K 9a3jYtrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xIjD8-00000006vHk-2mSF; Mon, 19 Oct 2026 08:59:14 +0000 Received: from mail-m127163.xmail.ntesmail.com ([115.236.127.163]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xIjD5-00000006vF5-1NAr; Mon, 19 Oct 2026 08:59:12 +0000 Received: from zyb-HP-ProDesk-680-G2-MT.. (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 5189b85e3; Mon, 19 Oct 2026 16:59:03 +0800 (GMT+08:00) From: Damon Ding To: Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jingoo Han , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Peter Griffin , Alim Akhtar , Heiko Stuebner Cc: Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Dmitry Baryshkov , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Damon Ding Subject: [PATCH v4 03/14] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Date: Mon, 19 Oct 2026 16:58:25 +0800 Message-Id: <20261019085836.3065008-4-damon.ding@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261019085836.3065008-1-damon.ding@rock-chips.com> References: <20261019085836.3065008-1-damon.ding@rock-chips.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0aa15362c34e03a8kunm6ee755052eac0c X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlCTEtDVkMfSRkdQ0lLGhoYGFYVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSU 9PT0hVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=V1piAwZ4pFZNkca7Quy0wrZqJ16Yv55AMW2BD0JHFk3gwaX1J/TOnS4zgEgUwakPbe/E2xoP0QOJj7b9+dBlontTlwd9Iy8x5bqsk1Bz7IbItDBEDbE1aAh1VNPc3DPDpaZZlrjcTgt9qaWJIFMLiRICbdWMgRH/YI3PecW3P6o=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=2L+09F9hyYJBtW2+9gGxzTO7Q7byd/UcjK8R6Uj43ZY=; h=date:mime-version:subject:message-id:from; X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261019_015911_696188_3B894DBB X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The threaded IRQ is requested without IRQF_ONESHOT, allowing hardirq to preempt the threaded handler. This creates a read-modify-write race on HPD interrupt mask registers between the hardirq mute and thread unmute operations. Add IRQF_ONESHOT to keep the IRQ line masked during thread execution, which eliminates the race and makes the per-event mute/unmute calls in hardirq and thread handlers redundant. Move interrupt status clearing to the beginning of the threaded handler, before drm_helper_hpd_irq_event(), to avoid losing events that arrive during the event handling. Tested-by: Heiko Stuebner Signed-off-by: Damon Ding --- Changes in v3: - Split out a separate commit to improve the return value checking for &analogix_dp_device.irq.(Sashiko) Changes in v4: - Add Tested-by tag. --- .../gpu/drm/bridge/analogix/analogix_dp_core.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 27c9a764e25f..974be5b702dc 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -704,10 +704,8 @@ static irqreturn_t analogix_dp_hardirq(int irq, void *arg) u32 irq_type; irq_type = analogix_dp_get_irq_type(dp); - if (irq_type) { - analogix_dp_mute_hpd_interrupt(dp); + if (irq_type) ret = IRQ_WAKE_THREAD; - } return ret; } @@ -718,6 +716,9 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg) u32 irq_type; irq_type = analogix_dp_get_irq_type(dp); + if (irq_type) + analogix_dp_clear_hotplug_interrupts(dp); + if (irq_type & DP_IRQ_TYPE_HP_CABLE_IN || irq_type & DP_IRQ_TYPE_HP_CABLE_OUT) { dev_dbg(dp->dev, "Detected cable status changed!\n"); @@ -725,11 +726,6 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg) drm_helper_hpd_irq_event(dp->drm_dev); } - if (irq_type) { - analogix_dp_clear_hotplug_interrupts(dp); - analogix_dp_unmute_hpd_interrupt(dp); - } - return IRQ_HANDLED; } @@ -1474,10 +1470,11 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) * that we can get the current state of the GPIO. */ dp->irq = gpiod_to_irq(dp->hpd_gpiod); - irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN; + irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN | + IRQF_ONESHOT; } else { dp->irq = platform_get_irq(pdev, 0); - irq_flags = IRQF_NO_AUTOEN; + irq_flags = IRQF_NO_AUTOEN | IRQF_ONESHOT; } if (dp->irq < 0) { -- 2.34.1