Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1889060pxb; Mon, 13 Sep 2021 07:35:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9U4foFyQ5d1aDNt2Zy7xRb3PabuvHMUMwCTN4Pa3bnd7nuuyA1ryLrjtUisqe8cNQTJ8x X-Received: by 2002:a05:6402:229c:: with SMTP id cw28mr10174648edb.356.1631543703916; Mon, 13 Sep 2021 07:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631543703; cv=none; d=google.com; s=arc-20160816; b=cPDD4vwJRGLWflaITlCw97p/5vJolW+PRVheewVtrK0oQdIOILUWdZY7IcQqpcp1bW 0+YXBgF1J/cxr13SkDbDWwo/D2FLqd5iFoMjCluvfhvql3dM6Wt5LpcqNd9SxhCkZRYZ 8yzcJFubNSbp2xvxKuKnHt7odKt/zSkWLdQzF4bgS50EyrVFs4r5JWEzq9tCDpu8k5jf nQz/pmlpmfKkiOYc8zOVQUDWeri/6+X+6treUXPc40Zi9f3ihNL8iGkLgbD+s9uDujzT mKcYN1QuMQjuG3ryHR12ClULKo0FfHcZ05gIFLBYMfqnhyovX/ST2ouuGMZGbi5GMvpR m55Q== 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=UQc3C1B/yXOpOLQFY80aSFx7spM7yWMUZ6l+Ru7VE/A=; b=MM0fuiK8iWXCiHTn3zhNhHhYvW753zHVL0N2nX5GcgD46f/PMxK1oKDWKvFn42Ps3r GLgBV/k1ZrRUeu/DDCGp2Nx7Bs93SWxOKmeD9IAcUEKKQCjVKVbe8wZFtpX25496sx61 I0nImV1aEdk5HKcZsc+GLiK/WWYN/aygQYyxbEx6zmOOpCgT9hgfIm+Fsr/0fR6rcAAi 8OUjh4LuRB5kmEANbCBlCPv/4teyaehsaIqMsLpwvNw4beHjvSerijrXkxd6LXJLmXXY qrl2UbsGyLgAf5C2HxB7/3gfcjJx+XNDpBHFqMOEQuWqaceVeSYVSdh1o+KWX/QCBALG XiHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imVBZjxv; 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 t14si7456964ejy.51.2021.09.13.07.34.37; Mon, 13 Sep 2021 07:35:03 -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=imVBZjxv; 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 S1345515AbhIMOcR (ORCPT + 99 others); Mon, 13 Sep 2021 10:32:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:46962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345462AbhIMO0b (ORCPT ); Mon, 13 Sep 2021 10:26:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BD7E61B62; Mon, 13 Sep 2021 13:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540948; bh=lTmFjbFJNaynfMHEyg/jKzXMsCObDxdudbkUztee5/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imVBZjxvbzCbE9yj2B/2rMdahJiEIMtNE55ShHNXXoQSDnepiDPXF/qsOKCvPbmHc GgQMZ9tNnEaDgv1puIN4hYVcXbuwIFKBB9UrXRNAEmks43trGig5yz8qSparC80JEa Spr1FcDN4h5VD5jMA8vB+cBC+tJH+k7usNvLkhKY= 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.14 068/334] irqchip/apple-aic: Fix irq_disable from within irq handlers Date: Mon, 13 Sep 2021 15:12:02 +0200 Message-Id: <20210913131115.707554063@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131113.390368911@linuxfoundation.org> References: <20210913131113.390368911@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 b8c06bd8659e..6fc145aacaf0 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -226,7 +226,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