On 05.06.2025 17:59, Oleksii Kurochko wrote:
> +static int __init cf_check aplic_init(void)
> +{
> +    dt_phandle imsic_phandle;
> +    const __be32 *prop;
> +    uint64_t size, paddr;
> +    const struct dt_device_node *imsic_node;
> +    const struct dt_device_node *node = aplic_info.node;
> +    int rc;
> +
> +    /* Check for associated imsic node */
> +    if ( !dt_property_read_u32(node, "msi-parent", &imsic_phandle) )
> +        panic("%s: IDC mode not supported\n", node->full_name);
> +
> +    imsic_node = dt_find_node_by_phandle(imsic_phandle);
> +    if ( !imsic_node )
> +        panic("%s: unable to find IMSIC node\n", node->full_name);
> +
> +    rc = imsic_init(imsic_node);
> +    if ( rc == IRQ_M_EXT )
> +        /* Machine mode imsic node, ignore this aplic node */
> +        return 0;
> +
> +    if ( rc )
> +        panic("%s: Failded to initialize IMSIC\n", node->full_name);

Nit: Stray 'd'.

> +    /* Find out number of interrupt sources */
> +    if ( !dt_property_read_u32(node, "riscv,num-sources",
> +                               &aplic_info.num_irqs) )
> +        panic("%s: failed to get number of interrupt sources\n",
> +              node->full_name);
> +
> +    if ( aplic_info.num_irqs > ARRAY_SIZE(aplic.regs->sourcecfg) )
> +        aplic_info.num_irqs = ARRAY_SIZE(aplic.regs->sourcecfg);
> +
> +    prop = dt_get_property(node, "reg", NULL);
> +    dt_get_range(&prop, node, &paddr, &size);
> +    if ( !paddr )
> +        panic("%s: first MMIO resource not found\n", node->full_name);
> +
> +    if ( !IS_ALIGNED(paddr, KB(4)) )
> +        panic("%s: paddr of memory-mapped control region should be 4Kb "
> +              "aligned:%#lx\n", __func__, paddr);
> +
> +    if ( !IS_ALIGNED(size, KB(4)) && (size < KB(16)) )

DYM || instead of && here?

> +        panic("%s: memory-mapped control region should be a multiple of 4 
> KiB "
> +              "in size and the smallest valid control is 16Kb: %#lx\n",
> +              __func__, size);

Here and above: See my remark on the earlier patch regarding the wrapping
of format strings.

Jan

Reply via email to