Skip to contentSkip to conversation

xen/arm: Bunch of clean-ups

PATCH In review Julien Grall 3 participants 25 messages Oct 31, 2018 – Nov 9, 2018 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

v2 cover xen/arm: Bunch of clean-ups

Hi all,

This patch series is a bunch of clean-ups I have collected the past few weeks.

The main goal is to reduce the scope of some includes and reduce the size of processor.h by moving some parts in new/current headers.

All the patches but #1 and #3 have been reviewed by Andrii.

Cheers,

Julien Grall (21):
xen/arm: traps: Constify show_*, do_unexpected_trap and do_bug_frame
parameters
xen/arm: regs: Convert guest_mode to a static inline helper xen/arm: Remove __init from prototype
xen/arm: bugs: Move do_bug_frame to traps.h
xen/arm: Consolidate CPU identification in cpufeature.{c,h} xen/arm: Move VABORT_GEN_BY_GUEST to traps.h and turned into inline xen/arm: gic-3: Remove unused includes
xen/arm: gic-v3: Re-order includes in alphabetical order xen/arm: Move HSR defines in a new header hsr.h
xen/arm: Move SYSREG accessors in sysregs.h
xen/arm: Move out of processor.h traps related variable/function xen/arm: Only include stringify.h when necessary
xen/arm: Only include vreg.h when necessary
xen/arm: Remove unnecessary includes in asm/vgic.h xen/arm: Remove unnecessary includes in asm/mmio.h xen/arm: Remove unnecessary includes in traps.c
xen/arm: Remove unnecessary includes in asm/p2m.h xen/arm: Remove unnecessary includes in asm-arm/acpi.h xen/arm: Remove unnecessary includes in asm/current.h xen/arm: platform: Don't include p2m.h in exynos5 and omap5 xen/arm: Move vgic_* helpers from gic.h to vgic.h

 xen/arch/arm/Makefile                 |   1 -
 xen/arch/arm/acpi/lib.c               |   1 +
 xen/arch/arm/arm32/entry.S            |   1 +
 xen/arch/arm/arm32/proc-v7.S          |   1 +
 xen/arch/arm/arm32/traps.c            |   1 +
 xen/arch/arm/arm64/traps.c            |   1 +
 xen/arch/arm/bootfdt.c                |   2 +-
 xen/arch/arm/cpu.c                    |  68 -------
 xen/arch/arm/cpuerrata.c              |   1 +
 xen/arch/arm/cpufeature.c             |  42 ++++
 xen/arch/arm/device.c                 |   1 +
 xen/arch/arm/gic-v3-lpi.c             |   1 +
 xen/arch/arm/gic-v3.c                 |  28 ++-
 xen/arch/arm/platforms/exynos5.c      |   1 -
 xen/arch/arm/platforms/omap5.c        |   1 -
 xen/arch/arm/psci.c                   |   1 +
 xen/arch/arm/traps.c                  |  37 ++--
 xen/arch/arm/vcpreg.c                 |   1 +
 xen/arch/arm/vgic-v2.c                |   1 +
 xen/arch/arm/vgic-v3-its.c            |   1 +
 xen/arch/arm/vpl011.c                 |   1 +
 xen/include/asm-arm/acpi.h            |   8 +-
 xen/include/asm-arm/alternative.h     |   3 +-
 xen/include/asm-arm/arm32/processor.h |  62 ------
 xen/include/asm-arm/arm32/sysregs.h   |  75 +++++++
 xen/include/asm-arm/arm64/hsr.h       | 122 ++++++++++++
 xen/include/asm-arm/arm64/processor.h |  27 ---
 xen/include/asm-arm/arm64/sysregs.h   | 132 +++----------
 xen/include/asm-arm/bug.h             |   4 -
 xen/include/asm-arm/cpregs.h          |   2 -
 xen/include/asm-arm/cpufeature.h      | 134 +++++++++++++
 xen/include/asm-arm/current.h         |   2 -
 xen/include/asm-arm/device.h          |  10 +-
 xen/include/asm-arm/event.h           |   1 -
 xen/include/asm-arm/gic.h             |   3 -
 xen/include/asm-arm/hsr.h             | 217 +++++++++++++++++++++
 xen/include/asm-arm/iommu.h           |   4 +-
 xen/include/asm-arm/mmio.h            |   4 +-
 xen/include/asm-arm/p2m.h             |   3 -
 xen/include/asm-arm/page.h            |   1 +
 xen/include/asm-arm/percpu.h          |   8 +-
 xen/include/asm-arm/platform.h        |   7 +-
 xen/include/asm-arm/processor.h       | 354 +---------------------------------
 xen/include/asm-arm/regs.h            |  22 ++-
 xen/include/asm-arm/setup.h           |   9 +-
 xen/include/asm-arm/sysregs.h         |  22 +++
 xen/include/asm-arm/time.h            |   2 +
 xen/include/asm-arm/traps.h           |  16 ++
 xen/include/asm-arm/vgic.h            |   9 +-
 xen/include/asm-arm/vpl011.h          |   1 -
 xen/include/xen/device_tree.h         |   5 +-
 51 files changed, 742 insertions(+), 720 deletions(-)
 delete mode 100644 xen/arch/arm/cpu.c
 create mode 100644 xen/include/asm-arm/arm32/sysregs.h
 create mode 100644 xen/include/asm-arm/arm64/hsr.h
 create mode 100644 xen/include/asm-arm/hsr.h
 create mode 100644 xen/include/asm-arm/sysregs.h
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v2 1/21 xen/arm: traps: Constify show_*, do_unexpected_trap and do_bug_frame parameters

Those helpers are not meant to modify most of the parameters. So constify them.

---

Changes in v2:
- Constify more parameters.

---
 xen/arch/arm/traps.c            | 26 +++++++++++++-------------
 xen/include/asm-arm/bug.h       |  2 +-
 xen/include/asm-arm/processor.h |  7 ++++---
 3 files changed, 18 insertions(+), 17 deletions(-)
xen/arch/arm/traps.c +13 -13
index 51d2e42c77..e8fa760607 100644
@@ -787,8 +787,8 @@ static const char *mode_string(uint32_t cpsr)
     return mode_strings[mode] ? : "Unknown";
 }
 
-static void show_registers_32(struct cpu_user_regs *regs,
-                              struct reg_ctxt *ctxt,
+static void show_registers_32(const struct cpu_user_regs *regs,
+                              const struct reg_ctxt *ctxt,
                               int guest_mode,
                               const struct vcpu *v)
 {
@@ -864,8 +864,8 @@ static void show_registers_32(struct cpu_user_regs *regs,
 }
 
 #ifdef CONFIG_ARM_64
-static void show_registers_64(struct cpu_user_regs *regs,
-                              struct reg_ctxt *ctxt,
+static void show_registers_64(const struct cpu_user_regs *regs,
+                              const struct reg_ctxt *ctxt,
                               int guest_mode,
                               const struct vcpu *v)
 {
@@ -925,8 +925,8 @@ static void show_registers_64(struct cpu_user_regs *regs,
 }
 #endif
 
-static void _show_registers(struct cpu_user_regs *regs,
-                            struct reg_ctxt *ctxt,
+static void _show_registers(const struct cpu_user_regs *regs,
+                            const struct reg_ctxt *ctxt,
                             int guest_mode,
                             const struct vcpu *v)
 {
@@ -981,7 +981,7 @@ static void _show_registers(struct cpu_user_regs *regs,
     printk("\n");
 }
 
-void show_registers(struct cpu_user_regs *regs)
+void show_registers(const struct cpu_user_regs *regs)
 {
     struct reg_ctxt ctxt;
     ctxt.sctlr_el1 = READ_SYSREG(SCTLR_EL1);
@@ -1027,7 +1027,7 @@ void vcpu_show_registers(const struct vcpu *v)
     _show_registers(&v->arch.cpu_info->guest_cpu_user_regs, &ctxt, 1, v);
 }
 
-static void show_guest_stack(struct vcpu *v, struct cpu_user_regs *regs)
+static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
 {
     int i;
     vaddr_t sp;
@@ -1161,7 +1161,7 @@ static void show_guest_stack(struct vcpu *v, struct cpu_user_regs *regs)
  */
 #define STACK_FRAME_BASE(fp)       ((register_t*)(fp))
 #endif
-static void show_trace(struct cpu_user_regs *regs)
+static void show_trace(const struct cpu_user_regs *regs)
 {
     register_t *frame, next, addr, low, high;
 
@@ -1196,7 +1196,7 @@ static void show_trace(struct cpu_user_regs *regs)
     printk("\n");
 }
 
-void show_stack(struct cpu_user_regs *regs)
+void show_stack(const struct cpu_user_regs *regs)
 {
     register_t *stack = STACK_BEFORE_EXCEPTION(regs), addr;
     int i;
@@ -1223,7 +1223,7 @@ void show_stack(struct cpu_user_regs *regs)
     show_trace(regs);
 }
 
-void show_execution_state(struct cpu_user_regs *regs)
+void show_execution_state(const struct cpu_user_regs *regs)
 {
     show_registers(regs);
     show_stack(regs);
@@ -1249,14 +1249,14 @@ void vcpu_show_execution_state(struct vcpu *v)
     vcpu_unpause(v);
 }
 
-void do_unexpected_trap(const char *msg, struct cpu_user_regs *regs)
+void do_unexpected_trap(const char *msg, const struct cpu_user_regs *regs)
 {
     printk("CPU%d: Unexpected Trap: %s\n", smp_processor_id(), msg);
     show_execution_state(regs);
     panic("CPU%d: Unexpected Trap: %s\n", smp_processor_id(), msg);
 }
 
-int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc)
+int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)
 {
     const struct bug_frame *bug = NULL;
     const char *prefix = "", *filename, *predicate;
xen/include/asm-arm/bug.h +1 -1
index 4704e2d858..90a59c972b 100644
@@ -77,7 +77,7 @@ extern const struct bug_frame __start_bug_frames[],
                               __stop_bug_frames_1[],
                               __stop_bug_frames_2[];
 
-int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc);
+int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
 
 #endif /* __ARM_BUG_H__ */
 /*
xen/include/asm-arm/processor.h +4 -3
index 8016cf306f..fcdc0f6375 100644
@@ -793,8 +793,8 @@ void init_traps(void);
 
 void panic_PAR(uint64_t par);
 
-void show_execution_state(struct cpu_user_regs *regs);
-void show_registers(struct cpu_user_regs *regs);
+void show_execution_state(const struct cpu_user_regs *regs);
+void show_registers(const struct cpu_user_regs *regs);
 //#define dump_execution_state() run_in_exception_handler(show_execution_state)
 #define dump_execution_state() WARN()
 
@@ -804,7 +804,8 @@ void show_registers(struct cpu_user_regs *regs);
 #define cpu_to_core(_cpu)   (0)
 #define cpu_to_socket(_cpu) (0)
 
-void noreturn do_unexpected_trap(const char *msg, struct cpu_user_regs *regs);
+void noreturn do_unexpected_trap(const char *msg,
+                                 const struct cpu_user_regs *regs);
 
 struct vcpu;
 void vcpu_regs_hyp_to_user(const struct vcpu *vcpu,
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v2 1/21
#2 lore raw

Re: [PATCH v2 01/21] xen/arm: traps: Constify show_*, do_unexpected_trap and do_bug_frame parameters

Hello Julien,

ps. please reach me by my gmail [email protected] further, rather than epam's email.
Our infra enabled 2-factor auth, and I didn't manage to make thunderbird functional any more. And outlook's web interface is nearly unusable.

ANDRII ANISOV

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

PATCH v2 2/21 xen/arm: regs: Convert guest_mode to a static inline helper

In reply to Julien Grall

At the same time, switch the parameter guest_mode from int to bool

---
Changes in v2:
- Add andrii's reviewed-by

---
 xen/arch/arm/traps.c       |  6 +++---
 xen/include/asm-arm/regs.h | 22 ++++++++++++----------
 2 files changed, 15 insertions(+), 13 deletions(-)
xen/arch/arm/traps.c +3 -3
index e8fa760607..b9323672fc 100644
@@ -789,7 +789,7 @@ static const char *mode_string(uint32_t cpsr)
 
 static void show_registers_32(const struct cpu_user_regs *regs,
                               const struct reg_ctxt *ctxt,
-                              int guest_mode,
+                              bool guest_mode,
                               const struct vcpu *v)
 {
 
@@ -866,7 +866,7 @@ static void show_registers_32(const struct cpu_user_regs *regs,
 #ifdef CONFIG_ARM_64
 static void show_registers_64(const struct cpu_user_regs *regs,
                               const struct reg_ctxt *ctxt,
-                              int guest_mode,
+                              bool guest_mode,
                               const struct vcpu *v)
 {
 
@@ -927,7 +927,7 @@ static void show_registers_64(const struct cpu_user_regs *regs,
 
 static void _show_registers(const struct cpu_user_regs *regs,
                             const struct reg_ctxt *ctxt,
-                            int guest_mode,
+                            bool guest_mode,
                             const struct vcpu *v)
 {
     print_xen_info();
xen/include/asm-arm/regs.h +12 -10
index 2440edb29a..ddc6eba9ce 100644
@@ -5,8 +5,10 @@
 
 #ifndef __ASSEMBLY__
 
+#include <xen/lib.h>
 #include <xen/types.h>
 #include <public/xen.h>
+#include <asm/current.h>
 #include <asm/processor.h>
 
 #define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
@@ -37,16 +39,16 @@
     (psr_mode((r)->cpsr,PSR_MODE_EL0t) || usr_mode(r))
 #endif
 
-#define guest_mode(r)                                                         \
-({                                                                            \
-    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
-    /* Frame pointer must point into current CPU stack. */                    \
-    ASSERT(diff < STACK_SIZE);                                                \
-    /* If not a guest frame, it must be a hypervisor frame. */                \
-    ASSERT((diff == 0) || hyp_mode(r));                                       \
-    /* Return TRUE if it's a guest frame. */                                  \
-    (diff == 0);                                                              \
-})
+static inline bool guest_mode(const struct cpu_user_regs *r)
+{
+    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);
+    /* Frame pointer must point into current CPU stack. */
+    ASSERT(diff < STACK_SIZE);
+    /* If not a guest frame, it must be a hypervisor frame. */
+    ASSERT((diff == 0) || hyp_mode(r));
+    /* Return TRUE if it's a guest frame. */
+    return (diff == 0);
+}
 
 #define return_reg(v) ((v)->arch.cpu_info->guest_cpu_user_regs.r0)
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw

PATCH v2 3/21 xen/arm: Remove __init from prototype

In reply to Julien Grall

In Xen, it is common to add __init to the declaration and not the prototype. Remove the few __init on some prototypes which allows to avoid the inclusion of init.h in headers.

With these changes, init.h is now required to be included on some c files. Also, add __init where it was missing in declaration.

---
Changes in v2:
- Remove __init in asm-arm/iommu.h prototypes

---
 xen/arch/arm/acpi/lib.c           |  1 +
 xen/arch/arm/bootfdt.c            |  2 +-
 xen/arch/arm/cpuerrata.c          |  1 +
 xen/arch/arm/device.c             |  1 +
 xen/arch/arm/psci.c               |  1 +
 xen/include/asm-arm/acpi.h        |  7 +++----
 xen/include/asm-arm/alternative.h |  3 +--
 xen/include/asm-arm/device.h      | 10 ++++------
 xen/include/asm-arm/iommu.h       |  4 ++--
 xen/include/asm-arm/platform.h    |  7 +++----
 xen/include/asm-arm/setup.h       |  6 +++---
 xen/include/xen/device_tree.h     |  5 ++---
 12 files changed, 23 insertions(+), 25 deletions(-)
xen/arch/arm/acpi/lib.c +1 -0
index ada5298a38..4fc6e17322 100644
@@ -22,6 +22,7 @@
  */
 
 #include <xen/acpi.h>
+#include <xen/init.h>
 #include <xen/mm.h>
 
 char *__acpi_map_table(paddr_t phys, unsigned long size)
xen/arch/arm/bootfdt.c +1 -1
index 8eba42c7b9..44af11c0fd 100644
@@ -349,7 +349,7 @@ size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
     return fdt_totalsize(fdt);
 }
 
-const char *boot_fdt_cmdline(const void *fdt)
+const __init char *boot_fdt_cmdline(const void *fdt)
 {
     int node;
     const struct fdt_property *prop;
xen/arch/arm/cpuerrata.c +1 -0
index 97a118293b..adf88e7bdc 100644
@@ -1,5 +1,6 @@
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
+#include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/sizes.h>
 #include <xen/smp.h>
xen/arch/arm/device.c +1 -0
index a0072c1563..70cd6c1a19 100644
@@ -19,6 +19,7 @@
 
 #include <asm/device.h>
 #include <xen/errno.h>
+#include <xen/init.h>
 #include <xen/lib.h>
 
 extern const struct device_desc _sdevice[], _edevice[];
xen/arch/arm/psci.c +1 -0
index a93121f43b..d23cb8e76e 100644
@@ -19,6 +19,7 @@
 
 
 #include <xen/types.h>
+#include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/smp.h>
 #include <asm/cpufeature.h>
xen/include/asm-arm/acpi.h +3 -4
index c183b6bb6e..feec4fb0ac 100644
@@ -23,7 +23,6 @@
 #ifndef _ASM_ARM_ACPI_H
 #define _ASM_ARM_ACPI_H
 
-#include <xen/init.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 
@@ -43,9 +42,9 @@ typedef enum {
     TBL_MMAX,
 } EFI_MEM_RES;
 
-bool __init acpi_psci_present(void);
-bool __init acpi_psci_hvc_present(void);
-void __init acpi_smp_init_cpus(void);
+bool acpi_psci_present(void);
+bool acpi_psci_hvc_present(void);
+void acpi_smp_init_cpus(void);
 
 /*
  * This function returns the offset of a given ACPI/EFI table in the allocated
xen/include/asm-arm/alternative.h +1 -2
index 9b4b02811b..dedb6dd001 100644
@@ -7,7 +7,6 @@
 
 #ifndef __ASSEMBLY__
 
-#include <xen/init.h>
 #include <xen/types.h>
 #include <xen/stringify.h>
 
@@ -28,7 +27,7 @@ typedef void (*alternative_cb_t)(const struct alt_instr *alt,
 				 const uint32_t *origptr, uint32_t *updptr,
 				 int nr_inst);
 
-void __init apply_alternatives_all(void);
+void apply_alternatives_all(void);
 int apply_alternatives(const struct alt_instr *start, const struct alt_instr *end);
 
 #define ALTINSTR_ENTRY(feature, cb)					      \
xen/include/asm-arm/device.h +4 -6
index 6734ae8efd..63a0f3631d 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_ARM_DEVICE_H
 #define __ASM_ARM_DEVICE_H
 
-#include <xen/init.h>
-
 enum device_type
 {
     DEV_DT,
@@ -68,8 +66,8 @@ struct acpi_device_desc {
  *
  *  Return 0 on success.
  */
-int __init acpi_device_init(enum device_class class,
-                            const void *data, int class_type);
+int acpi_device_init(enum device_class class,
+                     const void *data, int class_type);
 
 /**
  *  device_init - Initialize a device
@@ -79,8 +77,8 @@ int __init acpi_device_init(enum device_class class,
  *
  *  Return 0 on success.
  */
-int __init device_init(struct dt_device_node *dev, enum device_class class,
-                       const void *data);
+int device_init(struct dt_device_node *dev, enum device_class class,
+                const void *data);
 
 /**
  * device_get_type - Get the type of the device
xen/include/asm-arm/iommu.h +2 -2
index f6df32f860..90cd011d35 100644
@@ -24,9 +24,9 @@ struct arch_iommu
 #define iommu_use_hap_pt(d) (has_iommu_pt(d))
 
 const struct iommu_ops *iommu_get_ops(void);
-void __init iommu_set_ops(const struct iommu_ops *ops);
+void iommu_set_ops(const struct iommu_ops *ops);
 
-int __init iommu_hardware_setup(void);
+int iommu_hardware_setup(void);
 
 #endif /* __ARCH_ARM_IOMMU_H__ */
 
xen/include/asm-arm/platform.h +3 -4
index 2591d7bb03..bf9258156c 100644
@@ -1,7 +1,6 @@
 #ifndef __ASM_ARM_PLATFORM_H
 #define __ASM_ARM_PLATFORM_H
 
-#include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/mm.h>
 #include <xen/device_tree.h>
@@ -46,9 +45,9 @@ struct platform_desc {
  */
 #define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 0)
 
-void __init platform_init(void);
-int __init platform_init_time(void);
-int __init platform_specific_mapping(struct domain *d);
+void platform_init(void);
+int platform_init_time(void);
+int platform_specific_mapping(struct domain *d);
 #ifdef CONFIG_ARM_32
 int platform_smp_init(void);
 int platform_cpu_up(int cpu);
xen/include/asm-arm/setup.h +3 -3
index 0cc3330807..5f41ba0cba 100644
@@ -74,14 +74,14 @@ void discard_initial_modules(void);
 void dt_unreserved_regions(paddr_t s, paddr_t e,
                            void (*cb)(paddr_t, paddr_t), int first);
 
-size_t __init boot_fdt_info(const void *fdt, paddr_t paddr);
-const char __init *boot_fdt_cmdline(const void *fdt);
+size_t boot_fdt_info(const void *fdt, paddr_t paddr);
+const char *boot_fdt_cmdline(const void *fdt);
 
 struct bootmodule *add_boot_module(bootmodule_kind kind,
                                    paddr_t start, paddr_t size,
                                    const char *cmdline);
 struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
-const char * __init boot_module_kind_as_string(bootmodule_kind kind);
+const char *boot_module_kind_as_string(bootmodule_kind kind);
 
 #endif
 /*
xen/include/xen/device_tree.h +2 -3
index 91fa0b6f61..7408a6c48c 100644
@@ -15,7 +15,6 @@
 #include <public/xen.h>
 #include <public/device_tree_defs.h>
 #include <xen/kernel.h>
-#include <xen/init.h>
 #include <xen/string.h>
 #include <xen/types.h>
 #include <xen/list.h>
@@ -169,7 +168,7 @@ int device_tree_for_each_node(const void *fdt,
  * Create a hierarchical device tree for the host DTB to be able
  * to retrieve parents.
  */
-void __init dt_unflatten_host_device_tree(void);
+void dt_unflatten_host_device_tree(void);
 
 /**
  * IRQ translation callback
@@ -204,7 +203,7 @@ extern const struct dt_device_node *dt_interrupt_controller;
  *
  * If found, return the interrupt controller device node.
  */
-struct dt_device_node * __init
+struct dt_device_node *
 dt_find_interrupt_controller(const struct dt_device_match *matches);
 
 #define dt_prop_cmp(s1, s2) strcmp((s1), (s2))
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

PATCH v2 4/21 xen/arm: bugs: Move do_bug_frame to traps.h

In reply to Julien Grall

do_bug_frame is only necessary when trapping. This allows to remove processor.h include.

However, time.h was missing an include resulting to compilation error if processor.h is removed from bug.h.

---
Changes in v2:
- Rebase
- Add Andrii's reviewed-by

---
 xen/arch/arm/arm32/traps.c  | 1 +
 xen/include/asm-arm/bug.h   | 4 ----
 xen/include/asm-arm/time.h  | 2 ++
 xen/include/asm-arm/traps.h | 2 ++
 4 files changed, 5 insertions(+), 4 deletions(-)
xen/arch/arm/arm32/traps.c +1 -0
index 4f27543dec..76f714a168 100644
@@ -22,6 +22,7 @@
 #include <public/xen.h>
 
 #include <asm/processor.h>
+#include <asm/traps.h>
 
 void do_trap_reset(struct cpu_user_regs *regs)
 {
xen/include/asm-arm/bug.h +0 -4
index 90a59c972b..36c803357c 100644
@@ -1,8 +1,6 @@
 #ifndef __ARM_BUG_H__
 #define __ARM_BUG_H__
 
-#include <asm/processor.h>
-
 #if defined(CONFIG_ARM_32)
 # include <asm/arm32/bug.h>
 #elif defined(CONFIG_ARM_64)
@@ -77,8 +75,6 @@ extern const struct bug_frame __start_bug_frames[],
                               __stop_bug_frames_1[],
                               __stop_bug_frames_2[];
 
-int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
-
 #endif /* __ARM_BUG_H__ */
 /*
  * Local variables:
xen/include/asm-arm/time.h +2 -0
index 19a4515e72..ea88e76304 100644
@@ -1,6 +1,8 @@
 #ifndef __ARM_TIME_H__
 #define __ARM_TIME_H__
 
+#include <asm/processor.h>
+
 #define DT_MATCH_TIMER                      \
     DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
     DT_MATCH_COMPATIBLE("arm,armv8-timer")
xen/include/asm-arm/traps.h +2 -0
index 70b52d1d16..d30ee1e01e 100644
@@ -43,6 +43,8 @@ void do_cp(struct cpu_user_regs *regs, const union hsr hsr);
 void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr);
 void do_trap_hvc_smccc(struct cpu_user_regs *regs);
 
+int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
+
 #endif /* __ASM_ARM_TRAPS__ */
 /*
  * Local variables:
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw

PATCH v2 5/21 xen/arm: Consolidate CPU identification in cpufeature.{c, h}

In reply to Julien Grall

At the moment, CPU Identification is spread accross cpu.c, cpufeature.c, processor.h, cpufeature.h. It would be better to keep everything together in a single place.

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/Makefile            |   1 -
 xen/arch/arm/cpu.c               |  68 --------------------
 xen/arch/arm/cpufeature.c        |  42 ++++++++++++
 xen/arch/arm/vcpreg.c            |   1 +
 xen/include/asm-arm/cpufeature.h | 134 ++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/processor.h  | 135 ---------------------------------------
 6 files changed, 177 insertions(+), 204 deletions(-)
 delete mode 100644 xen/arch/arm/cpu.c
xen/arch/arm/Makefile +0 -1
index 37fa8268b3..6d91ba7c46 100644
@@ -6,7 +6,6 @@ subdir-$(CONFIG_ACPI) += acpi
 
 obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
 obj-y += bootfdt.init.o
-obj-y += cpu.o
 obj-y += cpuerrata.o
 obj-y += cpufeature.o
 obj-y += decode.o
xen/arch/arm/cpu.c deleted +0 -68

68 lines not on this page · raw message

xen/arch/arm/cpufeature.c +42 -0

48 lines not on this page · raw message

xen/arch/arm/vcpreg.c +1 -0
index b04d996fd3..7b783e4bcc 100644
@@ -18,6 +18,7 @@
 
 #include <xen/sched.h>
 
+#include <asm/cpufeature.h>
 #include <asm/cpregs.h>
 #include <asm/current.h>
 #include <asm/regs.h>
xen/include/asm-arm/cpufeature.h +134 -0

140 lines not on this page · raw message

xen/include/asm-arm/processor.h +0 -135

141 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

PATCH v2 6/21 xen/arm: Move VABORT_GEN_BY_GUEST to traps.h and turned into inline

In reply to Julien Grall

The macro VABORT_GEN_BY_GUEST is only used by the trap code. So move it to trap.h.

While moving the code, convert is to a static inline to allow typecheck.

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/processor.h | 10 ----------
 xen/include/asm-arm/traps.h     | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
xen/include/asm-arm/processor.h +0 -10
index bdce0df122..3f40468bfd 100644
@@ -684,16 +684,6 @@ void do_trap_guest_serror(struct cpu_user_regs *regs);
 
 register_t get_default_hcr_flags(void);
 
-/* Functions for pending virtual abort checking window. */
-void abort_guest_exit_start(void);
-void abort_guest_exit_end(void);
-
-#define VABORT_GEN_BY_GUEST(r)  \
-( \
-    ( (unsigned long)abort_guest_exit_start == (r)->pc ) || \
-    ( (unsigned long)abort_guest_exit_end == (r)->pc ) \
-)
-
 /*
  * Synchronize SError unless the feature is selected.
  * This is relying on the SErrors are currently unmasked.
xen/include/asm-arm/traps.h +10 -0
index d30ee1e01e..a0406b5a3c 100644
@@ -45,6 +45,16 @@ void do_trap_hvc_smccc(struct cpu_user_regs *regs);
 
 int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
 
+/* Functions for pending virtual abort checking window. */
+void abort_guest_exit_start(void);
+void abort_guest_exit_end(void);
+
+static inline bool VABORT_GEN_BY_GUEST(const struct cpu_user_regs *regs)
+{
+    return ((unsigned long)abort_guest_exit_start == regs->pc) ||
+        (unsigned long)abort_guest_exit_end == regs->pc;
+}
+
 #endif /* __ASM_ARM_TRAPS__ */
 /*
  * Local variables:
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw

PATCH v2 7/21 xen/arm: gic-3: Remove unused includes

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/gic-v3.c | 5 -----
 1 file changed, 5 deletions(-)
xen/arch/arm/gic-v3.c +0 -5
index 2952335d05..8ff4e0f08e 100644
@@ -23,7 +23,6 @@
 
 #include <xen/lib.h>
 #include <xen/init.h>
-#include <xen/cpu.h>
 #include <xen/mm.h>
 #include <xen/irq.h>
 #include <xen/iocap.h>
@@ -33,18 +32,14 @@
 #include <xen/device_tree.h>
 #include <xen/sizes.h>
 #include <xen/libfdt/libfdt.h>
-#include <xen/sort.h>
 #include <xen/acpi.h>
 #include <acpi/actables.h>
-#include <asm/p2m.h>
-#include <asm/domain.h>
 #include <asm/io.h>
 #include <asm/device.h>
 #include <asm/gic.h>
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
 #include <asm/cpufeature.h>
-#include <asm/acpi.h>
 
 /* Global state */
 static struct {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw

PATCH v2 8/21 xen/arm: gic-v3: Re-order includes in alphabetical order

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/gic-v3.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
xen/arch/arm/gic-v3.c +12 -10
index 8ff4e0f08e..a7ce94789c 100644
@@ -21,25 +21,27 @@
  * GNU General Public License for more details.
  */
 
-#include <xen/lib.h>
+#include <xen/acpi.h>
+#include <xen/delay.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
 #include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/irq.h>
 #include <xen/iocap.h>
+#include <xen/irq.h>
+#include <xen/lib.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/mm.h>
 #include <xen/sched.h>
-#include <xen/errno.h>
-#include <xen/delay.h>
-#include <xen/device_tree.h>
 #include <xen/sizes.h>
-#include <xen/libfdt/libfdt.h>
-#include <xen/acpi.h>
+
 #include <acpi/actables.h>
-#include <asm/io.h>
+
+#include <asm/cpufeature.h>
 #include <asm/device.h>
 #include <asm/gic.h>
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
-#include <asm/cpufeature.h>
+#include <asm/io.h>
 
 /* Global state */
 static struct {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw

PATCH v2 9/21 xen/arm: Move HSR defines in a new header hsr.h

In reply to Julien Grall

The HSR defines are pretty much self-contained and not necessary to be included everywhere in Xen. So move them in a new header hsr.h.

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/arm64/traps.c          |   1 +
 xen/arch/arm/traps.c                |   1 +
 xen/include/asm-arm/arm64/hsr.h     | 122 ++++++++++++++++++++
 xen/include/asm-arm/arm64/sysregs.h | 109 ------------------
 xen/include/asm-arm/hsr.h           | 217 ++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/mmio.h          |   2 +
 xen/include/asm-arm/processor.h     | 199 ---------------------------------
 xen/include/asm-arm/traps.h         |   1 +
 8 files changed, 344 insertions(+), 308 deletions(-)
 create mode 100644 xen/include/asm-arm/arm64/hsr.h
 create mode 100644 xen/include/asm-arm/hsr.h
xen/arch/arm/arm64/traps.c +1 -0
index e5240190e6..babfc1d884 100644
@@ -18,6 +18,7 @@
 
 #include <xen/lib.h>
 
+#include <asm/hsr.h>
 #include <asm/system.h>
 #include <asm/processor.h>
 
xen/arch/arm/traps.c +1 -0
index b9323672fc..0b8d342c1a 100644
@@ -43,6 +43,7 @@
 #include <asm/debugger.h>
 #include <asm/event.h>
 #include <asm/flushtlb.h>
+#include <asm/hsr.h>
 #include <asm/mmio.h>
 #include <asm/monitor.h>
 #include <asm/psci.h>
xen/include/asm-arm/arm64/hsr.h new file +122 -0

122 lines not on this page · raw message

xen/include/asm-arm/arm64/sysregs.h +0 -109

115 lines not on this page · raw message

xen/include/asm-arm/hsr.h new file +217 -0

217 lines not on this page · raw message

xen/include/asm-arm/mmio.h +2 -0
index c8dadb5006..3ed3f82bf7 100644
@@ -21,6 +21,8 @@
 
 #include <xen/lib.h>
 #include <xen/rwlock.h>
+
+#include <asm/hsr.h>
 #include <asm/processor.h>
 #include <asm/regs.h>
 
xen/include/asm-arm/processor.h +0 -199

207 lines not on this page · raw message

xen/include/asm-arm/traps.h +1 -0
index a0406b5a3c..589fba9cd0 100644
@@ -1,6 +1,7 @@
 #ifndef __ASM_ARM_TRAPS__
 #define __ASM_ARM_TRAPS__
 
+#include <asm/hsr.h>
 #include <asm/processor.h>
 
 #if defined(CONFIG_ARM_32)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw

PATCH v2 10/21 xen/arm: Move SYSREG accessors in sysregs.h

In reply to Julien Grall

System registers accessors are self-contained and should not be included everywhere in Xen. Move the accessors in sysregs.h and include the file when necessary.

With that change, it is not necessary to include processor.h in time.h.

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/arm32/entry.S            |  1 +
 xen/arch/arm/arm32/proc-v7.S          |  1 +
 xen/arch/arm/gic-v3-lpi.c             |  1 +
 xen/arch/arm/gic-v3.c                 |  1 +
 xen/include/asm-arm/arm32/processor.h | 62 -----------------------------
 xen/include/asm-arm/arm32/sysregs.h   | 74 +++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/arm64/processor.h | 25 ------------
 xen/include/asm-arm/arm64/sysregs.h   | 23 +++++++++++
 xen/include/asm-arm/page.h            |  1 +
 xen/include/asm-arm/percpu.h          |  8 +---
 xen/include/asm-arm/sysregs.h         | 22 +++++++++++
 xen/include/asm-arm/time.h            |  2 +-
 12 files changed, 126 insertions(+), 95 deletions(-)
 create mode 100644 xen/include/asm-arm/arm32/sysregs.h
 create mode 100644 xen/include/asm-arm/sysregs.h
xen/arch/arm/arm32/entry.S +1 -0
index f6908e3f16..0b4cd19abd 100644
@@ -1,4 +1,5 @@
 #include <asm/asm_defns.h>
+#include <asm/sysregs.h>
 #include <asm/regs.h>
 #include <asm/alternative.h>
 #include <public/xen.h>
xen/arch/arm/arm32/proc-v7.S +1 -0
index 2f3ff1e6c9..80a250d8e8 100644
@@ -19,6 +19,7 @@
 
 #include <asm/asm_defns.h>
 #include <asm/arm32/processor.h>
+#include <asm/sysregs.h>
 
 ca15mp_init:
 ca7mp_init:
xen/arch/arm/gic-v3-lpi.c +1 -0
index efd5cd62fb..e8c6e159ca 100644
@@ -30,6 +30,7 @@
 #include <asm/gic_v3_its.h>
 #include <asm/io.h>
 #include <asm/page.h>
+#include <asm/sysregs.h>
 
 /*
  * There could be a lot of LPIs on the host side, and they always go to
xen/arch/arm/gic-v3.c +1 -0
index a7ce94789c..264a981bab 100644
@@ -42,6 +42,7 @@
 #include <asm/gic_v3_defs.h>
 #include <asm/gic_v3_its.h>
 #include <asm/io.h>
+#include <asm/sysregs.h>
 
 /* Global state */
 static struct {
xen/include/asm-arm/arm32/processor.h +0 -62

74 lines not on this page · raw message

xen/include/asm-arm/arm32/sysregs.h new file +74 -0

74 lines not on this page · raw message

xen/include/asm-arm/arm64/processor.h +0 -25
index c18ab7203d..765de1b74b 100644
@@ -3,8 +3,6 @@
 
 #include <xen/stringify.h>
 
-#include <asm/arm64/sysregs.h>
-
 #ifndef __ASSEMBLY__
 
 /* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */
@@ -89,29 +87,6 @@ struct cpu_user_regs
 
 #undef __DECL_REG
 
-/* Access to system registers */
-
-#define READ_SYSREG32(name) ({                          \
-    uint32_t _r;                                        \
-    asm volatile("mrs  %0, "__stringify(name) : "=r" (_r));         \
-    _r; })
-#define WRITE_SYSREG32(v, name) do {                    \
-    uint32_t _r = v;                                    \
-    asm volatile("msr "__stringify(name)", %0" : : "r" (_r));       \
-} while (0)
-
-#define WRITE_SYSREG64(v, name) do {                    \
-    uint64_t _r = v;                                    \
-    asm volatile("msr "__stringify(name)", %0" : : "r" (_r));       \
-} while (0)
-#define READ_SYSREG64(name) ({                          \
-    uint64_t _r;                                        \
-    asm volatile("mrs  %0, "__stringify(name) : "=r" (_r));         \
-    _r; })
-
-#define READ_SYSREG(name)     READ_SYSREG64(name)
-#define WRITE_SYSREG(v, name) WRITE_SYSREG64(v, name)
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_ARM_ARM64_PROCESSOR_H */
xen/include/asm-arm/arm64/sysregs.h +23 -0
index f510925a2a..08585a969e 100644
@@ -57,6 +57,29 @@
 #define ICH_AP1R2_EL2             __AP1Rx_EL2(2)
 #define ICH_AP1R3_EL2             __AP1Rx_EL2(3)
 
+/* Access to system registers */
+
+#define READ_SYSREG32(name) ({                          \
+    uint32_t _r;                                        \
+    asm volatile("mrs  %0, "__stringify(name) : "=r" (_r));         \
+    _r; })
+#define WRITE_SYSREG32(v, name) do {                    \
+    uint32_t _r = v;                                    \
+    asm volatile("msr "__stringify(name)", %0" : : "r" (_r));       \
+} while (0)
+
+#define WRITE_SYSREG64(v, name) do {                    \
+    uint64_t _r = v;                                    \
+    asm volatile("msr "__stringify(name)", %0" : : "r" (_r));       \
+} while (0)
+#define READ_SYSREG64(name) ({                          \
+    uint64_t _r;                                        \
+    asm volatile("mrs  %0, "__stringify(name) : "=r" (_r));         \
+    _r; })
+
+#define READ_SYSREG(name)     READ_SYSREG64(name)
+#define WRITE_SYSREG(v, name) WRITE_SYSREG64(v, name)
+
 #endif /* _ASM_ARM_ARM64_SYSREGS_H */
 
 /*
xen/include/asm-arm/page.h +1 -0
index bcdea970ca..1a1713ce02 100644
@@ -4,6 +4,7 @@
 #include <public/xen.h>
 #include <asm/processor.h>
 #include <asm/lpae.h>
+#include <asm/sysregs.h>
 
 #ifdef CONFIG_ARM_64
 #define PADDR_BITS              48
xen/include/asm-arm/percpu.h +1 -7
index cdf64e0f77..6263e77251 100644
@@ -4,13 +4,7 @@
 #ifndef __ASSEMBLY__
 
 #include <xen/types.h>
-#if defined(CONFIG_ARM_32)
-# include <asm/arm32/processor.h>
-#elif defined(CONFIG_ARM_64)
-# include <asm/arm64/processor.h>
-#else
-# error "unknown ARM variant"
-#endif
+#include <asm/sysregs.h>
 
 extern char __per_cpu_start[], __per_cpu_data_end[];
 extern unsigned long __per_cpu_offset[NR_CPUS];
xen/include/asm-arm/sysregs.h new file +22 -0
new file mode 100644
index 0000000000..5c5c51bbcd
@@ -0,0 +1,22 @@
+#ifndef __ASM_ARM_SYSREGS_H
+#define __ASM_ARM_SYSREGS_H
+
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/sysregs.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/sysregs.h>
+#else
+# error "unknown ARM variant"
+#endif
+
+#endif /* __ASM_ARM_SYSREGS_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
+
xen/include/asm-arm/time.h +1 -1
index ea88e76304..9a7071a546 100644
@@ -1,7 +1,7 @@
 #ifndef __ARM_TIME_H__
 #define __ARM_TIME_H__
 
-#include <asm/processor.h>
+#include <asm/sysregs.h>
 
 #define DT_MATCH_TIMER                      \
     DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#13 lore raw

PATCH v2 11/21 xen/arm: Move out of processor.h traps related variable/function

In reply to Julien Grall

do_unexpected_traps() is moved to traps.h while init_traps() and hyp_traps_vectors() are moved to setup.h.

---
Changes in v2:
- Rebase
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/processor.h | 7 -------
 xen/include/asm-arm/setup.h     | 3 +++
 xen/include/asm-arm/traps.h     | 3 +++
 3 files changed, 6 insertions(+), 7 deletions(-)
xen/include/asm-arm/processor.h +0 -7
index b64ea4e8e4..72ddc42778 100644
@@ -453,10 +453,6 @@ extern register_t __cpu_logical_map[];
 #endif
 
 #ifndef __ASSEMBLY__
-extern uint32_t hyp_traps_vector[];
-
-void init_traps(void);
-
 void panic_PAR(uint64_t par);
 
 void show_execution_state(const struct cpu_user_regs *regs);
@@ -470,9 +466,6 @@ void show_registers(const struct cpu_user_regs *regs);
 #define cpu_to_core(_cpu)   (0)
 #define cpu_to_socket(_cpu) (0)
 
-void noreturn do_unexpected_trap(const char *msg,
-                                 const struct cpu_user_regs *regs);
-
 struct vcpu;
 void vcpu_regs_hyp_to_user(const struct vcpu *vcpu,
                            struct vcpu_guest_core_regs *regs);
xen/include/asm-arm/setup.h +3 -0
index 5f41ba0cba..11e1b2aacf 100644
@@ -83,6 +83,9 @@ struct bootmodule *add_boot_module(bootmodule_kind kind,
 struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
 const char *boot_module_kind_as_string(bootmodule_kind kind);
 
+extern uint32_t hyp_traps_vector[];
+void init_traps(void);
+
 #endif
 /*
  * Local variables:
xen/include/asm-arm/traps.h +3 -0
index 589fba9cd0..6d8a43a691 100644
@@ -46,6 +46,9 @@ void do_trap_hvc_smccc(struct cpu_user_regs *regs);
 
 int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc);
 
+void noreturn do_unexpected_trap(const char *msg,
+                                 const struct cpu_user_regs *regs);
+
 /* Functions for pending virtual abort checking window. */
 void abort_guest_exit_start(void);
 void abort_guest_exit_end(void);
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#14 lore raw

PATCH v2 12/21 xen/arm: Only include stringify.h when necessary

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/arm32/sysregs.h   | 1 +
 xen/include/asm-arm/arm64/processor.h | 2 --
 xen/include/asm-arm/cpregs.h          | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
xen/include/asm-arm/arm32/sysregs.h +1 -0
index b25b59a557..25cdcbfa4e 100644
@@ -1,6 +1,7 @@
 #ifndef __ASM_ARM_ARM32_SYSREGS_H
 #define __ASM_ARM_ARM32_SYSREGS_H
 
+#include <xen/stringify.h>
 #include <asm/cpregs.h>
 
 /* Layout as used in assembly, with src/dest registers mixed in */
xen/include/asm-arm/arm64/processor.h +0 -2
index 765de1b74b..81dfc5e615 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_ARM_ARM64_PROCESSOR_H
 #define __ASM_ARM_ARM64_PROCESSOR_H
 
-#include <xen/stringify.h>
-
 #ifndef __ASSEMBLY__
 
 /* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */
xen/include/asm-arm/cpregs.h +0 -2
index 07e5791983..97a3c6f1c1 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_ARM_CPREGS_H
 #define __ASM_ARM_CPREGS_H
 
-#include <xen/stringify.h>
-
 /*
  * AArch32 Co-processor registers.
  *
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#15 lore raw

PATCH v2 13/21 xen/arm: Only include vreg.h when necessary

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/vgic-v2.c       | 1 +
 xen/arch/arm/vgic-v3-its.c   | 1 +
 xen/arch/arm/vpl011.c        | 1 +
 xen/include/asm-arm/vgic.h   | 1 -
 xen/include/asm-arm/vpl011.h | 1 -
 5 files changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/vgic-v2.c +1 -0
index f6c11f1e41..8526f9be04 100644
@@ -31,6 +31,7 @@
 #include <asm/platform.h>
 #include <asm/vgic.h>
 #include <asm/vgic-emul.h>
+#include <asm/vreg.h>
 
 static struct {
     bool enabled;
xen/arch/arm/vgic-v3-its.c +1 -0
index 9edd97c4e7..5b73c4ecd7 100644
@@ -45,6 +45,7 @@
 #include <asm/gic_v3_its.h>
 #include <asm/vgic.h>
 #include <asm/vgic-emul.h>
+#include <asm/vreg.h>
 
 /*
  * Data structure to describe a virtual ITS.
xen/arch/arm/vpl011.c +1 -0
index a281eabd7e..117e41c760 100644
@@ -33,6 +33,7 @@
 #include <asm/pl011-uart.h>
 #include <asm/vgic-emul.h>
 #include <asm/vpl011.h>
+#include <asm/vreg.h>
 
 /*
  * Since pl011 registers are 32-bit registers, all registers
xen/include/asm-arm/vgic.h +0 -1
index 374fdaa40d..760392f9ef 100644
@@ -27,7 +27,6 @@
 #include <xen/rbtree.h>
 #include <asm/gic.h>
 #include <asm/mmio.h>
-#include <asm/vreg.h>
 
 struct pending_irq
 {
xen/include/asm-arm/vpl011.h +0 -1
index db95ff822f..a82869a53c 100644
@@ -21,7 +21,6 @@
 
 #include <public/domctl.h>
 #include <public/io/ring.h>
-#include <asm/vreg.h>
 #include <xen/mm.h>
 
 /* helper macros */
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#16 lore raw

