Skip to content

Commit e533dbe

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: acpi: fix DAIF manipulation with pNMI
Since commit: d44f1b8 ("arm64: KVM/mm: Move SEA handling behind a single 'claim' interface") ... the top-level APEI SEA handler has the shape: 1. current_flags = arch_local_save_flags() 2. local_daif_restore(DAIF_ERRCTX) 3. <GHES handler> 4. local_daif_restore(current_flags) However, since commit: 4a50321 ("arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking") ... when pseudo-NMIs (pNMIs) are in use, arch_local_save_flags() will save the PMR value rather than the DAIF flags. The combination of these two commits means that the APEI SEA handler will erroneously attempt to restore the PMR value into DAIF. Fix this by factoring local_daif_save_flags() out of local_daif_save(), so that we can consistently save DAIF in step #1, regardless of whether pNMIs are in use. Both commits were introduced concurrently in v5.0. Cc: <[email protected]> Fixes: 4a50321 ("arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking") Fixes: d44f1b8 ("arm64: KVM/mm: Move SEA handling behind a single 'claim' interface") Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: James Morse <[email protected]> Cc: Julien Thierry <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent bc20606 commit e533dbe

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

arch/arm64/include/asm/daifflags.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static inline void local_daif_mask(void)
3838
trace_hardirqs_off();
3939
}
4040

41-
static inline unsigned long local_daif_save(void)
41+
static inline unsigned long local_daif_save_flags(void)
4242
{
4343
unsigned long flags;
4444

@@ -50,6 +50,15 @@ static inline unsigned long local_daif_save(void)
5050
flags |= PSR_I_BIT;
5151
}
5252

53+
return flags;
54+
}
55+
56+
static inline unsigned long local_daif_save(void)
57+
{
58+
unsigned long flags;
59+
60+
flags = local_daif_save_flags();
61+
5362
local_daif_mask();
5463

5564
return flags;

arch/arm64/kernel/acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ int apei_claim_sea(struct pt_regs *regs)
274274
if (!IS_ENABLED(CONFIG_ACPI_APEI_GHES))
275275
return err;
276276

277-
current_flags = arch_local_save_flags();
277+
current_flags = local_daif_save_flags();
278278

279279
/*
280280
* SEA can interrupt SError, mask it and describe this as an NMI so

0 commit comments

Comments
 (0)