Skip to contentSkip to conversation

A new PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE quirk and smp initialization callbacks for omap5

PATCH Applied Chen Baozi 3 participants 11 messages Oct 15, 2013 – Nov 5, 2013

lore
Share & tools
lore

Chen Baozi

author
#0 lore raw

cover A new PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE quirk and smp initialization callbacks for omap5

This series contains the work I've mentioned in the previous mail. It is still under development. I plan to re-ship it after I boot the dom0 kernel successfully again on my OMAP5 board. So this is just supplement information for the last mail.

Chen Baozi (3):
xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11 xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE xen/arm: implement smp initialization callbacks for omap5

 xen/arch/arm/domain_build.c           |  3 ++-
 xen/arch/arm/platforms/omap5.c        | 37 ++++++++++++++++++++++++++++++++++-
 xen/include/asm-arm/platform.h        |  8 +++++++-
 xen/include/asm-arm/platforms/omap5.h |  3 +++
 4 files changed, 48 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.1.4
author
#1 lore raw

PATCH 1/3 xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11

---
 xen/include/asm-arm/platform.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/asm-arm/platform.h +1 -1
index dbd2a15..43afebb 100644
@@ -41,7 +41,7 @@ struct platform_desc {
 
 /*
  * Quirk to map dom0 memory in 1:1
- * Usefull on platform where System MMU is not yet implemented
+ * Useful on platform where System MMU is not yet implemented
  */
 #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
 
Signature · 1 line
1.8.1.4
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11

(+ Ian Campbell in CC)

Quoted 2 lines · Chen Baozi

If you don't mind, I think this patch can go upstream :).

Quoted 18 lines
---
  xen/include/asm-arm/platform.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/asm-arm/platform.h +1 -1
index dbd2a15..43afebb 100644
@@ -41,7 +41,7 @@ struct platform_desc {
 
  /*
   * Quirk to map dom0 memory in 1:1
- * Usefull on platform where System MMU is not yet implemented
+ * Useful on platform where System MMU is not yet implemented
   */
  #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
 
Signature · 1 line
Julien Grall
author
#3 lore raw

Re: [PATCH 1/3] xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11

Quoted 7 lines · Julien Grall

(+ Ian Campbell in CC)

Quoted 2 lines · Chen Baozi

If you don't mind, I think this patch can go upstream :).

Never mind, ;-)

Quoted 24 lines
Quoted 18 lines
---
 xen/include/asm-arm/platform.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/asm-arm/platform.h +1 -1
index dbd2a15..43afebb 100644
@@ -41,7 +41,7 @@ struct platform_desc {
 
 /*
  * Quirk to map dom0 memory in 1:1
- * Usefull on platform where System MMU is not yet implemented
+ * Useful on platform where System MMU is not yet implemented
  */
 #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
 
Signature · 1 line
Julien Grall
author
#5 lore raw

PATCH 2/3 xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE

In reply to Chen Baozi

Add a new quirk to map all disabled device in dom0, for omap5 kernel would try to access the modules that are listed in DT and then do a soft-reset to get those modules to a known state.

---
 xen/arch/arm/domain_build.c    | 3 ++-
 xen/arch/arm/platforms/omap5.c | 3 ++-
 xen/include/asm-arm/platform.h | 6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
xen/arch/arm/domain_build.c +2 -1
index 4f91327..b6f5b72 100644
@@ -714,7 +714,8 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
      *  solution can be use later for pass through.
      */
     if ( !dt_device_type_is_equal(np, "memory") &&
-         dt_device_is_available(np) )
+         (dt_device_is_available(np) ||
+          platform_has_quirk(PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE)))
     {
         res = map_device(d, np);
 
xen/arch/arm/platforms/omap5.c +2 -1
index a40d016..a583e2b 100644
@@ -123,7 +123,8 @@ static int omap5_specific_mapping(struct domain *d)
 
 static uint32_t omap5_quirks(void)
 {
-    return PLATFORM_QUIRK_DOM0_MAPPING_11;
+    return PLATFORM_QUIRK_DOM0_MAPPING_11 |
+           PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE;
 }
 
 static const char const *omap5_dt_compat[] __initdata =
xen/include/asm-arm/platform.h +6 -0
index 43afebb..09360a4 100644
@@ -44,6 +44,12 @@ struct platform_desc {
  * Useful on platform where System MMU is not yet implemented
  */
 #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
+/*
+ * Quirk to map disabled device
+ * Useful on platform where dom0 kernel would access device addresses
+ * whether it is disabled or not.
+ */
+#define PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE (1 << 1)
 
 int __init platform_init(void);
 int __init platform_init_time(void);
Signature · 1 line
1.8.1.4
#6 lore raw

Re: [PATCH 2/3] xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE

Quoted 5 lines · Chen Baozi

Add a new quirk to map all disabled device in dom0, for omap5 kernel would try to access the modules that are listed in DT and then do a soft-reset to get those modules to a known state.

Are we intending to run with this approach or is the kernel getting fixed?

author
#7 lore raw

Re: [PATCH 2/3] xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE

Hi Ian,

Sorry for the late reply.

Quoted 9 lines · Ian Campbell
Quoted 5 lines · Chen Baozi

Add a new quirk to map all disabled device in dom0, for omap5 kernel would try to access the modules that are listed in DT and then do a soft-reset to get those modules to a known state.

Are we intending to run with this approach or is the kernel getting fixed?

I prefer to run with this approach. After hacking the dom0 not to initialize UART3's state, I booted dom0 again with this patch finally. I think I could add more hacks to avoid using this patch booting dom0, but I don't think those hacks are neat enough to be merged to mainline kernel.

Cheers,

Baozi

author
#8 lore raw

PATCH 3/3 xen/arm: implement smp initialization callbacks for omap5

In reply to Chen Baozi
---
 xen/arch/arm/platforms/omap5.c        | 34 ++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/platforms/omap5.h |  3 +++
 2 files changed, 37 insertions(+)
xen/arch/arm/platforms/omap5.c +34 -0
index a583e2b..b90e570 100644
@@ -121,6 +121,38 @@ static int omap5_specific_mapping(struct domain *d)
     return 0;
 }
 
+static int __init omap5_smp_init(void)
+{
+    void __iomem *wugen_base;
+
+    wugen_base = ioremap_nocache(OMAP5_WKUPGEN_BASE, PAGE_SIZE);
+    if ( !wugen_base )
+    {
+        dprintk(XENLOG_ERR, "Unable to map omap5 MMIO\n");
+        return -EFAULT;
+    }
+
+    printk("Set AuxCoreBoot1 to %"PRIpaddr" (%p)\n",
+           __pa(init_secondary), init_secondary);
+    writel(__pa(init_secondary), wugen_base + OMAP_AUX_CORE_BOOT_1_OFFSET);
+
+    printk("Set AuxCoreBoot0 to 0x20\n");
+    writel(0x20, wugen_base + OMAP_AUX_CORE_BOOT_0_OFFSET);
+
+    iounmap(wugen_base);
+
+    return 0;
+}
+
+static int __init omap5_cpu_up(int cpu)
+{
+    /* Nothing to do here, the generic sev() will suffice to kick CPUs
+     * out of either the firmware or our own smp_up_cpu gate,
+     * depending on where they have ended up. */
+
+    return 0;
+}
+
 static uint32_t omap5_quirks(void)
 {
     return PLATFORM_QUIRK_DOM0_MAPPING_11 |
@@ -137,6 +169,8 @@ PLATFORM_START(omap5, "TI OMAP5")
     .compatible = omap5_dt_compat,
     .init_time = omap5_init_time,
     .specific_mapping = omap5_specific_mapping,
+    .smp_init = omap5_smp_init,
+    .cpu_up = omap5_cpu_up,
     .quirks = omap5_quirks,
 PLATFORM_END
 
xen/include/asm-arm/platforms/omap5.h +3 -0
index dd8c6ca..c559c84 100644
@@ -17,6 +17,9 @@
 #define OMAP5_WKUPGEN_BASE                      0x48281000
 #define OMAP5_SRAM_PA                           0x40300000
 
+#define OMAP_AUX_CORE_BOOT_0_OFFSET             0x800
+#define OMAP_AUX_CORE_BOOT_1_OFFSET             0x804
+
 #endif /* __ASM_ARM_PLATFORMS_OMAP5_H */
 
 /*
Signature · 1 line
1.8.1.4
Acked-by on v1 3/3
#9 lore raw

Re: [PATCH 3/3] xen/arm: implement smp initialization callbacks for omap5

Quoted 2 lines · Chen Baozi

If you don't modify the patch in the next version:

Quoted 72 lines
---
  xen/arch/arm/platforms/omap5.c        | 34 ++++++++++++++++++++++++++++++++++
  xen/include/asm-arm/platforms/omap5.h |  3 +++
  2 files changed, 37 insertions(+)
xen/arch/arm/platforms/omap5.c +34 -0
index a583e2b..b90e570 100644
@@ -121,6 +121,38 @@ static int omap5_specific_mapping(struct domain *d)
      return 0;
  }
 
+static int __init omap5_smp_init(void)
+{
+    void __iomem *wugen_base;
+
+    wugen_base = ioremap_nocache(OMAP5_WKUPGEN_BASE, PAGE_SIZE);
+    if ( !wugen_base )
+    {
+        dprintk(XENLOG_ERR, "Unable to map omap5 MMIO\n");
+        return -EFAULT;
+    }
+
+    printk("Set AuxCoreBoot1 to %"PRIpaddr" (%p)\n",
+           __pa(init_secondary), init_secondary);
+    writel(__pa(init_secondary), wugen_base + OMAP_AUX_CORE_BOOT_1_OFFSET);
+
+    printk("Set AuxCoreBoot0 to 0x20\n");
+    writel(0x20, wugen_base + OMAP_AUX_CORE_BOOT_0_OFFSET);
+
+    iounmap(wugen_base);
+
+    return 0;
+}
+
+static int __init omap5_cpu_up(int cpu)
+{
+    /* Nothing to do here, the generic sev() will suffice to kick CPUs
+     * out of either the firmware or our own smp_up_cpu gate,
+     * depending on where they have ended up. */
+
+    return 0;
+}
+
  static uint32_t omap5_quirks(void)
  {
      return PLATFORM_QUIRK_DOM0_MAPPING_11 |
@@ -137,6 +169,8 @@ PLATFORM_START(omap5, "TI OMAP5")
      .compatible = omap5_dt_compat,
      .init_time = omap5_init_time,
      .specific_mapping = omap5_specific_mapping,
+    .smp_init = omap5_smp_init,
+    .cpu_up = omap5_cpu_up,
      .quirks = omap5_quirks,
  PLATFORM_END
 
xen/include/asm-arm/platforms/omap5.h +3 -0
index dd8c6ca..c559c84 100644
@@ -17,6 +17,9 @@
  #define OMAP5_WKUPGEN_BASE                      0x48281000
  #define OMAP5_SRAM_PA                           0x40300000
 
+#define OMAP_AUX_CORE_BOOT_0_OFFSET             0x800
+#define OMAP_AUX_CORE_BOOT_1_OFFSET             0x804
+
  #endif /* __ASM_ARM_PLATFORMS_OMAP5_H */
 
  /*
Signature · 1 line
Julien Grall