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=-18.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 5F013C433DB for ; Wed, 17 Feb 2021 11:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28BD364E04 for ; Wed, 17 Feb 2021 11:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbhBQL40 (ORCPT ); Wed, 17 Feb 2021 06:56:26 -0500 Received: from foss.arm.com ([217.140.110.172]:57052 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbhBQLuR (ORCPT ); Wed, 17 Feb 2021 06:50:17 -0500 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 A999531B; Wed, 17 Feb 2021 03:49:29 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.46.232]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 623163F694; Wed, 17 Feb 2021 03:49:26 -0800 (PST) Date: Wed, 17 Feb 2021 11:49:23 +0000 From: Mark Rutland To: Hector Martin , Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, Rob Herring , Arnd Bergmann , Olof Johansson , Krzysztof Kozlowski , Mark Kettenis , Tony Lindgren , Mohamed Mediouni , Stan Skowronek , Alexander Graf , Will Deacon , Linus Walleij , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 09/25] arm64: entry: Map the FIQ vector to IRQ on NEEDS_FIQ platforms Message-ID: <20210217114923.GB5556@C02TD0UTHF1T.local> References: <20210215121713.57687-1-marcan@marcan.st> <20210215121713.57687-10-marcan@marcan.st> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210215121713.57687-10-marcan@marcan.st> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hector, On Mon, Feb 15, 2021 at 09:16:57PM +0900, Hector Martin wrote: > From: Marc Zyngier > > By default, FIQ exceptions trigger a panic. On platforms that need to > deliver interrupts via FIQ, this gets redirected via an alternative to > instead handle FIQ the same way as IRQ. It is up to the irqchip handler > to discriminate between the two. > > Signed-off-by: Marc Zyngier > Signed-off-by: Hector Martin Since the use of FIQ is a platform integration detail rather than a CPU implementation detail (and e.g. can differ across bare-metal and VM), I'd prefer to always have separate registered handlers for IRQ/FIQ (also avoiding the need for patching). That way we can explicitly opt-in to FIQ when required, and avoid edge-cases where an unexpected FIQ could livelock an unaware IRQ handler. Marc and I had a quick play with that, and I have a series of patches I've pushed to: https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/fiq git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/fiq ... which I'll post out shortly. Thanks, Mark. > --- > arch/arm64/kernel/entry.S | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index ba5f9aa379ce..bcfd1ac72636 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -547,18 +547,18 @@ SYM_CODE_START(vectors) > > kernel_ventry 1, sync // Synchronous EL1h > kernel_ventry 1, irq // IRQ EL1h > - kernel_ventry 1, fiq_invalid // FIQ EL1h > + kernel_ventry 1, fiq // FIQ EL1h > kernel_ventry 1, error // Error EL1h > > kernel_ventry 0, sync // Synchronous 64-bit EL0 > kernel_ventry 0, irq // IRQ 64-bit EL0 > - kernel_ventry 0, fiq_invalid // FIQ 64-bit EL0 > + kernel_ventry 0, fiq // FIQ 64-bit EL0 > kernel_ventry 0, error // Error 64-bit EL0 > > #ifdef CONFIG_COMPAT > kernel_ventry 0, sync_compat, 32 // Synchronous 32-bit EL0 > kernel_ventry 0, irq_compat, 32 // IRQ 32-bit EL0 > - kernel_ventry 0, fiq_invalid_compat, 32 // FIQ 32-bit EL0 > + kernel_ventry 0, fiq_compat, 32 // FIQ 32-bit EL0 > kernel_ventry 0, error_compat, 32 // Error 32-bit EL0 > #else > kernel_ventry 0, sync_invalid, 32 // Synchronous 32-bit EL0 > @@ -658,6 +658,10 @@ SYM_CODE_START_LOCAL_NOALIGN(el1_sync) > SYM_CODE_END(el1_sync) > > .align 6 > +SYM_CODE_START_LOCAL_NOALIGN(el1_fiq) > +alternative_if_not ARM64_NEEDS_FIQ > + b el1_fiq_invalid > +alternative_else_nop_endif > SYM_CODE_START_LOCAL_NOALIGN(el1_irq) > kernel_entry 1 > gic_prio_irq_setup pmr=x20, tmp=x1 > @@ -688,6 +692,7 @@ alternative_else_nop_endif > > kernel_exit 1 > SYM_CODE_END(el1_irq) > +SYM_CODE_END(el1_fiq) > > /* > * EL0 mode handlers. > @@ -710,10 +715,15 @@ SYM_CODE_START_LOCAL_NOALIGN(el0_sync_compat) > SYM_CODE_END(el0_sync_compat) > > .align 6 > +SYM_CODE_START_LOCAL_NOALIGN(el0_fiq_compat) > +alternative_if_not ARM64_NEEDS_FIQ > + b el0_fiq_invalid_compat > +alternative_else_nop_endif > SYM_CODE_START_LOCAL_NOALIGN(el0_irq_compat) > kernel_entry 0, 32 > b el0_irq_naked > SYM_CODE_END(el0_irq_compat) > +SYM_CODE_END(el0_fiq_compat) > > SYM_CODE_START_LOCAL_NOALIGN(el0_error_compat) > kernel_entry 0, 32 > @@ -722,6 +732,10 @@ SYM_CODE_END(el0_error_compat) > #endif > > .align 6 > +SYM_CODE_START_LOCAL_NOALIGN(el0_fiq) > +alternative_if_not ARM64_NEEDS_FIQ > + b el0_fiq_invalid > +alternative_else_nop_endif > SYM_CODE_START_LOCAL_NOALIGN(el0_irq) > kernel_entry 0 > el0_irq_naked: > @@ -736,6 +750,7 @@ el0_irq_naked: > > b ret_to_user > SYM_CODE_END(el0_irq) > +SYM_CODE_END(el0_fiq) > > SYM_CODE_START_LOCAL(el1_error) > kernel_entry 1 > -- > 2.30.0 > 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=-18.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,MENTIONS_GIT_HOSTING,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 AEFF9C433DB for ; Wed, 17 Feb 2021 11:52:58 +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 46E5A64DDA for ; Wed, 17 Feb 2021 11:52:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46E5A64DDA 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=m0iTvyopn+aACZ87XTiaq/1g2cW6CZxgM0TzVHSz8PQ=; b=TIgJsv75VY2spRHXo9fBjulXk InumAg7MM43RFpzQ0lDNgOJw+zdSYP1YQWc1dyxL9YgwsoZtMW1eupjsvhafYjpPfW3RjVkzhaMxU BvrXN9TLByd+WPsEYZrv8op9aWUMsY9uU7BVV0juwxjsS74c9foS+HmO8+YPVsr1MXDoJHry53Yon AL5uKec75uhFP5ExbEJZZnhoMUPFTFVSX8TGqSVK9eHYyRqSPJ4rGmMEUEz+EYEJJX7vQMRpPgoSh XdzNtQ8G9m2xe/afbmsS7hsbghdMr7C03qsGjLfbOui7sBDmelpH8+idjH+tPvWXyfx4JA61fTMlH j4vCdFmXw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCLMZ-0005Mz-HS; Wed, 17 Feb 2021 11:51:23 +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 1lCLKr-0004S7-FO for linux-arm-kernel@lists.infradead.org; Wed, 17 Feb 2021 11:49:38 +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 A999531B; Wed, 17 Feb 2021 03:49:29 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.46.232]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 623163F694; Wed, 17 Feb 2021 03:49:26 -0800 (PST) Date: Wed, 17 Feb 2021 11:49:23 +0000 From: Mark Rutland To: Hector Martin , Marc Zyngier Subject: Re: [PATCH v2 09/25] arm64: entry: Map the FIQ vector to IRQ on NEEDS_FIQ platforms Message-ID: <20210217114923.GB5556@C02TD0UTHF1T.local> References: <20210215121713.57687-1-marcan@marcan.st> <20210215121713.57687-10-marcan@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210215121713.57687-10-marcan@marcan.st> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210217_064937_698540_B899B3C6 X-CRM114-Status: GOOD ( 20.32 ) 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: Rob Herring , Arnd Bergmann , Tony Lindgren , 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:57PM +0900, Hector Martin wrote: > From: Marc Zyngier > > By default, FIQ exceptions trigger a panic. On platforms that need to > deliver interrupts via FIQ, this gets redirected via an alternative to > instead handle FIQ the same way as IRQ. It is up to the irqchip handler > to discriminate between the two. > > Signed-off-by: Marc Zyngier > Signed-off-by: Hector Martin Since the use of FIQ is a platform integration detail rather than a CPU implementation detail (and e.g. can differ across bare-metal and VM), I'd prefer to always have separate registered handlers for IRQ/FIQ (also avoiding the need for patching). That way we can explicitly opt-in to FIQ when required, and avoid edge-cases where an unexpected FIQ could livelock an unaware IRQ handler. Marc and I had a quick play with that, and I have a series of patches I've pushed to: https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/fiq git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/fiq ... which I'll post out shortly. Thanks, Mark. > --- > arch/arm64/kernel/entry.S | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index ba5f9aa379ce..bcfd1ac72636 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -547,18 +547,18 @@ SYM_CODE_START(vectors) > > kernel_ventry 1, sync // Synchronous EL1h > kernel_ventry 1, irq // IRQ EL1h > - kernel_ventry 1, fiq_invalid // FIQ EL1h > + kernel_ventry 1, fiq // FIQ EL1h > kernel_ventry 1, error // Error EL1h > > kernel_ventry 0, sync // Synchronous 64-bit EL0 > kernel_ventry 0, irq // IRQ 64-bit EL0 > - kernel_ventry 0, fiq_invalid // FIQ 64-bit EL0 > + kernel_ventry 0, fiq // FIQ 64-bit EL0 > kernel_ventry 0, error // Error 64-bit EL0 > > #ifdef CONFIG_COMPAT > kernel_ventry 0, sync_compat, 32 // Synchronous 32-bit EL0 > kernel_ventry 0, irq_compat, 32 // IRQ 32-bit EL0 > - kernel_ventry 0, fiq_invalid_compat, 32 // FIQ 32-bit EL0 > + kernel_ventry 0, fiq_compat, 32 // FIQ 32-bit EL0 > kernel_ventry 0, error_compat, 32 // Error 32-bit EL0 > #else > kernel_ventry 0, sync_invalid, 32 // Synchronous 32-bit EL0 > @@ -658,6 +658,10 @@ SYM_CODE_START_LOCAL_NOALIGN(el1_sync) > SYM_CODE_END(el1_sync) > > .align 6 > +SYM_CODE_START_LOCAL_NOALIGN(el1_fiq) > +alternative_if_not ARM64_NEEDS_FIQ > + b el1_fiq_invalid > +alternative_else_nop_endif > SYM_CODE_START_LOCAL_NOALIGN(el1_irq) > kernel_entry 1 > gic_prio_irq_setup pmr=x20, tmp=x1 > @@ -688,6 +692,7 @@ alternative_else_nop_endif > > kernel_exit 1 > SYM_CODE_END(el1_irq) > +SYM_CODE_END(el1_fiq) > > /* > * EL0 mode handlers. > @@ -710,10 +715,15 @@ SYM_CODE_START_LOCAL_NOALIGN(el0_sync_compat) > SYM_CODE_END(el0_sync_compat) > > .align 6 > +SYM_CODE_START_LOCAL_NOALIGN(el0_fiq_compat) > +alternative_if_not ARM64_NEEDS_FIQ > + b el0_fiq_invalid_compat > +alternative_else_nop_endif > SYM_CODE_START_LOCAL_NOALIGN(el0_irq_compat) > kernel_entry 0, 32 > b el0_irq_naked > SYM_CODE_END(el0_irq_compat) > +SYM_CODE_END(el0_fiq_compat) > > SYM_CODE_START_LOCAL_NOALIGN(el0_error_compat) > kernel_entry 0, 32 > @@ -722,6 +732,10 @@ SYM_CODE_END(el0_error_compat) > #endif > > .align 6 > +SYM_CODE_START_LOCAL_NOALIGN(el0_fiq) > +alternative_if_not ARM64_NEEDS_FIQ > + b el0_fiq_invalid > +alternative_else_nop_endif > SYM_CODE_START_LOCAL_NOALIGN(el0_irq) > kernel_entry 0 > el0_irq_naked: > @@ -736,6 +750,7 @@ el0_irq_naked: > > b ret_to_user > SYM_CODE_END(el0_irq) > +SYM_CODE_END(el0_fiq) > > SYM_CODE_START_LOCAL(el1_error) > kernel_entry 1 > -- > 2.30.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel