|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v6 18/23] xen/riscv: implement IRQ routing for device passthrough
On 20.07.2026 17:59, Oleksii Kurochko wrote:
> --- a/xen/arch/riscv/Makefile
> +++ b/xen/arch/riscv/Makefile
> @@ -1,6 +1,7 @@
> obj-y += aia.o
> obj-y += aplic.o
> obj-y += cpufeature.o
> +obj-y += device.o
Since you don't permit OVERLAY_DTB=y just yet, this could simply be
obj-y += device.init.o
for the time being. Else use Arm's construct. (And I can't help the feeling
that I did point this out before.)
> @@ -227,3 +253,215 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int
> irq)
> spin_unlock(&desc->lock);
> irq_exit();
> }
> +
> +static struct irq_guest *irq_get_guest_info(struct irq_desc *desc)
> +{
> + ASSERT(spin_is_locked(&desc->lock));
> + ASSERT(test_bit(_IRQ_GUEST, &desc->status));
> + ASSERT(desc->action != NULL);
> +
> + return desc->action->dev_id;
> +}
> +
> +
Nit: Just to remind you - no double blank lines please.
> +/* Route an IRQ to a specific guest */
> +int route_irq_to_guest(struct domain *d, unsigned int virq,
> + unsigned int irq, const char *devname)
> +{
> + struct irqaction *action;
> + struct irq_guest *info;
> + struct irq_desc *desc;
> + unsigned long flags;
> + int retval = 0;
> +
> + if ( d->is_dying )
> + return -EINVAL;
> +
> + desc = irq_to_desc(irq);
> +
> + /*
> + * release_irq() frees this action via xvfree(), relying on action
> + * being the first member of struct irq_guest so that &info->action
> + * coincides with info itself. Guard the layout so a future field
> + * reorder can't silently turn that into a free() of a mid-allocation
> + * pointer.
> + */
> + BUILD_BUG_ON(offsetof(struct irq_guest, action) != 0);
Can't release_irq() simply use container_of()? One way or another it feels
like you're painting yourself into a particular corner ...
With at least the earlier two issues taken care of:
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |