Chen Baozi
2013-Oct-15 08:45 UTC
[PATCH 0/3] 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(-) -- 1.8.1.4
Chen Baozi
2013-Oct-15 08:45 UTC
[PATCH 1/3] xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11
Signed-off-by: Chen Baozi <baozich@gmail.com>
---
xen/include/asm-arm/platform.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index dbd2a15..43afebb 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -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)
--
1.8.1.4
Chen Baozi
2013-Oct-15 08:45 UTC
[PATCH 2/3] xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE
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.
Signed-off-by: Chen Baozi <baozich@gmail.com>
---
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(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 4f91327..b6f5b72 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -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);
diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c
index a40d016..a583e2b 100644
--- a/xen/arch/arm/platforms/omap5.c
+++ b/xen/arch/arm/platforms/omap5.c
@@ -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 diff --git
a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index 43afebb..09360a4 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -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);
--
1.8.1.4
Chen Baozi
2013-Oct-15 08:45 UTC
[PATCH 3/3] xen/arm: implement smp initialization callbacks for omap5
Signed-off-by: Chen Baozi <baozich@gmail.com>
---
xen/arch/arm/platforms/omap5.c | 34 ++++++++++++++++++++++++++++++++++
xen/include/asm-arm/platforms/omap5.h | 3 +++
2 files changed, 37 insertions(+)
diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c
index a583e2b..b90e570 100644
--- a/xen/arch/arm/platforms/omap5.c
+++ b/xen/arch/arm/platforms/omap5.c
@@ -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
diff --git a/xen/include/asm-arm/platforms/omap5.h
b/xen/include/asm-arm/platforms/omap5.h
index dd8c6ca..c559c84 100644
--- a/xen/include/asm-arm/platforms/omap5.h
+++ b/xen/include/asm-arm/platforms/omap5.h
@@ -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 */
/*
--
1.8.1.4
Julien Grall
2013-Oct-21 16:42 UTC
Re: [PATCH 1/3] xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11
(+ Ian Campbell in CC) On 10/15/2013 09:45 AM, Chen Baozi wrote:> > Signed-off-by: Chen Baozi <baozich@gmail.com>If you don''t mind, I think this patch can go upstream :). Acked-by: Julien Grall <julien.grall@linaro.org>> --- > xen/include/asm-arm/platform.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h > index dbd2a15..43afebb 100644 > --- a/xen/include/asm-arm/platform.h > +++ b/xen/include/asm-arm/platform.h > @@ -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) > >-- Julien Grall
Chen Baozi
2013-Oct-22 01:06 UTC
Re: [PATCH 1/3] xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11
On Oct 22, 2013, at 12:42 AM, Julien Grall <julien.grall@linaro.org> wrote:> (+ Ian Campbell in CC) > > On 10/15/2013 09:45 AM, Chen Baozi wrote: >> >> Signed-off-by: Chen Baozi <baozich@gmail.com> > > If you don''t mind, I think this patch can go upstream :).Never mind, ;-)> > Acked-by: Julien Grall <julien.grall@linaro.org> > >> --- >> xen/include/asm-arm/platform.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h >> index dbd2a15..43afebb 100644 >> --- a/xen/include/asm-arm/platform.h >> +++ b/xen/include/asm-arm/platform.h >> @@ -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) >> >> > > -- > Julien Grall
Julien Grall
2013-Oct-23 13:59 UTC
Re: [PATCH 3/3] xen/arm: implement smp initialization callbacks for omap5
On 10/15/2013 09:45 AM, Chen Baozi wrote:> > Signed-off-by: Chen Baozi <baozich@gmail.com>If you don''t modify the patch in the next version: Acked-by: Julien Grall <julien.grall@linaro.org>> --- > xen/arch/arm/platforms/omap5.c | 34 ++++++++++++++++++++++++++++++++++ > xen/include/asm-arm/platforms/omap5.h | 3 +++ > 2 files changed, 37 insertions(+) > > diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c > index a583e2b..b90e570 100644 > --- a/xen/arch/arm/platforms/omap5.c > +++ b/xen/arch/arm/platforms/omap5.c > @@ -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 > > diff --git a/xen/include/asm-arm/platforms/omap5.h b/xen/include/asm-arm/platforms/omap5.h > index dd8c6ca..c559c84 100644 > --- a/xen/include/asm-arm/platforms/omap5.h > +++ b/xen/include/asm-arm/platforms/omap5.h > @@ -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 */ > > /* >-- Julien Grall
Ian Campbell
2013-Oct-24 14:03 UTC
Re: [PATCH 1/3] xen/arm: fix a typo in comment of PLATFORM_QUIRK_DOM0_MAPPING_11
On Mon, 2013-10-21 at 17:42 +0100, Julien Grall wrote:> (+ Ian Campbell in CC) > > On 10/15/2013 09:45 AM, Chen Baozi wrote: > > > > Signed-off-by: Chen Baozi <baozich@gmail.com> > > If you don''t mind, I think this patch can go upstream :). > > Acked-by: Julien Grall <julien.grall@linaro.org>Yep. Applied.
Ian Campbell
2013-Oct-24 14:03 UTC
Re: [PATCH 3/3] xen/arm: implement smp initialization callbacks for omap5
On Wed, 2013-10-23 at 14:59 +0100, Julien Grall wrote:> > On 10/15/2013 09:45 AM, Chen Baozi wrote: > > > > Signed-off-by: Chen Baozi <baozich@gmail.com> > > If you don''t modify the patch in the next version: > > Acked-by: Julien Grall <julien.grall@linaro.org>Applied.
Ian Campbell
2013-Oct-24 14:04 UTC
Re: [PATCH 2/3] xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE
On Tue, 2013-10-15 at 16:45 +0800, Chen Baozi wrote:> 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. > > Signed-off-by: Chen Baozi <baozich@gmail.com>Are we intending to run with this approach or is the kernel getting fixed?
Chen Baozi
2013-Nov-05 17:19 UTC
Re: [PATCH 2/3] xen/arm: Add PLATFORM_QUIRK_DOM0_MAP_DISABLED_DEVICE
Hi Ian, Sorry for the late reply. On Oct 24, 2013, at 10:04 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:> On Tue, 2013-10-15 at 16:45 +0800, Chen Baozi wrote: >> 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. >> >> Signed-off-by: Chen Baozi <baozich@gmail.com> > > 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