Skip to content

arm64: provide pseudo NMI with GICv3

Julien Thierry kvmarm linux-arch linux-arm-kernel linux-efi lkml stable 11 versions – Applied

Status from this message: Applied. Thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest25 patches 7 repliesApplied
  2. v926 patches 55 repliesSuperseded
  3. v826 patches 31 repliesSuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v725 patches19 repliesSuperseded
v624 patches37 repliesSuperseded
v527 patches28 repliesApplied
v426 patches17 repliesSuperseded
v36 patches4 repliesSuperseded
v2 posting 2/20 of 6 patches0 repliesSuperseded
v2 posting 1/26 patches27 repliesSuperseded
v10 of 6 patches0 repliesSuperseded

Patches in v10 Applied

#Subject and filesSizeRepliesApplied
1/25arm64: Fix HCR.TGE status for NMI contextsarch/arm64/include/asm/hardirq.h arch/arm64/kernel/irq.c include/linux/hardirq.h+41 -01 reply
2/25arm64: Remove unused daif related functions/macrosarch/arm64/include/asm/assembler.h arch/arm64/include/asm/daifflags.h+1 -190 replies
3/25arm64: cpufeature: Set SYSREG_GIC_CPUIF as a boot system featurearch/arm64/kernel/cpufeature.c+1 -10 replies
4/25arm64: cpufeature: Add cpufeature for IRQ priority maskingarch/arm64/include/asm/cpucaps.h arch/arm64/include/asm/cpufeature.h arch/arm64/kernel/cpufeature.c+31 -10 replies
5/25arm/arm64: gic-v3: Add PMR and RPR accessorsarch/arm/include/asm/arch_gicv3.h arch/arm64/include/asm/arch_gicv3.h+31 -00 replies
6/25irqchip/gic-v3: Switch to PMR masking before calling IRQ handlerarch/arm/include/asm/arch_gicv3.h arch/arm64/include/asm/arch_gicv3.h drivers/irqchip/irq-gic-v3.c+39 -00 replies
7/25arm64: ptrace: Provide definitions for PMR valuesarch/arm64/include/asm/ptrace.h+12 -00 replies
8/25arm64: Make PMR part of task contextarch/arm64/include/asm/processor.h arch/arm64/include/asm/ptrace.h arch/arm64/kernel/asm-offsets.c +2 more+35 -30 replies
9/25arm64: Unmask PMR before going idlearch/arm64/kernel/process.c arch/arm64/mm/proc.S+45 -110 replies
10/25arm64: kvm: Unmask PMR before entering guestarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/hyp/switch.c+32 -00 replies
11/25efi: Let architectures decide the flags that should be saved/restoreddrivers/firmware/efi/runtime-wrappers.c include/linux/efi.h+18 -40 replies
12/25arm64: irqflags: Use ICC_PMR_EL1 for interrupt maskingarch/arm64/include/asm/efi.h arch/arm64/include/asm/irqflags.h+83 -284 replies
13/25arm64: daifflags: Include PMR in daifflags restore operationsarch/arm64/include/asm/daifflags.h+46 -40 replies
14/25arm64: alternative: Allow alternative status checking per cpufeaturearch/arm64/include/asm/alternative.h arch/arm64/kernel/alternative.c arch/arm64/kernel/cpufeature.c+19 -70 replies
15/25arm64: alternative: Apply alternatives early in boot processarch/arm64/include/asm/alternative.h arch/arm64/include/asm/cpufeature.h arch/arm64/kernel/alternative.c +2 more+56 -50 replies
16/25irqchip/gic-v3: Factor group0 detection into functionsdrivers/irqchip/irq-gic-v3.c+36 -190 replies
17/25arm64: Switch to PMR masking when starting CPUsarch/arm64/kernel/smp.c drivers/irqchip/irq-gic-v3.c+33 -10 replies
18/25arm64: gic-v3: Implement arch support for priority maskingarch/arm64/include/asm/arch_gicv3.h+4 -40 replies
19/25irqchip/gic-v3: Detect if GIC can support pseudo-NMIsDocumentation/arm64/booting.txt drivers/irqchip/irq-gic-v3.c+64 -70 replies
20/25irqchip/gic-v3: Handle pseudo-NMIsdrivers/irqchip/irq-gic-v3.c+36 -60 replies
21/25irqchip/gic-v3: Allow interrupts to be set as pseudo-NMIdrivers/irqchip/irq-gic-v3.c+91 -00 replies
22/25arm64: Handle serror in NMI contextarch/arm64/kernel/traps.c+6 -20 replies
23/25arm64: Skip preemption when exiting an NMIarch/arm64/kernel/entry.S+9 -10 replies
24/25arm64: Skip irqflags tracing for NMI in IRQs disabled contextarch/arm64/kernel/entry.S+21 -00 replies
25/25arm64: Enable the support of pseudo-NMIsDocumentation/admin-guide/kernel-parameters.txt arch/arm64/Kconfig arch/arm64/kernel/cpufeature.c+28 -10 replies

