Skip to contentSkip to conversation

xen: Remove the arch specific header init.h

PATCH In review Julien Grall 5 participants 5 messages Jan 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Remove the arch specific header init.h

From: Julien Grall <[email protected]>

Both x86 and (soon) RISC-V version of init.h are empty. On Arm, it contains a structure that should not be used by any common code.

The structure init_info is used to store information to setup the CPU currently being brought-up. setup.h seems to be more suitable even though the header is getting quite crowded.

Looking through the history, <asm/init.h> was introduced at the same time as the ia64 port because for some reasons most of the macros where duplicated. This was changed in 72c07f413879 and I don't foresee any reason to require arch specific definition for init.h in the near future.

Therefore remove asm/init.h for both x86 and arm (the only definition is moved in setup.h). With that RISC-V will not need to introduce an empty header.

---
cc: Oleksii Kurochko <[email protected]>

---
 xen/arch/arm/arm32/asm-offsets.c |  1 +
 xen/arch/arm/arm64/asm-offsets.c |  1 +
 xen/arch/arm/include/asm/init.h  | 20 --------------------
 xen/arch/arm/include/asm/setup.h |  8 ++++++++
 xen/arch/x86/acpi/power.c        |  1 -
 xen/arch/x86/include/asm/init.h  |  4 ----
 xen/include/xen/init.h           |  2 --
 7 files changed, 10 insertions(+), 27 deletions(-)
 delete mode 100644 xen/arch/arm/include/asm/init.h
 delete mode 100644 xen/arch/x86/include/asm/init.h
xen/arch/arm/arm32/asm-offsets.c +1 -0
index 2116ba5b95bf..05c692bb2822 100644
@@ -11,6 +11,7 @@
 #include <public/xen.h>
 #include <asm/current.h>
 #include <asm/procinfo.h>
+#include <asm/setup.h>
 
 #define DEFINE(_sym, _val)                                                 \
     asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
xen/arch/arm/arm64/asm-offsets.c +1 -0
index 280ddb55bfd4..7226cd9b2eb0 100644
@@ -10,6 +10,7 @@
 #include <xen/bitops.h>
 #include <public/xen.h>
 #include <asm/current.h>
+#include <asm/setup.h>
 #include <asm/smccc.h>
 
 #define DEFINE(_sym, _val)                                                 \
