Hi Marc,
On Mon, Mar 24, 2014 at 4:10 AM, Marc Zyngier <marc.zyngier@xxxxxxx> wrote:
>
> Hi Zi,
>
> On 22/03/14 01:21, Zi Shen Lim wrote:
> > Hi Marc,
> >
> > On Thu, Mar 20, 2014 at 4:52 AM, Marc Zyngier <marc.zyngier@xxxxxxx
> > <mailto:marc.zyngier@xxxxxxx>> wrote:
> > <snip>
> >
> >
> > + /*
> > + * Find out how many interrupts are supported.
> > + * The GIC only supports up to 1020 interrupt sources
> > (SGI+PPI+SPI)
> > + */
> > + gic_irqs = readl_relaxed(gic_data.dist_base + GICD_TYPER) &
> > 0x1f;
> > + gic_irqs = (gic_irqs + 1) * 32;
> > + if (gic_irqs > 1020)
> > + gic_irqs = 1020;
> > + gic_data.irq_nr = gic_irqs;
> > +
> > + gic_data.domain = irq_domain_add_linear(node, gic_irqs - 16,
> > + &gic_irq_domain_ops,
> > &gic_data);
> >
> >
> > Why gic_irqs - 16?
>
> Because we keep the SGIs (all 16 of them) for the core kernel (drivers
> are not allowed to request them).
>
> >
> > __irq_domain_add(of_node, size, size, 0, ops, host_data);
> >
> > domain->hwirq_max = hwirq_max;
> >
> >
> > So hwirq_max is effectively set to actual_hwirq_max-16.
> >
> > Later, the following warning can be triggered:
> >
> > int irq_domain_associate(struct irq_domain *domain, unsigned int virq,
> > irq_hw_number_t hwirq)
> > {
> > struct irq_data *irq_data = irq_get_irq_data(virq);
> > int ret;
> >
> > if (WARN(hwirq >= domain->hwirq_max,
> > "error: hwirq 0x%x is too large for %s\n",
> > (int)hwirq, domain->name))
> > return -EINVAL;
>
> Do you actually see this warning being triggered? I don't. We're using a
> linear domain that doesn't call into this function.
I see this warning :(
You can trigger it when a device's INT# falls within [gic_irqs-16, gic_irqs), which lines up with the -16 above.
>
> What am I missing?
>
> Cheers,
>
> M.
> --
> Jazz is not dead. It just smells funny...
On Mon, Mar 24, 2014 at 4:10 AM, Marc Zyngier <marc.zyngier@xxxxxxx> wrote:
>
> Hi Zi,
>
> On 22/03/14 01:21, Zi Shen Lim wrote:
> > Hi Marc,
> >
> > On Thu, Mar 20, 2014 at 4:52 AM, Marc Zyngier <marc.zyngier@xxxxxxx
> > <mailto:marc.zyngier@xxxxxxx>> wrote:
> > <snip>
> >
> >
> > + /*
> > + * Find out how many interrupts are supported.
> > + * The GIC only supports up to 1020 interrupt sources
> > (SGI+PPI+SPI)
> > + */
> > + gic_irqs = readl_relaxed(gic_data.dist_base + GICD_TYPER) &
> > 0x1f;
> > + gic_irqs = (gic_irqs + 1) * 32;
> > + if (gic_irqs > 1020)
> > + gic_irqs = 1020;
> > + gic_data.irq_nr = gic_irqs;
> > +
> > + gic_data.domain = irq_domain_add_linear(node, gic_irqs - 16,
> > + &gic_irq_domain_ops,
> > &gic_data);
> >
> >
> > Why gic_irqs - 16?
>
> Because we keep the SGIs (all 16 of them) for the core kernel (drivers
> are not allowed to request them).
>
> >
> > __irq_domain_add(of_node, size, size, 0, ops, host_data);
> >
> > domain->hwirq_max = hwirq_max;
> >
> >
> > So hwirq_max is effectively set to actual_hwirq_max-16.
> >
> > Later, the following warning can be triggered:
> >
> > int irq_domain_associate(struct irq_domain *domain, unsigned int virq,
> > irq_hw_number_t hwirq)
> > {
> > struct irq_data *irq_data = irq_get_irq_data(virq);
> > int ret;
> >
> > if (WARN(hwirq >= domain->hwirq_max,
> > "error: hwirq 0x%x is too large for %s\n",
> > (int)hwirq, domain->name))
> > return -EINVAL;
>
> Do you actually see this warning being triggered? I don't. We're using a
> linear domain that doesn't call into this function.
I see this warning :(
You can trigger it when a device's INT# falls within [gic_irqs-16, gic_irqs), which lines up with the -16 above.
irq_create_of_mapping // SPI# from DT
domain->ops->xlate (gic_irq_domain_xlate) // SPI# + 32 = INT# = hwirq
irq_create_mapping // uses hwirq = INT#
irq_domain_associate // uses hwirq = INT#if (WARN(hwirq >= domain->hwirq_max, "error: hwirq 0x%x is too large for %s\n", (int)hwirq, domain->name)) // hwirq_max was set to (MAX_INT# - 16) above, uh oh...
>
> What am I missing?
>
> Cheers,
>
> M.
> --
> Jazz is not dead. It just smells funny...
_______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm