Skip to contentSkip to conversation

xen: arm: platforms: Adding reset support for xgene arm64 platform.

PATCH Superseded Pranavkumar Sawargaonkar 2 participants 3 messages Jan 23, 2014

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen: arm: platforms: Adding reset support for xgene arm64 platform.

This patch adds a reset support for xgene arm64 platform.

V2:
- Removed unnecssary mdelay in code.
- Adding iounmap of the base address.
V1:
-Initial patch.

---
 xen/arch/arm/platforms/xgene-storm.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
xen/arch/arm/platforms/xgene-storm.c +24 -0
index 5b0bd5f..9901bf0 100644
@@ -20,6 +20,9 @@
 
 #include <xen/config.h>
 #include <asm/platform.h>
+#include <xen/mm.h>
+#include <xen/vmap.h>
+#include <asm/io.h>
 #include <asm/gic.h>
 
 static uint32_t xgene_storm_quirks(void)
@@ -107,6 +110,26 @@ err:
     return ret;
 }
 
+/*
+ * TODO: Get base address and mask from the device tree
+ */
+static void xgene_storm_reset(void)
+{
+    void __iomem *addr;
+
+    addr = ioremap_nocache(0x17000014UL, 0x100);
+
+    if ( !addr )
+    {
+        dprintk(XENLOG_ERR, "Unable to map xgene reset address\n");
+        return;
+    }
+
+    /* Write mask 0x1 to base address */
+    writel(0x1, addr);
+
+    iounmap(addr);
+}
 
 static const char * const xgene_storm_dt_compat[] __initconst =
 {
@@ -116,6 +139,7 @@ static const char * const xgene_storm_dt_compat[] __initconst =
 
 PLATFORM_START(xgene_storm, "APM X-GENE STORM")
     .compatible = xgene_storm_dt_compat,
+    .reset = xgene_storm_reset,
     .quirks = xgene_storm_quirks,
     .specific_mapping = xgene_storm_specific_mapping,
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 19 lines · Pranavkumar Sawargaonkar

This patch adds a reset support for xgene arm64 platform.

V2:
- Removed unnecssary mdelay in code.
- Adding iounmap of the base address.
V1:
-Initial patch.

---
 xen/arch/arm/platforms/xgene-storm.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
xen/arch/arm/platforms/xgene-storm.c +0 -0
index 5b0bd5f..9901bf0 100644

xen/arch/arm/platforms/xgene-storm.c line 25

Quoted 6 lines
xen/arch/arm/platforms/xgene-storm.c +3 -0
@@ -20,6 +20,9 @@
 
 #include <xen/config.h>
 #include <asm/platform.h>
+#include <xen/mm.h>
+#include <xen/vmap.h>
+#include <asm/io.h>

Do you really need all 3 of these?

xen/arch/arm/platforms/xgene-storm.c err: · line 114

Quoted 9 lines
xen/arch/arm/platforms/xgene-storm.c +2 -0
 #include <asm/gic.h>
 
 static uint32_t xgene_storm_quirks(void)
@@ -107,6 +110,26 @@ err:
     return ret;
 }
 
