[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240409012344.3194724-10-liaochang1@huawei.com>
Date: Tue, 9 Apr 2024 01:23:44 +0000
From: Liao Chang <liaochang1@...wei.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <maz@...nel.org>,
<oliver.upton@...ux.dev>, <james.morse@....com>, <suzuki.poulose@....com>,
<yuzenghui@...wei.com>, <tglx@...utronix.de>, <mark.rutland@....com>,
<ardb@...nel.org>, <broonie@...nel.org>, <liaochang1@...wei.com>,
<anshuman.khandual@....com>, <miguel.luis@...cle.com>, <joey.gouly@....com>,
<ryan.roberts@....com>, <jeremy.linton@....com>, <liwei391@...wei.com>,
<daniel.thompson@...aro.org>, <sumit.garg@...aro.org>,
<kristina.martsenko@....com>, <jpoimboe@...nel.org>, <ericchancf@...gle.com>,
<robh@...nel.org>, <scott@...amperecomputing.com>,
<songshuaishuai@...ylab.org>, <shijie@...amperecomputing.com>,
<bhe@...hat.com>, <akpm@...ux-foundation.org>, <thunder.leizhen@...wei.com>,
<horms@...nel.org>, <rmk+kernel@...linux.org.uk>, <takakura@...inux.co.jp>,
<dianders@...omium.org>, <swboyd@...omium.org>, <frederic@...nel.org>,
<reijiw@...gle.com>, <akihiko.odaki@...nix.com>, <ruanjinjie@...wei.com>
CC: <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<kvmarm@...ts.linux.dev>
Subject: [PATCH 9/9] irqchip/gic-v3: Improve the maintainability of NMI masking in GIC driver
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 <liaochang1@...wei.com>
---
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 <asm/exception.h>
#include <asm/smp_plat.h>
#include <asm/virt.h>
+#include <asm/daifflags.h>
#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);
--
2.34.1
Powered by blists - more mailing lists