[PATCH 8/8] Documentation: how to configure jailhouse

26 views
Skip to first unread message

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:48 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

There is no documentation on how to configure jailhouse for a specific
platform. A documentation describing all available 'config.h' parameters
is created.

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
Documentation/hypervisor-configuration.txt | 55 ++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 Documentation/hypervisor-configuration.txt

diff --git a/Documentation/hypervisor-configuration.txt b/Documentation/hypervisor-configuration.txt
new file mode 100644
index 0000000..8894be0
--- /dev/null
+++ b/Documentation/hypervisor-configuration.txt
@@ -0,0 +1,55 @@
+Hypervisor Configuration
+========================
+
+The Jailhouse Hypervisor supports various static compile-time configuration
+parameters, such as different UART drivers, platform specific settings and
+debugging options.
+
+Those settings can optionally be defined in config.h in the project root
+directory.
+
+Jailhouse derives config.mk from this file that makes symbols available
+for the kbuild system.
+
+Available configuration options
+-------------------------------
+
+General configuration parameters
+CONFIG_TRACE_ERROR /* Trace jailhouse errors to serial console */
+
+X86 specific
+CONFIG_UART_OXPCIE952 /* OXPCIE952 serial interface */
+
+ARM specific
+CONFIG_ARM_GIC_V2 /* ARM Generic Interrupt Controller */
+CONFIG_ARM_GIC_V3 /* ARM Generic Interrupt Controller version 3 */
+
+CONFIG_MACH_TEGRA124 /* Tegra124 platform */
+CONFIG_MACH_SUN7I /* Sun7I platform */
+CONFIG_MACH_VEXPRESS /* Versatile Express platform */
+
+CONFIG_SERIAL_TEGRA /* Tegra serial interface */
+CONFIG_SERIAL_AMBA_PL011 /* AMBA_PL011 serial interface */
+CONFIG_SERIAL_8250_DW /* 8250 serial interface */
+
+Examples for different platform configurations
+==============================================
+
+Jetson TK1
+----------
+#define CONFIG_ARM_GIC_V2 1
+#define CONFIG_MACH_TEGRA124 1
+#define CONFIG_SERIAL_TEGRA 1
+
+Banana Pi
+---------
+#define CONFIG_ARM_GIC_V2 1
+#define CONFIG_MACH_SUN7I 1
+#define CONFIG_SERIAL_8250_DW 1
+
+Versatile Express
+-----------------
+
+#define CONFIG_ARM_GIC_V3 1
+#define CONFIG_MACH_VEXPRESS 1
+#define CONFIG_SERIAL_AMBA_PL011 1
--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:48 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

This smaller interface should be used when no output is needed.

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
hypervisor/Makefile | 6 +++++-
hypervisor/arch/arm/Makefile | 9 ++++++++-
hypervisor/dbg-write-stubs.c | 28 ++++++++++++++++++++++++++++
3 files changed, 41 insertions(+), 2 deletions(-)
create mode 100644 hypervisor/dbg-write-stubs.c

diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index e070abd..03b2d32 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -39,7 +39,7 @@ ifneq ($(wildcard $(src)/../config.h),)
KBUILD_CFLAGS += -include $(obj)/../config.h
endif

-CORE_OBJECTS = setup.o printk.o paging.o control.o lib.o mmio.o
+CORE_OBJECTS = setup.o dbg-write-stubs.o paging.o control.o lib.o mmio.o

define filechk_version
$(src)/../scripts/gen_version_h $(src)/..
@@ -71,6 +71,10 @@ define cmd_defines
echo "#endif" ) > $@
endef

+ifdef CONFIG_DEBUG_OUTPUT
+CORE_OBJECTS += printk.o
+endif
+
defines-file := include/generated/asm-defines.h

targets := $(defines-file) arch/$(SRCARCH)/asm-defines.s
diff --git a/hypervisor/arch/arm/Makefile b/hypervisor/arch/arm/Makefile
index 5d06679..4c5f564 100644
--- a/hypervisor/arch/arm/Makefile
+++ b/hypervisor/arch/arm/Makefile
@@ -16,7 +16,7 @@ KBUILD_AFLAGS := $(subst -include asm/unified.h,,$(KBUILD_AFLAGS))

always := built-in.o

-obj-y := entry.o dbg-write.o exception.o setup.o control.o lib.o
+obj-y := entry.o exception.o setup.o control.o lib.o
obj-y += traps.o mmio.o
obj-y += paging.o mmu_hyp.o mmu_cell.o caches.o
obj-y += psci.o smp-stubs.o
@@ -27,3 +27,10 @@ obj-$(CONFIG_SERIAL_AMBA_PL011) += uart-pl011.o
obj-$(CONFIG_SERIAL_8250_DW) += uart-8250-dw.o
obj-$(CONFIG_SERIAL_TEGRA) += uart-tegra.o
obj-$(CONFIG_MACH_VEXPRESS) += smp-vexpress.o
+ifdef CONFIG_DEBUG_OUTPUT
+ obj-y += dbg-write.o
+ obj-$(CONFIG_SERIAL_AMBA_PL011) += uart-pl011.o
+ obj-$(CONFIG_SERIAL_8250_DW) += uart-8250-dw.o
+ obj-$(CONFIG_SERIAL_TEGRA) += uart-tegra.o
+endif
+
diff --git a/hypervisor/dbg-write-stubs.c b/hypervisor/dbg-write-stubs.c
new file mode 100644
index 0000000..7e87645
--- /dev/null
+++ b/hypervisor/dbg-write-stubs.c
@@ -0,0 +1,28 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) OTH Regensburg, 2016
+ *
+ * Authors:
+ * Andreas Kölbl <andreas...@st.oth-regensburg.de>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+#include <jailhouse/printk.h>
+
+void __attribute__((weak)) arch_dbg_write_init(void)
+{
+}
+
+void __attribute__((weak)) arch_dbg_write(const char *msg)
+{
+}
+
+void __attribute__((weak)) printk(const char *fmt, ...)
+{
+}
+
+void __attribute__((weak)) panic_printk(const char *fmt, ...)
+{
+}
--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:48 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

This header is only included by concrete uart drivers. Furthermore, it
only declares the the abstract uart_chip structure. Naming it debug.h
might be misleading.

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
hypervisor/arch/arm/dbg-write.c | 2 +-
hypervisor/arch/arm/include/asm/uart-8250-dw.h | 2 +-
hypervisor/arch/arm/include/asm/uart-pl011.h | 2 +-
hypervisor/arch/arm/include/asm/uart-tegra.h | 2 +-
hypervisor/arch/arm/include/asm/{debug.h => uart.h} | 6 +++---
inmates/lib/arm/printk.c | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
rename hypervisor/arch/arm/include/asm/{debug.h => uart.h} (86%)

diff --git a/hypervisor/arch/arm/dbg-write.c b/hypervisor/arch/arm/dbg-write.c
index 076821b..8de0103 100644
--- a/hypervisor/arch/arm/dbg-write.c
+++ b/hypervisor/arch/arm/dbg-write.c
@@ -13,7 +13,7 @@
#include <jailhouse/entry.h>
#include <jailhouse/printk.h>
#include <jailhouse/processor.h>
-#include <asm/debug.h>
+#include <asm/uart.h>

static struct uart_chip uart;

diff --git a/hypervisor/arch/arm/include/asm/uart-8250-dw.h b/hypervisor/arch/arm/include/asm/uart-8250-dw.h
index 9c6c27f..a06923a 100644
--- a/hypervisor/arch/arm/include/asm/uart-8250-dw.h
+++ b/hypervisor/arch/arm/include/asm/uart-8250-dw.h
@@ -12,7 +12,7 @@

#include <jailhouse/mmio.h>
#include <jailhouse/processor.h>
-#include <asm/debug.h>
+#include <asm/uart.h>

#define UART_TX 0x0
#define UART_DLL 0x0
diff --git a/hypervisor/arch/arm/include/asm/uart-pl011.h b/hypervisor/arch/arm/include/asm/uart-pl011.h
index adba555..7f1a56e 100644
--- a/hypervisor/arch/arm/include/asm/uart-pl011.h
+++ b/hypervisor/arch/arm/include/asm/uart-pl011.h
@@ -13,7 +13,7 @@
#ifndef _JAILHOUSE_ASM_UART_PL011_H
#define _JAILHOUSE_ASM_UART_PL011_H

-#include <asm/debug.h>
+#include <asm/uart.h>
#include <asm/processor.h>

#define UART_CLK 24000000
diff --git a/hypervisor/arch/arm/include/asm/uart-tegra.h b/hypervisor/arch/arm/include/asm/uart-tegra.h
index 0c0b254..ecac543 100644
--- a/hypervisor/arch/arm/include/asm/uart-tegra.h
+++ b/hypervisor/arch/arm/include/asm/uart-tegra.h
@@ -12,7 +12,7 @@

#include <jailhouse/mmio.h>
#include <jailhouse/processor.h>
-#include <asm/debug.h>
+#include <asm/uart.h>

#define UART_TX 0x0
#define UART_DLL 0x0
diff --git a/hypervisor/arch/arm/include/asm/debug.h b/hypervisor/arch/arm/include/asm/uart.h
similarity index 86%
rename from hypervisor/arch/arm/include/asm/debug.h
rename to hypervisor/arch/arm/include/asm/uart.h
index 02c6f48..8bcb242 100644
--- a/hypervisor/arch/arm/include/asm/debug.h
+++ b/hypervisor/arch/arm/include/asm/uart.h
@@ -10,8 +10,8 @@
* the COPYING file in the top-level directory.
*/

-#ifndef JAILHOUSE_ASM_DEBUG_H_
-#define JAILHOUSE_ASM_DEBUG_H_
+#ifndef JAILHOUSE_ASM_UART_H_
+#define JAILHOUSE_ASM_UART_H_

#ifndef __ASSEMBLY__

@@ -30,4 +30,4 @@ struct uart_chip {
void uart_chip_init(struct uart_chip *chip);

#endif /* !__ASSEMBLY__ */
-#endif /* !JAILHOUSE_ASM_DEBUG_H_ */
+#endif /* !JAILHOUSE_ASM_UART_H_ */
diff --git a/inmates/lib/arm/printk.c b/inmates/lib/arm/printk.c
index 874dada..3ede5cf 100644
--- a/inmates/lib/arm/printk.c
+++ b/inmates/lib/arm/printk.c
@@ -11,7 +11,7 @@
*/

#include <inmate.h>
-#include <asm/debug.h>
+#include <asm/uart.h>
#include <stdarg.h>

static struct uart_chip chip;
--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:48 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

Rename uart_pl011.h to uart-pl011.h and dbg-write-pl011.c to uart-pl011.c

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
hypervisor/arch/arm/Makefile | 2 +-
hypervisor/arch/arm/include/asm/{uart_pl011.h => uart-pl011.h} | 6 +++---
hypervisor/arch/arm/{dbg-write-pl011.c => uart-pl011.c} | 2 +-
inmates/lib/arm/uart-pl011.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
rename hypervisor/arch/arm/include/asm/{uart_pl011.h => uart-pl011.h} (95%)
rename hypervisor/arch/arm/{dbg-write-pl011.c => uart-pl011.c} (94%)

diff --git a/hypervisor/arch/arm/Makefile b/hypervisor/arch/arm/Makefile
index 30986b9..ef4624f 100644
--- a/hypervisor/arch/arm/Makefile
+++ b/hypervisor/arch/arm/Makefile
@@ -23,7 +23,7 @@ obj-y += psci.o smp.o
obj-y += irqchip.o gic-common.o
obj-$(CONFIG_ARM_GIC_V2) += gic-v2.o
obj-$(CONFIG_ARM_GIC_V3) += gic-v3.o
-obj-$(CONFIG_SERIAL_AMBA_PL011) += dbg-write-pl011.o
+obj-$(CONFIG_SERIAL_AMBA_PL011) += uart-pl011.o
obj-$(CONFIG_SERIAL_8250_DW) += uart-8250-dw.o
obj-$(CONFIG_SERIAL_TEGRA) += uart-tegra.o
obj-$(CONFIG_MACH_VEXPRESS) += smp-vexpress.o
diff --git a/hypervisor/arch/arm/include/asm/uart_pl011.h b/hypervisor/arch/arm/include/asm/uart-pl011.h
similarity index 95%
rename from hypervisor/arch/arm/include/asm/uart_pl011.h
rename to hypervisor/arch/arm/include/asm/uart-pl011.h
index 8548c86..adba555 100644
--- a/hypervisor/arch/arm/include/asm/uart_pl011.h
+++ b/hypervisor/arch/arm/include/asm/uart-pl011.h
@@ -10,8 +10,8 @@
* the COPYING file in the top-level directory.
*/

-#ifndef _JAILHOUSE_ASM_DEBUG_PL011_H
-#define _JAILHOUSE_ASM_DEBUG_PL011_H
+#ifndef _JAILHOUSE_ASM_UART_PL011_H
+#define _JAILHOUSE_ASM_UART_PL011_H

#include <asm/debug.h>
#include <asm/processor.h>
@@ -111,4 +111,4 @@ static void uart_write(struct uart_chip *chip, char c)
}

