The patch titled paravirt: i386: More generic paravirtualization has been added to the -mm tree. Its filename is paravirt-i386-more-generic-paravirtualization.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: paravirt: i386: More generic paravirtualization From: Rusty Russell <rusty@xxxxxxxxxxxxxxx> 1) Each hypervisor writes a probe function to detect whether we are running under that hypervisor. paravirt_probe() registers this function. 2) If vmlinux is booted with ring != 0, we call all the probe functions (with registers except %esp intact) in link order: the winner will not return. Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx> Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx> Signed-off-by: Andi Kleen <ak@xxxxxxx> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx> Cc: Zachary Amsden <zach@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/Makefile | 2 + arch/i386/kernel/head.S | 33 +++++++++++++++++++++++++++++++ arch/i386/kernel/paravirt.c | 4 +++ arch/i386/kernel/vmlinux.lds.S | 6 +++++ include/asm-i386/paravirt.h | 5 ++++ 5 files changed, 50 insertions(+) diff -puN arch/i386/kernel/Makefile~paravirt-i386-more-generic-paravirtualization arch/i386/kernel/Makefile --- a/arch/i386/kernel/Makefile~paravirt-i386-more-generic-paravirtualization +++ a/arch/i386/kernel/Makefile @@ -39,6 +39,8 @@ obj-$(CONFIG_VM86) += vm86.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_HPET_TIMER) += hpet.o obj-$(CONFIG_K8_NB) += k8.o + +# Make sure this is linked after any other paravirt_ops structs: see head.S obj-$(CONFIG_PARAVIRT) += paravirt.o EXTRA_AFLAGS := -traditional diff -puN arch/i386/kernel/head.S~paravirt-i386-more-generic-paravirtualization arch/i386/kernel/head.S --- a/arch/i386/kernel/head.S~paravirt-i386-more-generic-paravirtualization +++ a/arch/i386/kernel/head.S @@ -55,6 +55,12 @@ */ ENTRY(startup_32) +#ifdef CONFIG_PARAVIRT + movl %cs, %eax + testl $0x3, %eax + jnz startup_paravirt +#endif + /* * Set segments to known values. */ @@ -486,6 +492,33 @@ ignore_int: #endif iret +#ifdef CONFIG_PARAVIRT +startup_paravirt: + cld + movl $(init_thread_union+THREAD_SIZE),%esp + + /* We take pains to preserve all the regs. */ + pushl %edx + pushl %ecx + pushl %eax + + /* paravirt.o is last in link, and that probe fn never returns */ + pushl $__start_paravirtprobe +1: + movl 0(%esp), %eax + pushl (%eax) + movl 8(%esp), %eax + call *(%esp) + popl %eax + + movl 4(%esp), %eax + movl 8(%esp), %ecx + movl 12(%esp), %edx + + addl $4, (%esp) + jmp 1b +#endif + /* * Real beginning of normal "text" segment */ diff -puN arch/i386/kernel/paravirt.c~paravirt-i386-more-generic-paravirtualization arch/i386/kernel/paravirt.c --- a/arch/i386/kernel/paravirt.c~paravirt-i386-more-generic-paravirtualization +++ a/arch/i386/kernel/paravirt.c @@ -19,6 +19,7 @@ #include <linux/module.h> #include <linux/efi.h> #include <linux/bcd.h> +#include <linux/start_kernel.h> #include <asm/bug.h> #include <asm/paravirt.h> @@ -382,6 +383,9 @@ static int __init print_banner(void) } core_initcall(print_banner); +/* We simply declare start_kernel to be the paravirt probe of last resort. */ +paravirt_probe(start_kernel); + struct paravirt_ops paravirt_ops = { .name = "bare hardware", .paravirt_enabled = 0, diff -puN arch/i386/kernel/vmlinux.lds.S~paravirt-i386-more-generic-paravirtualization arch/i386/kernel/vmlinux.lds.S --- a/arch/i386/kernel/vmlinux.lds.S~paravirt-i386-more-generic-paravirtualization +++ a/arch/i386/kernel/vmlinux.lds.S @@ -61,6 +61,12 @@ SECTIONS CONSTRUCTORS } :data + __start_paravirtprobe = .; + .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) { + *(.paravirtprobe) + } + __stop_paravirtprobe = .; + . = ALIGN(4096); .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { __nosave_begin = .; diff -puN include/asm-i386/paravirt.h~paravirt-i386-more-generic-paravirtualization include/asm-i386/paravirt.h --- a/include/asm-i386/paravirt.h~paravirt-i386-more-generic-paravirtualization +++ a/include/asm-i386/paravirt.h @@ -120,6 +120,11 @@ struct paravirt_ops void (fastcall *iret)(void); }; +/* Mark a paravirt probe function. */ +#define paravirt_probe(fn) \ + static void (*__paravirtprobe_##fn)(void) __attribute_used__ \ + __attribute__((__section__(".paravirtprobe"))) = fn + extern struct paravirt_ops paravirt_ops; #define paravirt_enabled() (paravirt_ops.paravirt_enabled) _ Patches currently in -mm which might be from rusty@xxxxxxxxxxxxxxx are paravirt-i386-header-and-stubs-for-paravirtualisation.patch paravirt-i386-patch-inline-replacements-for.patch paravirt-i386-more-generic-paravirtualization.patch paravirt-i386-allow-selected-bug-checks-to-be.patch paravirt-i386-allow-disabling-legacy-power.patch paravirt-i386-add-apic-accessors-to-paravirt-ops.patch paravirt-i386-add-mmu-virtualization-to.patch prep-for-paravirt-be-careful-about-touching-bios.patch paravirtualization-header-and-stubs-for-fix.patch paravirtualization-header-and-stubs-for-headers_check-fix.patch paravirtualization-patch-inline-replacements-for-fix-2.patch paravirtualization-patch-inline-replacements-for-fix-3.patch paravirtualization-more-generic-paravirtualization-warning-fix.patch fix-config_paravirt.patch fix-kunmap_atomics-use-of-kpte_clear_flush.patch generic-bug-implementation.patch generic-bug-for-i386.patch generic-bug-for-x86-64.patch bug-test-1.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html