diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-04 11:05:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-04 11:05:13 -0700 |
commit | 05eebfb26bac9215410b70e0f043861aecff896c (patch) | |
tree | 3a6f63bad6d7dbc75d66bbb3f8deb4d5e40ef60c /arch/x86/include/asm/processor.h | |
parent | cb3e4330e697dffaf3d9cefebc9c7e7d39c89f2e (diff) | |
parent | 9df56f19a500bea90d160be1bf77e4fbcd204d3f (diff) | |
download | op-kernel-dev-05eebfb26bac9215410b70e0f043861aecff896c.zip op-kernel-dev-05eebfb26bac9215410b70e0f043861aecff896c.tar.gz |
Merge branch 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 paravirt changes from Ingo Molnar:
"Hypervisor signature detection cleanup and fixes - the goal is to make
KVM guests run better on MS/Hyperv and to generalize and factor out
the code a bit"
* 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: Correctly detect hypervisor
x86, kvm: Switch to use hypervisor_cpuid_base()
xen: Switch to use hypervisor_cpuid_base()
x86: Introduce hypervisor_cpuid_base()
Diffstat (limited to 'arch/x86/include/asm/processor.h')
-rw-r--r-- | arch/x86/include/asm/processor.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 4c2d31d..987c75e 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -942,6 +942,21 @@ extern int set_tsc_mode(unsigned int val); extern u16 amd_get_nb_id(int cpu); +static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves) +{ + uint32_t base, eax, signature[3]; + + for (base = 0x40000000; base < 0x40010000; base += 0x100) { + cpuid(base, &eax, &signature[0], &signature[1], &signature[2]); + + if (!memcmp(sig, signature, 12) && + (leaves == 0 || ((eax - base) >= leaves))) + return base; + } + + return 0; +} + extern unsigned long arch_align_stack(unsigned long sp); extern void free_init_pages(char *what, unsigned long begin, unsigned long end); |