Skip to content

Instantly share code, notes, and snippets.

@bkrepo
Last active October 12, 2015 06:29
Show Gist options
  • Select an option

  • Save bkrepo/0a2e15a9a95b4ea42955 to your computer and use it in GitHub Desktop.

Select an option

Save bkrepo/0a2e15a9a95b4ea42955 to your computer and use it in GitHub Desktop.
Patch to support for exynos5422 CPU in Xen
diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c
index 79e3a5f..7813f59 100644
--- a/xen/arch/arm/platforms/exynos5.c
+++ b/xen/arch/arm/platforms/exynos5.c
@@ -165,8 +165,9 @@ static void exynos_cpu_power_up(void __iomem *power, int cpu)
static int exynos5_cpu_power_up(void __iomem *power, int cpu)
{
- unsigned int timeout;
+ unsigned int timeout, val;
+ cpu = (cpu + 4) % 8; // logical mapping for EXYNOS5422 cores
if ( !exynos_cpu_power_state(power, cpu) )
{
exynos_cpu_power_up(power, cpu);
@@ -187,6 +188,19 @@ static int exynos5_cpu_power_up(void __iomem *power, int cpu)
return -ETIMEDOUT;
}
}
+
+ cpu = (cpu + 4) % 8; // logical mapping for EXYNOS5422 cores
+ if ( cpu < 4 )
+ {
+ while (!__raw_readl(power + EXYNOS5_PMU_SPARE2))
+ udelay(10);
+
+ udelay(10);
+
+ val = ((1 << 20) | (1 << 8)) << cpu;
+ __raw_writel(val, power + EXYNOS5_SWRESET);
+ }
+
return 0;
}
@@ -298,6 +312,7 @@ static const char * const exynos5250_dt_compat[] __initconst =
static const char * const exynos5_dt_compat[] __initconst =
{
"samsung,exynos5410",
+ "samsung,exynos5422",
NULL
};
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 9d2bd6a..5b82d51 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -47,6 +47,8 @@
#include <asm/gic.h>
#include <asm/vgic.h>
+#include <asm/processor.h>
+
/* The base of the stack must always be double-word aligned, which means
* that both the kernel half of struct cpu_user_regs (which is pushed in
* entry.S) and struct cpu_info (which lives at the bottom of a Xen
@@ -2523,7 +2525,10 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
*/
GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr));
perfc_incr(trap_smc32);
- inject_undef32_exception(regs);
+ if (current->domain->domain_id == 0)
+ call_smc(regs->r0, regs->r1, regs->r2, regs->r3);
+ else
+ inject_undef32_exception(regs);
break;
case HSR_EC_HVC32:
GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr));
diff --git a/xen/include/asm-arm/platforms/exynos5.h b/xen/include/asm-arm/platforms/exynos5.h
index aef5c67..a4ac750 100644
--- a/xen/include/asm-arm/platforms/exynos5.h
+++ b/xen/include/asm-arm/platforms/exynos5.h
@@ -8,6 +8,7 @@
#define EXYNOS5_PA_TIMER 0x12dd0000
#define EXYNOS5_SWRESET 0x0400 /* Relative to PA_PMU */
+#define EXYNOS5_PMU_SPARE2 0x0908
#endif /* __ASM_ARM_PLATFORMS_EXYNOS5_H */
/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment