From: Jan Kiszka <[email protected]>

We will share generic bitops this way.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/arm/include/asm/bitops.h   | 10 ----------
 hypervisor/arch/arm/mmio.c                 |  2 +-
 hypervisor/arch/arm64/include/asm/bitops.h | 10 ----------
 hypervisor/arch/arm64/mmio.c               |  2 +-
 hypervisor/arch/x86/include/asm/bitops.h   |  7 -------
 hypervisor/include/jailhouse/bitops.h      | 19 +++++++++++++++++++
 hypervisor/include/jailhouse/control.h     |  2 +-
 scripts/header_check                       |  6 ++++++
 8 files changed, 28 insertions(+), 30 deletions(-)
 create mode 100644 hypervisor/include/jailhouse/bitops.h

diff --git a/hypervisor/arch/arm/include/asm/bitops.h 
b/hypervisor/arch/arm/include/asm/bitops.h
index 3b5d0a89..fbdcc817 100644
--- a/hypervisor/arch/arm/include/asm/bitops.h
+++ b/hypervisor/arch/arm/include/asm/bitops.h
@@ -10,13 +10,6 @@
  * the COPYING file in the top-level directory.
  */
 
-#ifndef _JAILHOUSE_ASM_BITOPS_H
-#define _JAILHOUSE_ASM_BITOPS_H
-
-#include <jailhouse/types.h>
-
-#ifndef __ASSEMBLY__
-
 #define BITOPT_ALIGN(bits, addr)                               \
        do {                                                    \
                (addr) = (unsigned long *)((u32)(addr) & ~0x3)  \
@@ -120,6 +113,3 @@ static inline unsigned long ffzl(unsigned long word)
 {
        return ffsl(~word);
 }
-
-#endif /* !__ASSEMBLY__ */
-#endif /* !_JAILHOUSE_ASM_BITOPS_H */
diff --git a/hypervisor/arch/arm/mmio.c b/hypervisor/arch/arm/mmio.c
index fcc7fdf2..1c492b43 100644
--- a/hypervisor/arch/arm/mmio.c
+++ b/hypervisor/arch/arm/mmio.c
@@ -10,10 +10,10 @@
  * the COPYING file in the top-level directory.
  */
 
+#include <jailhouse/bitops.h>
 #include <jailhouse/mmio.h>
 #include <jailhouse/pci.h>
 #include <jailhouse/printk.h>
-#include <asm/bitops.h>
 #include <jailhouse/percpu.h>
 #include <asm/processor.h>
 #include <asm/traps.h>
diff --git a/hypervisor/arch/arm64/include/asm/bitops.h 
b/hypervisor/arch/arm64/include/asm/bitops.h
index aad70f29..df99402d 100644
--- a/hypervisor/arch/arm64/include/asm/bitops.h
+++ b/hypervisor/arch/arm64/include/asm/bitops.h
@@ -11,13 +11,6 @@
  * the COPYING file in the top-level directory.
  */
 
-#ifndef _JAILHOUSE_ASM_BITOPS_H
-#define _JAILHOUSE_ASM_BITOPS_H
-
-#include <jailhouse/types.h>
-
-#ifndef __ASSEMBLY__
-
 #define BITOPT_ALIGN(bits, addr)                               \
        do {                                                    \
                (addr) = (unsigned long *)((u64)(addr) & ~0x7)  \
@@ -123,6 +116,3 @@ static inline unsigned long ffzl(unsigned long word)
 {
        return ffsl(~word);
 }
-
-#endif /* !__ASSEMBLY__ */
-#endif /* !_JAILHOUSE_ASM_BITOPS_H */
diff --git a/hypervisor/arch/arm64/mmio.c b/hypervisor/arch/arm64/mmio.c
index e6933716..7fbfef75 100644
--- a/hypervisor/arch/arm64/mmio.c
+++ b/hypervisor/arch/arm64/mmio.c
@@ -14,10 +14,10 @@
  * the COPYING file in the top-level directory.
  */
 
+#include <jailhouse/bitops.h>
 #include <jailhouse/entry.h>
 #include <jailhouse/mmio.h>
 #include <jailhouse/printk.h>
-#include <asm/bitops.h>
 #include <jailhouse/percpu.h>
 #include <asm/sysregs.h>
 #include <asm/traps.h>
diff --git a/hypervisor/arch/x86/include/asm/bitops.h 
b/hypervisor/arch/x86/include/asm/bitops.h
index 1f07db47..66fc91ab 100644
--- a/hypervisor/arch/x86/include/asm/bitops.h
+++ b/hypervisor/arch/x86/include/asm/bitops.h
@@ -15,11 +15,6 @@
  * Copyright (c) Linux kernel developers, 2013
  */
 
-#ifndef _JAILHOUSE_ASM_BITOPS_H
-#define _JAILHOUSE_ASM_BITOPS_H
-
-#include <jailhouse/types.h>
-
 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
 /* Technically wrong, but this avoids compilation errors on some gcc
    versions. */
@@ -109,5 +104,3 @@ static inline unsigned long ffsl(unsigned long word)
                : "rm" (word));
        return word;
 }
-
-#endif /* !_JAILHOUSE_ASM_BITOPS_H */
diff --git a/hypervisor/include/jailhouse/bitops.h 
b/hypervisor/include/jailhouse/bitops.h
new file mode 100644
index 00000000..426e51f1
--- /dev/null
+++ b/hypervisor/include/jailhouse/bitops.h
@@ -0,0 +1,19 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2020
+ *
+ * Authors:
+ *  Jan Kiszka <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef _JAILHOUSE_BITOPS_H
+#define _JAILHOUSE_BITOPS_H
+
+#include <jailhouse/types.h>
+#include <asm/bitops.h>
+
+#endif /* !_JAILHOUSE_BITOPS_H */
diff --git a/hypervisor/include/jailhouse/control.h 
b/hypervisor/include/jailhouse/control.h
index 72518f6a..e50beed7 100644
--- a/hypervisor/include/jailhouse/control.h
+++ b/hypervisor/include/jailhouse/control.h
@@ -10,7 +10,7 @@
  * the COPYING file in the top-level directory.
  */
 
-#include <asm/bitops.h>
+#include <jailhouse/bitops.h>
 #include <jailhouse/percpu.h>
 #include <jailhouse/cell.h>
 #include <jailhouse/cell-config.h>
diff --git a/scripts/header_check b/scripts/header_check
index 2fa6e45f..6487378b 100755
--- a/scripts/header_check
+++ b/scripts/header_check
@@ -42,6 +42,12 @@ test_compile()
                prepend="#define __ASSEMBLY__
                         #include <jailhouse/types.h>"
                ;;
+       bitops.h)
+               if [ "$1" == "asm" ]; then
+                       # must be included by jailhouse/bitops.h only
+                       return
+               fi
+               ;;
        ivshmem.h)
                if [ "$1" == "asm" ]; then
                        # must be included by jailhouse/ivshmem.h only
-- 
2.16.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/1c4c15399f736c49be665ca7af343b90cb448108.1581930651.git.jan.kiszka%40siemens.com.

Reply via email to