]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: vgic-v3: Correctly set GICD_TYPER.IDbits
authorJulien Grall <julien.grall@linaro.org>
Mon, 16 Feb 2015 14:50:41 +0000 (14:50 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 2 Apr 2015 10:44:46 +0000 (11:44 +0100)
From Linux 3.19, the GICv3 drivers is using GICD_TYPER.IDbits to check
the validity of the hardware interrupt number.

The field IDBits in the register GICD_TYPER is used to know the number of
interrupt identifiers (SPI, PPIs, SGIs, LPIs) supported by GIC Stream Protocol
Interface.

This field contains the number of interrupt identifier bits minus one.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
(cherry picked from commit 8206d052eb11061d7b6cada566c0804c14001fec)

xen/arch/arm/vgic-v3.c
xen/include/asm-arm/gic_v3_defs.h

index 3326110cac73f1d1e05226329a2c89aaf5c34c9e..427c9b678465ae5244bfc377fd0044a6367f7be6 100644 (file)
@@ -673,11 +673,22 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info)
         vgic_unlock(v);
         return 1;
     case GICD_TYPER:
+    {
+        /*
+         * Number of interrupt identifier bits supported by the GIC
+         * Stream Protocol Interface
+         */
+        unsigned int irq_bits = get_count_order(vgic_num_irqs(v->domain));
+
         if ( dabt.size != DABT_WORD ) goto bad_width;
         /* No secure world support for guests. */
         *r = (((v->domain->max_vcpus << 5) & GICD_TYPE_CPUS ) |
               ((v->domain->arch.vgic.nr_spis / 32) & GICD_TYPE_LINES));
+
+        *r |= (irq_bits - 1) << GICD_TYPE_ID_BITS_SHIFT;
+
         return 1;
+    }
     case GICD_STATUSR:
         /*
          *  Optional, Not implemented for now.
index 13adb538d7a80ae27b1f2153ced4f52cfc4b4549..b8a1c2eb62cf4bacca837c63c35414f48dfa4155 100644 (file)
@@ -45,6 +45,9 @@
 #define GICC_SRE_EL2_DIB             (1UL << 2)
 #define GICC_SRE_EL2_ENEL1           (1UL << 3)
 
+/* Additional bits in GICD_TYPER defined by GICv3 */
+#define GICD_TYPE_ID_BITS_SHIFT 19
+
 #define GICD_CTLR_RWP                (1UL << 31)
 #define GICD_CTLR_ARE_NS             (1U << 4)
 #define GICD_CTLR_ENABLE_G1A         (1U << 1)