Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6411112pxb; Wed, 17 Feb 2021 03:59:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5n7Zt9mbksHlApsthyQ16u5MfnRY1/0XCNZFib/0cny6yFz4xhkAQiO84AD3dnBS8RnfJ X-Received: by 2002:a50:9ecf:: with SMTP id a73mr25344271edf.181.1613563164650; Wed, 17 Feb 2021 03:59:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613563164; cv=none; d=google.com; s=arc-20160816; b=jnjB9eOxA3FphWdkbkpy2lsvc+KDt4eA0sPJa0NhHLZjTX7d+6ftO6uHLwQisgySt/ /wNlOruX6CXRIMFgtTe3D60on4pk3y/Ii+iG/dwF2UWsIEtCUJM+0RTYskfxeAGICmmz SXFjBFCZTfyiSnqH1oO4PXsWYakbjzy8Z9QHtTvinaVfbtMvxLI7tvpyDV975F7O1MdQ C+5wfAidbHYDGx+uWVVzSdqv42iN9VTJ9/0vNO5JyD/SnS8VRwnXjK8twwITwXBEhIu2 lyjGN5gNixi4GavZeOI58AQ7q4QFmaWvfasSaI9h1jxv7KTzQml5TwHRxS8vkoi1+HZ4 5kQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=JnaRncX/N0A4yLJ7500aAb4PVozsLk9zZXP4urMMmhM=; b=TkaBsmo+Pjnjabd6YB1jfoVuenLba3t++Ayy2XYIR0hqJ6w9wC5qzSE23HLjnwOgKF fmNfE11iKB3VSSzzKwLjjyL6At5LQ58CD4pIrYMBSoLmkTKZqfimcxP9Kn23jCrqNOWi GNUmcFvHKfpDZR2ReSJZLt84nbWnmHniVFBol1auDKmHYM5hSo3t/AgenULxN8kcRq7s FENMONLKfeOCn7lIHUlnNibzJrcjvQcjjxwrSD+8kHR9g1kMBCyPNV+spTrUnYU3liQN WM+mj0+/4F6uJJIzI7M3ODyCqYodQfIDBUzA5/7kwQRyDnpC+SywRrxP9JksStzDcOF/ pyfA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj18si804438edb.422.2021.02.17.03.59.02; Wed, 17 Feb 2021 03:59:24 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232463AbhBQL4L (ORCPT + 99 others); Wed, 17 Feb 2021 06:56:11 -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 >