Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp133236pxb; Mon, 13 Sep 2021 15:05:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5IAxo1Kj5JUdqwQZ2XDkSVguN5saEmZcwRI68Tib26DvfL26T/N8hZhStzL0TaPu2ngs8 X-Received: by 2002:a17:907:7664:: with SMTP id kk4mr14623739ejc.362.1631570745023; Mon, 13 Sep 2021 15:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631570745; cv=none; d=google.com; s=arc-20160816; b=Xk7b2yi83s7LJd1cI6PMYLFH+Xqdq65zzLGdDRkzgKABw2mK0BLi3dZ3cZ5+m/HCC3 +BeXai7pSoVUDAYh/XMRXMFC+XBXHbX23Wb/6mlynWygDZBvpuUnEWenVFinHBcNNIcq TEX9bOh/X+7Gue1iwTj1Zrm7CWzGnI4myShwdlRhsYd7wzHtgKBMAC+ZG7p7ZKfc2cGt W/a4dG7dgngtWote76O3uiC0F8cIxC1ouK57cVu8ukipuerMqmxUZxKiQS9Bbz48tvDH gxdSMsaX54AshUlI4rNx3t71z0IIdNILvt5vY9Bt6CT0HMtVljmp1gNpxnIc/U5j1Vo1 Hh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HqHMgQRbDCAHTBNS4T2KE4QoAym5QHVzj4XMSQe2tos=; b=R8PBX25MhF30c1VJcdv91mmyeyZGavEp5SGwWC3UgP0lUWVJIaBE6GoQRkMEpdEI36 Bx24yTN75MJytO6eJx9WkjQ2lztlvG2yQCc1Wa1Hi4/9UB1cZ8V0IvuxO7TBinQ1Wy9J /dmDy43/nX2yIdaER9P77S5p0N8B3J9TqVu3o5xmX0Sd+5YmmD6hADbR5Wz3M90ITngD +z73+hQ7QksRmjprwCozpWkIKMbsq5uNGCRudrPWi6k+1eyLGp9j93AxaiSfKDqxNIFY /VPh63JKmMgBC0NKa7tM8rqBU14eYQdne8ijNVuP/HtIOu1Ar7hZnQnzqR/ZqugqAbfX H2Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=opbsK47F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn9si8285527ejc.550.2021.09.13.15.05.21; Mon, 13 Sep 2021 15:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=opbsK47F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244638AbhIMN57 (ORCPT + 99 others); Mon, 13 Sep 2021 09:57:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:40310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244824AbhIMNzh (ORCPT ); Mon, 13 Sep 2021 09:55:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 81FB46124A; Mon, 13 Sep 2021 13:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540134; bh=E6Ko0Dh8PQIrm2t1fWvgN2n4AudnrxF/bkAePU23Rgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=opbsK47FLiGj7uc/9trZ8yw/X/qlm15rFikLSDXdEQuDGPX543Bxq++akRk2xIJQ+ thn4lUIcsrr4HxvoJH0+zYcU2zQtTAQZ4loZ0cOU7PnFQQ5O0exZuAr9axCvhig1Al HqU823plZBLarevORxiNy4CV5siEs3x+DsSu6EzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Peter , Hector Martin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.13 066/300] irqchip/apple-aic: Fix irq_disable from within irq handlers Date: Mon, 13 Sep 2021 15:12:07 +0200 Message-Id: <20210913131111.595522253@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131109.253835823@linuxfoundation.org> References: <20210913131109.253835823@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Peter [ Upstream commit 60a1cd10b222e004f860d14651e80089c77e8e6b ] When disable_irq_nosync for an interrupt is called from within its interrupt handler, this interrupt is only marked as disabled with the intention to mask it when it triggers again. The AIC hardware however automatically masks the interrupt when it is read. aic_irq_eoi then unmasks it again if it's not disabled *and* not masked. This results in a state mismatch between the hardware state and the state kept in irq_data: The hardware interrupt is masked but IRQD_IRQ_MASKED is not set. Any further calls to unmask_irq will directly return and the interrupt can never be enabled again. Fix this by keeping the hardware and irq_data state in sync by unmasking in aic_irq_eoi if and only if the irq_data state also assumes the interrupt to be unmasked. Fixes: 76cde2639411 ("irqchip/apple-aic: Add support for the Apple Interrupt Controller") Signed-off-by: Sven Peter Acked-by: Hector Martin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20210812100942.17206-1-sven@svenpeter.dev Signed-off-by: Sasha Levin --- drivers/irqchip/irq-apple-aic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index c179e27062fd..151aab408fa6 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -225,7 +225,7 @@ static void aic_irq_eoi(struct irq_data *d) * Reading the interrupt reason automatically acknowledges and masks * the IRQ, so we just unmask it here if needed. */ - if (!irqd_irq_disabled(d) && !irqd_irq_masked(d)) + if (!irqd_irq_masked(d)) aic_irq_unmask(d); } -- 2.30.2