diff mbox series

[Xen-devel,v2,2/2] xen/arm: GICv3: Only initialize ITS when the distributor supports LPIs.

Message ID 20180124182616.3384-3-julien.grall@linaro.org
State Accepted
Commit 6fd572826c26f777b72e3b5f64a137dbcfdd6361
Headers show
Series xen/arm: GICv3: Only initialize ITS when LPIs are available | expand

Commit Message

Julien Grall Jan. 24, 2018, 6:26 p.m. UTC
There are firmware tables out describing the ITS but does not support
LPIs. This will result to a data abort when trying to initialize ITS.

While this can be consider a bug in the Device-Tree, same configuration
boots on Linux. So gate the ITS initialization with the support of LPIs
in the distributor.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/gic-v3.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Jan. 30, 2018, 5:55 p.m. UTC | #1
On Wed, 24 Jan 2018, Julien Grall wrote:
> There are firmware tables out describing the ITS but does not support
> LPIs. This will result to a data abort when trying to initialize ITS.
> 
> While this can be consider a bug in the Device-Tree, same configuration
> boots on Linux. So gate the ITS initialization with the support of LPIs
> in the distributor.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

> ---
>  xen/arch/arm/gic-v3.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 9f9cf59f82..730450e34b 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -1637,6 +1637,11 @@ static unsigned long gicv3_get_hwdom_extra_madt_size(const struct domain *d)
>  }
>  #endif
>  
> +static bool gic_dist_supports_lpis(void)
> +{
> +    return (readl_relaxed(GICD + GICD_TYPER) & GICD_TYPE_LPIS);
> +}
> +
>  /* Set up the GIC */
>  static int __init gicv3_init(void)
>  {
> @@ -1699,9 +1704,12 @@ static int __init gicv3_init(void)
>  
>      gicv3_dist_init();
>  
> -    res = gicv3_its_init();
> -    if ( res )
> -        panic("GICv3: ITS: initialization failed: %d\n", res);
> +    if ( gic_dist_supports_lpis() )
> +    {
> +        res = gicv3_its_init();
> +        if ( res )
> +            panic("GICv3: ITS: initialization failed: %d\n", res);
> +    }
>  
>      res = gicv3_cpu_init();
>      if ( res )
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 9f9cf59f82..730450e34b 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1637,6 +1637,11 @@  static unsigned long gicv3_get_hwdom_extra_madt_size(const struct domain *d)
 }
 #endif
 
+static bool gic_dist_supports_lpis(void)
+{
+    return (readl_relaxed(GICD + GICD_TYPER) & GICD_TYPE_LPIS);
+}
+
 /* Set up the GIC */
 static int __init gicv3_init(void)
 {
@@ -1699,9 +1704,12 @@  static int __init gicv3_init(void)
 
     gicv3_dist_init();
 
-    res = gicv3_its_init();
-    if ( res )
-        panic("GICv3: ITS: initialization failed: %d\n", res);
+    if ( gic_dist_supports_lpis() )
+    {
+        res = gicv3_its_init();
+        if ( res )
+            panic("GICv3: ITS: initialization failed: %d\n", res);
+    }
 
     res = gicv3_cpu_init();
     if ( res )