#endif /* !__ASSEMBLY__ */
-#endif /* !_JAILHOUSE_ASM_DEBUG_PL011_H */
+#endif /* !_JAILHOUSE_ASM_UART_PL011_H */
diff --git a/hypervisor/arch/arm/dbg-write-pl011.c b/hypervisor/arch/arm/uart-pl011.c
similarity index 94%
rename from hypervisor/arch/arm/dbg-write-pl011.c
rename to hypervisor/arch/arm/uart-pl011.c
index b682f30..6fc9495 100644
--- a/hypervisor/arch/arm/dbg-write-pl011.c
+++ b/hypervisor/arch/arm/uart-pl011.c
@@ -10,7 +10,7 @@
* the COPYING file in the top-level directory.
*/

-#include <asm/uart_pl011.h>
+#include <asm/uart-pl011.h>

/* All the helpers are in the header, to make them re-usable by the inmates */
void uart_chip_init(struct uart_chip *chip)
diff --git a/inmates/lib/arm/uart-pl011.c b/inmates/lib/arm/uart-pl011.c
index 29e1975..98fcc09 100644
--- a/inmates/lib/arm/uart-pl011.c
+++ b/inmates/lib/arm/uart-pl011.c
@@ -9,7 +9,7 @@
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*/
-#include <asm/uart_pl011.h>
+#include <asm/uart-pl011.h>
#include <mach/uart.h>

void uart_chip_init(struct uart_chip *chip)
--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:48 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <Andreas Koelbl andreas...@st.oth-regensburg.de>

These are mostly cleanups for uart, configuration changes and a documentation.
Key changes:

- Move configuraton to project root
- Opt-in for hypervisor output (CONFIG_DEBUG_OUTPUT)
(Note: update the location of your config.h!)

Andi

Andreas Koelbl (8):
arm: consistent naming of uart components
arm: Rename debug.h to uart.h
arm: Rename CONFIG_UART_OXPCIE952 to CONFIG_SERIAL_OXPCIE952
arm: rename smp.c to smp-stubs.c
Move jailhouse configuration to project root
core: Move panic_cpu and panic_in_progress to control.c
Use a stub of dbg-write.o and uart.o
Documentation: how to configure jailhouse

.gitignore | 2 +-
Documentation/hypervisor-configuration.txt | 55 ++++++++++++++++++++++
FAQ.md | 2 +-
Kbuild | 21 ++++++++-
ci/build-all-configs.sh | 2 +-
configs/Makefile | 4 +-
hypervisor/Makefile | 32 +++++--------
hypervisor/arch/arm/Makefile | 15 ++++--
hypervisor/arch/arm/dbg-write.c | 3 +-
hypervisor/arch/arm/include/asm/uart-8250-dw.h | 2 +-
.../arm/include/asm/{uart_pl011.h => uart-pl011.h} | 8 ++--
hypervisor/arch/arm/include/asm/uart-tegra.h | 2 +-
.../arch/arm/include/asm/{debug.h => uart.h} | 6 +--
hypervisor/arch/arm/{smp.c => smp-stubs.c} | 0
.../arch/arm/{dbg-write-pl011.c => uart-pl011.c} | 2 +-
hypervisor/arch/x86/dbg-write.c | 2 +-
hypervisor/control.c | 3 ++
hypervisor/dbg-write-stubs.c | 28 +++++++++++
hypervisor/include/jailhouse/control.h | 3 ++
hypervisor/include/jailhouse/printk.h | 3 --
hypervisor/printk.c | 4 +-
inmates/Makefile | 4 +-
inmates/demos/x86/32-bit-demo.c | 2 +-
inmates/demos/x86/apic-demo.c | 2 +-
inmates/demos/x86/e1000-demo.c | 2 +-
inmates/demos/x86/ioapic-demo.c | 2 +-
inmates/demos/x86/pci-demo.c | 2 +-
inmates/demos/x86/smp-demo.c | 2 +-
inmates/demos/x86/tiny-demo.c | 2 +-
inmates/lib/arm/Makefile.lib | 2 +-
inmates/lib/arm/printk.c | 2 +-
inmates/lib/arm/uart-pl011.c | 2 +-
inmates/lib/x86/printk.c | 2 +-
33 files changed, 162 insertions(+), 63 deletions(-)
create mode 100644 Documentation/hypervisor-configuration.txt
rename hypervisor/arch/arm/include/asm/{uart_pl011.h => uart-pl011.h} (94%)
rename hypervisor/arch/arm/include/asm/{debug.h => uart.h} (86%)
rename hypervisor/arch/arm/{smp.c => smp-stubs.c} (100%)
rename hypervisor/arch/arm/{dbg-write-pl011.c => uart-pl011.c} (94%)
create mode 100644 hypervisor/dbg-write-stubs.c

