[PATCH v3 0/6] Decouple inmates from hypervisor

25 views
Skip to first unread message

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:04 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer
Hi,

this series decouples inmates from hypervisor (besides printk-core.c).

To achieve that, I introduced a new global include directory in the root
path of the project.

Rationale is as follows:
Inmates could accidentally include headers from
'hypervisor/include/jailhouse', such as utils.h, mmio.h or others.
Furthermore, we intermixed headers of different licenses in this
directory which complicates clearness. All includes that are
dual-licensed are needed by both, hypervisor and inmates. Let's
outsource those headers to their own directory.

I also moved the project-global configuration header config.h to
'include/jailhouse/config.h'

This series would also facilitate efforts to entirely decouple inmates.

Compile-time tested on x86 (think that suffices), run-time tested on arm
and arm64.

Find those patches here:
https://github.com/lfd/jailhouse/tree/inmate-decouple

Besides Jan's Signed-Offs, we're missing Signed-Offs for following
patches:
- 1/6: Tony
- 4/6: Tony
- 5/6: Tony, Nikhil

Cheers
Ralf

changes since v2:
- Include Signed-Offs of Jean-Philippe and Lokesh
- rebased to next (and respect that GICv3 is unconditionally compiled for all
ARM architectures)

changes since v1:
- squashed some patches
- improved commit messages
- Cc Jean-Phillippe and Antonios for sysregs.h patches

Ralf Ramsauer (6):
core: move hypercall interface to global include directory
core: move cell-config.h to global include directory
core: move hypervisor configuration to include/jailhouse/config.h
inmates, arm: provide own sysregs.h
inmates, arm64: provide own sysregs.h
inmates: remove hypervisor-local include directory

.gitignore | 2 +-
Documentation/hypervisor-configuration.md | 2 +-
Documentation/setup-on-banana-pi-arm-board.md | 2 +-
Kbuild | 2 +-
configs/Makefile | 7 +-
driver/Makefile | 5 +-
hypervisor/Makefile | 4 +-
.../arch/arm}/asm/jailhouse_hypercall.h | 0
.../arch/arm64}/asm/jailhouse_hypercall.h | 26 ++++++++
.../arch/x86}/asm/jailhouse_hypercall.h | 0
.../include => include}/jailhouse/cell-config.h | 0
.../include => include}/jailhouse/hypercall.h | 0
inmates/Makefile | 4 +-
inmates/lib/arm/include/asm/sysregs.h | 76 ++++++++++++++++++++++
inmates/lib/arm64/include/asm/sysregs.h | 55 ++++++++++++++++
15 files changed, 174 insertions(+), 11 deletions(-)
rename {hypervisor/arch/arm/include => include/arch/arm}/asm/jailhouse_hypercall.h (100%)
rename {hypervisor/arch/arm64/include => include/arch/arm64}/asm/jailhouse_hypercall.h (63%)
rename {hypervisor/arch/x86/include => include/arch/x86}/asm/jailhouse_hypercall.h (100%)
rename {hypervisor/include => include}/jailhouse/cell-config.h (100%)
rename {hypervisor/include => include}/jailhouse/hypercall.h (100%)
create mode 100644 inmates/lib/arm/include/asm/sysregs.h
create mode 100644 inmates/lib/arm64/include/asm/sysregs.h

--
2.14.1

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:05 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer
Keep dual-licensed code and/or headers shared between components at one
single place.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
---
{hypervisor/include => include}/jailhouse/cell-config.h | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename {hypervisor/include => include}/jailhouse/cell-config.h (100%)

diff --git a/hypervisor/include/jailhouse/cell-config.h b/include/jailhouse/cell-config.h
similarity index 100%
rename from hypervisor/include/jailhouse/cell-config.h
rename to include/jailhouse/cell-config.h
--
2.14.1

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:05 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer, Antonios Motakis
Keep dual-licensed code and/or headers shared between components at one
single place.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
Cc: Antonios Motakis <antonios...@huawei.com>
---
configs/Makefile | 7 +++---
driver/Makefile | 5 ++++-
hypervisor/Makefile | 4 +++-
.../arch/arm}/asm/jailhouse_hypercall.h | 0
.../arch/arm64}/asm/jailhouse_hypercall.h | 26 ++++++++++++++++++++++
.../arch/x86}/asm/jailhouse_hypercall.h | 0
.../include => include}/jailhouse/hypercall.h | 0
inmates/Makefile | 4 +++-
8 files changed, 40 insertions(+), 6 deletions(-)
rename {hypervisor/arch/arm/include => include/arch/arm}/asm/jailhouse_hypercall.h (100%)
rename {hypervisor/arch/arm64/include => include/arch/arm64}/asm/jailhouse_hypercall.h (63%)
rename {hypervisor/arch/x86/include => include/arch/x86}/asm/jailhouse_hypercall.h (100%)
rename {hypervisor/include => include}/jailhouse/hypercall.h (100%)