Reviews trailers per patch

24 of 25 patches have a Reviewed-by or Acked-by.

PatchMarc ZyngierJames MorseCatalin MarinasChristoffer DallArd BiesheuvelMark RutlandSuzuki K PouloseNathan Chancellor
1/25R-b R-b
2/25A-b A-b R-b
3/25A-b A-b R-b R-b
4/25A-b A-b R-b R-b
5/25R-b A-b R-b
6/25A-b A-b
7/25A-b A-b
8/25R-b R-b
9/25R-b R-b
10/25R-b A-b R-b
11/25A-b A-b A-b
12/25R-b A-b T-b
13/25R-b R-b
14/25A-b
15/25R-b R-b
16/25A-b
17/25A-b
18/25A-b
19/25A-b
20/25A-b
21/25R-b
22/25A-b
23/25A-b
24/25A-b
25/25

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v10 thread

Cover letter [PATCH v10 00/25] arm64: provide pseudo NMI with GICv3

Hi,

This series is a continuation of the work started by Daniel [1]. The goal is to use GICv3 interrupt priorities to simulate an NMI.

The patches depend on the core API for NMIs patches [2]. Both series can be found on this branch:
git clone http://linux-arm.org/linux-jt.git -b v5.0-pseudo-nmi

To achieve this, set two priorities, one for standard interrupts and another, higher priority, for NMIs. Whenever we want to disable interrupts, we mask the standard priority instead so NMIs can still be raised. Some corner cases though still require to actually mask all interrupts effectively disabling the NMI.

Daniel Thompson ran some benchmarks [3] on a previous version showing a small (<1%) performance drop when using interrupt priorities on Cortex-A53 and GIC-500.

Currently, only PPIs and SPIs can be set as NMIs. IPIs being currently hardcoded IRQ numbers, there isn't a generic interface to set SGIs as NMI for now. LPIs being controlled by the ITS cannot be delivered as NMI. When an NMI is active on a CPU, no other NMI can be triggered on the CPU.

Requirements to use this:
- Have GICv3
- SCR_EL3.FIQ is set to 1 when linux runs or have single security state
- Select Kernel Feature -> Support for NMI-like interrupts
- Set "irqchip.gicv3_pseudo_nmi" to 1 on the kernel command line

* Patch 1 fixes an existing issue with current NMI contexts in arm64
* Patches 2 and 3 are just a bit of cleanup
* Patch 4 introduces a CPU feature to check if priority masking should be used
* Patches 5 and 6 add the support for priority masking in GICv3 driver
* Patches 7 to 13 add the support for priority masking the arch/arm64 code
* Patches 14 and 15 allow us to apply alternatives earlier in the boot process
* Patches 16 to 18 starts the PMR masking on cpu startup and provides primitives for arm64 GICv3 driver to perform priority masking
* Patches 19 to 21 Add support for pseudo-NMIs in GICv3 driver
* Patches 22 to 24 Add support for receiving NMIs in arch/arm64
* Patch 25 adds the build config and command line option to enable pseudo-NMIs

