]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: vgic-v3: Correctly set GICD_TYPER.CPUNumber
authorJulien Grall <julien.grall@linaro.org>
Mon, 16 Feb 2015 14:50:42 +0000 (14:50 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 19 Feb 2015 16:54:01 +0000 (16:54 +0000)
On GICv3, the value (CPUNumber + 1) indicates the number of processor that may
be used as interrupts targets when ARE bit is zero. The maximum is 8
processors.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/vgic-v3.c
xen/include/asm-arm/gic.h

index 72b22eea202123942f87c3f989e5125a5567bf97..e0a7d5bd8843eb8b4f0fd063b53c5fbf6a6af8fe 100644 (file)
@@ -685,10 +685,15 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info)
          * 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;
index 187dc46e12486664e078c56b7b1692413e9ba763..0396a8eed04ab578031aa2e22052d9f91d346219 100644 (file)
@@ -93,6 +93,7 @@
 #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