--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:48 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

The Jailhouse configuration is currently hidden in
hypervisor/include/jailhouse/config.h, together with config.mk.
config.mk is only needed for the kbuild system, and not an actual include.

config.h is a global jailhouse configuration that not only applies to
the hypervisor, but also to inmates.

As a consequence, move config.mk and config.h to the project root directory.

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
.gitignore | 2 +-
FAQ.md | 2 +-
Kbuild | 21 +++++++++++++++++++--
ci/build-all-configs.sh | 2 +-
configs/Makefile | 4 ++--
hypervisor/Makefile | 26 ++++++--------------------
hypervisor/arch/arm/Makefile | 2 +-
inmates/Makefile | 4 ++--
inmates/lib/arm/Makefile.lib | 2 +-
9 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/.gitignore b/.gitignore
index 87962f4..d4687da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,7 @@
Module.symvers
modules.order
driver/jailhouse.ko
-hypervisor/include/jailhouse/config.h
+config.h
hypervisor/hypervisor.lds
tools/jailhouse
tools/jailhouse-config-collect
diff --git a/FAQ.md b/FAQ.md
index 5d2cc05..005d9b1 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -58,7 +58,7 @@ a Linux machine to the other side of serial connection and use terminal emulator
like minicom to grab the log messages.

To enable error tracing, put ```#define CONFIG_TRACE_ERROR``` in file
-hypervisor/include/jailhouse/config.h before compiling.
+config.h before compiling.

Please note Jailhouse developers may ask you for these logs, shall you come for
help to jailhouse-dev mailing list, because they are extremely useful to analyze
diff --git a/Kbuild b/Kbuild
index 9013179..6fcc741 100644
--- a/Kbuild
+++ b/Kbuild
@@ -11,10 +11,27 @@
# the COPYING file in the top-level directory.
#

+define filechk_config_mk
+( \
+ echo "\$$(foreach config,\$$(filter CONFIG_%, \
+ \$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
+ if [ -f $(src)/config.h ]; then \
+ sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d" \
+ -e "s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/" \
+ $(src)/config.h; \
+ fi \
+)
+endef
+
subdir-y := driver hypervisor configs inmates

subdir-ccflags-y := -Werror

-# inmates build depends on generated config.mk of the hypervisor,
+# inmates build depends on generated config.mk,
# and the driver needs version.h from there
-$(obj)/inmates $(obj)/driver: $(obj)/hypervisor
+$(obj)/inmates $(obj)/driver: $(obj)/config.mk $(obj)/hypervisor
+
+$(obj)/config.mk: Makefile
+ $(call filechk,config_mk)
+
+.PHONY: $(obj)/config.mk
diff --git a/ci/build-all-configs.sh b/ci/build-all-configs.sh
index cbcbb86..cc47215 100755
--- a/ci/build-all-configs.sh
+++ b/ci/build-all-configs.sh
@@ -30,7 +30,7 @@ for CONFIG in $CONFIGS; do
echo
echo "*** Building configuration $CONFIG ***"

- cp ci/jailhouse-config-$CONFIG.h hypervisor/include/jailhouse/config.h
+ cp ci/jailhouse-config-$CONFIG.h config.h

case $CONFIG in
x86)
diff --git a/configs/Makefile b/configs/Makefile
index 3e94199..f5fa0d9 100644
--- a/configs/Makefile
+++ b/configs/Makefile
@@ -14,8 +14,8 @@ LINUXINCLUDE := -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
-I$(src)/../hypervisor/include
KBUILD_CFLAGS := -Wextra

-ifneq ($(wildcard $(obj)/../hypervisor/include/jailhouse/config.h),)
-KBUILD_CFLAGS += -include $(obj)/../hypervisor/include/jailhouse/config.h
+ifneq ($(wildcard $(obj)/../config.h),)
+KBUILD_CFLAGS += -include $(obj)/../config.h
endif

OBJCOPYFLAGS := -O binary
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index 0532e4e..e070abd 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -16,6 +16,8 @@
# Copyright (c) Linux kernel developers, 2014
#

+include $(src)/../config.mk
+
LINUXINCLUDE := -I$(src)/arch/$(SRCARCH)/include -I$(src)/include
KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
-Wmissing-declarations -Wmissing-prototypes \
@@ -33,27 +35,12 @@ ifeq ($(SRCARCH),arm)
KBUILD_CFLAGS += -marm
endif

-ifneq ($(wildcard $(obj)/include/jailhouse/config.h),)
-KBUILD_CFLAGS += -include $(obj)/include/jailhouse/config.h
+ifneq ($(wildcard $(src)/../config.h),)
+KBUILD_CFLAGS += -include $(obj)/../config.h
endif

CORE_OBJECTS = setup.o printk.o paging.o control.o lib.o mmio.o

-define filechk_config_mk
-( \
- echo "\$$(foreach config,\$$(filter CONFIG_%, \
- \$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
- if [ -f $(src)/include/jailhouse/config.h ]; then \
- sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d" \
- -e "s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/" \
- $(src)/include/jailhouse/config.h; \
- fi \
-)
-endef
-
-$(obj)/include/generated/config.mk: Makefile FORCE
- $(call filechk,config_mk)
-
define filechk_version
$(src)/../scripts/gen_version_h $(src)/..
endef
@@ -103,9 +90,8 @@ $(foreach co,$(CORE_OBJECTS),\

$(obj)/setup.o: $(obj)/include/generated/version.h

-arch-builtin: $(obj)/$(defines-file) $(obj)/include/generated/config.mk FORCE
- $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH) \
- CONFIG_MK=$(obj)/include/generated/config.mk
+arch-builtin: $(obj)/$(defines-file) FORCE
+ $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH)

always :=

diff --git a/hypervisor/arch/arm/Makefile b/hypervisor/arch/arm/Makefile
index 437b78d..5d06679 100644
--- a/hypervisor/arch/arm/Makefile
+++ b/hypervisor/arch/arm/Makefile
@@ -10,7 +10,7 @@
# the COPYING file in the top-level directory.
#

-include $(CONFIG_MK)
+include $(src)/../../../config.mk

KBUILD_AFLAGS := $(subst -include asm/unified.h,,$(KBUILD_AFLAGS))

diff --git a/inmates/Makefile b/inmates/Makefile
index 0e8f258..7d3b1a8 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -23,8 +23,8 @@ KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
-Wmissing-declarations -Wmissing-prototypes \
-fno-strict-aliasing -fomit-frame-pointer -fno-pic \
-fno-common -fno-stack-protector $(INCLUDES)
-ifneq ($(wildcard $(src)/../hypervisor/include/jailhouse/config.h),)
-KBUILD_CFLAGS += -include $(src)/../hypervisor/include/jailhouse/config.h
+ifneq ($(wildcard $(src)/../config.h),)
+KBUILD_CFLAGS += -include $(src)/../config.h
endif

OBJCOPYFLAGS := -O binary
diff --git a/inmates/lib/arm/Makefile.lib b/inmates/lib/arm/Makefile.lib
index 9510ff8..67841cf 100644
--- a/inmates/lib/arm/Makefile.lib
+++ b/inmates/lib/arm/Makefile.lib
@@ -12,7 +12,7 @@
# the COPYING file in the top-level directory.
#

--include $(obj)/../../../hypervisor/include/generated/config.mk
+-include $(obj)/../../../config.mk

KBUILD_AFLAGS := $(filter-out -include asm/unified.h,$(KBUILD_AFLAGS))

--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:49 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

