Hi Jan,
On 31/03/2022 10:31, Jan Beulich wrote:
lib.h is imo a better fit for them than config.h.
Signed-off-by: Jan Beulich <jbeul...@suse.com>
Reviewed-by: Julien Grall <jgr...@amazon.com>
Cheers,
---
v4: New.
---
Originally I thought I'd also move KB() etc, but they're used in places
where yet further adjustments (adding of #include) would be necessary.
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -3,6 +3,7 @@
/* Modified for ARM Xen by Ian Campbell */
#include <xen/cache.h>
+#include <xen/lib.h>
#include <asm/page.h>
#undef ENTRY
#undef ALIGN
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -2,6 +2,7 @@
/* Modified for i386/x86-64 Xen by Keir Fraser */
#include <xen/cache.h>
+#include <xen/lib.h>
#include <asm/page.h>
#undef ENTRY
#undef ALIGN
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -82,11 +82,6 @@
#define MB(_mb) (_AC(_mb, ULL) << 20)
#define GB(_gb) (_AC(_gb, ULL) << 30)
-#define IS_ALIGNED(val, align) (((val) & ((align) - 1)) == 0)
-
-#define __STR(...) #__VA_ARGS__
-#define STR(...) __STR(__VA_ARGS__)
-
/* allow existing code to work with Kconfig variable */
#define NR_CPUS CONFIG_NR_CPUS
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -3,6 +3,8 @@
#define ROUNDUP(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define IS_ALIGNED(val, align) (!((val) & ((align) - 1)))
+
#define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
@@ -17,6 +19,9 @@
#define PASTE_(a, b) a ## b
#define PASTE(a, b) PASTE_(a, b)
+#define __STR(...) #__VA_ARGS__
+#define STR(...) __STR(__VA_ARGS__)
+
#ifndef __ASSEMBLY__
#include <xen/inttypes.h>
--
Julien Grall