diff --git a/configs/Makefile b/configs/Makefile
index fc15086f..7a0224de 100644
--- a/configs/Makefile
+++ b/configs/Makefile
@@ -13,11 +13,12 @@
subdir-y := dts

LINUXINCLUDE := -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
- -I$(src)/../hypervisor/include
+ -I$(src)/../hypervisor/include \
+ -I$(src)/../include
KBUILD_CFLAGS := -Wextra

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

OBJCOPYFLAGS := -O binary
diff --git a/driver/Makefile b/driver/Makefile
index 9febfe26..609e07a9 100644
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -14,7 +14,10 @@
obj-m := jailhouse.o

ccflags-y := -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
- -I$(src)/../hypervisor/include
+ -I$(src)/../hypervisor/include \
+ -I$(src)/../include/arch/$(SRCARCH) \
+ -I$(src)/../include
+

jailhouse-y := cell.o main.o sysfs.o
jailhouse-$(CONFIG_PCI) += pci.o
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index 279c4c4e..92c39221 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -20,7 +20,9 @@

LINUXINCLUDE := -I$(src)/arch/$(SRCARCH)/include \
-I$(src)/arch/$(SRCARCH)/include/generated \
- -I$(src)/include
+ -I$(src)/include \
+ -I$(src)/../include/arch/$(SRCARCH) \
+ -I$(src)/../include
KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
-Wmissing-declarations -Wmissing-prototypes \
-fno-strict-aliasing -fno-pic -fno-common \
diff --git a/hypervisor/arch/arm/include/asm/jailhouse_hypercall.h b/include/arch/arm/asm/jailhouse_hypercall.h
similarity index 100%
rename from hypervisor/arch/arm/include/asm/jailhouse_hypercall.h
rename to include/arch/arm/asm/jailhouse_hypercall.h
diff --git a/hypervisor/arch/arm64/include/asm/jailhouse_hypercall.h b/include/arch/arm64/asm/jailhouse_hypercall.h
similarity index 63%
rename from hypervisor/arch/arm64/include/asm/jailhouse_hypercall.h
rename to include/arch/arm64/asm/jailhouse_hypercall.h
index 3a1b2c42..d9a9f693 100644
--- a/hypervisor/arch/arm64/include/asm/jailhouse_hypercall.h
+++ b/include/arch/arm64/asm/jailhouse_hypercall.h
@@ -8,6 +8,32 @@
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
+ *
+ * Alternatively, you can use or redistribute this file under the following
+ * BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
*/

#define JAILHOUSE_CALL_INS "hvc #0x4a48"
diff --git a/hypervisor/arch/x86/include/asm/jailhouse_hypercall.h b/include/arch/x86/asm/jailhouse_hypercall.h
similarity index 100%
rename from hypervisor/arch/x86/include/asm/jailhouse_hypercall.h
rename to include/arch/x86/asm/jailhouse_hypercall.h
diff --git a/hypervisor/include/jailhouse/hypercall.h b/include/jailhouse/hypercall.h
similarity index 100%
rename from hypervisor/include/jailhouse/hypercall.h
rename to include/jailhouse/hypercall.h
diff --git a/inmates/Makefile b/inmates/Makefile
index 7f3ee742..47c630da 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -17,7 +17,9 @@ export INMATES_LIB

INCLUDES := -I$(INMATES_LIB) \
-I$(src)/../hypervisor/arch/$(SRCARCH)/include \
- -I$(src)/../hypervisor/include
+ -I$(src)/../hypervisor/include \
+ -I$(src)/../include/arch/$(SRCARCH) \
+ -I$(src)/../include

ifeq ($(subst arm64,arm,$(SRCARCH)),arm)
INCLUDES += -I$(src)/../hypervisor/arch/arm-common/include
--
2.14.1

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:05 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer
Keep dual-licensed code and/or headers shared between components at one
single place. Also maintain documentation and .gitignore.

