diff mbox series

[2/4] x86/traps: Move percpu_traps_init() into traps-setup.c

Message ID 20250317192023.568432-3-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series x86/traps: Simplify exception setup | expand

Commit Message

Andrew Cooper March 17, 2025, 7:20 p.m. UTC
Move the declaration from asm/system.h into asm/traps.h.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/acpi/power.c         |  1 +
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  2 ++
 xen/arch/x86/setup.c              |  1 +
 xen/arch/x86/smpboot.c            |  1 +
 xen/arch/x86/traps-setup.c        | 15 +++++++++++++++
 xen/arch/x86/traps.c              |  8 --------
 7 files changed, 20 insertions(+), 9 deletions(-)

Comments

Jan Beulich March 18, 2025, 3:04 p.m. UTC | #1
On 17.03.2025 20:20, Andrew Cooper wrote:
> Move the declaration from asm/system.h into asm/traps.h.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

> --- a/xen/arch/x86/traps-setup.c
> +++ b/xen/arch/x86/traps-setup.c
> @@ -3,5 +3,20 @@
>   * Configuration of event handling for all CPUs.
>   */
>  #include <asm/idt.h>
> +#include <asm/msr.h>
> +#include <asm/system.h>
> +#include <asm/traps.h>
>  
>  DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
> +
> +/*
> + * Set up per-CPU linkage registers for exception, interrupt and syscall
> + * handling.
> + */
> +void percpu_traps_init(void)
> +{
> +    subarch_percpu_traps_init();

At some point this may then want expanding into here, seeing that we don't
have any subarch anymore, and don't expect to re-gain one any time soon?

Jan
Andrew Cooper March 18, 2025, 3:12 p.m. UTC | #2
On 18/03/2025 3:04 pm, Jan Beulich wrote:
> On 17.03.2025 20:20, Andrew Cooper wrote:
>> Move the declaration from asm/system.h into asm/traps.h.
>>
>> No functional change.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks.

>
>> --- a/xen/arch/x86/traps-setup.c
>> +++ b/xen/arch/x86/traps-setup.c
>> @@ -3,5 +3,20 @@
>>   * Configuration of event handling for all CPUs.
>>   */
>>  #include <asm/idt.h>
>> +#include <asm/msr.h>
>> +#include <asm/system.h>
>> +#include <asm/traps.h>
>>  
>>  DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
>> +
>> +/*
>> + * Set up per-CPU linkage registers for exception, interrupt and syscall
>> + * handling.
>> + */
>> +void percpu_traps_init(void)
>> +{
>> +    subarch_percpu_traps_init();
> At some point this may then want expanding into here, seeing that we don't
> have any subarch anymore, and don't expect to re-gain one any time soon?

I have folded it later in the FRED series. 

This, and load_system_tables() need non-trivial alterations to support
FRED, and I haven't got that part of the work cleaned up suitable to
post yet.

~Andrew
diff mbox series

Patch

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index fe70257864e1..3196a33b1918 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -31,6 +31,7 @@ 
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 #include <public/platform.h>
 
diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 73cb16ca68d6..73364056c702 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -266,7 +266,6 @@  static inline int local_irq_is_enabled(void)
 void trap_init(void);
 void init_idt_traps(void);
 void load_system_tables(void);
-void percpu_traps_init(void);
 void subarch_percpu_traps_init(void);
 
 #endif
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 01ef362edc8c..825f7441c86e 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,6 +7,8 @@ 
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void percpu_traps_init(void);
+
 const char *vector_name(unsigned int vec);
 
 #endif /* ASM_TRAP_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 718297ca541a..b092106ccca5 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -56,6 +56,7 @@ 
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index b63a9ce13e0a..54207e6d8830 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -41,6 +41,7 @@ 
 #include <asm/tboot.h>
 #include <asm/time.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 uint32_t __ro_after_init trampoline_phys;
 enum ap_boot_method __read_mostly ap_boot_method = AP_BOOT_NORMAL;
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 3ee28319584d..fa78a35a7ebf 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -3,5 +3,20 @@ 
  * Configuration of event handling for all CPUs.
  */
 #include <asm/idt.h>
+#include <asm/msr.h>
+#include <asm/system.h>
+#include <asm/traps.h>
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
+
+/*
+ * Set up per-CPU linkage registers for exception, interrupt and syscall
+ * handling.
+ */
+void percpu_traps_init(void)
+{
+    subarch_percpu_traps_init();
+
+    if ( cpu_has_xen_lbr )
+        wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
+}
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a89f4f4f34ea..29d7e4123f90 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1864,14 +1864,6 @@  void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void percpu_traps_init(void)
-{
-    subarch_percpu_traps_init();
-
-    if ( cpu_has_xen_lbr )
-        wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
-}
-
 void nocall entry_PF(void);
 
 void __init init_idt_traps(void)