Skip to content

Commit 9e90e58

Browse files
vireshkjgross1
authored andcommitted
xen: evtchn: Allow shared registration of IRQ handers
Currently the handling of events is supported either in the kernel or userspace, but not both. In order to support fast delivery of interrupts from the guest to the backend, we need to handle the Queue notify part of Virtio protocol in kernel and the rest in userspace. Update the interrupt handler registration flag to IRQF_SHARED for event channels, which would allow multiple entities to bind their interrupt handler for the same event channel port. Also increment the reference count of irq_info when multiple entities try to bind event channel to irqchip, so the unbinding happens only after all the users are gone. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/99b1edfd3147c6b5d22a5139dab5861e767dc34a.1697439990.git.viresh.kumar@linaro.org Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent 767e33c commit 9e90e58

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/xen/events/events_base.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,8 @@ static int bind_evtchn_to_irq_chip(evtchn_port_t evtchn, struct irq_chip *chip,
12291229
bind_evtchn_to_cpu(evtchn, 0, false);
12301230
} else {
12311231
struct irq_info *info = info_for_irq(irq);
1232-
WARN_ON(info == NULL || info->type != IRQT_EVTCHN);
1232+
if (!WARN_ON(!info || info->type != IRQT_EVTCHN))
1233+
info->refcnt++;
12331234
}
12341235

12351236
out:

drivers/xen/evtchn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static int evtchn_bind_to_user(struct per_user_data *u, evtchn_port_t port,
397397
if (rc < 0)
398398
goto err;
399399

400-
rc = bind_evtchn_to_irqhandler_lateeoi(port, evtchn_interrupt, 0,
400+
rc = bind_evtchn_to_irqhandler_lateeoi(port, evtchn_interrupt, IRQF_SHARED,
401401
u->name, evtchn);
402402
if (rc < 0)
403403
goto err;

0 commit comments

Comments
 (0)