Skip to content

Commit

Permalink
intrng: split intr_isrc_assign_cpu()
Browse files Browse the repository at this point in the history
intr_isrc_assign_cpu() failed to split the intr_event functionality
from the assignment functionality.  The actual assignment is a PIC-level
operation and as such should be separate.
  • Loading branch information
ehem committed Dec 17, 2024
1 parent c21650b commit fceb240
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
21 changes: 14 additions & 7 deletions sys/kern/subr_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,14 +635,10 @@ intr_isrc_post_filter(void *arg)
PIC_POST_FILTER(isrc->isrc_dev, isrc);
}

/*
* Interrupt source assign_cpu method for MI interrupt framework.
*/
static int
intr_isrc_assign_cpu(void *arg, int cpu)
int
intr_assign_irq(struct intr_irqsrc *isrc, int cpu, bool do_assignment)
{
#ifdef SMP
struct intr_irqsrc *isrc = arg;
int error;

mtx_lock(&isrc_table_lock);
Expand All @@ -660,7 +656,7 @@ intr_isrc_assign_cpu(void *arg, int cpu)
* PIC is expected to change isrc_cpu appropriately to keep us well
* informed if the call is successful.
*/
if (irq_assign_cpu) {
if (do_assignment) {
error = PIC_BIND_INTR(isrc->isrc_dev, isrc);
if (error) {
CPU_ZERO(&isrc->isrc_cpu);
Expand All @@ -675,6 +671,17 @@ intr_isrc_assign_cpu(void *arg, int cpu)
#endif
}

/*
* Interrupt source assign_cpu method for MI interrupt framework.
*/
static int
intr_isrc_assign_cpu(void *arg, int cpu)
{
struct intr_irqsrc *isrc = arg;

return (intr_assign_irq(isrc, cpu, irq_assign_cpu));
}

/*
* Create interrupt event for interrupt source.
*/
Expand Down
1 change: 1 addition & 0 deletions sys/sys/intr.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ int intr_isrc_deregister(struct intr_irqsrc *);
int intr_isrc_register(struct intr_irqsrc *, device_t, u_int, const char *, ...)
__printflike(4, 5);

int intr_assign_irq(struct intr_irqsrc *isrc, int cpu, bool do_assignment);
int intr_add_handler(struct intr_irqsrc *, const char *, driver_filter_t,
driver_intr_t, void *, enum intr_type, void **);
int intr_describe(struct intr_irqsrc *isrc, void *cookie, const char *descr);
Expand Down

0 comments on commit fceb240

Please sign in to comment.