Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a362601 authored by Jan Kiszka's avatar Jan Kiszka Committed by Thomas Gleixner
Browse files

x86/jailhouse: Add infrastructure for running in non-root cell



The Jailhouse hypervisor is able to statically partition a multicore
system into multiple so-called cells. Linux is used as boot loader and
continues to run in the root cell after Jailhouse is enabled. Linux can
also run in non-root cells.

Jailhouse does not emulate usual x86 devices. It also provides no
complex ACPI but basic platform information that the boot loader
forwards via setup data. This adds the infrastructure to detect when
running in a non-root cell so that the platform can be configured as
required in succeeding steps.

Support is limited to x86-64 so far, primarily because no boot loader
stub exists for i386 and, thus, we wouldn't be able to test the 32-bit
path.

Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: jailhouse-dev@googlegroups.com
Link: https://lkml.kernel.org/r/7f823d077b38b1a70c526b40b403f85688c137d3.1511770314.git.jan.kiszka@siemens.com
parent a09c5ec0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -796,6 +796,14 @@ config PARAVIRT_TIME_ACCOUNTING
config PARAVIRT_CLOCK
	bool

config JAILHOUSE_GUEST
	bool "Jailhouse non-root cell support"
	depends on X86_64
	---help---
	  This option allows to run Linux as guest in a Jailhouse non-root
	  cell. You can leave this option disabled if you only want to start
	  Jailhouse and run Linux afterwards in the root cell.

endif #HYPERVISOR_GUEST

config NO_BOOTMEM
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ enum x86_hypervisor_type {
	X86_HYPER_XEN_PV,
	X86_HYPER_XEN_HVM,
	X86_HYPER_KVM,
	X86_HYPER_JAILHOUSE,
};

#ifdef CONFIG_HYPERVISOR_GUEST
+26 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL2.0 */

/*
 * Jailhouse paravirt_ops implementation
 *
 * Copyright (c) Siemens AG, 2015-2017
 *
 * Authors:
 *  Jan Kiszka <jan.kiszka@siemens.com>
 */

#ifndef _ASM_X86_JAILHOUSE_PARA_H
#define _ASM_X86_JAILHOUSE_PARA_H

#include <linux/types.h>

#ifdef CONFIG_JAILHOUSE_GUEST
bool jailhouse_paravirt(void);
#else
static inline bool jailhouse_paravirt(void)
{
	return false;
}
#endif

#endif /* _ASM_X86_JAILHOUSE_PARA_H */
+22 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#define SETUP_PCI			3
#define SETUP_EFI			4
#define SETUP_APPLE_PROPERTIES		5
#define SETUP_JAILHOUSE			6

/* ram_size flags */
#define RAMDISK_IMAGE_START_MASK	0x07FF
@@ -126,6 +127,27 @@ struct boot_e820_entry {
	__u32 type;
} __attribute__((packed));

/*
 * Smallest compatible version of jailhouse_setup_data required by this kernel.
 */
#define JAILHOUSE_SETUP_REQUIRED_VERSION	1

/*
 * The boot loader is passing platform information via this Jailhouse-specific
 * setup data structure.
 */
struct jailhouse_setup_data {
	u16	version;
	u16	compatible_version;
	u16	pm_timer_address;
	u16	num_cpus;
	u64	pci_mmconfig_base;
	u32	tsc_khz;
	u32	apic_khz;
	u8	standard_ioapic;
	u8	cpu_ids[255];
} __attribute__((packed));

/* The so-called "zeropage" */
struct boot_params {
	struct screen_info screen_info;			/* 0x000 */
+2 −0
Original line number Diff line number Diff line
@@ -112,6 +112,8 @@ obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o
obj-$(CONFIG_PARAVIRT_CLOCK)	+= pvclock.o
obj-$(CONFIG_X86_PMEM_LEGACY_DEVICE) += pmem.o

obj-$(CONFIG_JAILHOUSE_GUEST)	+= jailhouse.o

obj-$(CONFIG_EISA)		+= eisa.o
obj-$(CONFIG_PCSPKR_PLATFORM)	+= pcspeaker.o

Loading