Skip to content

cpus: Add common CPUClass::exception_name() handler

Philippe Mathieu-Daudé qemu-arm qemu-devel qemu-riscv 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest33 patches 13 repliesIn review
  2. v233 patches 8 repliesSuperseded
  3. v127 patches 33 repliesSuperseded

Changes in v3 from the cover letter

- Add STR_ARRAY_ELEM_OR_NULL() suggested by Pierrick

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/33qemu/osdep: Document ARRAY_SIZE() macro rejects pointersinclude/qemu/osdep.h+6 -01 reply
2/33util/cutils: Add STR_ARRAY_ELEM_OR_NULL() for string table lookupsinclude/qemu/cutils.h include/qemu/osdep.h util/cutils.c+26 -05 replies
3/33cpus: Add helper to log raised exceptions with '-d int'accel/tcg/cpu-exec-common.c+30 -01 reply
4/33cpus: Introduce CPUClass::exception_name() handleraccel/tcg/cpu-exec-common.c include/hw/core/cpu.h+8 -01 reply
5/33target/alpha: Register CPUClass::exception_name() handlertarget/alpha/cpu.c target/alpha/cpu.h target/alpha/helper.c+48 -361 reply
6/33target/alpha: Use a static table in alpha_exception_name()target/alpha/helper.c+15 -401 reply
7/33target/arm: Register CPUClass::exception_name() handlertarget/arm/cpu.c target/arm/cpu.h target/arm/helper.c+42 -401 reply
8/33target/avr: Implement and register CPUClass::exception_name()target/avr/cpu.c target/avr/cpu.h+19 -00 replies
9/33target/hexagon: Register CPUClass::exception_name() handlertarget/hexagon/cpu.c target/hexagon/cpu_bits.h target/hexagon/hexswi.c+38 -290 replies
10/33target/hppa: Register CPUClass::exception_name() handlertarget/hppa/cpu.c target/hppa/cpu.h target/hppa/int_helper.c+47 -450 replies
11/33target/i386: Replace magic value by proper EXCP0E_PAGE definitiontarget/i386/tcg/seg_helper.c+1 -10 replies
12/33target/i386: Implement and register CPUClass::exception_name()target/i386/cpu.c target/i386/cpu.h target/i386/tcg/excp_helper.c +1 more+44 -40 replies
13/33target/loongarch: Register CPUClass::exception_name() handlertarget/loongarch/cpu.c target/loongarch/internals.h target/loongarch/tcg/tcg_cpu.c+40 -410 replies
14/33target/m68k: Register CPUClass::exception_name() handlertarget/m68k/cpu.c target/m68k/cpu.h target/m68k/op_helper.c+9 -20 replies
15/33target/m68k: Use a static table in m68k_exception_name()target/m68k/op_helper.c+54 -990 replies
16/33target/microblaze: Implement and register CPUClass::exception_name()target/microblaze/cpu.c target/microblaze/cpu.h+17 -00 replies
17/33target/mips: Remove EXCP_LAST, use ARRAY_SIZE(excp_names)target/mips/cpu.h target/mips/tcg/exception.c+2 -40 replies
18/33target/mips: Register CPUClass::exception_name() handlertarget/mips/cpu.c target/mips/cpu.h target/mips/tcg/exception.c +1 more+6 -70 replies
19/33target/or1k: Register CPUClass::exception_name() handlertarget/or1k/cpu.c target/or1k/cpu.h target/or1k/exception.c +1 more+26 -180 replies
20/33target/ppc: Name the EBB exceptionstarget/ppc/excp_helper.c+2 -00 replies
21/33target/ppc: Use a static table in powerpc_excp_name()target/ppc/excp_helper.c+69 -680 replies
22/33target/ppc: Register CPUClass::exception_name() handlertarget/ppc/cpu.h target/ppc/cpu_init.c target/ppc/excp_helper.c+6 -20 replies
23/33target/riscv: Register CPUClass::exception_name() handlertarget/riscv/cpu.c target/riscv/cpu.h target/riscv/tcg/op_helper.c+12 -111 reply
24/33target/rx: Unify BRK and INT trap handlingtarget/rx/helper.h target/rx/op_helper.c target/rx/translate.c+12 -190 replies
25/33target/rx: Define exception vector constantstarget/rx/cpu.h target/rx/helper.c target/rx/op_helper.c +1 more+30 -160 replies
26/33target/rx: Register CPUClass::exception_name() handlertarget/rx/cpu.c target/rx/cpu.h target/rx/helper.c+34 -210 replies
27/33target/s390x: Implement and register CPUClass::exception_name()target/s390x/cpu.c target/s390x/cpu.h target/s390x/interrupt.c +2 more+25 -31 reply
28/33target/sh4: Define exception vector constantstarget/sh4/cpu.h target/sh4/helper.c target/sh4/op_helper.c+59 -380 replies
29/33target/sh4: Register CPUClass::exception_name() handlertarget/sh4/cpu.c target/sh4/cpu.h target/sh4/helper.c+56 -470 replies
30/33target/sh4: Use a static table in sh4_exception_name()target/sh4/helper.c+20 -460 replies
31/33target/sparc: Remove always-defined DEBUG_PCALLtarget/sparc/int64_helper.c+0 -60 replies
32/33target/sparc: Register CPUClass::exception_name() handlertarget/sparc/cpu.c target/sparc/cpu.h target/sparc/int32_helper.c +1 more+28 -320 replies
33/33target/xtensa: Implement and register CPUClass::exception_name()target/xtensa/cpu.c target/xtensa/cpu.h target/xtensa/exc_helper.c+28 -10 replies

Reviews trailers per patch

All 33 patches have a Reviewed-by or Acked-by.

PatchPierrick BouvierBrian CainBibo MaoPeter MaydellYoshinori SatoPhilippe Mathieu-DaudéChao LiuCornelia HuckRichard Henderson
1/33R-b
2/33R-b A-b
3/33R-b
4/33R-b
5/33R-b
6/33R-b R-b
7/33R-b R-b
8/33R-b
9/33R-b
10/33R-b
11/33R-b
12/33R-b
13/33R-b
14/33R-b
15/33R-b
16/33R-b
17/33R-b
18/33R-b
19/33R-b
20/33R-b
21/33R-b
22/33R-b
23/33R-b R-b
24/33R-b R-b R-b
25/33R-b R-b
26/33R-b
27/33R-b A-b
28/33R-b R-b
29/33R-b
30/33R-b
31/33R-b
32/33R-b
33/33R-b

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

Read the v3 thread

Cover letter [PATCH v3 00/33] cpus: Add common CPUClass::exception_name() handler

Missing review: 1 (new), 2 (rewrite)

v3:
- Add STR_ARRAY_ELEM_OR_NULL() suggested by Pierrick

v2:
- Addressed Pierrick suggestions
- No change addressed wrt logging-prefix (patch 2) because not needed so far.

Add qemu_excp_name() to resolve QEMU internal exception values.

Add a common CPUClass::exception_name() callback so the generic exception logger can resolve architecture-specific exception values to human-readable names.

Re-use existing methods (expose prototype or refactor) when available otherwise implement new ones (AVR, X86, MicroBlaze, S390x, TriCore and Xtensa).

This series is the base for consolidating exception management in accel/tcg/ (more series to be posted on top).

Philippe Mathieu-Daudé (31):
qemu/osdep: Document ARRAY_SIZE() macro rejects pointers util/cutils: Add STR_ARRAY_ELEM_OR_NULL() for string table lookups
cpus: Add helper to log raised exceptions with '-d int'
cpus: Introduce CPUClass::exception_name() handler target/alpha: Register CPUClass::exception_name() handler target/alpha: Use a static table in alpha_exception_name() target/arm: Register CPUClass::exception_name() handler target/avr: Implement and register CPUClass::exception_name() target/hexagon: Register CPUClass::exception_name() handler target/hppa: Register CPUClass::exception_name() handler target/i386: Replace magic value by proper EXCP0E_PAGE definition target/i386: Implement and register CPUClass::exception_name() target/loongarch: Register CPUClass::exception_name() handler target/m68k: Register CPUClass::exception_name() handler target/m68k: Use a static table in m68k_exception_name() target/microblaze: Implement and register CPUClass::exception_name() target/mips: Remove EXCP_LAST, use ARRAY_SIZE(excp_names) target/mips: Register CPUClass::exception_name() handler target/or1k: Register CPUClass::exception_name() handler target/ppc: Name the EBB exceptions
target/ppc: Use a static table in powerpc_excp_name() target/ppc: Register CPUClass::exception_name() handler target/riscv: Register CPUClass::exception_name() handler target/rx: Unify BRK and INT trap handling
target/rx: Register CPUClass::exception_name() handler target/s390x: Implement and register CPUClass::exception_name() target/sh4: Register CPUClass::exception_name() handler target/sh4: Use a static table in sh4_exception_name() target/sparc: Remove always-defined DEBUG_PCALL target/sparc: Register CPUClass::exception_name() handler target/xtensa: Implement and register CPUClass::exception_name()

