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

Commit 43ff2f4d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 platform updates from Ingo Molnar:
 "The main changes in this cycle were:

   - a refactoring of the early virt init code by merging 'struct
     x86_hyper' into 'struct x86_platform' and 'struct x86_init', which
     allows simplifications and also the addition of a new
     ->guest_late_init() callback. (Juergen Gross)

   - timer_setup() conversion of the UV code (Kees Cook)"

* 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/virt/xen: Use guest_late_init to detect Xen PVH guest
  x86/virt, x86/platform: Add ->guest_late_init() callback to hypervisor_x86 structure
  x86/virt, x86/acpi: Add test for ACPI_FADT_NO_VGA
  x86/virt: Add enum for hypervisors to replace x86_hyper
  x86/virt, x86/platform: Merge 'struct x86_hyper' into 'struct x86_platform' and 'struct x86_init'
  x86/platform/UV: Convert timers to use timer_setup()
parents 13e57da4 418492ba
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ void hyperv_init(void)
	u64 guest_id;
	union hv_x64_msr_hypercall_contents hypercall_msr;

	if (x86_hyper != &x86_hyper_ms_hyperv)
	if (x86_hyper_type != X86_HYPER_MS_HYPERV)
		return;

	/* Allocate percpu VP index */
+18 −28
Original line number Diff line number Diff line
@@ -23,11 +23,22 @@
#ifdef CONFIG_HYPERVISOR_GUEST

#include <asm/kvm_para.h>
#include <asm/x86_init.h>
#include <asm/xen/hypervisor.h>

/*
 * x86 hypervisor information
 */

enum x86_hypervisor_type {
	X86_HYPER_NATIVE = 0,
	X86_HYPER_VMWARE,
	X86_HYPER_MS_HYPERV,
	X86_HYPER_XEN_PV,
	X86_HYPER_XEN_HVM,
	X86_HYPER_KVM,
};

struct hypervisor_x86 {
	/* Hypervisor name */
	const char	*name;
@@ -35,40 +46,19 @@ struct hypervisor_x86 {
	/* Detection routine */
	uint32_t	(*detect)(void);

	/* Platform setup (run once per boot) */
	void		(*init_platform)(void);

	/* X2APIC detection (run once per boot) */
	bool		(*x2apic_available)(void);
	/* Hypervisor type */
	enum x86_hypervisor_type type;

	/* pin current vcpu to specified physical cpu (run rarely) */
	void		(*pin_vcpu)(int);
	/* init time callbacks */
	struct x86_hyper_init init;

	/* called during init_mem_mapping() to setup early mappings. */
	void		(*init_mem_mapping)(void);
	/* runtime callbacks */
	struct x86_hyper_runtime runtime;
};

extern const struct hypervisor_x86 *x86_hyper;

/* Recognized hypervisors */
extern const struct hypervisor_x86 x86_hyper_vmware;
extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
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 enum x86_hypervisor_type x86_hyper_type;
extern void init_hypervisor_platform(void);
extern bool hypervisor_x2apic_available(void);
extern void hypervisor_pin_vcpu(int cpu);

static inline void hypervisor_init_mem_mapping(void)
{
	if (x86_hyper && x86_hyper->init_mem_mapping)
		x86_hyper->init_mem_mapping();
}
#else
static inline void init_hypervisor_platform(void) { }
static inline bool hypervisor_x2apic_available(void) { return false; }
static inline void hypervisor_init_mem_mapping(void) { }
#endif /* CONFIG_HYPERVISOR_GUEST */
#endif /* _ASM_X86_HYPERVISOR_H */
+0 −2
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
#ifdef CONFIG_KVM_GUEST
bool kvm_para_available(void);
unsigned int kvm_arch_para_features(void);
void __init kvm_guest_init(void);
void kvm_async_pf_task_wait(u32 token, int interrupt_kernel);
void kvm_async_pf_task_wake(u32 token);
u32 kvm_read_and_reset_pf_reason(void);
@@ -103,7 +102,6 @@ static inline void kvm_spinlock_init(void)
#endif /* CONFIG_PARAVIRT_SPINLOCKS */

#else /* CONFIG_KVM_GUEST */
#define kvm_guest_init() do {} while (0)
#define kvm_async_pf_task_wait(T, I) do {} while(0)
#define kvm_async_pf_task_wake(T) do {} while(0)

+27 −0
Original line number Diff line number Diff line
@@ -114,6 +114,20 @@ struct x86_init_pci {
	void (*fixup_irqs)(void);
};

/**
 * struct x86_hyper_init - x86 hypervisor init functions
 * @init_platform:		platform setup
 * @guest_late_init:		guest late init
 * @x2apic_available:		X2APIC detection
 * @init_mem_mapping:		setup early mappings during init_mem_mapping()
 */
struct x86_hyper_init {
	void (*init_platform)(void);
	void (*guest_late_init)(void);
	bool (*x2apic_available)(void);
	void (*init_mem_mapping)(void);
};

/**
 * struct x86_init_ops - functions for platform specific setup
 *
@@ -127,6 +141,7 @@ struct x86_init_ops {
	struct x86_init_timers		timers;
	struct x86_init_iommu		iommu;
	struct x86_init_pci		pci;
	struct x86_hyper_init		hyper;
};

/**
@@ -195,10 +210,20 @@ enum x86_legacy_i8042_state {
struct x86_legacy_features {
	enum x86_legacy_i8042_state i8042;
	int rtc;
	int no_vga;
	int reserve_bios_regions;
	struct x86_legacy_devices devices;
};

/**
 * struct x86_hyper_runtime - x86 hypervisor specific runtime callbacks
 *
 * @pin_vcpu:		pin current vcpu to specified physical cpu (run rarely)
 */
struct x86_hyper_runtime {
	void (*pin_vcpu)(int cpu);
};

/**
 * struct x86_platform_ops - platform specific runtime functions
 * @calibrate_cpu:		calibrate CPU
@@ -218,6 +243,7 @@ struct x86_legacy_features {
 * 				possible in x86_early_init_platform_quirks() by
 * 				only using the current x86_hardware_subarch
 * 				semantics.
 * @hyper:			x86 hypervisor specific runtime callbacks
 */
struct x86_platform_ops {
	unsigned long (*calibrate_cpu)(void);
@@ -233,6 +259,7 @@ struct x86_platform_ops {
	void (*apic_post_init)(void);
	struct x86_legacy_features legacy;
	void (*set_legacy_features)(void);
	struct x86_hyper_runtime hyper;
};

struct pci_dev;
+5 −0
Original line number Diff line number Diff line
@@ -961,6 +961,11 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
		x86_platform.legacy.rtc = 0;
	}

	if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_VGA) {
		pr_debug("ACPI: probing for VGA not safe\n");
		x86_platform.legacy.no_vga = 1;
	}

#ifdef CONFIG_X86_PM_TIMER
	/* detect the location of the ACPI PM Timer */
	if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) {
Loading