[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2] plat/xen: CPU definition for Arm32



Introduce minimal CPU definitons to enable compiling for Arm32.
This commits also removes x86 specific CPU functions from the
Arm32 build unit and introduces CONFIG_XN_HVMLITE as invisible
menu configuraiton. Its intention is to support switching
between PV and PVH mode later. For now, we set PV mode for x86
and PVH mode for Arm.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 plat/common/arm/cpu_native.c      | 11 ++++++++++-
 plat/common/include/arm/arm/cpu.h |  9 +++++++++
 plat/xen/Config.uk                |  6 ++++++
 plat/xen/Makefile.uk              |  7 ++++---
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/plat/common/arm/cpu_native.c b/plat/common/arm/cpu_native.c
index 898c4375..d9364835 100644
--- a/plat/common/arm/cpu_native.c
+++ b/plat/common/arm/cpu_native.c
@@ -31,10 +31,14 @@
  *
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
+#include <uk/config.h>
 #include <cpu.h>
+#if !CONFIG_ARCH_ARM_32
+/* TODO: Not yet supported for Arm32 */
 #include <irq.h>
-#include <uk/assert.h>
 #include <arm/cpu_defs.h>
+#endif
+#include <uk/assert.h>
 
 /*
  * Halts the CPU until the next external interrupt is fired. For Arm,
@@ -45,6 +49,10 @@ void halt(void)
        __asm__ __volatile__("wfi");
 }
 
+#if !CONFIG_ARCH_ARM_32
+/*
+ * TODO: Port the following functionality to Arm32
+ */
 /* Systems support PSCI >= 0.2 can do system reset from PSCI */
 void reset(void)
 {
@@ -74,3 +82,4 @@ void system_off(void)
 
        smcc_psci_call(PSCI_FNID_SYSTEM_OFF, 0, 0, 0);
 }
+#endif /* !CONFIG_ARCH_ARM_32 */
diff --git a/plat/common/include/arm/arm/cpu.h 
b/plat/common/include/arm/arm/cpu.h
index 697a20a1..c966cb41 100644
--- a/plat/common/include/arm/arm/cpu.h
+++ b/plat/common/include/arm/arm/cpu.h
@@ -1,8 +1,10 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ * Authors: Wei Chen <wei.chen@xxxxxxx>
  *
  *
+ * Copyright (c) 2018, Arm Ltd. All rights reserved.
  * Copyright (c) 2019, NEC Laboratories Europe GmbH, NEC Corporation.
  *                     All rights reserved.
  *
@@ -33,7 +35,14 @@
  *
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
+#ifndef _PLAT_COMMON_ARM_ARM_CPU_H_
+#define _PLAT_COMMON_ARM_ARM_CPU_H_
 
 static inline void _init_cpufeatures(void)
 {
 }
+
+/* CPU native APIs */
+void halt(void);
+
+#endif /* _PLAT_COMMON_ARM_ARM_CPU_H_ */
diff --git a/plat/xen/Config.uk b/plat/xen/Config.uk
index ebf766df..23bdf35a 100644
--- a/plat/xen/Config.uk
+++ b/plat/xen/Config.uk
@@ -10,6 +10,12 @@ menuconfig PLAT_XEN
                 Create a Unikraft image that runs as a Xen guest
 
 if (PLAT_XEN)
+# Invisible option to switch between PV and PVH mode
+config XEN_HVMLITE
+       bool
+       default n if (ARCH_X86_64 || ARCH_X86_32)
+       default y
+
 menu "Console Options"
 
 config XEN_KERNEL_HV_CONSOLE
diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
index 7a3fcc93..3642c5b2 100644
--- a/plat/xen/Makefile.uk
+++ b/plat/xen/Makefile.uk
@@ -46,12 +46,13 @@ LIBXENPLAT_SRCS-$(CONFIG_ARCH_X86_64) += 
$(LIBXENPLAT_BASE)/x86/mm.c
 LIBXENPLAT_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBXENPLAT_BASE)/x86/arch_events.c
 LIBXENPLAT_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBXENPLAT_BASE)/x86/arch_time.c
 
-ifneq ($(XEN_HVMLITE),y)
+ifneq ($(CONFIG_XEN_HVMLITE),y)
 LIBXENPLAT_ASFLAGS-y           += -DCONFIG_PARAVIRT
 LIBXENPLAT_CFLAGS-y            += -DCONFIG_PARAVIRT
-LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/x86/cpu_pv.c
+LIBXENPLAT_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBXENPLAT_BASE)/x86/cpu_pv.c
 else
-LIBXENPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/x86/cpu_native.c
+LIBXENPLAT_SRCS-$(CONFIG_ARCH_X86_64) += 
$(UK_PLAT_COMMON_BASE)/x86/cpu_native.c
+LIBXENPLAT_SRCS-$(CONFIG_ARCH_ARM_32) += 
$(UK_PLAT_COMMON_BASE)/arm/cpu_native.c
 endif
 
 LIBXENPLAT_SRCS-$(CONFIG_ARCH_ARM_32) += $(LIBXENPLAT_BASE)/arm/setup.c
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.