Yonggang Luo (2):
target/rx: Define exception vector constants
target/sh4: Define exception vector constants

 include/hw/core/cpu.h          |   2 +
 include/qemu/cutils.h          |  17 ++++
 include/qemu/osdep.h           |   9 ++
 target/alpha/cpu.h             |   1 +
 target/arm/cpu.h               |   4 +-
 target/avr/cpu.h               |   2 +
 target/hexagon/cpu_bits.h      |   2 +
 target/hppa/cpu.h              |   2 +
 target/i386/cpu.h              |   2 +
 target/loongarch/internals.h   |   2 +
 target/m68k/cpu.h              |   2 +
 target/microblaze/cpu.h        |   2 +
 target/mips/cpu.h              |   4 +-
 target/mips/tcg/tcg-internal.h |   2 -
 target/or1k/cpu.h              |   2 +
 target/ppc/cpu.h               |   2 +
 target/riscv/cpu.h             |   1 +
 target/rx/cpu.h                |  14 +++
 target/rx/helper.h             |   3 +-
 target/s390x/cpu.h             |   2 +
 target/sh4/cpu.h               |  22 +++++
 target/sparc/cpu.h             |   1 +
 target/xtensa/cpu.h            |   2 +
 accel/tcg/cpu-exec-common.c    |  36 ++++++++
 target/alpha/cpu.c             |   1 +
 target/alpha/helper.c          |  57 +++++-------
 target/arm/cpu.c               |   1 +
 target/arm/helper.c            |  77 ++++++++--------
 target/avr/cpu.c               |  17 ++++
 target/hexagon/cpu.c           |  35 ++++++++
 target/hexagon/hexswi.c        |  30 +------
 target/hppa/cpu.c              |  42 +++++++++
 target/hppa/int_helper.c       |  48 +---------
 target/i386/cpu.c              |  30 +++++++
 target/i386/tcg/excp_helper.c  |   7 +-
 target/i386/tcg/seg_helper.c   |  11 ++-
 target/loongarch/cpu.c         |  38 ++++++++
 target/loongarch/tcg/tcg_cpu.c |  41 ---------
 target/m68k/cpu.c              |   1 +
 target/m68k/op_helper.c        | 159 ++++++++++++---------------------
 target/microblaze/cpu.c        |  15 ++++
 target/mips/cpu.c              |   1 +
 target/mips/tcg/exception.c    |  10 +--
 target/or1k/cpu.c              |   1 +
 target/or1k/exception.c        |  22 +++++
 target/or1k/interrupt.c        |  19 +---
 target/ppc/cpu_init.c          |   1 +
 target/ppc/excp_helper.c       | 140 +++++++++++++++--------------
 target/riscv/cpu.c             |  20 ++---
 target/riscv/tcg/op_helper.c   |   2 +-
 target/rx/cpu.c                |   1 +
 target/rx/helper.c             |  62 +++++++------
 target/rx/op_helper.c          |  17 ++--
 target/rx/translate.c          |  23 +++--
 target/s390x/cpu.c             |   1 +
 target/s390x/interrupt.c       |  16 ++++
 target/s390x/tcg/excp_helper.c |   6 +-
 target/s390x/tcg/misc_helper.c |   3 +-
 target/sh4/cpu.c               |   1 +
 target/sh4/helper.c            | 109 ++++++++++------------
 target/sh4/op_helper.c         |  16 ++--
 target/sparc/cpu.c             |   1 +
 target/sparc/int32_helper.c    |  22 ++---
 target/sparc/int64_helper.c    |  42 ++++-----
 target/xtensa/cpu.c            |  24 +++++
 target/xtensa/exc_helper.c     |   3 +-
 util/cutils.c                  |   6 ++
 67 files changed, 750 insertions(+), 567 deletions(-)
Signature · 1 line
2.55.0