1 /******************************************************************************
2  * config.h
3  *
4  * A Linux-style configuration list.
5  */
6 
7 #ifndef __XEN_CONFIG_H__
8 #define __XEN_CONFIG_H__
9 
10 #include <xen/kconfig.h>
11 
12 #ifndef __ASSEMBLY__
13 #include <xen/compiler.h>
14 
15 #if defined(CONFIG_ENFORCE_UNIQUE_SYMBOLS) || defined(__clang__)
16 # define EMIT_FILE asm ( "" )
17 #else
18 # define EMIT_FILE asm ( ".file \"" __FILE__ "\"" )
19 #endif
20 
21 #endif
22 
23 #include <asm/config.h>
24 
25 #define EXPORT_SYMBOL(var)
26 
27 /*
28  * The following log levels are as follows:
29  *
30  *   XENLOG_ERR: Fatal errors, either Xen, Guest or Dom0
31  *               is about to crash.
32  *
33  *   XENLOG_WARNING: Something bad happened, but we can recover.
34  *
35  *   XENLOG_INFO: Interesting stuff, but not too noisy.
36  *
37  *   XENLOG_DEBUG: Use where ever you like. Lots of noise.
38  *
39  *
40  * Since we don't trust the guest operating system, we don't want
41  * it to allow for DoS by causing the HV to print out a lot of
42  * info, so where ever the guest has control of what is printed
43  * we use the XENLOG_GUEST to distinguish that the output is
44  * controlled by the guest.
45  *
46  * To make it easier on the typing, the above log levels all
47  * have a corresponding _G_ equivalent that appends the
48  * XENLOG_GUEST. (see the defines below).
49  *
50  */
51 #define XENLOG_ERR     "<0>"
52 #define XENLOG_WARNING "<1>"
53 #define XENLOG_INFO    "<2>"
54 #define XENLOG_DEBUG   "<3>"
55 
56 #define XENLOG_GUEST   "<G>"
57 
58 #define XENLOG_G_ERR     XENLOG_GUEST XENLOG_ERR
59 #define XENLOG_G_WARNING XENLOG_GUEST XENLOG_WARNING
60 #define XENLOG_G_INFO    XENLOG_GUEST XENLOG_INFO
61 #define XENLOG_G_DEBUG   XENLOG_GUEST XENLOG_DEBUG
62 
63 /*
64  * Some code is copied directly from Linux.
65  * Match some of the Linux log levels to Xen.
66  */
67 #define KERN_ERR       XENLOG_ERR
68 #define KERN_CRIT      XENLOG_ERR
69 #define KERN_EMERG     XENLOG_ERR
70 #define KERN_WARNING   XENLOG_WARNING
71 #define KERN_NOTICE    XENLOG_INFO
72 #define KERN_INFO      XENLOG_INFO
73 #define KERN_DEBUG     XENLOG_DEBUG
74 
75 /* Linux 'checker' project. */
76 #define __iomem
77 #define __user
78 #define __force
79 #define __bitwise
80 
81 #define KB(_kb)     (_AC(_kb, ULL) << 10)
82 #define MB(_mb)     (_AC(_mb, ULL) << 20)
83 #define GB(_gb)     (_AC(_gb, ULL) << 30)
84 
85 #define IS_ALIGNED(val, align) (((val) & ((align) - 1)) == 0)
86 
87 #define __STR(...) #__VA_ARGS__
88 #define STR(...) __STR(__VA_ARGS__)
89 
90 /* allow existing code to work with Kconfig variable */
91 #define NR_CPUS CONFIG_NR_CPUS
92 
93 #ifndef CONFIG_DEBUG
94 #define NDEBUG
95 #endif
96 
97 #ifndef ZERO_BLOCK_PTR
98 /* Return value for zero-size allocation, distinguished from NULL. */
99 #define ZERO_BLOCK_PTR ((void *)-1L)
100 #endif
101 
102 #endif /* __XEN_CONFIG_H__ */
103