Skip to content

riscv: convert bottom half of exception handling to C

Jisheng Zhang linux-riscv lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 1 replyIn review
  2. v16 patches 14 repliesSuperseded

Changes in v2 from the cover letter

- add two clean up patches
- remove the two patches which fix imbalance in RAS, instead, explicitly mark this series is applied against one of them.
- save cause in pt_regs prior to calling do_traps()
- do more clean up and optimization after the asm->c conversion:
staticalize and mark do_irq() as __always_inline.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7riscv: traps: staticalize handle_break()arch/riscv/include/asm/entry-common.h arch/riscv/kernel/traps.c+1 -20 replies
2/7riscv: traps: remove __visible annotationarch/riscv/kernel/traps.c+7 -70 replies
3/7riscv: convert bottom half of exception handling to Carch/riscv/errata/sifive/errata.c arch/riscv/include/asm/asm-prototypes.h arch/riscv/include/asm/errata_list.h +2 more+61 -641 reply
4/7riscv: errata: remove ALT_INSN_FAULT and ALT_PAGE_FAULTarch/riscv/include/asm/errata_list.h+1 -150 replies
5/7riscv: errata: sifive: remove NOMMU handlingarch/riscv/errata/sifive/errata_cip_453.S+0 -40 replies
6/7riscv: staticalize and remove asmlinkage from updated functionsarch/riscv/include/asm/asm-prototypes.h arch/riscv/kernel/kernel_mode_vector.c arch/riscv/kernel/traps.c+10 -270 replies
7/7riscv: traps: mark do_irq() as __always_inlinearch/riscv/kernel/traps.c+1 -10 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchDeepak Gupta
1/7
2/7
3/7R-b
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/7] riscv: convert bottom half of exception handling to C

For readability, maintainability and future scalability, convert the bottom half of the exception handling to C.

During the conversion, I found Anton fixed a performance issue[1] and my patches will touch the same exception asm code, so this series is applied against Anton's patch.

patch1 and patch2 are cleanup patches. patch3~patch7 do the conversion and some cleanup/optimization after conversion.

Mostly the assembly code is converted to C in a relatively straightforward manner.

However, there are two modifications I need to mention:

1. the cause I.E the CSR_CAUSE value is passed to do_traps() via. 2nd param, do_traps() doesn't get it from pt_regs because this way an extra memory load is needed, the exception handling sits in hot code path, every instruction matters.

2.To cope with SIFIVE_CIP_453 errata, it looks like we don't need alternative mechanism any more after the asm->c conversion. Just replace the excp_vect_table two entries.

since v1:
- add two clean up patches
- remove the two patches which fix imbalance in RAS, instead, explicitly mark this series is applied against one of them.
- save cause in pt_regs prior to calling do_traps()
- do more clean up and optimization after the asm->c conversion:
staticalize and mark do_irq() as __always_inline.

Jisheng Zhang (7):
riscv: traps: staticalize handle_break()
riscv: traps: remove __visible annotation
riscv: convert bottom half of exception handling to C
riscv: errata: remove ALT_INSN_FAULT and ALT_PAGE_FAULT
riscv: errata: sifive: remove NOMMU handling
riscv: staticalize and remove asmlinkage from updated functions
riscv: traps: mark do_irq() as __always_inline

 arch/riscv/errata/sifive/errata.c         | 25 +++++++---
 arch/riscv/errata/sifive/errata_cip_453.S |  4 --
 arch/riscv/include/asm/asm-prototypes.h   | 20 +-------
 arch/riscv/include/asm/entry-common.h     |  1 -
 arch/riscv/include/asm/errata_list.h      | 21 ++-------
 arch/riscv/kernel/entry.S                 | 57 +----------------------
 arch/riscv/kernel/kernel_mode_vector.c    |  2 +-
 arch/riscv/kernel/traps.c                 | 55 ++++++++++++++++++----
 8 files changed, 73 insertions(+), 112 deletions(-)
Signature · 1 line
2.43.0