The formula of GICD_TYPER.ITLinesNumber is 32(N + 1).
As the number of SPIs suppported by the domain may not be a multiple of
32, we have to round up the number before using it.
At the same time remove the mask GICD_TYPE_LINES which is pointless.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
/* No secure world support for guests. */
vgic_lock(v);
*r = ( ((v->domain->max_vcpus - 1) << GICD_TYPE_CPUS_SHIFT) )
- |( ((v->domain->arch.vgic.nr_spis / 32)) & GICD_TYPE_LINES );
+ | DIV_ROUND_UP(v->domain->arch.vgic.nr_spis, 32);
vgic_unlock(v);
return 1;
case GICD_IIDR:
if ( dabt.size != DABT_WORD ) goto bad_width;
/* No secure world support for guests. */
*r = ((ncpus - 1) << GICD_TYPE_CPUS_SHIFT |
- ((v->domain->arch.vgic.nr_spis / 32) & GICD_TYPE_LINES));
+ DIV_ROUND_UP(v->domain->arch.vgic.nr_spis, 32));
*r |= (irq_bits - 1) << GICD_TYPE_ID_BITS_SHIFT;