Skip to content

Commit

Permalink
IRQ: generalize [gs]et_irq_regs()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Andrew Cooper <[email protected]>
Reviewed-by: Julien Grall <[email protected]>
  • Loading branch information
jbeulich committed Jan 23, 2024
1 parent 79519fc commit f67bddf
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
2 changes: 2 additions & 0 deletions xen/arch/arm/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,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);

Expand Down Expand Up @@ -288,6 +289,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)
out_no_end:
spin_unlock(&desc->lock);
irq_exit();
set_irq_regs(old_regs);
}

void release_irq(unsigned int irq, const void *dev_id)
Expand Down
21 changes: 0 additions & 21 deletions xen/arch/x86/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions xen/arch/x86/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions xen/common/irq.c
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
21 changes: 21 additions & 0 deletions xen/include/xen/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,27 @@ void cf_check irq_actor_none(struct irq_desc *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;

Expand Down

0 comments on commit f67bddf

Please sign in to comment.