PATCH v2 14/21 xen/arm: Remove unnecessary includes in asm/vgic.h

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/vgic.h | 3 ---
 1 file changed, 3 deletions(-)
xen/include/asm-arm/vgic.h +0 -3
index 760392f9ef..0316d87f66 100644
@@ -22,11 +22,8 @@
 #include <asm/new_vgic.h>
 #else
 
-#include <xen/bitops.h>
 #include <xen/radix-tree.h>
 #include <xen/rbtree.h>
-#include <asm/gic.h>
-#include <asm/mmio.h>
 
 struct pending_irq
 {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#17 lore raw

PATCH v2 15/21 xen/arm: Remove unnecessary includes in asm/mmio.h

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/mmio.h | 2 --
 1 file changed, 2 deletions(-)
xen/include/asm-arm/mmio.h +0 -2
index 3ed3f82bf7..8dbfb27682 100644
@@ -23,8 +23,6 @@
 #include <xen/rwlock.h>
 
 #include <asm/hsr.h>
-#include <asm/processor.h>
-#include <asm/regs.h>
 
 #define MAX_IO_HANDLER  16
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#18 lore raw

PATCH v2 16/21 xen/arm: Remove unnecessary includes in traps.c

In reply to Julien Grall

Also, include smccc.h instead of psci.h.

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/traps.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
xen/arch/arm/traps.c +1 -3
index 0b8d342c1a..88ffeeb480 100644
@@ -42,12 +42,10 @@
 #include <asm/cpufeature.h>
 #include <asm/debugger.h>
 #include <asm/event.h>
-#include <asm/flushtlb.h>
 #include <asm/hsr.h>
 #include <asm/mmio.h>
-#include <asm/monitor.h>
-#include <asm/psci.h>
 #include <asm/regs.h>
+#include <asm/smccc.h>
 #include <asm/traps.h>
 #include <asm/vgic.h>
 #include <asm/vtimer.h>
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#19 lore raw

PATCH v2 17/21 xen/arm: Remove unnecessary includes in asm/p2m.h

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/p2m.h | 3 ---
 1 file changed, 3 deletions(-)
xen/include/asm-arm/p2m.h +0 -3
index c03557544a..be58125fb7 100644
@@ -5,10 +5,7 @@
 #include <xen/radix-tree.h>
 #include <xen/rwlock.h>
 #include <xen/mem_access.h>
-#include <public/vm_event.h> /* for vm_event_response_t */
-#include <public/memory.h>
 #include <xen/p2m-common.h>
-#include <public/memory.h>
 
 #define paddr_bits PADDR_BITS
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#20 lore raw

PATCH v2 18/21 xen/arm: Remove unnecessary includes in asm-arm/acpi.h

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/acpi.h | 1 -
 1 file changed, 1 deletion(-)
xen/include/asm-arm/acpi.h +0 -1
index feec4fb0ac..50340281a9 100644
@@ -23,7 +23,6 @@
 #ifndef _ASM_ARM_ACPI_H
 #define _ASM_ARM_ACPI_H
 
-#include <asm/page.h>
 #include <asm/setup.h>
 
 #define COMPILER_DEPENDENT_INT64   long long
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#21 lore raw

PATCH v2 19/21 xen/arm: Remove unnecessary includes in asm/current.h

In reply to Julien Grall

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/current.h | 2 --
 1 file changed, 2 deletions(-)
xen/include/asm-arm/current.h +0 -2
index f9819b34fc..c4af66fbb9 100644
@@ -2,9 +2,7 @@
 #define __ARM_CURRENT_H__
 
 #include <xen/percpu.h>
-#include <public/xen.h>
 
-#include <asm/percpu.h>
 #include <asm/processor.h>
 
 /* Tell whether the guest vCPU enabled Workaround 2 (i.e variant 4) */
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#22 lore raw

PATCH v2 20/21 xen/arm: platform: Don't include p2m.h in exynos5 and omap5

In reply to Julien Grall

None of the platforms are using the p2m helpers.

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/arch/arm/platforms/exynos5.c | 1 -
 xen/arch/arm/platforms/omap5.c   | 1 -
 2 files changed, 2 deletions(-)
xen/arch/arm/platforms/exynos5.c +0 -1
index e2c0b7b878..6560507092 100644
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/p2m.h>
 #include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/mm.h>
xen/arch/arm/platforms/omap5.c +0 -1
index 7dbba95756..aee24e4d28 100644
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/p2m.h>
 #include <asm/platform.h>
 #include <asm/platforms/omap5.h>
 #include <xen/mm.h>
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#23 lore raw

PATCH v2 21/21 xen/arm: Move vgic_* helpers from gic.h to vgic.h

In reply to Julien Grall

Keep vgic_* helpers in a single place. At the same time remove gic.h from event.h since the helpers has now been moved to vgic.h (included by domain.h).

---
Changes in v2:
- Add Andrii's reviewed-by

---
 xen/include/asm-arm/event.h | 1 -
 xen/include/asm-arm/gic.h   | 3 ---
 xen/include/asm-arm/vgic.h  | 5 +++++
 3 files changed, 5 insertions(+), 4 deletions(-)
xen/include/asm-arm/event.h +0 -1
index 2f51864043..b14c166ad6 100644
@@ -1,7 +1,6 @@
 #ifndef __ASM_EVENT_H__
 #define __ASM_EVENT_H__
 
-#include <asm/gic.h>
 #include <asm/domain.h>
 
 void vcpu_kick(struct vcpu *v);
xen/include/asm-arm/gic.h +0 -3
index 22fa122e52..fab02f19f7 100644
@@ -249,9 +249,7 @@ extern int gic_route_irq_to_guest(struct domain *, unsigned int virq,
 int gic_remove_irq_from_guest(struct domain *d, unsigned int virq,
                               struct irq_desc *desc);
 
-extern void vgic_sync_to_lrs(void);
 extern void gic_clear_pending_irqs(struct vcpu *v);
-extern int vgic_vcpu_pending_irq(struct vcpu *v);
 
 extern void init_maintenance_interrupt(void);
 extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,
@@ -306,7 +304,6 @@ extern unsigned int gic_number_lines(void);
 /* IRQ translation function for the device tree */
 int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
                   unsigned int *out_hwirq, unsigned int *out_type);
-void vgic_sync_from_lrs(struct vcpu *v);
 
 struct gic_info {
     /* GIC version */
xen/include/asm-arm/vgic.h +5 -0
index 0316d87f66..56ed5fe8fe 100644
@@ -363,6 +363,11 @@ void vgic_v3_setup_hw(paddr_t dbase,
                       unsigned int intid_bits);
 #endif
 
+void vgic_sync_to_lrs(void);
+void vgic_sync_from_lrs(struct vcpu *v);
+
+int vgic_vcpu_pending_irq(struct vcpu *v);
+
 #endif /* __ASM_ARM_VGIC_H__ */
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#24 lore raw
In reply to Julien Grall

I committed the whole series

Quoted 84 lines · Julien Grall

Hi all,

This patch series is a bunch of clean-ups I have collected the past few weeks.

The main goal is to reduce the scope of some includes and reduce the size of processor.h by moving some parts in new/current headers.

All the patches but #1 and #3 have been reviewed by Andrii.

Cheers,

Julien Grall (21):
xen/arm: traps: Constify show_*, do_unexpected_trap and do_bug_frame
parameters
xen/arm: regs: Convert guest_mode to a static inline helper xen/arm: Remove __init from prototype
xen/arm: bugs: Move do_bug_frame to traps.h
xen/arm: Consolidate CPU identification in cpufeature.{c,h} xen/arm: Move VABORT_GEN_BY_GUEST to traps.h and turned into inline xen/arm: gic-3: Remove unused includes
xen/arm: gic-v3: Re-order includes in alphabetical order xen/arm: Move HSR defines in a new header hsr.h
xen/arm: Move SYSREG accessors in sysregs.h
xen/arm: Move out of processor.h traps related variable/function xen/arm: Only include stringify.h when necessary
xen/arm: Only include vreg.h when necessary
xen/arm: Remove unnecessary includes in asm/vgic.h xen/arm: Remove unnecessary includes in asm/mmio.h xen/arm: Remove unnecessary includes in traps.c
xen/arm: Remove unnecessary includes in asm/p2m.h xen/arm: Remove unnecessary includes in asm-arm/acpi.h xen/arm: Remove unnecessary includes in asm/current.h xen/arm: platform: Don't include p2m.h in exynos5 and omap5 xen/arm: Move vgic_* helpers from gic.h to vgic.h

 xen/arch/arm/Makefile                 |   1 -
 xen/arch/arm/acpi/lib.c               |   1 +
 xen/arch/arm/arm32/entry.S            |   1 +
 xen/arch/arm/arm32/proc-v7.S          |   1 +
 xen/arch/arm/arm32/traps.c            |   1 +
 xen/arch/arm/arm64/traps.c            |   1 +
 xen/arch/arm/bootfdt.c                |   2 +-
 xen/arch/arm/cpu.c                    |  68 -------
 xen/arch/arm/cpuerrata.c              |   1 +
 xen/arch/arm/cpufeature.c             |  42 ++++
 xen/arch/arm/device.c                 |   1 +
 xen/arch/arm/gic-v3-lpi.c             |   1 +
 xen/arch/arm/gic-v3.c                 |  28 ++-
 xen/arch/arm/platforms/exynos5.c      |   1 -
 xen/arch/arm/platforms/omap5.c        |   1 -
 xen/arch/arm/psci.c                   |   1 +
 xen/arch/arm/traps.c                  |  37 ++--
 xen/arch/arm/vcpreg.c                 |   1 +
 xen/arch/arm/vgic-v2.c                |   1 +
 xen/arch/arm/vgic-v3-its.c            |   1 +
 xen/arch/arm/vpl011.c                 |   1 +
 xen/include/asm-arm/acpi.h            |   8 +-
 xen/include/asm-arm/alternative.h     |   3 +-
 xen/include/asm-arm/arm32/processor.h |  62 ------
 xen/include/asm-arm/arm32/sysregs.h   |  75 +++++++
 xen/include/asm-arm/arm64/hsr.h       | 122 ++++++++++++
 xen/include/asm-arm/arm64/processor.h |  27 ---
 xen/include/asm-arm/arm64/sysregs.h   | 132 +++----------
 xen/include/asm-arm/bug.h             |   4 -
 xen/include/asm-arm/cpregs.h          |   2 -
 xen/include/asm-arm/cpufeature.h      | 134 +++++++++++++
 xen/include/asm-arm/current.h         |   2 -
 xen/include/asm-arm/device.h          |  10 +-
 xen/include/asm-arm/event.h           |   1 -
 xen/include/asm-arm/gic.h             |   3 -
 xen/include/asm-arm/hsr.h             | 217 +++++++++++++++++++++
 xen/include/asm-arm/iommu.h           |   4 +-
 xen/include/asm-arm/mmio.h            |   4 +-
 xen/include/asm-arm/p2m.h             |   3 -
 xen/include/asm-arm/page.h            |   1 +
 xen/include/asm-arm/percpu.h          |   8 +-
 xen/include/asm-arm/platform.h        |   7 +-
 xen/include/asm-arm/processor.h       | 354 +---------------------------------
 xen/include/asm-arm/regs.h            |  22 ++-
 xen/include/asm-arm/setup.h           |   9 +-
 xen/include/asm-arm/sysregs.h         |  22 +++
 xen/include/asm-arm/time.h            |   2 +
 xen/include/asm-arm/traps.h           |  16 ++
 xen/include/asm-arm/vgic.h            |   9 +-
Quoted 12 lines
 xen/include/asm-arm/vpl011.h          |   1 -
 xen/include/xen/device_tree.h         |   5 +-
 51 files changed, 742 insertions(+), 720 deletions(-)
 delete mode 100644 xen/arch/arm/cpu.c
 create mode 100644 xen/include/asm-arm/arm32/sysregs.h
 create mode 100644 xen/include/asm-arm/arm64/hsr.h
 create mode 100644 xen/include/asm-arm/hsr.h
 create mode 100644 xen/include/asm-arm/sysregs.h
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel