|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen/arm: Preserve host GIC #interrupt-cells for Dom0
On 05-Nov-26 18:01, Kuan-Wei Chiu wrote:
> Xen copies device interrupt properties from the host device tree to
> Dom0, but hardcodes #interrupt-cells to 3 in make_gic_node() and
> fdt_property_interrupts(). On GICv3 platforms where the host uses 4
> cells, Dom0 parses the copied specifiers as 3 cells each and fails to
> set up device interrupts.
>
> Propagate #interrupt-cells from the host GIC node in make_gic_node()
> and pad Dom0 interrupt specifiers with trailing zero cells in
> fdt_property_interrupts().
>
> Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
> ---
> xen/arch/arm/domain_build.c | 30 +++++++++++++++++++++++++++---
> 1 file changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 1ee1f1f6a7..74d2491f9e 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -654,12 +654,30 @@ static int __init fdt_property_interrupts(const struct
> kernel_info *kinfo,
> unsigned int num_irq)
> {
> int res;
> + uint32_t intrcells = ARRAY_SIZE(intr[0]);
> + void *val;
> + unsigned int i, stride;
>
> - res = fdt_property(kinfo->fdt, "interrupts",
> - intr, sizeof(intr[0]) * num_irq);
> + if ( is_hardware_domain(kinfo->bd.d) )
> + {
> + const struct dt_device_node *gic = dt_interrupt_controller;
> +
> + if ( !dt_property_read_u32(gic, "#interrupt-cells", &intrcells) )
> + return -FDT_ERR_XEN(ENOENT);
> + if ( intrcells < ARRAY_SIZE(intr[0]) )
> + return -FDT_ERR_XEN(ERANGE);
> + }
> +
> + stride = intrcells * sizeof(intr[0][0]);
> + res = fdt_property_placeholder(kinfo->fdt, "interrupts",
> + stride * num_irq, &val);
> if ( res )
> return res;
>
> + memset(val, 0, stride * num_irq);
> + for ( i = 0; i < num_irq; i++ )
> + memcpy((uint8_t *)val + i * stride, intr[i], sizeof(intr[0]));
Please add a comment explaining why only the hardware domain is special
cased and that any extra cells beyond the 3-cell specifier are zero-padded.
With that:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
~Michal
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |