Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 platform updayes from Ingo Molnar: "Most of the commits add ACRN hypervisor guest support, plus two cleanups" * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/jailhouse: Mark jailhouse_x2apic_available() as __init x86/platform/geode: Drop <linux/gpio.h> includes x86/acrn: Use HYPERVISOR_CALLBACK_VECTOR for ACRN guest upcall vector x86: Add support for Linux guests on an ACRN hypervisor x86/Kconfig: Add new X86_HV_CALLBACK_VECTOR config symbol
This commit is contained in:
commit
8faef7125d
|
@ -785,6 +785,9 @@ config PARAVIRT_SPINLOCKS
|
|||
|
||||
If you are unsure how to answer this question, answer Y.
|
||||
|
||||
config X86_HV_CALLBACK_VECTOR
|
||||
def_bool n
|
||||
|
||||
source "arch/x86/xen/Kconfig"
|
||||
|
||||
config KVM_GUEST
|
||||
|
@ -836,6 +839,17 @@ config JAILHOUSE_GUEST
|
|||
cell. You can leave this option disabled if you only want to start
|
||||
Jailhouse and run Linux afterwards in the root cell.
|
||||
|
||||
config ACRN_GUEST
|
||||
bool "ACRN Guest support"
|
||||
depends on X86_64
|
||||
select X86_HV_CALLBACK_VECTOR
|
||||
help
|
||||
This option allows to run Linux as guest in the ACRN hypervisor. ACRN is
|
||||
a flexible, lightweight reference open-source hypervisor, built with
|
||||
real-time and safety-criticality in mind. It is built for embedded
|
||||
IOT with small footprint and real-time features. More details can be
|
||||
found in https://projectacrn.org/.
|
||||
|
||||
endif #HYPERVISOR_GUEST
|
||||
|
||||
source "arch/x86/Kconfig.cpu"
|
||||
|
|
|
@ -1164,6 +1164,11 @@ apicinterrupt3 HYPERV_STIMER0_VECTOR \
|
|||
hv_stimer0_callback_vector hv_stimer0_vector_handler
|
||||
#endif /* CONFIG_HYPERV */
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACRN_GUEST)
|
||||
apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
|
||||
acrn_hv_callback_vector acrn_hv_vector_handler
|
||||
#endif
|
||||
|
||||
idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=IST_INDEX_DB ist_offset=DB_STACK_OFFSET
|
||||
idtentry int3 do_int3 has_error_code=0 create_gap=1
|
||||
idtentry stack_segment do_stack_segment has_error_code=1
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_X86_ACRN_H
|
||||
#define _ASM_X86_ACRN_H
|
||||
|
||||
extern void acrn_hv_callback_vector(void);
|
||||
#ifdef CONFIG_TRACING
|
||||
#define trace_acrn_hv_callback_vector acrn_hv_callback_vector
|
||||
#endif
|
||||
|
||||
extern void acrn_hv_vector_handler(struct pt_regs *regs);
|
||||
#endif /* _ASM_X86_ACRN_H */
|
|
@ -37,7 +37,7 @@ typedef struct {
|
|||
#ifdef CONFIG_X86_MCE_AMD
|
||||
unsigned int irq_deferred_error_count;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
|
||||
#ifdef CONFIG_X86_HV_CALLBACK_VECTOR
|
||||
unsigned int irq_hv_callback_count;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_HYPERV)
|
||||
|
|
|
@ -29,6 +29,7 @@ enum x86_hypervisor_type {
|
|||
X86_HYPER_XEN_HVM,
|
||||
X86_HYPER_KVM,
|
||||
X86_HYPER_JAILHOUSE,
|
||||
X86_HYPER_ACRN,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HYPERVISOR_GUEST
|
||||
|
|
|
@ -49,6 +49,7 @@ obj-$(CONFIG_X86_CPU_RESCTRL) += resctrl/
|
|||
obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
|
||||
|
||||
obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
|
||||
obj-$(CONFIG_ACRN_GUEST) += acrn.o
|
||||
|
||||
ifdef CONFIG_X86_FEATURE_NAMES
|
||||
quiet_cmd_mkcapflags = MKCAP $@
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* ACRN detection support
|
||||
*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Jason Chen CJ <jason.cj.chen@intel.com>
|
||||
* Zhao Yakui <yakui.zhao@intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/acrn.h>
|
||||
#include <asm/apic.h>
|
||||
#include <asm/desc.h>
|
||||
#include <asm/hypervisor.h>
|
||||
#include <asm/irq_regs.h>
|
||||
|
||||
static uint32_t __init acrn_detect(void)
|
||||
{
|
||||
return hypervisor_cpuid_base("ACRNACRNACRN\0\0", 0);
|
||||
}
|
||||
|
||||
static void __init acrn_init_platform(void)
|
||||
{
|
||||
/* Setup the IDT for ACRN hypervisor callback */
|
||||
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, acrn_hv_callback_vector);
|
||||
}
|
||||
|
||||
static bool acrn_x2apic_available(void)
|
||||
{
|
||||
/*
|
||||
* x2apic is not supported for now. Future enablement will have to check
|
||||
* X86_FEATURE_X2APIC to determine whether x2apic is supported in the
|
||||
* guest.
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
static void (*acrn_intr_handler)(void);
|
||||
|
||||
__visible void __irq_entry acrn_hv_vector_handler(struct pt_regs *regs)
|
||||
{
|
||||
struct pt_regs *old_regs = set_irq_regs(regs);
|
||||
|
||||
/*
|
||||
* The hypervisor requires that the APIC EOI should be acked.
|
||||
* If the APIC EOI is not acked, the APIC ISR bit for the
|
||||
* HYPERVISOR_CALLBACK_VECTOR will not be cleared and then it
|
||||
* will block the interrupt whose vector is lower than
|
||||
* HYPERVISOR_CALLBACK_VECTOR.
|
||||
*/
|
||||
entering_ack_irq();
|
||||
inc_irq_stat(irq_hv_callback_count);
|
||||
|
||||
if (acrn_intr_handler)
|
||||
acrn_intr_handler();
|
||||
|
||||
exiting_irq();
|
||||
set_irq_regs(old_regs);
|
||||
}
|
||||
|
||||
const __initconst struct hypervisor_x86 x86_hyper_acrn = {
|
||||
.name = "ACRN",
|
||||
.detect = acrn_detect,
|
||||
.type = X86_HYPER_ACRN,
|
||||
.init.init_platform = acrn_init_platform,
|
||||
.init.x2apic_available = acrn_x2apic_available,
|
||||
};
|
|
@ -32,6 +32,7 @@ extern const struct hypervisor_x86 x86_hyper_xen_pv;
|
|||
extern const struct hypervisor_x86 x86_hyper_xen_hvm;
|
||||
extern const struct hypervisor_x86 x86_hyper_kvm;
|
||||
extern const struct hypervisor_x86 x86_hyper_jailhouse;
|
||||
extern const struct hypervisor_x86 x86_hyper_acrn;
|
||||
|
||||
static const __initconst struct hypervisor_x86 * const hypervisors[] =
|
||||
{
|
||||
|
@ -49,6 +50,9 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =
|
|||
#ifdef CONFIG_JAILHOUSE_GUEST
|
||||
&x86_hyper_jailhouse,
|
||||
#endif
|
||||
#ifdef CONFIG_ACRN_GUEST
|
||||
&x86_hyper_acrn,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum x86_hypervisor_type x86_hyper_type;
|
||||
|
|
|
@ -135,7 +135,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
|
|||
seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
|
||||
seq_puts(p, " Machine check polls\n");
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
|
||||
#ifdef CONFIG_X86_HV_CALLBACK_VECTOR
|
||||
if (test_bit(HYPERVISOR_CALLBACK_VECTOR, system_vectors)) {
|
||||
seq_printf(p, "%*s: ", prec, "HYP");
|
||||
for_each_online_cpu(j)
|
||||
|
|
|
@ -203,7 +203,7 @@ bool jailhouse_paravirt(void)
|
|||
return jailhouse_cpuid_base() != 0;
|
||||
}
|
||||
|
||||
static bool jailhouse_x2apic_available(void)
|
||||
static bool __init jailhouse_x2apic_available(void)
|
||||
{
|
||||
/*
|
||||
* The x2APIC is only available if the root cell enabled it. Jailhouse
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <linux/moduleparam.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/dmi.h>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <linux/string.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/dmi.h>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <linux/string.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ config XEN
|
|||
bool "Xen guest support"
|
||||
depends on PARAVIRT
|
||||
select PARAVIRT_CLOCK
|
||||
select X86_HV_CALLBACK_VECTOR
|
||||
depends on X86_64 || (X86_32 && X86_PAE)
|
||||
depends on X86_LOCAL_APIC && X86_TSC
|
||||
help
|
||||
|
|
|
@ -6,6 +6,7 @@ config HYPERV
|
|||
tristate "Microsoft Hyper-V client drivers"
|
||||
depends on X86 && ACPI && X86_LOCAL_APIC && HYPERVISOR_GUEST
|
||||
select PARAVIRT
|
||||
select X86_HV_CALLBACK_VECTOR
|
||||
help
|
||||
Select this option to run Linux as a Hyper-V client operating
|
||||
system.
|
||||
|
|
Loading…
Reference in New Issue