Skip to contentSkip to conversation

xen: arm: X-Gene Storm check GIC DIST address for EOI quirk

PATCH In review Pranavkumar Sawargaonkar 4 participants 10 messages Apr 29, 2015 – May 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xen: arm: X-Gene Storm check GIC DIST address for EOI quirk

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

---
ChangeLog:

V3:
- Indentation fixes and other misc comments on V2.
V2:
- Fine tune interrupt controller node search as per comments on V1 patch
- Incorporating other misc comments on V1.
V1:
- Initial patch.

---
 xen/arch/arm/platforms/xgene-storm.c |   40 +++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)
xen/arch/arm/platforms/xgene-storm.c +39 -1
index 1812e5b..c717360 100644
@@ -22,6 +22,7 @@
 #include <asm/platform.h>
 #include <xen/stdbool.h>
 #include <xen/vmap.h>
+#include <xen/device_tree.h>
 #include <asm/io.h>
 #include <asm/gic.h>
 
@@ -35,9 +36,44 @@ static u64 reset_addr, reset_size;
 static u32 reset_mask;
 static bool reset_vals_valid = false;
 
+#define XGENE_SEC_GICV2_DIST_ADDR    0x78010000
+static u32 __read_mostly xgene_quirks = PLATFORM_QUIRK_GIC_64K_STRIDE;
+
+static void __init xgene_check_pirq_eoi(void)
+{
+    const struct dt_device_node *node;
+    int res;
+    paddr_t dbase;
+    const struct dt_device_match xgene_dt_int_ctrl_match[] =
+    {
+        DT_MATCH_COMPATIBLE("arm,cortex-a15-gic"),
+        { /*sentinel*/ },
+    };
+
+    node = dt_find_interrupt_controller(xgene_dt_int_ctrl_match);
+    if ( !node )
+        panic("%s: Can not find interrupt controller node", __func__);
+
+    res = dt_device_get_address(node, 0, &dbase, NULL);
+    if ( !dbase )
+        panic("%s: Cannot find a valid address for the distributor", __func__);
+
+    /*
+     * In old X-Gene Storm firmware and DT, secure mode addresses have
+     * been mentioned in GICv2 node. We have to use maintenance interrupt
+     * instead of EOI HW in this case. We check the GIC Distributor Base
+     * Address to maintain compatibility with older firmware.
+     */
+    if ( dbase == XGENE_SEC_GICV2_DIST_ADDR )
+    {
+        xgene_quirks |= PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI;
+        printk("Xen: WARNING: OLD X-Gene Firmware, disabling PIRQ EOI mode\n");
+    }
+}
+
 static uint32_t xgene_storm_quirks(void)
 {
-    return PLATFORM_QUIRK_GIC_64K_STRIDE|PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI;
+    return xgene_quirks;
 }
 
 static int map_one_mmio(struct domain *d, const char *what,
@@ -216,6 +252,8 @@ static int xgene_storm_init(void)
     reset_mask = XGENE_RESET_MASK;
 
     reset_vals_valid = true;
+    xgene_check_pirq_eoi();
+
     return 0;
 }
 
Signature · 1 line
1.7.9.5
Reviewed-by on v3 1/1
#1 lore raw

Hi Pranav,

Quoted 4 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

Quoted 8 lines

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Regards,

Signature · 1 line
Julien Grall
Acked-by on v3 1/1
#2 lore raw
In reply to Pranavkumar Sawargaonkar
Quoted 4 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

Quoted 8 lines

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Quoted 83 lines

ChangeLog:

V3:
- Indentation fixes and other misc comments on V2.
V2:
- Fine tune interrupt controller node search as per comments on V1 patch
- Incorporating other misc comments on V1.
V1:
- Initial patch.

---
 xen/arch/arm/platforms/xgene-storm.c |   40 +++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)
xen/arch/arm/platforms/xgene-storm.c +39 -1
index 1812e5b..c717360 100644
@@ -22,6 +22,7 @@
 #include <asm/platform.h>
 #include <xen/stdbool.h>
 #include <xen/vmap.h>
+#include <xen/device_tree.h>
 #include <asm/io.h>
 #include <asm/gic.h>
 
@@ -35,9 +36,44 @@ static u64 reset_addr, reset_size;
 static u32 reset_mask;
 static bool reset_vals_valid = false;
 
