unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#66252] [PATCH 0/3] riscv: Introduce Pseudo NMI
@ 2023-09-28  9:34 Xu Lu via Guix-patches via
  0 siblings, 0 replies; only message in thread
From: Xu Lu via Guix-patches via @ 2023-09-28  9:34 UTC (permalink / raw)
  To: 66252; +Cc: Xu Lu

The existing riscv kernel still lacks a NMI mechanism. It now
disables interrupts via per cpu control register CSR_STATUS,
the SIE bit of which controls the enablement of all interrupts
of whole cpu.

This patch series introduces a pseudo NMI mechanism in RISC-V
by switching interrupt disable way to another per cpu control
register CSR_IE. This register controls the enablement of each
seperate interrupt. Every bit of CSR_IE corresponds to a single
major interrupt and a clear bit means disablement of corresponding
interrupt. The main procedure of implementing pseudo NMI via
CSR_IE consists of three steps:

Stage1:
Make CSR_IE register part of thread context to avoid irq status
inconsistence after context switch.

Stage2:
Switch to CSR_IE masking when disabling irqs. When interrupts
are disabled, all bits of CSR_IE corresponding to normal
interrupts are cleared while bits corresponding to NMIs are
still kept as ones.

Stage3:
Enable NMIs mannualy during exceptions and normal interrupts as
hardware automatically disables all interrupts when trapped into
supervisor mode.

Xu Lu (3):
  riscv: Enable NMIs during normal interrupt handling
  riscv: Request pmu overflow interrupt as NMI
  riscv: Enable CONFIG_RISCV_PSEUDO_NMI in default

 arch/riscv/Kconfig               |  2 +-
 arch/riscv/kernel/traps.c        | 44 +++++++++++++++++++++++---------
 drivers/irqchip/irq-riscv-intc.c |  2 ++
 drivers/perf/riscv_pmu_sbi.c     | 23 ++++++++++++++---
 4 files changed, 54 insertions(+), 17 deletions(-)


base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c
prerequisite-patch-id: 0f865f6b1e0e30e051fd516afeb4cbdf687fa2e3
prerequisite-patch-id: 6632047c24a21a9426d54145f499a9ec4f6fb0c6
prerequisite-patch-id: 681d783ad71fe9770787680cb6d4385ae7a1ac05
prerequisite-patch-id: 1aa352fed255df745c4e47b589405bb9fe932efb
prerequisite-patch-id: 579727cfbe5f803335a678b227c31f9ec165df9f
prerequisite-patch-id: 9b616129ab18eb41abcdf007ce7d0d49f9a88d36
prerequisite-patch-id: 6c01bc4284a007d3a8b57b919d41380f2786b156
prerequisite-patch-id: f62067b439c1553c96e3462221a16fc52de2accb
-- 
2.20.1





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-28 13:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28  9:34 [bug#66252] [PATCH 0/3] riscv: Introduce Pseudo NMI Xu Lu via Guix-patches via

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).