[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/8] IRQ: generalize [gs]et_irq_regs()



Hi Jan,

On 11/01/2024 07:32, Jan Beulich wrote:
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@xxxxxxxx>

Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>

---
To limit visibility of the per-CPU data item, we may want to consider
making the functions out-of-line ones (in common/irq.c).

--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -221,6 +221,7 @@ void do_IRQ(struct cpu_user_regs *regs,
  {
      struct irq_desc *desc = irq_to_desc(irq);
      struct irqaction *action;
+    struct cpu_user_regs *old_regs = set_irq_regs(regs);
perfc_incr(irqs); @@ -288,6 +289,7 @@ out:
  out_no_end:
      spin_unlock(&desc->lock);
      irq_exit();
+    set_irq_regs(old_regs);
  }

[...]

+/*
+ * Per-cpu interrupted context register state - the top-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;

NIT: As you move the code, can you add a newline before the return?

+       return old_regs;
+}
+
  struct domain;
  struct vcpu;

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.