Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus

* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
lguest: fix irq vectors.
lguest: fix early_ioremap.
lguest: fix example launcher compile after moved asm-x86 dir.

+22 -14
+1 -1
Documentation/lguest/Makefile
··· 1 # This creates the demonstration utility "lguest" which runs a Linux guest. 2 - CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include 3 LDLIBS:=-lz 4 5 all: lguest
··· 1 # This creates the demonstration utility "lguest" which runs a Linux guest. 2 + CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include 3 LDLIBS:=-lz 4 5 all: lguest
+1 -1
Documentation/lguest/lguest.c
··· 44 #include "linux/virtio_console.h" 45 #include "linux/virtio_rng.h" 46 #include "linux/virtio_ring.h" 47 - #include "asm-x86/bootparam.h" 48 /*L:110 We can ignore the 39 include files we need for this program, but I do 49 * want to draw attention to the use of kernel-style types. 50 *
··· 44 #include "linux/virtio_console.h" 45 #include "linux/virtio_rng.h" 46 #include "linux/virtio_ring.h" 47 + #include "asm/bootparam.h" 48 /*L:110 We can ignore the 39 include files we need for this program, but I do 49 * want to draw attention to the use of kernel-style types. 50 *
+20 -12
arch/x86/lguest/boot.c
··· 367 * lazily after a task switch, and Linux uses that gratefully, but wouldn't a 368 * name like "FPUTRAP bit" be a little less cryptic? 369 * 370 - * We store cr0 (and cr3) locally, because the Host never changes it. The 371 - * Guest sometimes wants to read it and we'd prefer not to bother the Host 372 - * unnecessarily. */ 373 - static unsigned long current_cr0, current_cr3; 374 static void lguest_write_cr0(unsigned long val) 375 { 376 lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0); ··· 398 return lguest_data.cr2; 399 } 400 401 /* cr3 is the current toplevel pagetable page: the principle is the same as 402 - * cr0. Keep a local copy, and tell the Host when it changes. */ 403 static void lguest_write_cr3(unsigned long cr3) 404 { 405 lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0); 406 - current_cr3 = cr3; 407 } 408 409 static unsigned long lguest_read_cr3(void) 410 { 411 - return current_cr3; 412 } 413 414 /* cr4 is used to enable and disable PGE, but we don't care. */ ··· 503 * to forget all of them. Fortunately, this is very rare. 504 * 505 * ... except in early boot when the kernel sets up the initial pagetables, 506 - * which makes booting astonishingly slow. So we don't even tell the Host 507 - * anything changed until we've done the first page table switch. */ 508 static void lguest_set_pte(pte_t *ptep, pte_t pteval) 509 { 510 *ptep = pteval; 511 - /* Don't bother with hypercall before initial setup. */ 512 - if (current_cr3) 513 lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0); 514 } 515 ··· 526 static void lguest_flush_tlb_single(unsigned long addr) 527 { 528 /* Simply set it to zero: if it was not, it will fault back in. */ 529 - lazy_hcall(LHCALL_SET_PTE, current_cr3, addr, 0); 530 } 531 532 /* This is what happens after the Guest has removed a large number of entries. ··· 586 587 for (i = 0; i < LGUEST_IRQS; i++) { 588 int vector = FIRST_EXTERNAL_VECTOR + i; 589 if (vector != SYSCALL_VECTOR) { 590 set_intr_gate(vector, interrupt[vector]); 591 set_irq_chip_and_handler_name(i, &lguest_irq_controller,
··· 367 * lazily after a task switch, and Linux uses that gratefully, but wouldn't a 368 * name like "FPUTRAP bit" be a little less cryptic? 369 * 370 + * We store cr0 locally because the Host never changes it. The Guest sometimes 371 + * wants to read it and we'd prefer not to bother the Host unnecessarily. */ 372 + static unsigned long current_cr0; 373 static void lguest_write_cr0(unsigned long val) 374 { 375 lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0); ··· 399 return lguest_data.cr2; 400 } 401 402 + /* See lguest_set_pte() below. */ 403 + static bool cr3_changed = false; 404 + 405 /* cr3 is the current toplevel pagetable page: the principle is the same as 406 + * cr0. Keep a local copy, and tell the Host when it changes. The only 407 + * difference is that our local copy is in lguest_data because the Host needs 408 + * to set it upon our initial hypercall. */ 409 static void lguest_write_cr3(unsigned long cr3) 410 { 411 + lguest_data.pgdir = cr3; 412 lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0); 413 + cr3_changed = true; 414 } 415 416 static unsigned long lguest_read_cr3(void) 417 { 418 + return lguest_data.pgdir; 419 } 420 421 /* cr4 is used to enable and disable PGE, but we don't care. */ ··· 498 * to forget all of them. Fortunately, this is very rare. 499 * 500 * ... except in early boot when the kernel sets up the initial pagetables, 501 + * which makes booting astonishingly slow: 1.83 seconds! So we don't even tell 502 + * the Host anything changed until we've done the first page table switch, 503 + * which brings boot back to 0.25 seconds. */ 504 static void lguest_set_pte(pte_t *ptep, pte_t pteval) 505 { 506 *ptep = pteval; 507 + if (cr3_changed) 508 lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0); 509 } 510 ··· 521 static void lguest_flush_tlb_single(unsigned long addr) 522 { 523 /* Simply set it to zero: if it was not, it will fault back in. */ 524 + lazy_hcall(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0); 525 } 526 527 /* This is what happens after the Guest has removed a large number of entries. ··· 581 582 for (i = 0; i < LGUEST_IRQS; i++) { 583 int vector = FIRST_EXTERNAL_VECTOR + i; 584 + /* Some systems map "vectors" to interrupts weirdly. Lguest has 585 + * a straightforward 1 to 1 mapping, so force that here. */ 586 + __get_cpu_var(vector_irq)[vector] = i; 587 if (vector != SYSCALL_VECTOR) { 588 set_intr_gate(vector, interrupt[vector]); 589 set_irq_chip_and_handler_name(i, &lguest_irq_controller,