[PATCH 2/3] arm: Add PSCI v0.1 support as provided by U-Boot

37 views
Skip to first unread message

Jan Kiszka

unread,
Feb 12, 2015, 5:16:08 AM2/12/15
to jailho...@googlegroups.com
Upstream U-Boot will continue to offer only a PSCI v0.1 interface. To
make us independent of patches, add the IDs for CPU_OFF and CPU_ON to
the dispatcher. Those functions are practically compatible between 0.1
and 0.2.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
hypervisor/arch/arm/include/asm/psci.h | 4 ++++
hypervisor/arch/arm/psci.c | 2 ++
2 files changed, 6 insertions(+)

diff --git a/hypervisor/arch/arm/include/asm/psci.h b/hypervisor/arch/arm/include/asm/psci.h
index 4ef4568..90c3a23 100644
--- a/hypervisor/arch/arm/include/asm/psci.h
+++ b/hypervisor/arch/arm/include/asm/psci.h
@@ -29,6 +29,10 @@
#define PSCI_SYSTEM_OFF 0x84000008
#define PSCI_SYSTEM_RESET 0x84000009

+/* v0.1 function IDs as used by U-Boot */
+#define PSCI_CPU_OFF_V0_1_UBOOT 0x95c1ba5f
+#define PSCI_CPU_ON_V0_1_UBOOT 0x95c1ba60
+
#define PSCI_SUCCESS 0
#define PSCI_NOT_SUPPORTED (-1)
#define PSCI_INVALID_PARAMETERS (-2)
diff --git a/hypervisor/arch/arm/psci.c b/hypervisor/arch/arm/psci.c
index 8521810..60654eb 100644
--- a/hypervisor/arch/arm/psci.c
+++ b/hypervisor/arch/arm/psci.c
@@ -142,6 +142,7 @@ long psci_dispatch(struct per_cpu *cpu_data, struct trap_context *ctx)
return 2;

case PSCI_CPU_OFF:
+ case PSCI_CPU_OFF_V0_1_UBOOT:
/*
* The reset function will take care of calling
* psci_emulate_spin
@@ -152,6 +153,7 @@ long psci_dispatch(struct per_cpu *cpu_data, struct trap_context *ctx)
return 0;

case PSCI_CPU_ON_32:
+ case PSCI_CPU_ON_V0_1_UBOOT:
return psci_emulate_cpu_on(cpu_data, ctx);

case PSCI_AFFINITY_INFO_32:
--
2.1.4

Jan Kiszka

unread,
Feb 12, 2015, 5:16:09 AM2/12/15
to jailho...@googlegroups.com
We no longer depend on PSCI v0.2 patches, just on a recent upstream
version.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 9b5ccd6..ea70d2f 100644
--- a/README.md
+++ b/README.md
@@ -263,8 +263,8 @@ The Banana Pi is a cheap Raspberry-Pi-like ARM board with an Allwinner A20 SoC
comparably well hackable. Further information can be found on
http://linux-sunxi.org.

-For Jailhouse, U-Boot currently requires a few additional patches that can be
-retrieved from https://github.com/siemens/u-boot/commits/sunxi.
+For Jailhouse, a U-Boot (pre-)release more recent than v2015.04-rc1 is
+required. Tested and know to work is git revision bd2a4888b1.

The Linux kernel version should be at least 3.19-rcX. The configuration used
for continuous integration builds can serve as reference, see
--
2.1.4

Jan Kiszka

unread,
Feb 12, 2015, 5:16:10 AM2/12/15
to jailho...@googlegroups.com
See patches for details.

Jan

Jan Kiszka (3):
arm: Rename CONFIG_ARCH_* to CONFIG_MACH_*
arm: Add PSCI v0.1 support as provided by U-Boot
README: Update U-Boot requirement for Banana Pi

README.md | 4 ++--
ci/jailhouse-config-banana-pi.h | 2 +-
ci/jailhouse-config-vexpress.h | 2 +-
hypervisor/arch/arm/Makefile | 4 ++--
hypervisor/arch/arm/include/asm/platform.h | 8 ++++----
hypervisor/arch/arm/include/asm/psci.h | 4 ++++
hypervisor/arch/arm/psci.c | 2 ++
inmates/demos/arm/gic-demo.c | 2 +-
inmates/lib/arm/Makefile.lib | 4 ++--
9 files changed, 19 insertions(+), 13 deletions(-)

--
2.1.4

Jan Kiszka

unread,
Feb 12, 2015, 5:16:10 AM2/12/15
to jailho...@googlegroups.com
Based on proposal by Benedikt Spranger: CONFIG_ARCH_SUN7I and
CONFIG_ARCH_VEXPRESS select a machine type, not an architecture. Rename
them to clarify this.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
ci/jailhouse-config-banana-pi.h | 2 +-
ci/jailhouse-config-vexpress.h | 2 +-
hypervisor/arch/arm/Makefile | 4 ++--
hypervisor/arch/arm/include/asm/platform.h | 8 ++++----
inmates/demos/arm/gic-demo.c | 2 +-
inmates/lib/arm/Makefile.lib | 4 ++--
6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ci/jailhouse-config-banana-pi.h b/ci/jailhouse-config-banana-pi.h
index 15cbd58..69afba1 100644
--- a/ci/jailhouse-config-banana-pi.h
+++ b/ci/jailhouse-config-banana-pi.h
@@ -1,3 +1,3 @@
#define CONFIG_ARM_GIC 1
-#define CONFIG_ARCH_SUN7I 1
+#define CONFIG_MACH_SUN7I 1
#define CONFIG_SERIAL_8250_DW 1
diff --git a/ci/jailhouse-config-vexpress.h b/ci/jailhouse-config-vexpress.h
index ddd6e84..3ee36bf 100644
--- a/ci/jailhouse-config-vexpress.h
+++ b/ci/jailhouse-config-vexpress.h
@@ -1,3 +1,3 @@
#define CONFIG_ARM_GIC 1
-#define CONFIG_ARCH_VEXPRESS 1
+#define CONFIG_MACH_VEXPRESS 1
#define CONFIG_SERIAL_AMBA_PL011 1
diff --git a/hypervisor/arch/arm/Makefile b/hypervisor/arch/arm/Makefile
index c9186d3..51e46af 100644
--- a/hypervisor/arch/arm/Makefile
+++ b/hypervisor/arch/arm/Makefile
@@ -25,5 +25,5 @@ obj-$(CONFIG_ARM_GIC_V3) += gic-v3.o
obj-$(CONFIG_ARM_GIC) += gic-v2.o
obj-$(CONFIG_SERIAL_AMBA_PL011) += dbg-write-pl011.o
obj-$(CONFIG_SERIAL_8250_DW) += uart-8250-dw.o
-obj-$(CONFIG_ARCH_VEXPRESS) += smp-vexpress.o
-obj-$(CONFIG_ARCH_SUN7I) += smp-sun7i.o
+obj-$(CONFIG_MACH_VEXPRESS) += smp-vexpress.o
+obj-$(CONFIG_MACH_SUN7I) += smp-sun7i.o
diff --git a/hypervisor/arch/arm/include/asm/platform.h b/hypervisor/arch/arm/include/asm/platform.h
index 1a2d4b3..b0d51ee 100644
--- a/hypervisor/arch/arm/include/asm/platform.h
+++ b/hypervisor/arch/arm/include/asm/platform.h
@@ -20,7 +20,7 @@
*/
#ifndef __ASSEMBLY__

