From patchwork Thu Apr 11 06:48:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 13625484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45866CD1292 for ; Thu, 11 Apr 2024 06:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RLsHIptH/ZBvQNWDL2xlndQrspKh1HNeU8561GP+chM=; b=rRmEqUC+X9uu09 vogRNKIuNLpqyNpTeEWNMrcD18YzlNrAdjtzD9f4KgsIF1mLUmLxJqtdEVXPFaS+H83zSFDnL+9BK aJUXsxRZ518B9+C/vtbWAneex28VEES/fX5MvxKyT7EmkICntrp4tIGDL5022xKnFY6zNmILp+sPF ygPStgK7kvb2nMvjytb+nQxGBbDG5h1eGjJhPvlxdQ9ETddd6zASVl0QEHbr3Hk6SBUOYuQ+IrK+X kEyVpbThgMcCdNTCtmzrm2daeI2qu7t1E7qZTjjF5JSN4FFmcgDUTzuLGh7uuhT426c24th+N5jKr h/47srLAaVHDPkgqYLGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoMK-0000000AhJW-15Ln; Thu, 11 Apr 2024 06:56:32 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoLz-0000000Ah30-04yC for linux-arm-kernel@bombadil.infradead.org; Thu, 11 Apr 2024 06:56:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=7u+D+dZZ76jD6exXcFiPUJi2n0c3ZnlbKevJlAmOa7M=; b=PNdQpohrXwv2X+r1yvdIjUXzjX /cRbGumfR50Jek/o8fAjxuQ3KGH4G7RxN2ZMxJ5Y+0QIh1w/X/3vhKieFCQgYsoGzZmb8rTjRd4Sy JZm/hlDg2SLfkpy0c+312SQomu8Q3ZO97/E8I+ak9lGKDGwGGm3EW8Qrgz+fIFGaoIFUZKuJj/q1X GTqyan40P9epH4bcADr7P26nU+nS8P0blEKGjUP/kyclEDeKxiAZJjwb3m/w53gKG7NPBVVL58/80 J1A0u/nirufRMdiPpWuh+QTQfsFM7+bUnUnDLdmLb8sqEEjlTy2VxB3bW47Xtg84AmGq89kko15OF 7W64znsg==; Received: from szxga04-in.huawei.com ([45.249.212.190]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoLo-00000008ROD-0Hvm for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 06:56:09 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VFVl84jfVz1yn2R; Thu, 11 Apr 2024 14:53:08 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id 3B58B140156; Thu, 11 Apr 2024 14:55:25 +0800 (CST) Received: from huawei.com (10.67.174.28) by kwepemd200013.china.huawei.com (7.221.188.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 11 Apr 2024 14:55:23 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v2 9/9] irqchip/gic-v3: Improve the maintainability of NMI masking in GIC driver Date: Thu, 11 Apr 2024 06:48:58 +0000 Message-ID: <20240411064858.3232574-10-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240411064858.3232574-1-liaochang1@huawei.com> References: <20240411064858.3232574-1-liaochang1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.28] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemd200013.china.huawei.com (7.221.188.133) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_075604_977068_10136962 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It has a better maintainability to use the local_nmi_enable() in GIC driver to unmask NMI and keep regular IRQ and FIQ maskable, instead of writing raw value into DAIF, PMR and ALLINT directly. Signed-off-by: Liao Chang --- arch/arm64/include/asm/daifflags.h | 13 +++++++++++++ drivers/irqchip/irq-gic-v3.c | 6 ++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/daifflags.h b/arch/arm64/include/asm/daifflags.h index b831def08bb3..1196eb85aa8d 100644 --- a/arch/arm64/include/asm/daifflags.h +++ b/arch/arm64/include/asm/daifflags.h @@ -330,4 +330,17 @@ static inline void local_errnmi_enable(void) irqflags.fields.allint = 0; local_allint_restore(irqflags); } + +/* + * local_nmi_enable - Enable NMI with or without superpriority. + */ +static inline void local_nmi_enable(void) +{ + arch_irqflags_t irqflags; + + irqflags.fields.daif = read_sysreg(daif); + irqflags.fields.pmr = GIC_PRIO_IRQOFF; + irqflags.fields.allint = 0; + local_allint_restore(irqflags); +} #endif diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 6fb276504bcc..ed7d8d87768f 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "irq-gic-common.h" @@ -813,10 +814,7 @@ static void __gic_handle_irq_from_irqson(struct pt_regs *regs) nmi_exit(); } - if (gic_prio_masking_enabled()) { - gic_pmr_mask_irqs(); - gic_arch_enable_irqs(); - } + local_nmi_enable(); if (!is_nmi) __gic_handle_irq(irqnr, regs);