Both, inmates and hypervisor need those definitions. Don't store the
global config.h somewhere deep inside 'hypervisor/' any longer.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
---
.gitignore | 2 +-
Documentation/hypervisor-configuration.md | 2 +-
Documentation/setup-on-banana-pi-arm-board.md | 2 +-
Kbuild | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index b4ebeda7..26399865 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,7 @@
Module.symvers
modules.order
driver/jailhouse.ko
-hypervisor/include/jailhouse/config.h
+include/jailhouse/config.h
hypervisor/hypervisor.lds
inmates/lib/arm/inmate.lds
inmates/lib/arm64/inmate.lds
diff --git a/Documentation/hypervisor-configuration.md b/Documentation/hypervisor-configuration.md
index ecd4fa54..e59a2faf 100644
--- a/Documentation/hypervisor-configuration.md
+++ b/Documentation/hypervisor-configuration.md
@@ -4,7 +4,7 @@ Hypervisor Configuration
Jailhouse supports various static compile-time configuration
parameters, such as platform specific settings and debugging options.
Those settings can optionally be defined in
-'hypervisor/include/jailhouse/config.h'.
+'include/jailhouse/config.h'.
Every configuration option should be defined to "1" or not be in the file at
all. Defining any other value can cause unexpected behaviour.

diff --git a/Documentation/setup-on-banana-pi-arm-board.md b/Documentation/setup-on-banana-pi-arm-board.md
index 26b84480..060062d9 100644
--- a/Documentation/setup-on-banana-pi-arm-board.md
+++ b/Documentation/setup-on-banana-pi-arm-board.md
@@ -235,7 +235,7 @@ $ cp -av ~/freertos-cell/jailhouse-configs/bananapi.c ~/jailhouse/configs/banana
$ cp -av freertos-cell/jailhouse-configs/bananapi-freertos-demo.c ~/jailhouse/configs/

#Copy the configuration header file before building
-$ cp -av ~/jailhouse/ci/jailhouse-config-banana-pi.h ~/jailhouse/hypervisor/include/jailhouse/config.h
+$ cp -av ~/jailhouse/ci/jailhouse-config-banana-pi.h ~/jailhouse/include/jailhouse/config.h
$ cd ~/jailhouse
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KDIR=../linux-stable
```
diff --git a/Kbuild b/Kbuild
index 420dedc1..090094e2 100644
--- a/Kbuild
+++ b/Kbuild
@@ -11,7 +11,7 @@
# the COPYING file in the top-level directory.
#

-INC_CONFIG_H = $(src)/hypervisor/include/jailhouse/config.h
+INC_CONFIG_H = $(src)/include/jailhouse/config.h
export INC_CONFIG_H

define filechk_config_mk
--
2.14.1

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:06 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer, Jean-Philippe Brucker, Antonios Motakis
ARM inmates make use of hypervisor's sysregs accessors and helpers. In
order to entirely decouple the hypervisor code from inmate code, let's
duplicate some of those definitions, but only those that are really in
use.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
Signed-off-by: Jean-Philippe Brucker <jean-phili...@arm.com>
Cc: Jean-Philippe Brucker <jean-phili...@arm.com>
Cc: Jan Kiszka <jan.k...@siemens.com>
Cc: Antonios Motakis <antonios...@huawei.com>
---
inmates/lib/arm/include/asm/sysregs.h | 76 +++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 inmates/lib/arm/include/asm/sysregs.h

diff --git a/inmates/lib/arm/include/asm/sysregs.h b/inmates/lib/arm/include/asm/sysregs.h
new file mode 100644
index 00000000..7c285923
--- /dev/null
+++ b/inmates/lib/arm/include/asm/sysregs.h
@@ -0,0 +1,76 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) OTH Regensburg, 2017
+ *
+ * Authors:
+ * Ralf Ramsauer <ralf.r...@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.
+ */
+
+/* The following definitions are inspired by
+ * hypervisor/arch/arm/include/asm/sysregs.h */
+
+#define VBAR SYSREG_32(0, c12, c0, 0)
+#define CNTFRQ_EL0 SYSREG_32(0, c14, c0, 0)
+#define CNTV_TVAL_EL0 SYSREG_32(0, c14, c3, 0)
+#define CNTV_CTL_EL0 SYSREG_32(0, c14, c3, 1)
+#define CNTPCT_EL0 SYSREG_64(0, c14)
+
+#define SYSREG_32(...) 32, __VA_ARGS__
+#define SYSREG_64(...) 64, __VA_ARGS__
+
+#define _arm_write_sysreg(size, ...) arm_write_sysreg_ ## size(__VA_ARGS__)
+#define arm_write_sysreg(...) _arm_write_sysreg(__VA_ARGS__)
+
+#define _arm_read_sysreg(size, ...) arm_read_sysreg_ ## size(__VA_ARGS__)
+#define arm_read_sysreg(...) _arm_read_sysreg(__VA_ARGS__)
+
+#ifndef __ASSEMBLY__
+asm(".arch_extension virt\n");
+
+#define arm_write_sysreg_32(op1, crn, crm, op2, val) \
+ asm volatile ("mcr p15, "#op1", %0, "#crn", "#crm", "#op2"\n" \
+ : : "r"((u32)(val)))
+
+#define arm_read_sysreg_32(op1, crn, crm, op2, val) \
+ asm volatile ("mrc p15, "#op1", %0, "#crn", "#crm", "#op2"\n" \
+ : "=r"((u32)(val)))
+#define arm_read_sysreg_64(op1, crm, val) \
+ asm volatile ("mrrc p15, "#op1", %Q0, %R0, "#crm"\n" \
+ : "=r"((u64)(val)))
+
+#else /* __ASSEMBLY__ */
+
+#define arm_write_sysreg_32(op1, crn, crm, op2, reg) \
+ mcr p15, op1, reg, crn, crm, op2
+
+#endif /* __ASSEMBLY__ */
--
2.14.1

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:07 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer, Lokesh Vutla, Antonios Motakis, Nikhil Devshatwar
ARM inmates make use of hypervisor's sysregs accessors and helpers. In
order to entirely decouple the hypervisor code from inmate code, let's
duplicate accessors.

And that's it, we just need to define accessors, compiler makes the
rest.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
Signed-off-by: Lokesh Vutla <lokes...@ti.com>
Reviewed-by: Lokesh Vutla <lokes...@ti.com>
Cc: Antonios Motakis <antonios...@huawei.com>
Cc: Nikhil Devshatwar <nikh...@ti.com>
Cc: Lokesh Vutla <lokes...@ti.com>
Cc: Jan Kiszka <jan.k...@siemens.com>
---
inmates/lib/arm64/include/asm/sysregs.h | 55 +++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 inmates/lib/arm64/include/asm/sysregs.h

diff --git a/inmates/lib/arm64/include/asm/sysregs.h b/inmates/lib/arm64/include/asm/sysregs.h
new file mode 100644
index 00000000..0caea891
--- /dev/null
+++ b/inmates/lib/arm64/include/asm/sysregs.h
@@ -0,0 +1,55 @@
+ * hypervisor/arch/arm64/include/asm/sysregs.h */
+
+#ifndef __ASSEMBLY__
+
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
+
+#define SYSREG_32(op1, crn, crm, op2) s3_##op1 ##_##crn ##_##crm ##_##op2
+
+#define arm_write_sysreg(sysreg, val) \
+ asm volatile ("msr "__stringify(sysreg)", %0\n" : : "r"((u64)(val)))
+
+#define arm_read_sysreg(sysreg, val) \
+ asm volatile ("mrs %0, "__stringify(sysreg)"\n" : "=r"((val)))

Ralf Ramsauer

unread,
Sep 25, 2017, 7:54:07 AM9/25/17
to Jan Kiszka, jailho...@googlegroups.com, Ralf Ramsauer
There's no more need for it. And that's it, inmates no more depend on
pure hypervisor headers.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
---
inmates/Makefile | 2 --
1 file changed, 2 deletions(-)

diff --git a/inmates/Makefile b/inmates/Makefile
index 47c630da..29b6236c 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -16,8 +16,6 @@ INMATES_LIB = $(src)/lib/$(SRCARCH)
export INMATES_LIB

INCLUDES := -I$(INMATES_LIB) \
- -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
- -I$(src)/../hypervisor/include \
-I$(src)/../include/arch/$(SRCARCH) \
-I$(src)/../include

--
2.14.1

Jan Kiszka

unread,
Sep 25, 2017, 8:07:09 AM9/25/17
to jailho...@googlegroups.com, Lokesh Vutla, Ralf Ramsauer, Antonios Motakis, Nikhil Devshatwar
On 2017-09-25 13:53, Ralf Ramsauer wrote:
> ARM inmates make use of hypervisor's sysregs accessors and helpers. In
> order to entirely decouple the hypervisor code from inmate code, let's
> duplicate accessors.
>
> And that's it, we just need to define accessors, compiler makes the
> rest.
>
> Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
> Signed-off-by: Lokesh Vutla <lokes...@ti.com>

Lokesh, as you've already signed off, just let us know if this covered
TI contribution of both you and Nikhil. I suspect so, but we need this
formally confirmed.

Thanks!
Jan

PS: My Siemens signed-offs are already in the queue and will by applied
on merge.
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

Nikhil Devshatwar

unread,
Sep 25, 2017, 9:12:54 AM9/25/17
to Ralf Ramsauer, Jan Kiszka, jailho...@googlegroups.com, Lokesh Vutla, Antonios Motakis, Nikhil Devshatwar
On Monday 25 September 2017 05:23 PM, Ralf Ramsauer wrote:
> ARM inmates make use of hypervisor's sysregs accessors and helpers. In
> order to entirely decouple the hypervisor code from inmate code, let's
> duplicate accessors.
>
> And that's it, we just need to define accessors, compiler makes the
> rest.
>
> Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
> Signed-off-by: Lokesh Vutla <lokes...@ti.com>
> Reviewed-by: Lokesh Vutla <lokes...@ti.com>
> Cc: Antonios Motakis <antonios...@huawei.com>
> Cc: Nikhil Devshatwar <nikh...@ti.com>
> Cc: Lokesh Vutla <lokes...@ti.com>
> Cc: Jan Kiszka <jan.k...@siemens.com>
Signed-off-by: Nikhil Devshatwar <nikh...@ti.com>

Ralf Ramsauer

unread,
Nov 6, 2017, 5:31:51 AM11/6/17
to jailho...@googlegroups.com, Antonios Motakis, Jan Kiszka
Hi Tony,

any updates?

Thanks,
Ralf

Antonios Motakis

unread,
Dec 12, 2017, 4:11:15 AM12/12/17
to Ralf Ramsauer, Jan Kiszka, jailho...@googlegroups.com, jani.k...@huawei.com, goetz....@huawei.com
Hello all,

I apologize for the delay to confirm this, but:

Signed-off-by: Antonios Motakis <antonios...@huawei.com>

Cheers,
Tony
Antonios Motakis
Virtualization Engineer
Huawei Technologies Duesseldorf GmbH
European Research Center
Riesstrasse 25, 80992 München

Jan Kiszka

unread,
Dec 12, 2017, 4:18:29 AM12/12/17
to Antonios Motakis, Ralf Ramsauer, jailho...@googlegroups.com, jani.k...@huawei.com, goetz....@huawei.com
On 2017-12-12 10:10, Antonios Motakis wrote:
> Hello all,
>
> I apologize for the delay to confirm this, but:
>
> Signed-off-by: Antonios Motakis <antonios...@huawei.com>

Thanks a lot, Tony!

Ralf, please let me know if the patches are still fine or if you need a
rebase.

Jan

Ralf Ramsauer

unread,
Dec 12, 2017, 3:21:36 PM12/12/17
to Antonios Motakis, Ralf Ramsauer, Jan Kiszka, jailho...@googlegroups.com, jani.k...@huawei.com, goetz....@huawei.com
Hi Toni,

On 12/12/2017 10:10 AM, Antonios Motakis wrote:
> Hello all,
>
> I apologize for the delay to confirm this, but:
>
> Signed-off-by: Antonios Motakis <antonios...@huawei.com>
thanks for the christmas present! I apply your sign-off to the whole series.

Luckily there were no merge conflicts while rebasing.

Thanks
Ralf

Ralf Ramsauer

unread,
Dec 12, 2017, 3:40:52 PM12/12/17
to jailho...@googlegroups.com, Jan Kiszka, Antonios Motakis, Ralf Ramsauer
Hohoho,

this series decouples inmates from hypervisor (besides printk-core.c).

To achieve that, I introduced a new global include directory in the root
path of the project.

Rationale is as follows:
Inmates could accidentally include headers from
'hypervisor/include/jailhouse', such as utils.h, mmio.h or others.
Furthermore, we intermixed headers of different licenses in this
directory which complicates clearness. All includes that are
dual-licensed are needed by both, hypervisor and inmates. Let's
outsource those headers to their own directory.

I also moved the project-global configuration header config.h to
'include/jailhouse/config.h'

This series would also facilitate efforts to entirely decouple inmates.

Compile-time tested on x86 (think that suffices), run-time tested on arm
and arm64.

Jan, you might want to pick those patches from here:
https://github.com/lfd/jailhouse/tree/inmate-decouple

Cheers
Ralf

changes since v3:
- collected all signed-off's
- rebased to latest next (no conflicts)
- compile test for all archs
--
2.15.1

Ralf Ramsauer

unread,
Dec 12, 2017, 3:40:52 PM12/12/17
to jailho...@googlegroups.com, Jan Kiszka, Antonios Motakis, Ralf Ramsauer
There's no more need for it. And that's it, inmates no more depend on
pure hypervisor headers.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
Signed-off-by: Antonios Motakis <antonios...@huawei.com>
---
inmates/Makefile | 2 --
1 file changed, 2 deletions(-)

diff --git a/inmates/Makefile b/inmates/Makefile
index 47c630da..29b6236c 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -16,8 +16,6 @@ INMATES_LIB = $(src)/lib/$(SRCARCH)
export INMATES_LIB

INCLUDES := -I$(INMATES_LIB) \
- -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
- -I$(src)/../hypervisor/include \
-I$(src)/../include/arch/$(SRCARCH) \
-I$(src)/../include

--
2.15.1

Ralf Ramsauer

unread,
Dec 12, 2017, 3:40:52 PM12/12/17
to jailho...@googlegroups.com, Jan Kiszka, Antonios Motakis, Ralf Ramsauer, Jean-Philippe Brucker
ARM inmates make use of hypervisor's sysregs accessors and helpers. In
order to entirely decouple the hypervisor code from inmate code, let's
duplicate some of those definitions, but only those that are really in
use.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
Signed-off-by: Jean-Philippe Brucker <jean-phili...@arm.com>
Signed-off-by: Antonios Motakis <antonios...@huawei.com>
Cc: Jean-Philippe Brucker <jean-phili...@arm.com>
Cc: Jan Kiszka <jan.k...@siemens.com>
Cc: Antonios Motakis <antonios...@huawei.com>
---
inmates/lib/arm/include/asm/sysregs.h | 76 +++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 inmates/lib/arm/include/asm/sysregs.h

diff --git a/inmates/lib/arm/include/asm/sysregs.h b/inmates/lib/arm/include/asm/sysregs.h
new file mode 100644
index 00000000..7c285923
--- /dev/null
+++ b/inmates/lib/arm/include/asm/sysregs.h
@@ -0,0 +1,76 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) OTH Regensburg, 2017
+ *
+ * Authors:
+ * Ralf Ramsauer <ralf.r...@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.
+ */
+
+/* The following definitions are inspired by
+
+#endif /* __ASSEMBLY__ */
--
2.15.1

Lokesh Vutla

unread,
Dec 13, 2017, 12:27:33 AM12/13/17
to Ralf Ramsauer, jailho...@googlegroups.com, Jan Kiszka, Antonios Motakis


On Wednesday 13 December 2017 02:10 AM, Ralf Ramsauer wrote:
> Hohoho,
>
> this series decouples inmates from hypervisor (besides printk-core.c).
>
> To achieve that, I introduced a new global include directory in the root
> path of the project.
>
> Rationale is as follows:
> Inmates could accidentally include headers from
> 'hypervisor/include/jailhouse', such as utils.h, mmio.h or others.
> Furthermore, we intermixed headers of different licenses in this
> directory which complicates clearness. All includes that are
> dual-licensed are needed by both, hypervisor and inmates. Let's
> outsource those headers to their own directory.
>
> I also moved the project-global configuration header config.h to
> 'include/jailhouse/config.h'
>
> This series would also facilitate efforts to entirely decouple inmates.
>
> Compile-time tested on x86 (think that suffices), run-time tested on arm
> and arm64.
>
> Jan, you might want to pick those patches from here:
> https://github.com/lfd/jailhouse/tree/inmate-decouple

FWIW, for entire series:
Reviewed-by: Lokesh Vutla <lokes...@ti.com>

Thanks and regards,
Lokesh

Jan Kiszka

unread,
Dec 13, 2017, 1:55:40 AM12/13/17
to Ralf Ramsauer, jailho...@googlegroups.com, Antonios Motakis
Thanks, merged now with fixups. One follow-up path will come.

Jan

Jan Kiszka

unread,
Dec 13, 2017, 1:58:52 AM12/13/17
to Lokesh Vutla, Ralf Ramsauer, jailho...@googlegroups.com, Antonios Motakis
Thanks! Almost forgot to add your tag.
Reply all
Reply to author
Forward
0 new messages