|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] xen/riscv: bound each IMSIC MMIO regset by the per-group hart slots
On 16.11.2026 16:29, Baptiste Le Duc wrote:
> @@ -442,15 +442,34 @@ int __init imsic_init(const struct dt_device_node *node)
> goto imsic_init_err;
> }
>
> - if ( mmios[i].size != expected_mmio_size )
> + /* A register set must not run past the end of its group. */
> + offset = mmios[i].base_addr & (group_size - 1);
> + if ( mmios[i].size + offset > group_size )
> {
> rc = -EINVAL;
> - printk(XENLOG_ERR "%s: IMSIC MMIO size is incorrect %ld,
> expected MMIO size: %ld\n",
> - node->name, mmios[i].size, expected_mmio_size);
> + printk(XENLOG_ERR
> + "%s: IMSIC MMIO regset %u (offset %#lx + size %#lx)
> exceeds group size %#lx\n",
> + node->name, i, offset, mmios[i].size, group_size);
> goto imsic_init_err;
> }
> +
> + /* The last slot may be cut short, see the lookup below. */
> + nr_slots += DIV_ROUND_UP(mmios[i].size,
> +
> IMSIC_HART_SIZE(imsic_cfg.guest_index_bits));
> }
>
> + /*
> + * Parent irq i is given hart slot i, counting slots across the register
> + * sets in order. A slot with no hart behind it therefore shifts every
> + * later irq one slot early, onto the previous hart's interrupt file.
> + * Counting can't tell that from harmless unused slots at the end, hence
> + * only a warning.
> + */
> + if ( nr_slots > nr_parent_irqs )
> + printk(XENLOG_WARNING
> + "%s: %lu hart slots in IMSIC MMIO regsets for %u parent irqs,
> unused slots must only be at the end of the last regset\n",
I'll leave full review to Oleksii, just a remark here: This wants shortening
some.
Not only for source line length (we allow going past 80 cols, but please not
this
much), but also for what actually ends up on a serial console. For example, I
wonder whether what follows after the comma really needs to go to the log. If
the
message appears, context info can be obtained by consulting the source.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |