[PATCH v4 08/12] ACPI / APEI: Split fixmap pages for arm64 NMI-like notifications
From: james.morse@arm.com (James Morse)
Date: 2018-05-16 16:28:25
Also in:
kvmarm, linux-acpi
Subsystem:
acpi, acpi apei, arm64 port (aarch64 architecture), the rest · Maintainers:
"Rafael J. Wysocki", Catalin Marinas, Will Deacon, Linus Torvalds
Now that ghes uses the fixmap addresses and locks via some indirection
we can support multiple NMI-like notifications on arm64.
These should be named after their notification method. x86's
NOTIFY_NMI already is, move it to live with the ghes_nmi list.
Change the SEA fixmap entry to be called FIX_APEI_GHES_SEA.
Future patches can add support for FIX_APEI_GHES_SEI and
FIX_APEI_GHES_SDEI_{NORMAL,CRITICAL}.
Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Punit Agrawal <redacted>
Tested-by: Tyler Baicar <redacted>
---
Changes since v3:
* idx/lock are now in a separate struct.
* Add to the comment above ghes_fixmap_lock_irq so that it makes more
sense in isolation.
arch/arm64/include/asm/fixmap.h | 4 +++-
drivers/acpi/apei/ghes.c | 12 ++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h
index ec1e6d6fa14c..c3974517c2cb 100644
--- a/arch/arm64/include/asm/fixmap.h
+++ b/arch/arm64/include/asm/fixmap.h@@ -55,7 +55,9 @@ enum fixed_addresses { #ifdef CONFIG_ACPI_APEI_GHES /* Used for GHES mapping from assorted contexts */ FIX_APEI_GHES_IRQ, - FIX_APEI_GHES_NMI, +#ifdef CONFIG_ACPI_APEI_SEA + FIX_APEI_GHES_SEA, +#endif #endif /* CONFIG_ACPI_APEI_GHES */ #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 13bb3bb94fbd..014966bdd0a7 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c@@ -117,8 +117,10 @@ static DEFINE_MUTEX(ghes_list_mutex); * from BIOS to Linux can be determined only in NMI, IRQ or timer * handler, but general ioremap can not be used in atomic context, so * the fixmap is used instead. + * This lock protects access to the FIX_APEI_GHES_IRQ entry. + * NMI-like notifications use DEFINE_GHES_NMI_FIXMAP() to pair a fixmap + * entry and a lock. */ -static DEFINE_GHES_NMI_FIXMAP(nmi_fixmap, FIX_APEI_GHES_NMI); static DEFINE_SPINLOCK(ghes_fixmap_lock_irq); static struct gen_pool *ghes_estatus_pool;
@@ -948,6 +950,7 @@ static struct notifier_block ghes_notifier_hed = { #ifdef CONFIG_ACPI_APEI_SEA static LIST_HEAD(ghes_sea); +static DEFINE_GHES_NMI_FIXMAP(sea_fixmap, FIX_APEI_GHES_SEA); /* * Return 0 only if one of the SEA error sources successfully reported an error
@@ -960,7 +963,7 @@ int ghes_notify_sea(void) static void ghes_sea_add(struct ghes *ghes) { - ghes->nmi_fixmap = &nmi_fixmap; + ghes->nmi_fixmap = &sea_fixmap; ghes_estatus_queue_grow_pool(ghes); mutex_lock(&ghes_list_mutex);
@@ -984,12 +987,13 @@ static inline void ghes_sea_remove(struct ghes *ghes) { } #ifdef CONFIG_HAVE_ACPI_APEI_NMI /* - * NMI may be triggered on any CPU, so ghes_in_nmi is used for - * having only one concurrent reader. + * NOTIFY_NMI may be triggered on any CPU, so ghes_in_nmi is + * used for having only one concurrent reader. */ static atomic_t ghes_in_nmi = ATOMIC_INIT(0); static LIST_HEAD(ghes_nmi); +static DEFINE_GHES_NMI_FIXMAP(nmi_fixmap, FIX_APEI_GHES_NMI); static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) {
--
2.16.2