xen/arch/arm/include/asm/init.h deleted +0 -20
deleted file mode 100644
index 5ac8cf8797d6..000000000000
@@ -1,20 +0,0 @@
-#ifndef _XEN_ASM_INIT_H
-#define _XEN_ASM_INIT_H
-
-struct init_info
-{
-    /* Pointer to the stack, used by head.S when entering in C */
-    unsigned char *stack;
-    /* Logical CPU ID, used by start_secondary */
-    unsigned int cpuid;
-};
-
-#endif /* _XEN_ASM_INIT_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/arch/arm/include/asm/setup.h +8 -0
index fdbf68aadcaa..a926f30a2be4 100644
@@ -168,6 +168,14 @@ int map_range_to_domain(const struct dt_device_node *dev,
 
 extern const char __ro_after_init_start[], __ro_after_init_end[];
 
+struct init_info
+{
+    /* Pointer to the stack, used by head.S when entering in C */
+    unsigned char *stack;
+    /* Logical CPU ID, used by start_secondary */
+    unsigned int cpuid;
+};
+
 #endif
 /*
  * Local variables:
xen/arch/x86/acpi/power.c +0 -1
index b76f673acb1a..d23335391c67 100644
@@ -17,7 +17,6 @@
 #include <xen/sched.h>
 #include <asm/acpi.h>
 #include <asm/irq.h>
-#include <asm/init.h>
 #include <xen/spinlock.h>
 #include <xen/sched.h>
 #include <xen/domain.h>
xen/arch/x86/include/asm/init.h deleted +0 -4
deleted file mode 100644
index 5295b35e6337..000000000000
@@ -1,4 +0,0 @@
-#ifndef _XEN_ASM_INIT_H
-#define _XEN_ASM_INIT_H
-
-#endif /* _XEN_ASM_INIT_H */
xen/include/xen/init.h +0 -2
index 0af0e234ec80..1d7c0216bc80 100644
@@ -1,8 +1,6 @@
 #ifndef _LINUX_INIT_H
 #define _LINUX_INIT_H
 
-#include <asm/init.h>
-
 /*
  * Mark functions and data as being only used at initialization
  * or exit time.
Signature · 1 line
2.38.1
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Julien Grall

From: Julien Grall <[email protected]>

Both x86 and (soon) RISC-V version of init.h are empty. On Arm, it contains a structure that should not be used by any common code.

The structure init_info is used to store information to setup the CPU currently being brought-up. setup.h seems to be more suitable even though the header is getting quite crowded.

Looking through the history, <asm/init.h> was introduced at the same time as the ia64 port because for some reasons most of the macros where duplicated. This was changed in 72c07f413879 and I don't foresee any reason to require arch specific definition for init.h in the near future.

Quoted 6 lines

Therefore remove asm/init.h for both x86 and arm (the only definition is moved in setup.h). With that RISC-V will not need to introduce an empty header.

Acked-by on v1 1/1
#2 lore raw
In reply to Julien Grall
Quoted 16 lines · Julien Grall

From: Julien Grall <[email protected]>

Both x86 and (soon) RISC-V version of init.h are empty. On Arm, it contains a structure that should not be used by any common code.

The structure init_info is used to store information to setup the CPU currently being brought-up. setup.h seems to be more suitable even though the header is getting quite crowded.

Looking through the history, <asm/init.h> was introduced at the same time as the ia64 port because for some reasons most of the macros where duplicated. This was changed in 72c07f413879 and I don't foresee any reason to require arch specific definition for init.h in the near future.

Quoted 6 lines

Therefore remove asm/init.h for both x86 and arm (the only definition is moved in setup.h). With that RISC-V will not need to introduce an empty header.

Alistair

Quoted 123 lines

---
cc: Oleksii Kurochko <[email protected]>

---
 xen/arch/arm/arm32/asm-offsets.c |  1 +
 xen/arch/arm/arm64/asm-offsets.c |  1 +
 xen/arch/arm/include/asm/init.h  | 20 --------------------
 xen/arch/arm/include/asm/setup.h |  8 ++++++++
 xen/arch/x86/acpi/power.c        |  1 -
 xen/arch/x86/include/asm/init.h  |  4 ----
 xen/include/xen/init.h           |  2 --
 7 files changed, 10 insertions(+), 27 deletions(-)
 delete mode 100644 xen/arch/arm/include/asm/init.h
 delete mode 100644 xen/arch/x86/include/asm/init.h
xen/arch/arm/arm32/asm-offsets.c +1 -0
index 2116ba5b95bf..05c692bb2822 100644
@@ -11,6 +11,7 @@
 #include <public/xen.h>
 #include <asm/current.h>
 #include <asm/procinfo.h>
+#include <asm/setup.h>
 
 #define DEFINE(_sym, _val)                                                 \
     asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
xen/arch/arm/arm64/asm-offsets.c +1 -0
index 280ddb55bfd4..7226cd9b2eb0 100644
@@ -10,6 +10,7 @@
 #include <xen/bitops.h>
 #include <public/xen.h>
 #include <asm/current.h>
+#include <asm/setup.h>
 #include <asm/smccc.h>
 
 #define DEFINE(_sym, _val)                                                 \
xen/arch/arm/include/asm/init.h deleted +0 -20
deleted file mode 100644
index 5ac8cf8797d6..000000000000
@@ -1,20 +0,0 @@
-#ifndef _XEN_ASM_INIT_H
-#define _XEN_ASM_INIT_H
-
-struct init_info
-{
-    /* Pointer to the stack, used by head.S when entering in C */
-    unsigned char *stack;
-    /* Logical CPU ID, used by start_secondary */
-    unsigned int cpuid;
-};
-
-#endif /* _XEN_ASM_INIT_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/arch/arm/include/asm/setup.h +8 -0
index fdbf68aadcaa..a926f30a2be4 100644
@@ -168,6 +168,14 @@ int map_range_to_domain(const struct dt_device_node *dev,
 
 extern const char __ro_after_init_start[], __ro_after_init_end[];
 
+struct init_info
+{
+    /* Pointer to the stack, used by head.S when entering in C */
+    unsigned char *stack;
+    /* Logical CPU ID, used by start_secondary */
+    unsigned int cpuid;
+};
+
 #endif
 /*
  * Local variables:
xen/arch/x86/acpi/power.c +0 -1
index b76f673acb1a..d23335391c67 100644
@@ -17,7 +17,6 @@
 #include <xen/sched.h>
 #include <asm/acpi.h>
 #include <asm/irq.h>
-#include <asm/init.h>
 #include <xen/spinlock.h>
 #include <xen/sched.h>
 #include <xen/domain.h>
xen/arch/x86/include/asm/init.h deleted +0 -4
deleted file mode 100644
index 5295b35e6337..000000000000
@@ -1,4 +0,0 @@
-#ifndef _XEN_ASM_INIT_H
-#define _XEN_ASM_INIT_H
-
-#endif /* _XEN_ASM_INIT_H */
xen/include/xen/init.h +0 -3
index 0af0e234ec80..1d7c0216bc80 100644
@@ -1,8 +1,6 @@
 #ifndef _LINUX_INIT_H
 #define _LINUX_INIT_H
 
-#include <asm/init.h>
-
 /*
  * Mark functions and data as being only used at initialization
  * or exit time.
--

2.38.1

Reviewed-by on v1 1/1
#3 lore raw
In reply to Julien Grall
Quoted 19 lines · Julien Grall

From: Julien Grall <[email protected]>

Both x86 and (soon) RISC-V version of init.h are empty. On Arm, it contains a structure that should not be used by any common code.

The structure init_info is used to store information to setup the CPU currently being brought-up. setup.h seems to be more suitable even though the header is getting quite crowded.

Looking through the history, <asm/init.h> was introduced at the same time as the ia64 port because for some reasons most of the macros where duplicated. This was changed in 72c07f413879 and I don't foresee any reason to require arch specific definition for init.h in the near future.

Quoted 7 lines

Therefore remove asm/init.h for both x86 and arm (the only definition is moved in setup.h). With that RISC-V will not need to introduce an empty header.

Hi Julien,

The arm part looks good to me, I’ve also built x86, arm32 and arm64 and no problems found.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Julien Grall
Quoted 15 lines · Julien Grall

From: Julien Grall <[email protected]>

Both x86 and (soon) RISC-V version of init.h are empty. On Arm, it contains a structure that should not be used by any common code.

The structure init_info is used to store information to setup the CPU currently being brought-up. setup.h seems to be more suitable even though the header is getting quite crowded.

Looking through the history, <asm/init.h> was introduced at the same time as the ia64 port because for some reasons most of the macros where duplicated. This was changed in 72c07f413879 and I don't foresee any reason to require arch specific definition for init.h in the near future.

Quoted 6 lines

Therefore remove asm/init.h for both x86 and arm (the only definition is moved in setup.h). With that RISC-V will not need to introduce an empty header.