+#define XGENE_SEC_GICV2_DIST_ADDR    0x78010000
+static u32 __read_mostly xgene_quirks = PLATFORM_QUIRK_GIC_64K_STRIDE;
+
+static void __init xgene_check_pirq_eoi(void)
+{
+    const struct dt_device_node *node;
+    int res;
+    paddr_t dbase;
+    const struct dt_device_match xgene_dt_int_ctrl_match[] =
+    {
+        DT_MATCH_COMPATIBLE("arm,cortex-a15-gic"),
+        { /*sentinel*/ },
+    };
+
+    node = dt_find_interrupt_controller(xgene_dt_int_ctrl_match);
+    if ( !node )
+        panic("%s: Can not find interrupt controller node", __func__);
+
+    res = dt_device_get_address(node, 0, &dbase, NULL);
+    if ( !dbase )
+        panic("%s: Cannot find a valid address for the distributor", __func__);
+
+    /*
+     * In old X-Gene Storm firmware and DT, secure mode addresses have
+     * been mentioned in GICv2 node. We have to use maintenance interrupt
+     * instead of EOI HW in this case. We check the GIC Distributor Base
+     * Address to maintain compatibility with older firmware.
+     */
+    if ( dbase == XGENE_SEC_GICV2_DIST_ADDR )
+    {
+        xgene_quirks |= PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI;
+        printk("Xen: WARNING: OLD X-Gene Firmware, disabling PIRQ EOI mode\n");
+    }
+}
+
 static uint32_t xgene_storm_quirks(void)
 {
-    return PLATFORM_QUIRK_GIC_64K_STRIDE|PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI;
+    return xgene_quirks;
 }
 
 static int map_one_mmio(struct domain *d, const char *what,
@@ -216,6 +252,8 @@ static int xgene_storm_init(void)
     reset_mask = XGENE_RESET_MASK;
 
     reset_vals_valid = true;
+    xgene_check_pirq_eoi();
+
     return 0;
 }
 
Signature · 1 line
1.7.9.5
#3 lore raw
In reply to Pranavkumar Sawargaonkar
Quoted 4 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

Quoted 8 lines

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Acked + applied, thanks.

#4 lore raw
In reply to Pranavkumar Sawargaonkar

Hi Pranav,

Quoted 9 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Do you know if the new firmware is publicly available?

Regards,

Signature · 1 line
Julien Grall
#5 lore raw

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Pranav,

Quoted 4 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

Quoted 7 lines
Quoted 5 lines

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Do you know if the new firmware is publicly available?

No there is no direct link available to download this. One has to got through apm support to get this.

Thanks,
Pranav

Quoted 5 lines

Regards,

--
Julien Grall

#6 lore raw
Quoted 13 lines · Pranavkumar Sawargaonkar

Hi Julien,

Quoted 10 lines · Julien Grall

Hi Pranav,

Quoted 7 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Do you know if the new firmware is publicly available?

No there is no direct link available to download this. One has to got through apm support to get this.

Is it available on request to anybody who has a Mustang system? Or only to e.g. partners?

It would be a shame if not because while the quirk is buggy in various ways it is better than nothing, but we would all much prefer to ditch it if possible.

Ian.

#7 lore raw

Hi Ian,

Quoted 17 lines · Ian Campbell
Quoted 16 lines · Pranavkumar Sawargaonkar

Hi Julien,

Quoted 13 lines · Julien Grall

Hi Pranav,

Quoted 9 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Do you know if the new firmware is publicly available?

No there is no direct link available to download this. One has to got through apm support to get this.

Is it available on request to anybody who has a Mustang system? Or only to e.g. partners?

As far as my knowledge it is available to the people having mustang (and also to partners) on a request.

-
Pranav

Quoted 6 lines

It would be a shame if not because while the quirk is buggy in various ways it is better than nothing, but we would all much prefer to ditch it if possible.

Ian.

#8 lore raw

Hi Pranav,

Quoted 23 lines · Pranavkumar Sawargaonkar
Quoted 22 lines · Ian Campbell
Quoted 20 lines · Pranavkumar Sawargaonkar

Hi Julien,

Quoted 7 lines · Julien Grall

Hi Pranav,

Quoted 4 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

Quoted 7 lines
Quoted 5 lines

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Do you know if the new firmware is publicly available?

No there is no direct link available to download this. One has to got through apm support to get this.

Quoted 6 lines
Quoted 3 lines

Is it available on request to anybody who has a Mustang system? Or only to e.g. partners?

As far as my knowledge it is available to the people having mustang (and also to partners) on a request.

Thanks. I will send a patch to drop the EOI quirk and panic if the user is using an old firmware.

Regards,

Signature · 1 line
Julien Grall
#9 lore raw

Hi Julien,

Quoted 30 lines · Julien Grall

Hi Pranav,

Quoted 27 lines · Pranavkumar Sawargaonkar
Quoted 25 lines · Ian Campbell
Quoted 13 lines · Pranavkumar Sawargaonkar

Hi Julien,

Quoted 10 lines · Julien Grall

Hi Pranav,

Quoted 7 lines · Pranavkumar Sawargaonkar

In old X-Gene Storm firmware and DT, secure mode addresses have been mentioned in GICv2 node. In this case maintenance interrupt is used instead of EOI HW method.

This patch checks the GIC Distributor Base Address to enable EOI quirk for old firmware.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Ref:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg01263.html

Do you know if the new firmware is publicly available?

No there is no direct link available to download this. One has to got through apm support to get this.

Is it available on request to anybody who has a Mustang system? Or only to e.g. partners?

Quoted 5 lines
Quoted 2 lines

As far as my knowledge it is available to the people having mustang (and also to partners) on a request.

Thanks. I will send a patch to drop the EOI quirk and panic if the user is using an old firmware.

Sure, this is a good idea.

-
Pranav

Quoted 5 lines

Regards,

--
Julien Grall