mbox series

[v1,0/4] introduce generic implementation of macros from bug.h

Message ID cover.1675441720.git.oleksii.kurochko@gmail.com (mailing list archive)
Headers show
Series introduce generic implementation of macros from bug.h | expand

Message

Oleksii Kurochko Feb. 3, 2023, 5:05 p.m. UTC
A large part of the content of the bug.h is repeated among all
architectures (especially ARM and RISCV have the same implementation), so it
was created a new config CONFIG_GENERIC_BUG_FRAME which are used to
introduce generic implementation of do_bug_frame() and move ARM's <asm/bug.h>
to <xen/common/...> with the following changes:
    * add inclusion of arch-specific header <asm/bug.h>
    * rename the guard and remove ARM specific changes
    * wrap macros BUG_FRAME/run_in_exception_handler/WARN/BUG/assert_failed
      into #ifndef "BUG_FRAME/run_in_exception_handler/WARN/BUG/assert_failed"
      thereby each architecture can override generic implementation of macros.
    * add #ifdef __ASSEMBLY__ ... #endif
    * Update run_in_exception_handler() with:
        register void *fn_ asm(__stringify(BUG_FN_REG)) = (fn);
      to avoid:
        asm ("mv " __stringify(BUG_FN_REG) ", %0\n"

For x86 only common parts was removed from <asm/bug.h>.

RISC-V will be switched to use <xen/bug.h> and in the future, it will use common
the version of do_bug_frame() when xen/common will work for RISC-V.

Oleksii Kurochko (4):
  xen: introduce CONFIG_GENERIC_BUG_FRAME
  xen/arm: switch ARM to use generic implementation of bug.h
  xen/x86: switch x86 to use generic implemetation of bug.h
  xen: change <asm/bug.h> to <xen/bug.h>

 xen/arch/arm/Kconfig                 |   1 +
 xen/arch/arm/include/asm/bug.h       |  86 ------------------
 xen/arch/arm/include/asm/div64.h     |   2 +-
 xen/arch/arm/traps.c                 |  79 -----------------
 xen/arch/arm/vgic/vgic-v2.c          |   2 +-
 xen/arch/arm/vgic/vgic.c             |   2 +-
 xen/arch/x86/acpi/cpufreq/cpufreq.c  |   2 +-
 xen/arch/x86/include/asm/asm_defns.h |   2 +-
 xen/arch/x86/include/asm/bug.h       |  32 +------
 xen/common/Kconfig                   |   6 ++
 xen/common/Makefile                  |   1 +
 xen/common/bug.c                     |  88 +++++++++++++++++++
 xen/drivers/cpufreq/cpufreq.c        |   2 +-
 xen/include/xen/bug.h                | 127 +++++++++++++++++++++++++++
 xen/include/xen/lib.h                |   2 +-
 15 files changed, 232 insertions(+), 202 deletions(-)
 create mode 100644 xen/common/bug.c
 create mode 100644 xen/include/xen/bug.h