Add the suffix -stubs to smp.c to make it more obvious that the file
only contains weak stubs.

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
hypervisor/arch/arm/Makefile | 2 +-
hypervisor/arch/arm/{smp.c => smp-stubs.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename hypervisor/arch/arm/{smp.c => smp-stubs.c} (100%)

diff --git a/hypervisor/arch/arm/Makefile b/hypervisor/arch/arm/Makefile
index ef4624f..437b78d 100644
--- a/hypervisor/arch/arm/Makefile
+++ b/hypervisor/arch/arm/Makefile
@@ -19,7 +19,7 @@ always := built-in.o
obj-y := entry.o dbg-write.o exception.o setup.o control.o lib.o
obj-y += traps.o mmio.o
obj-y += paging.o mmu_hyp.o mmu_cell.o caches.o
-obj-y += psci.o smp.o
+obj-y += psci.o smp-stubs.o
obj-y += irqchip.o gic-common.o
obj-$(CONFIG_ARM_GIC_V2) += gic-v2.o
obj-$(CONFIG_ARM_GIC_V3) += gic-v3.o
diff --git a/hypervisor/arch/arm/smp.c b/hypervisor/arch/arm/smp-stubs.c
similarity index 100%
rename from hypervisor/arch/arm/smp.c
rename to hypervisor/arch/arm/smp-stubs.c
--
2.10.0

andreas...@st.oth-regensburg.de

unread,
Oct 11, 2016, 11:11:50 AM10/11/16
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

All configuration parameters for serial drivers are prefixed by CONFIF_UART_*,
except of OXPCIE952. In order to get consistency, CONFIG_UART_OXPCIE952 should
be renamed to CONFIG_SERIAL_OXPCIE952

Signed-off-by: Andreas Koelbl <andreas...@st.oth-regensburg.de>
---
hypervisor/arch/x86/dbg-write.c | 2 +-
inmates/demos/x86/32-bit-demo.c | 2 +-
inmates/demos/x86/apic-demo.c | 2 +-
inmates/demos/x86/e1000-demo.c | 2 +-
inmates/demos/x86/ioapic-demo.c | 2 +-
inmates/demos/x86/pci-demo.c | 2 +-
inmates/demos/x86/smp-demo.c | 2 +-
inmates/demos/x86/tiny-demo.c | 2 +-
inmates/lib/x86/printk.c | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hypervisor/arch/x86/dbg-write.c b/hypervisor/arch/x86/dbg-write.c
index fdbe95a..045ce65 100644
--- a/hypervisor/arch/x86/dbg-write.c
+++ b/hypervisor/arch/x86/dbg-write.c
@@ -89,7 +89,7 @@ static void uart_init(void)
}

uart_reg_out(UART_LCR, UART_LCR_DLAB);
-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
outb(0x22, uart_base + UART_DLL);
#else
uart_reg_out(UART_DLL, 1);
diff --git a/inmates/demos/x86/32-bit-demo.c b/inmates/demos/x86/32-bit-demo.c
index c0dc5a7..e95c7e9 100644
--- a/inmates/demos/x86/32-bit-demo.c
+++ b/inmates/demos/x86/32-bit-demo.c
@@ -15,7 +15,7 @@

#include <inmate.h>

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe000
#else
#define UART_BASE 0x2f8
diff --git a/inmates/demos/x86/apic-demo.c b/inmates/demos/x86/apic-demo.c
index 57f8975..272a5d1 100644
--- a/inmates/demos/x86/apic-demo.c
+++ b/inmates/demos/x86/apic-demo.c
@@ -17,7 +17,7 @@ CMDLINE_BUFFER(CMDLINE_BUFFER_SIZE);

#define POLLUTE_CACHE_SIZE (512 * 1024)

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe010
#else
#define UART_BASE 0x3f8
diff --git a/inmates/demos/x86/e1000-demo.c b/inmates/demos/x86/e1000-demo.c
index e60152f..33b353b 100644
--- a/inmates/demos/x86/e1000-demo.c
+++ b/inmates/demos/x86/e1000-demo.c
@@ -17,7 +17,7 @@

#include <inmate.h>

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe000
#else
#define UART_BASE 0x2f8
diff --git a/inmates/demos/x86/ioapic-demo.c b/inmates/demos/x86/ioapic-demo.c
index 9357a1b..28023fd 100644
--- a/inmates/demos/x86/ioapic-demo.c
+++ b/inmates/demos/x86/ioapic-demo.c
@@ -22,7 +22,7 @@

#include <inmate.h>

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe000
#else
#define UART_BASE 0x2f8
diff --git a/inmates/demos/x86/pci-demo.c b/inmates/demos/x86/pci-demo.c
index fb85bc2..5f00d31 100644
--- a/inmates/demos/x86/pci-demo.c
+++ b/inmates/demos/x86/pci-demo.c
@@ -17,7 +17,7 @@

#include <inmate.h>

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe000
#else
#define UART_BASE 0x2f8
diff --git a/inmates/demos/x86/smp-demo.c b/inmates/demos/x86/smp-demo.c
index a5567be..29c509d 100644
--- a/inmates/demos/x86/smp-demo.c
+++ b/inmates/demos/x86/smp-demo.c
@@ -12,7 +12,7 @@

#include <inmate.h>

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe000
#else
#define UART_BASE 0x2f8
diff --git a/inmates/demos/x86/tiny-demo.c b/inmates/demos/x86/tiny-demo.c
index 8e1a077..0c00d91 100644
--- a/inmates/demos/x86/tiny-demo.c
+++ b/inmates/demos/x86/tiny-demo.c
@@ -12,7 +12,7 @@