Changes since v9[4]:
* Add Acked-by and Reviewed-by tags
* Act on various remaks (renames, remove inlines, comments)

[1] http://www.spinics.net/lists/arm-kernel/msg525077.html
[2] https://lkml.org/lkml/2019/1/31/526
[3] https://lkml.org/lkml/2018/7/20/803
[4] https://lkml.org/lkml/2019/1/21/1060

Cheers,

Julien

-->

Daniel Thompson (1):
arm64: alternative: Apply alternatives early in boot process

Julien Thierry (24):
arm64: Fix HCR.TGE status for NMI contexts
arm64: Remove unused daif related functions/macros
arm64: cpufeature: Set SYSREG_GIC_CPUIF as a boot system feature
arm64: cpufeature: Add cpufeature for IRQ priority masking arm/arm64: gic-v3: Add PMR and RPR accessors irqchip/gic-v3: Switch to PMR masking before calling IRQ handler
arm64: ptrace: Provide definitions for PMR values
arm64: Make PMR part of task context
arm64: Unmask PMR before going idle
arm64: kvm: Unmask PMR before entering guest
efi: Let architectures decide the flags that should be saved/restored
arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking
arm64: daifflags: Include PMR in daifflags restore operations
arm64: alternative: Allow alternative status checking per cpufeature irqchip/gic-v3: Factor group0 detection into functions
arm64: Switch to PMR masking when starting CPUs
arm64: gic-v3: Implement arch support for priority masking irqchip/gic-v3: Detect if GIC can support pseudo-NMIs irqchip/gic-v3: Handle pseudo-NMIs
irqchip/gic-v3: Allow interrupts to be set as pseudo-NMI
arm64: Handle serror in NMI context
arm64: Skip preemption when exiting an NMI
arm64: Skip irqflags tracing for NMI in IRQs disabled context
arm64: Enable the support of pseudo-NMIs

 Documentation/admin-guide/kernel-parameters.txt |   5 +
 Documentation/arm64/booting.txt                 |   5 +
 arch/arm/include/asm/arch_gicv3.h               |  33 +++
 arch/arm64/Kconfig                              |  14 ++
 arch/arm64/include/asm/alternative.h            |   4 +-
 arch/arm64/include/asm/arch_gicv3.h             |  32 +++
 arch/arm64/include/asm/assembler.h              |  10 +-
 arch/arm64/include/asm/cpucaps.h                |   3 +-
 arch/arm64/include/asm/cpufeature.h             |  10 +
 arch/arm64/include/asm/daifflags.h              |  60 ++++--
 arch/arm64/include/asm/efi.h                    |  11 +
 arch/arm64/include/asm/hardirq.h                |  31 +++
 arch/arm64/include/asm/irqflags.h               | 100 ++++++---
 arch/arm64/include/asm/kvm_host.h               |  16 ++
 arch/arm64/include/asm/processor.h              |   3 +
 arch/arm64/include/asm/ptrace.h                 |  26 ++-
 arch/arm64/kernel/alternative.c                 |  60 +++++-
 arch/arm64/kernel/asm-offsets.c                 |   1 +
 arch/arm64/kernel/cpufeature.c                  |  41 +++-
 arch/arm64/kernel/entry.S                       |  45 +++-
 arch/arm64/kernel/irq.c                         |   3 +
 arch/arm64/kernel/process.c                     |  51 +++++
 arch/arm64/kernel/smp.c                         |  33 +++
 arch/arm64/kernel/traps.c                       |   8 +-
 arch/arm64/kvm/hyp/switch.c                     |  16 ++
 arch/arm64/mm/proc.S                            |  11 -
 drivers/firmware/efi/runtime-wrappers.c         |  17 +-
 drivers/irqchip/irq-gic-v3.c                    | 265 +++++++++++++++++++++---
 include/linux/efi.h                             |   5 +-
 include/linux/hardirq.h                         |   7 +
 30 files changed, 810 insertions(+), 116 deletions(-)

--
1.9.1