[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] xen/arm: GICv3: Parse ITS information from the firmware tables later on



Hi,

On 22/01/18 18:22, Julien Grall wrote:
There are Device Tree (e.g for the Foundation Model) out that describes the
ITS but LPIs is not supported by the platform. Booting with such DT will
result to an early Data Abort. The same DT is booting fine with a
baremetal  Linux because ITS will be initialized only when LPIs is
supported.

While this is a bug in the DT, I think Xen should be boot with the same
hardware level support (e.g ITS will not be used) as with a baremetal
Linux.

The slight problem is Xen is relying on gicv3_its_host_has_its() to know
if ITS can be used. The list is populated by gicv3_its_{dt,acpi}_init().
It would theoritical be possible to gate those with a check of
GICD_TYPER.LPIS because we don't know yet whether the HW is an actual
GICv3/GICv4.

Looking at the callers of gicv3_its_host_has_its(), they will only be
done after gicv3_its_init() is called. Therefore move the parsing of ITS
information from firmware tables later on.

Note that gicv3_its_init() has been moved at the end of the file to
avoid forward declaration.

Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>

---

I can move the code movement in a separate patch if necessary. It was
small enough that I thought it would not be worth.
---
  xen/arch/arm/gic-v3-its.c        | 47 +++++++++++++++++++++++++---------------
  xen/arch/arm/gic-v3.c            |  5 -----
  xen/include/asm-arm/gic_v3_its.h | 12 ----------
  3 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index e57ae05771..b01a0d9eb5 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -515,21 +515,6 @@ static int gicv3_its_init_single_its(struct host_its 
*hw_its)
      return 0;
  }
-int gicv3_its_init(void)
-{
-    struct host_its *hw_its;
-    int ret;
-
-    list_for_each_entry(hw_its, &host_its_list, entry)
-    {
-        ret = gicv3_its_init_single_its(hw_its);
-        if ( ret )
-            return ret;
-    }
-
-    return 0;
-}
-
  /*
   * TODO: Investigate the interaction when a guest removes a device while
   * some LPIs are still in flight.
@@ -1019,7 +1004,7 @@ static void add_to_host_its_list(paddr_t addr, paddr_t 
size,
  }
/* Scan the DT for any ITS nodes and create a list of host ITSes out of it. */
-void gicv3_its_dt_init(const struct dt_device_node *node)
+static void gicv3_its_dt_init(const struct dt_device_node *node)
  {
      const struct dt_device_node *its = NULL;
@@ -1056,7 +1041,7 @@ static int gicv3_its_acpi_probe(struct acpi_subtable_header *header,
      return 0;
  }
-void gicv3_its_acpi_init(void)
+static void gicv3_its_acpi_init(void)
  {
      /* Parse ITS information */
      acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
@@ -1081,8 +1066,36 @@ unsigned long gicv3_its_make_hwdom_madt(const struct 
domain *d, void *base_ptr)
return sizeof(struct acpi_madt_generic_translator) * vgic_v3_its_count(d);
  }
+#else /* !CONFIG_ACPI */
+
+static void gicv3_its_acpi_init(void)
+{
+    ASSERT_UNREACHABLE();
+}
+
  #endif
+int gicv3_its_init(void)
+{
+    struct host_its *hw_its;
+    int ret;
+
+    if ( acpi_disabled )
+        gicv3_its_dt_init();

Hmmm I am not sure how I tested this code. gicv3_its_dt_init require the DT node in parameter.

I will send a new version.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.