Skip to content

Commit 0d7c1e2

Browse files
jan-kiszkaKAGA-KOKO
authored andcommitted
x86/jailhouse: Avoid access of unsupported platform resources
Non-root cells do not have CMOS access, thus the warm reset cannot be enabled. There is no RTC, thus also no wall clock. Furthermore, there are no ISA IRQs and no PIC. Also disable probing of i8042 devices that are typically blocked for non-root cells. In theory, access could also be granted to a non-root cell, provided the root cell is not using the devices. But there is no concrete scenario in sight, and disabling probing over Jailhouse allows to build generic kernels that keep CONFIG_SERIO enabled for use in normal systems. Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/39b68cc2c496501c9d95e6f40e5d76e3053c3908.1511770314.git.jan.kiszka@siemens.com
1 parent e85eb63 commit 0d7c1e2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/x86/kernel/jailhouse.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <asm/apic.h>
1414
#include <asm/cpu.h>
1515
#include <asm/hypervisor.h>
16+
#include <asm/i8259.h>
1617
#include <asm/setup.h>
1718

1819
static __initdata struct jailhouse_setup_data setup_data;
@@ -32,6 +33,11 @@ static uint32_t __init jailhouse_detect(void)
3233
return jailhouse_cpuid_base();
3334
}
3435

36+
static void jailhouse_get_wallclock(struct timespec *now)
37+
{
38+
memset(now, 0, sizeof(*now));
39+
}
40+
3541
static void __init jailhouse_timer_init(void)
3642
{
3743
lapic_timer_frequency = setup_data.apic_khz * (1000 / HZ);
@@ -77,11 +83,18 @@ static void __init jailhouse_init_platform(void)
7783
struct setup_data header;
7884
void *mapping;
7985

86+
x86_init.irqs.pre_vector_init = x86_init_noop;
8087
x86_init.timers.timer_init = jailhouse_timer_init;
8188
x86_init.mpparse.get_smp_config = jailhouse_get_smp_config;
8289

8390
x86_platform.calibrate_cpu = jailhouse_get_tsc;
8491
x86_platform.calibrate_tsc = jailhouse_get_tsc;
92+
x86_platform.get_wallclock = jailhouse_get_wallclock;
93+
x86_platform.legacy.rtc = 0;
94+
x86_platform.legacy.warm_reset = 0;
95+
x86_platform.legacy.i8042 = X86_LEGACY_I8042_PLATFORM_ABSENT;
96+
97+
legacy_pic = &null_legacy_pic;
8598

8699
while (pa_data) {
87100
mapping = early_memremap(pa_data, sizeof(header));

0 commit comments

Comments
 (0)