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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF3FBC433E0 for ; Wed, 17 Feb 2021 12:26:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69C5464E0F for ; Wed, 17 Feb 2021 12:26:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69C5464E0F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=D3FNctvs8wXjFalwEDI1u7AQe201gqDXvBYpvpDpEhA=; b=l47U5wmPpOU3FnDDE4EQw/EAt vY5+auDFzuMRFfCXfBEhsts/GL80mabmVTOoMlS6cp2VIGjc5bz+oiebnLwsNtGMZ6JFLEiVHBTJz kj3s/q5/Fi92kyPsznqx5dGo3f2W+yY3IgsfLjVt02RznMDBcvBHzT/F3zCuy9nyf4LUVt262EZt0 m2h2XDJ6K8TtmySp2CII3WZWnKIqyVsUi/APZlbKYx3pGprSRFU1vuWFOOr254fz9tQqQsysoGoEt s3WNlpF3Si7Gwsaji6KwnAJJNGAzUWiLRaH9xwdiMQbjOsqM6p90/JqP1OqUiRBAaZDmRascuW9Xu TRJ2EwS1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCLqQ-0001HG-Li; Wed, 17 Feb 2021 12:22:14 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCLqO-0001Gr-Rc for linux-arm-kernel@lists.infradead.org; Wed, 17 Feb 2021 12:22:13 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 246671042; Wed, 17 Feb 2021 04:22:07 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.46.232]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 630103F694; Wed, 17 Feb 2021 04:22:03 -0800 (PST) Date: Wed, 17 Feb 2021 12:22:00 +0000 From: Mark Rutland To: Hector Martin Subject: Re: [PATCH v2 08/25] arm64: Always keep DAIF.[IF] in sync Message-ID: <20210217122200.GC5556@C02TD0UTHF1T.local> References: <20210215121713.57687-1-marcan@marcan.st> <20210215121713.57687-9-marcan@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210215121713.57687-9-marcan@marcan.st> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210217_072213_184534_5CA68A1F X-CRM114-Status: GOOD ( 33.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Rob Herring , Tony Lindgren , Marc Zyngier , Linus Walleij , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Alexander Graf , Olof Johansson , Mohamed Mediouni , Stan Skowronek , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Kettenis Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Hector, On Mon, Feb 15, 2021 at 09:16:56PM +0900, Hector Martin wrote: > Apple SoCs (A11 and newer) have some interrupt sources hardwired to the > FIQ line. We implement support for this by simply treating IRQs and FIQs > the same way in the interrupt vectors. > > To support these systems, the FIQ mask bit needs to be kept in sync with > the IRQ mask bit, so both kinds of exceptions are masked together. No > other platforms should be delivering FIQ exceptions right now, and we > already unmask FIQ in normal process context, so this should not have an > effect on other systems - if spurious FIQs were arriving, they would > already panic the kernel. Keeping these in sync sounds fine to me, FWIW. > Root irqchip drivers can discriminate between IRQs and FIQs by checking > the ISR_EL1 system register. I think we can remove this note for now. If we go with seperate handlers this won't be necessary, and if not this would be better placed on a commit adding the FIQ handling capability. > Signed-off-by: Hector Martin > --- > arch/arm64/include/asm/assembler.h | 6 +++--- > arch/arm64/include/asm/daifflags.h | 4 ++-- > arch/arm64/include/asm/irqflags.h | 19 +++++++++++-------- > arch/arm64/kernel/entry.S | 6 +++--- > 4 files changed, 19 insertions(+), 16 deletions(-) Judging by `git grep -Wi daif -- arch/arm64`, with this patch applied, we'll also need fixups in: * gic_arch_enable_irqs() in arch/arm64/include/asm/arch_gicv3.h * save_and_disable_irq() in arch/arm64/include/asm/assembler.h (noted below) * local_daif_save_flags() in arch/arm64/include/asm/daifflags.h (the fake DAIF should have F set too) * __cpu_do_idle_irqprio() in arch/arm64/kernel/process.c > diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h > index bf125c591116..ac4c823bf2b6 100644 > --- a/arch/arm64/include/asm/assembler.h > +++ b/arch/arm64/include/asm/assembler.h > @@ -40,9 +40,9 @@ > msr daif, \flags > .endm > > - /* IRQ is the lowest priority flag, unconditionally unmask the rest. */ > - .macro enable_da_f > - msr daifclr, #(8 | 4 | 1) > + /* IRQ/FIQ are the lowest priority flags, unconditionally unmask the rest. */ > + .macro enable_da > + msr daifclr, #(8 | 4) > .endm I think save_and_diable_irq below needs to be updated too, since it only sets DAIF.I and leaves DAIF.F as-is. [...] > diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h > index ff328e5bbb75..125201dced5f 100644 > --- a/arch/arm64/include/asm/irqflags.h > +++ b/arch/arm64/include/asm/irqflags.h > @@ -12,15 +12,18 @@ > > /* > * Aarch64 has flags for masking: Debug, Asynchronous (serror), Interrupts and > - * FIQ exceptions, in the 'daif' register. We mask and unmask them in 'dai' > + * FIQ exceptions, in the 'daif' register. We mask and unmask them in 'daif' > * order: > * Masking debug exceptions causes all other exceptions to be masked too/ > - * Masking SError masks irq, but not debug exceptions. Masking irqs has no > - * side effects for other flags. Keeping to this order makes it easier for > - * entry.S to know which exceptions should be unmasked. > + * Masking SError masks IRQ/FIQ, but not debug exceptions. IRQ and FIQ are > + * always masked and unmasked together, and have no side effects for other > + * flags. Keeping to this order makes it easier for entry.S to know which > + * exceptions should be unmasked. > * This sounds good. > - * FIQ is never expected, but we mask it when we disable debug exceptions, and > - * unmask it at all other times. > + * FIQ is never expected on most platforms, but we keep it synchronized > + * with the IRQ mask status. On platforms that do not expect FIQ, that vector > + * triggers a kernel panic. On platforms that do, the FIQ vector is unified > + * with the IRQ vector. > */ Can we please delete this bit, though? Now that we say IRQ and FIQ are masked/unmasked together, I don't think the rest is necessary to understand the masking logic, and it's one less thing to keep in sync with changes to the entry code. Otherwise this looks good to me. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel