]> xenbits.xensource.com Git - xen.git/commitdiff
IRQ: generalize [gs]et_irq_regs()
authorJan Beulich <jbeulich@suse.com>
Tue, 23 Jan 2024 11:03:23 +0000 (12:03 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 9 Apr 2024 15:48:19 +0000 (16:48 +0100)
Move functions (and their data) to common code, and invoke the functions
on Arm as well. This is in preparation of dropping the register
parameters from handler functions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit f67bddf3bccd99a5fee968c3b3f288db6a57d3be)

xen/arch/arm/irq.c
xen/arch/x86/include/asm/irq.h
xen/arch/x86/irq.c
xen/common/irq.c
xen/include/xen/irq.h

index fd0c15fffd9300c4c1c8bf4f8cba8ff98a11af42..8649c636a365a8703f89406c6165e3775f55412a 100644 (file)
@@ -229,6 +229,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)
 {
     struct irq_desc *desc = irq_to_desc(irq);
     struct irqaction *action;
+    struct cpu_user_regs *old_regs = set_irq_regs(regs);
 
     perfc_incr(irqs);
 
@@ -296,6 +297,7 @@ out:
 out_no_end:
     spin_unlock(&desc->lock);
     irq_exit();
+    set_irq_regs(old_regs);
 }
 
 void release_irq(unsigned int irq, const void *dev_id)
index 823d627fd0010cb9966ab09416c98ad07dfbe398..26850e5077fd6853c2ec57238bce2bf85b7144b0 100644 (file)
@@ -70,27 +70,6 @@ extern bool opt_noirqbalance;
 
 extern int opt_irq_vector_map;
 
-/*
- * Per-cpu current frame pointer - the location of the last exception frame on
- * the stack
- */
-DECLARE_PER_CPU(struct cpu_user_regs *, __irq_regs);
-
-static inline struct cpu_user_regs *get_irq_regs(void)
-{
-       return this_cpu(__irq_regs);
-}
-
-static inline struct cpu_user_regs *set_irq_regs(struct cpu_user_regs *new_regs)
-{
-       struct cpu_user_regs *old_regs, **pp_regs = &this_cpu(__irq_regs);
-
-       old_regs = *pp_regs;
-       *pp_regs = new_regs;
-       return old_regs;
-}
-
-
 #define platform_legacy_irq(irq)       ((irq) < 16)
 
 void cf_check event_check_interrupt(struct cpu_user_regs *regs);
index 51b4837cd33841b7bb0ee115043956fc6e532f74..abd6f577dd1b7b5b2d8b9c9e11b9ee83143222a1 100644 (file)
@@ -53,8 +53,6 @@ static DEFINE_SPINLOCK(vector_lock);
 
 DEFINE_PER_CPU(vector_irq_t, vector_irq);
 
-DEFINE_PER_CPU(struct cpu_user_regs *, __irq_regs);
-
 static LIST_HEAD(irq_ratelimit_list);
 static DEFINE_SPINLOCK(irq_ratelimit_lock);
 static struct timer irq_ratelimit_timer;
index 727cf8bd22daa16d74e7cb258b4c06b193e6dbae..236cf171e2afef7a86b823fe4dff925d84f3886e 100644 (file)
@@ -1,6 +1,8 @@
 #include <xen/irq.h>
 #include <xen/errno.h>
 
+DEFINE_PER_CPU(struct cpu_user_regs *, irq_regs);
+
 int init_one_irq_desc(struct irq_desc *desc)
 {
     int err;
index 300625e56db29716d1d608829f045db475df53f7..c93ef31a9c3dd10e2241d9ffc486e3e643b4ddf0 100644 (file)
@@ -130,6 +130,27 @@ void cf_check irq_actor_none(struct irq_desc *);
 #define irq_disable_none irq_actor_none
 #define irq_enable_none irq_actor_none
 
+/*
+ * Per-cpu interrupted context register state - the inner-most interrupt frame
+ * on the stack.
+ */
+DECLARE_PER_CPU(struct cpu_user_regs *, irq_regs);
+
+static inline struct cpu_user_regs *get_irq_regs(void)
+{
+       return this_cpu(irq_regs);
+}
+
+static inline struct cpu_user_regs *set_irq_regs(struct cpu_user_regs *new_regs)
+{
+       struct cpu_user_regs *old_regs, **pp_regs = &this_cpu(irq_regs);
+
+       old_regs = *pp_regs;
+       *pp_regs = new_regs;
+
+       return old_regs;
+}
+
 struct domain;
 struct vcpu;