-#ifdef CONFIG_ARCH_VEXPRESS
+#ifdef CONFIG_MACH_VEXPRESS

# ifdef CONFIG_ARM_GIC_V3
# define GICD_BASE ((void *)0x2f000000)
@@ -50,9 +50,9 @@
# define MAINTENANCE_IRQ 25
# define SYSREGS_BASE 0x1c010000

-#endif /* CONFIG_ARCH_VEXPRESS */
+#endif /* CONFIG_MACH_VEXPRESS */

-#ifdef CONFIG_ARCH_SUN7I
+#ifdef CONFIG_MACH_SUN7I

# define GICD_BASE ((void *)0x01c81000)
# define GICD_SIZE 0x1000
@@ -67,7 +67,7 @@

# define MAINTENANCE_IRQ 25

-#endif /* CONFIG_ARCH_SUN7I */
+#endif /* CONFIG_MACH_SUN7I */

#define HOTPLUG_SPIN 1
/*
diff --git a/inmates/demos/arm/gic-demo.c b/inmates/demos/arm/gic-demo.c
index 823f69d..e5c3669 100644
--- a/inmates/demos/arm/gic-demo.c
+++ b/inmates/demos/arm/gic-demo.c
@@ -68,7 +68,7 @@ static void handle_IRQ(unsigned int irqn)
ticks_to_ns(delta), ticks_to_ns(min_delta),
ticks_to_ns(max_delta));

-#ifdef CONFIG_ARCH_SUN7I
+#ifdef CONFIG_MACH_SUN7I
/* let green LED on Banana Pi blink */
#define LED_REG (void *)(0x1c20800 + 7*0x24 + 0x10)
mmio_write32(LED_REG, mmio_read32(LED_REG) ^ (1<<24));
diff --git a/inmates/lib/arm/Makefile.lib b/inmates/lib/arm/Makefile.lib
index 68c4cc2..2746eda 100644
--- a/inmates/lib/arm/Makefile.lib
+++ b/inmates/lib/arm/Makefile.lib
@@ -27,8 +27,8 @@ define DECLARE_TARGETS =
$$(_TARGETS:.bin=-linked.o) $$(_TARGETS)
endef

-mach-$(CONFIG_ARCH_VEXPRESS) := vexpress
-mach-$(CONFIG_ARCH_SUN7I) := sun7i
+mach-$(CONFIG_MACH_VEXPRESS) := vexpress
+mach-$(CONFIG_MACH_SUN7I) := sun7i

gic-$(CONFIG_ARM_GIC) := gic-v2.o
gic-$(CONFIG_ARM_GIC_V3) := gic-v3.o
--
2.1.4

Reply all
Reply to author
Forward
0 new messages