* Stream Protocol Interface
*/
unsigned int irq_bits = get_count_order(vgic_num_irqs(v->domain));
+ /*
+ * Number of processors that may be used as interrupt targets when ARE
+ * bit is zero. The maximum is 8.
+ */
+ unsigned int ncpus = min_t(unsigned int, v->domain->max_vcpus, 8);
if ( dabt.size != DABT_WORD ) goto bad_width;
/* No secure world support for guests. */
- *r = (((v->domain->max_vcpus << 5) & GICD_TYPE_CPUS ) |
+ *r = ((ncpus - 1) << GICD_TYPE_CPUS_SHIFT |
((v->domain->arch.vgic.nr_spis / 32) & GICD_TYPE_LINES));
*r |= (irq_bits - 1) << GICD_TYPE_ID_BITS_SHIFT;
#define GICD_CTL_ENABLE 0x1
#define GICD_TYPE_LINES 0x01f
+#define GICD_TYPE_CPUS_SHIFT 5
#define GICD_TYPE_CPUS 0x0e0
#define GICD_TYPE_SEC 0x400