xen: change <asm/bug.h> to <xen/bug.h>

The idea of the patch is to change all <asm/bug.h> to <xen/bug.h> and
keep Xen compilable with adding only minimal amount of changes:
1. It was added "#include <xen/types.h>" to ARM's "<asm/bug.h>" as it
  uses uint_{16,32}t in 'struct bug_frame'.
2. It was added '#define BUG_FRAME_STRUCT' which means that ARM hasn't
  been switched to generic implementation yet.
3. It was added '#define BUG_FRAME_STRUCT' which means that x86 hasn't
  been switched to generic implementation yet.
4. BUGFRAME_* and _start_bug_frame[], _stop_bug_frame_*[] were removed
  for ARM & x86 to deal with compilation errors such as:
      redundant redeclaration of ...
5. Remove BUG_DISP_WIDTH, BUG_LINE_LO_WIDTH, BUG_LINE_HI_WIDTH from
  x86's <asm.bug.h> to not to produce #undef for them and #define again
  with the same values as in <xen/bug.h>. These #undef and #define will
  be anyway removed in the patch [2]
6. Remove <asm/bug.h> from <x86/acpi/cpufreq/cpufreq.c> and
  <drivers/cpufreq/cpufreq.c> as nothing from <xen/bug.h> are used in
  <*/cpufreq.c>

In the following two patches x86 and ARM archictectures will be
switched fully:
[1] xen/arm: switch ARM to use generic implementation of bug.h
[2] xen/x86: switch x86 to use generic implemetation of bug.h

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
Oleksii Kurochko authored and Jan Beulich committed 2023-04-03 12:52:02 +02:00
1 parent faafb5cb73
commit 71efa7b868
9 files changed
+11 -37

No files matched your search

+4 -13
View File
@@ -1,6 +1,8 @@
#ifndef __ARM_BUG_H__
#define __ARM_BUG_H__
#include <xen/types.h>
#if defined(CONFIG_ARM_32)
# include <asm/arm32/bug.h>
#elif defined(CONFIG_ARM_64)
@@ -9,6 +11,8 @@
# error "unknown ARM variant"
#endif
#define BUG_FRAME_STRUCT
struct bug_frame {
signed int loc_disp; /* Relative address to the bug address */
signed int file_disp; /* Relative address to the filename */
@@ -22,13 +26,6 @@ struct bug_frame {
#define bug_line(b) ((b)->line)
#define bug_msg(b) ((const char *)(b) + (b)->msg_disp)
#define BUGFRAME_run_fn 0
#define BUGFRAME_warn 1
#define BUGFRAME_bug 2
#define BUGFRAME_assert 3
#define BUGFRAME_NR 4
/* Many versions of GCC doesn't support the asm %c parameter which would
* be preferable to this unpleasantness. We use mergeable string
* sections to avoid multiple copies of the string appearing in the
@@ -85,12 +82,6 @@ struct bug_frame {
unreachable(); \
} while (0)
extern const struct bug_frame __start_bug_frames[],
__stop_bug_frames_0[],
__stop_bug_frames_1[],
__stop_bug_frames_2[],
__stop_bug_frames_3[];
#endif /* __ARM_BUG_H__ */
/*
* Local variables:
+1 -1
View File
@@ -74,7 +74,7 @@
#elif __GNUC__ >= 4
#include <asm/bug.h>
#include <xen/bug.h>
/*
* If the divisor happens to be constant, we determine the appropriate
+1 -1
View File
@@ -16,8 +16,8 @@
*/
#include <asm/new_vgic.h>
#include <asm/bug.h>
#include <asm/gic.h>
#include <xen/bug.h>
#include <xen/sched.h>
#include <xen/sizes.h>
+1 -1
View File
@@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <xen/bug.h>
#include <xen/list_sort.h>
#include <xen/sched.h>
#include <asm/bug.h>
#include <asm/event.h>
#include <asm/new_vgic.h>
-1
View File
@@ -35,7 +35,6 @@
#include <xen/sched.h>
#include <xen/timer.h>
#include <xen/xmalloc.h>
#include <asm/bug.h>
#include <asm/msr.h>
#include <asm/io.h>
#include <asm/processor.h>
+1 -1
View File
@@ -6,8 +6,8 @@
/* NB. Auto-generated from arch/.../asm-offsets.c */
#include <asm/asm-offsets.h>
#endif
#include <asm/bug.h>
#include <asm/x86-defns.h>
#include <xen/bug.h>
#include <xen/stringify.h>
#include <asm/cpufeature.h>
#include <asm/alternative.h>
+2 -17
View File
@@ -1,19 +1,10 @@
#ifndef __X86_BUG_H__
#define __X86_BUG_H__
#define BUG_DISP_WIDTH 24
#define BUG_LINE_LO_WIDTH (31 - BUG_DISP_WIDTH)
#define BUG_LINE_HI_WIDTH (31 - BUG_DISP_WIDTH)
#define BUGFRAME_run_fn 0
#define BUGFRAME_warn 1
#define BUGFRAME_bug 2
#define BUGFRAME_assert 3
#define BUGFRAME_NR 4
#ifndef __ASSEMBLY__
#define BUG_FRAME_STRUCT
struct bug_frame {
signed int loc_disp:BUG_DISP_WIDTH;
unsigned int line_hi:BUG_LINE_HI_WIDTH;
@@ -80,12 +71,6 @@ struct bug_frame {
unreachable(); \
} while (0)
extern const struct bug_frame __start_bug_frames[],
__stop_bug_frames_0[],
__stop_bug_frames_1[],
__stop_bug_frames_2[],
__stop_bug_frames_3[];
#else /* !__ASSEMBLY__ */
/*
-1
View File
@@ -39,7 +39,6 @@
#include <xen/guest_access.h>
#include <xen/domain.h>
#include <xen/cpu.h>
#include <asm/bug.h>
#include <asm/io.h>
#include <asm/processor.h>
+1 -1
View File
@@ -24,12 +24,12 @@
#ifndef __ASSEMBLY__
#include <xen/bug.h>
#include <xen/inttypes.h>
#include <xen/stdarg.h>
#include <xen/types.h>
#include <xen/xmalloc.h>
#include <xen/string.h>
#include <asm/bug.h>
#define BUG_ON(p) do { if (unlikely(p)) BUG(); } while (0)
#define WARN_ON(p) ({ \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.