+/*
+ * TODO: Get base address and mask from the device tree

How likely are these to change during the lifetime of Xen 4.4? I think it cannot be ruled out. Doing this based on DT shouldn't be more than a dozen lines of code -- see e.g init_xen_time or gic_init.

You probably want to do the detection at start of day in the platform->init hook so that you can call:

        dt_device_set_used_by(node, DOMID_XEN);

on it so it doesn't get given to dom0.

Otherwise I expect you will also want to add the relevant compatibility string to the platform blacklist_dev list so it isn't given to dom0 for that reason.

xen/arch/arm/platforms/xgene-storm.c err: · line 120

Quoted 6 lines
xen/arch/arm/platforms/xgene-storm.c +6 -0
+ */
+static void xgene_storm_reset(void)
+{
+    void __iomem *addr;
+
+    addr = ioremap_nocache(0x17000014UL, 0x100);

If you aren't going to use device tree please can you at least add a #define for the address.

Quoted 22 lines
xen/arch/arm/platforms/xgene-storm.c +12 -0
+    if ( !addr )
+    {
+        dprintk(XENLOG_ERR, "Unable to map xgene reset address\n");
+        return;
+    }
+
+    /* Write mask 0x1 to base address */
+    writel(0x1, addr);
+
+    iounmap(addr);
+}
 
 static const char * const xgene_storm_dt_compat[] __initconst =
 {
@@ -116,6 +139,7 @@ static const char * const xgene_storm_dt_compat[] __initconst =
 
 PLATFORM_START(xgene_storm, "APM X-GENE STORM")
     .compatible = xgene_storm_dt_compat,
+    .reset = xgene_storm_reset,
     .quirks = xgene_storm_quirks,
     .specific_mapping = xgene_storm_specific_mapping,
 
#2 lore raw

Hi Ian,

Quoted 21 lines · Ian Campbell
Quoted 20 lines · Pranavkumar Sawargaonkar

This patch adds a reset support for xgene arm64 platform.

V2:
- Removed unnecssary mdelay in code.
- Adding iounmap of the base address.
V1:
-Initial patch.

---
 xen/arch/arm/platforms/xgene-storm.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
xen/arch/arm/platforms/xgene-storm.c +0 -0
index 5b0bd5f..9901bf0 100644
@@ -20,6 +20,9 @@
 
Quoted 7 lines

xen/arch/arm/platforms/xgene-storm.c line 25

Quoted 5 lines
xen/arch/arm/platforms/xgene-storm.c +3 -0
 #include <xen/config.h>
 #include <asm/platform.h>
+#include <xen/mm.h>
+#include <xen/vmap.h>
+#include <asm/io.h>

Do you really need all 3 of these?

I will remove mm.h
vmap.h is required for iounmap and io.h is for writel.

Quoted 15 lines

xen/arch/arm/platforms/xgene-storm.c err: · line 114

Quoted 10 lines
xen/arch/arm/platforms/xgene-storm.c +2 -0
 #include <asm/gic.h>
 
 static uint32_t xgene_storm_quirks(void)
@@ -107,6 +110,26 @@ err:
     return ret;
 }
 
+/*
+ * TODO: Get base address and mask from the device tree

How likely are these to change during the lifetime of Xen 4.4? I think it cannot be ruled out. Doing this based on DT shouldn't be more than a dozen lines of code -- see e.g init_xen_time or gic_init.

Quoted 8 lines

You probably want to do the detection at start of day in the platform->init hook so that you can call:

        dt_device_set_used_by(node, DOMID_XEN);

on it so it doesn't get given to dom0.

Otherwise I expect you will also want to add the relevant compatibility string to the platform blacklist_dev list so it isn't given to dom0 for that reason.

Thanks i was not aware of this let me try to fix it using device tree only.

Quoted 10 lines

xen/arch/arm/platforms/xgene-storm.c err: · line 120

Quoted 7 lines
xen/arch/arm/platforms/xgene-storm.c +6 -0
+ */
+static void xgene_storm_reset(void)
+{
+    void __iomem *addr;
+
+    addr = ioremap_nocache(0x17000014UL, 0x100);

If you aren't going to use device tree please can you at least add a #define for the address.

I think i can try using device tree only instead of hard-coding.

Quoted 17 lines
Quoted 17 lines
xen/arch/arm/platforms/xgene-storm.c +11 -0
+    if ( !addr )
+    {
+        dprintk(XENLOG_ERR, "Unable to map xgene reset address\n");
+        return;
+    }
+
+    /* Write mask 0x1 to base address */
+    writel(0x1, addr);
+
+    iounmap(addr);
+}
 
 static const char * const xgene_storm_dt_compat[] __initconst =
 {
@@ -116,6 +139,7 @@ static const char * const xgene_storm_dt_compat[] __initconst =
 
Quoted 8 lines

xen/arch/arm/platforms/xgene-storm.c static const char * const xgene_storm_dt_compat[] __initconst = · line 145

Quoted 6 lines
xen/arch/arm/platforms/xgene-storm.c +1 -0
 PLATFORM_START(xgene_storm, "APM X-GENE STORM")
     .compatible = xgene_storm_dt_compat,
+    .reset = xgene_storm_reset,
     .quirks = xgene_storm_quirks,
     .specific_mapping = xgene_storm_specific_mapping,
 

Thanks,
Pranav