#include <inmate.h>

-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
#define UART_BASE 0xe000
#else
#define UART_BASE 0x2f8
diff --git a/inmates/lib/x86/printk.c b/inmates/lib/x86/printk.c
index 78271e1..d5451eb 100644
--- a/inmates/lib/x86/printk.c
+++ b/inmates/lib/x86/printk.c
@@ -52,7 +52,7 @@ void printk(const char *fmt, ...)
if (!inited) {
inited = true;
outb(UART_LCR_DLAB, printk_uart_base + UART_LCR);
-#ifdef CONFIG_UART_OXPCIE952
+#ifdef CONFIG_SERIAL_OXPCIE952
outb(0x22, printk_uart_base + UART_DLL);
#else
outb(1, printk_uart_base + UART_DLL);
--
2.10.0

Jan Kiszka

unread,
Oct 13, 2016, 5:03:31 AM10/13/16
to andreas...@st.oth-regensburg.de, jailho...@googlegroups.com
Hi Andreas,
thanks for the patches already. I only quickly scanned through them the
other day with Ralf, found them generally very useful cleanups and will
try to look into some remaining details ASAP - but give me some days.

Jan

--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

Jan Kiszka

unread,
Oct 19, 2016, 1:46:39 AM10/19/16
to andreas...@st.oth-regensburg.de, jailho...@googlegroups.com
On 2016-10-11 17:11, andreas...@st.oth-regensburg.de wrote:
> From: Andreas Koelbl <andreas...@st.oth-regensburg.de>
>
> The Jailhouse configuration is currently hidden in
> hypervisor/include/jailhouse/config.h, together with config.mk.
> config.mk is only needed for the kbuild system, and not an actual include.

It is a makefile include, yes. And it is generated. As such, it should
end up in some similar directory again, likely /include/generated/.

>
> config.h is a global jailhouse configuration that not only applies to
> the hypervisor, but also to inmates.
>
> As a consequence, move config.mk and config.h to the project root directory.

If we move config.h, I would suggest to take the chance and convert it
into kconfig format (CONFIG_XXX=y, ie. what config.mk is already using).
That would give us a top-level .config from which we would generate
include/generated/config.h. Maybe someone will then feel like enabling
kconfig for Jailhouse...

Jan Kiszka

unread,
Oct 19, 2016, 1:47:22 AM10/19/16
to andreas...@st.oth-regensburg.de, jailho...@googlegroups.com
On 2016-10-11 17:11, andreas...@st.oth-regensburg.de wrote:
As you correctly found out: If we really want to save code & data, we
also need to eliminate the strings from the printk sites. And that
likely only works via defining the printk away.

So, for a quick solution to just silence the output on ARM, rather make
sure that a zero'ed jailhouse_system.debug_console works fine, just like
it already does on x86.

Jan Kiszka

unread,
Oct 19, 2016, 1:47:35 AM10/19/16
to andreas...@st.oth-regensburg.de, jailho...@googlegroups.com
On 2016-10-11 17:11, andreas...@st.oth-regensburg.de wrote:
Didn't you rename it?
Depends on the configuration of the target: either v2 or v3. OTOH, this
section is called "examples", so it's not incorrect.

> +#define CONFIG_MACH_VEXPRESS 1
> +#define CONFIG_SERIAL_AMBA_PL011 1
>

Please also add the new ARM64 variants now:

#define CONFIG_MACH_AMD_SEATTLE 1
#define CONFIG_SERIAL_AMBA_PL011 1
#define JAILHOUSE_BASE 0x82fc000000

#define CONFIG_MACH_HI6220 1
#define CONFIG_SERIAL_AMBA_PL011 1
#define JAILHOUSE_BASE 0x7c000000

Jan Kiszka

unread,
Oct 19, 2016, 1:48:52 AM10/19/16
to andreas...@st.oth-regensburg.de, jailho...@googlegroups.com
On 2016-10-11 17:11, andreas...@st.oth-regensburg.de wrote:
> From: Andreas Koelbl <Andreas Koelbl andreas...@st.oth-regensburg.de>
>
> These are mostly cleanups for uart, configuration changes and a documentation.
> Key changes:
>
> - Move configuraton to project root
> - Opt-in for hypervisor output (CONFIG_DEBUG_OUTPUT)
> (Note: update the location of your config.h!)
>

Thanks for the patches. When addressing my comments, please make sure to
also rebase over next which now contains arm64.
Reply all
Reply to author
Forward
0 new messages