diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/x86/lguest/boot.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'arch/x86/lguest/boot.c')
-rw-r--r-- | arch/x86/lguest/boot.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 9d5f55848455..db832fd65ecb 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * kernel and insert a module (lg.ko) which allows us to run other Linux | 7 | * kernel and insert a module (lg.ko) which allows us to run other Linux |
8 | * kernels the same way we'd run processes. We call the first kernel the Host, | 8 | * kernels the same way we'd run processes. We call the first kernel the Host, |
9 | * and the others the Guests. The program which sets up and configures Guests | 9 | * and the others the Guests. The program which sets up and configures Guests |
10 | * (such as the example in Documentation/lguest/lguest.c) is called the | 10 | * (such as the example in Documentation/virtual/lguest/lguest.c) is called the |
11 | * Launcher. | 11 | * Launcher. |
12 | * | 12 | * |
13 | * Secondly, we only run specially modified Guests, not normal kernels: setting | 13 | * Secondly, we only run specially modified Guests, not normal kernels: setting |
@@ -397,7 +397,7 @@ static void lguest_load_tr_desc(void) | |||
397 | * instead we just use the real "cpuid" instruction. Then I pretty much turned | 397 | * instead we just use the real "cpuid" instruction. Then I pretty much turned |
398 | * off feature bits until the Guest booted. (Don't say that: you'll damage | 398 | * off feature bits until the Guest booted. (Don't say that: you'll damage |
399 | * lguest sales!) Shut up, inner voice! (Hey, just pointing out that this is | 399 | * lguest sales!) Shut up, inner voice! (Hey, just pointing out that this is |
400 | * hardly future proof.) Noone's listening! They don't like you anyway, | 400 | * hardly future proof.) No one's listening! They don't like you anyway, |
401 | * parenthetic weirdo! | 401 | * parenthetic weirdo! |
402 | * | 402 | * |
403 | * Replacing the cpuid so we can turn features off is great for the kernel, but | 403 | * Replacing the cpuid so we can turn features off is great for the kernel, but |
@@ -531,7 +531,10 @@ static void lguest_write_cr3(unsigned long cr3) | |||
531 | { | 531 | { |
532 | lguest_data.pgdir = cr3; | 532 | lguest_data.pgdir = cr3; |
533 | lazy_hcall1(LHCALL_NEW_PGTABLE, cr3); | 533 | lazy_hcall1(LHCALL_NEW_PGTABLE, cr3); |
534 | cr3_changed = true; | 534 | |
535 | /* These two page tables are simple, linear, and used during boot */ | ||
536 | if (cr3 != __pa(swapper_pg_dir) && cr3 != __pa(initial_page_table)) | ||
537 | cr3_changed = true; | ||
535 | } | 538 | } |
536 | 539 | ||
537 | static unsigned long lguest_read_cr3(void) | 540 | static unsigned long lguest_read_cr3(void) |
@@ -703,9 +706,9 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval) | |||
703 | * to forget all of them. Fortunately, this is very rare. | 706 | * to forget all of them. Fortunately, this is very rare. |
704 | * | 707 | * |
705 | * ... except in early boot when the kernel sets up the initial pagetables, | 708 | * ... except in early boot when the kernel sets up the initial pagetables, |
706 | * which makes booting astonishingly slow: 1.83 seconds! So we don't even tell | 709 | * which makes booting astonishingly slow: 48 seconds! So we don't even tell |
707 | * the Host anything changed until we've done the first page table switch, | 710 | * the Host anything changed until we've done the first real page table switch, |
708 | * which brings boot back to 0.25 seconds. | 711 | * which brings boot back to 4.3 seconds. |
709 | */ | 712 | */ |
710 | static void lguest_set_pte(pte_t *ptep, pte_t pteval) | 713 | static void lguest_set_pte(pte_t *ptep, pte_t pteval) |
711 | { | 714 | { |
@@ -791,22 +794,22 @@ static void lguest_flush_tlb_kernel(void) | |||
791 | * simple as setting a bit. We don't actually "ack" interrupts as such, we | 794 | * simple as setting a bit. We don't actually "ack" interrupts as such, we |
792 | * just mask and unmask them. I wonder if we should be cleverer? | 795 | * just mask and unmask them. I wonder if we should be cleverer? |
793 | */ | 796 | */ |
794 | static void disable_lguest_irq(unsigned int irq) | 797 | static void disable_lguest_irq(struct irq_data *data) |
795 | { | 798 | { |
796 | set_bit(irq, lguest_data.blocked_interrupts); | 799 | set_bit(data->irq, lguest_data.blocked_interrupts); |
797 | } | 800 | } |
798 | 801 | ||
799 | static void enable_lguest_irq(unsigned int irq) | 802 | static void enable_lguest_irq(struct irq_data *data) |
800 | { | 803 | { |
801 | clear_bit(irq, lguest_data.blocked_interrupts); | 804 | clear_bit(data->irq, lguest_data.blocked_interrupts); |
802 | } | 805 | } |
803 | 806 | ||
804 | /* This structure describes the lguest IRQ controller. */ | 807 | /* This structure describes the lguest IRQ controller. */ |
805 | static struct irq_chip lguest_irq_controller = { | 808 | static struct irq_chip lguest_irq_controller = { |
806 | .name = "lguest", | 809 | .name = "lguest", |
807 | .mask = disable_lguest_irq, | 810 | .irq_mask = disable_lguest_irq, |
808 | .mask_ack = disable_lguest_irq, | 811 | .irq_mask_ack = disable_lguest_irq, |
809 | .unmask = enable_lguest_irq, | 812 | .irq_unmask = enable_lguest_irq, |
810 | }; | 813 | }; |
811 | 814 | ||
812 | /* | 815 | /* |
@@ -821,7 +824,7 @@ static void __init lguest_init_IRQ(void) | |||
821 | 824 | ||
822 | for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { | 825 | for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { |
823 | /* Some systems map "vectors" to interrupts weirdly. Not us! */ | 826 | /* Some systems map "vectors" to interrupts weirdly. Not us! */ |
824 | __get_cpu_var(vector_irq)[i] = i - FIRST_EXTERNAL_VECTOR; | 827 | __this_cpu_write(vector_irq[i], i - FIRST_EXTERNAL_VECTOR); |
825 | if (i != SYSCALL_VECTOR) | 828 | if (i != SYSCALL_VECTOR) |
826 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); | 829 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); |
827 | } | 830 | } |
@@ -838,13 +841,13 @@ static void __init lguest_init_IRQ(void) | |||
838 | * rather than set them in lguest_init_IRQ we are called here every time an | 841 | * rather than set them in lguest_init_IRQ we are called here every time an |
839 | * lguest device needs an interrupt. | 842 | * lguest device needs an interrupt. |
840 | * | 843 | * |
841 | * FIXME: irq_to_desc_alloc_node() can fail due to lack of memory, we should | 844 | * FIXME: irq_alloc_desc_at() can fail due to lack of memory, we should |
842 | * pass that up! | 845 | * pass that up! |
843 | */ | 846 | */ |
844 | void lguest_setup_irq(unsigned int irq) | 847 | void lguest_setup_irq(unsigned int irq) |
845 | { | 848 | { |
846 | irq_to_desc_alloc_node(irq, 0); | 849 | irq_alloc_desc_at(irq, 0); |
847 | set_irq_chip_and_handler_name(irq, &lguest_irq_controller, | 850 | irq_set_chip_and_handler_name(irq, &lguest_irq_controller, |
848 | handle_level_irq, "level"); | 851 | handle_level_irq, "level"); |
849 | } | 852 | } |
850 | 853 | ||
@@ -910,8 +913,6 @@ static struct clocksource lguest_clock = { | |||
910 | .rating = 200, | 913 | .rating = 200, |
911 | .read = lguest_clock_read, | 914 | .read = lguest_clock_read, |
912 | .mask = CLOCKSOURCE_MASK(64), | 915 | .mask = CLOCKSOURCE_MASK(64), |
913 | .mult = 1 << 22, | ||
914 | .shift = 22, | ||
915 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 916 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
916 | }; | 917 | }; |
917 | 918 | ||
@@ -992,9 +993,10 @@ static void lguest_time_irq(unsigned int irq, struct irq_desc *desc) | |||
992 | static void lguest_time_init(void) | 993 | static void lguest_time_init(void) |
993 | { | 994 | { |
994 | /* Set up the timer interrupt (0) to go to our simple timer routine */ | 995 | /* Set up the timer interrupt (0) to go to our simple timer routine */ |
995 | set_irq_handler(0, lguest_time_irq); | 996 | lguest_setup_irq(0); |
997 | irq_set_handler(0, lguest_time_irq); | ||
996 | 998 | ||
997 | clocksource_register(&lguest_clock); | 999 | clocksource_register_hz(&lguest_clock, NSEC_PER_SEC); |
998 | 1000 | ||
999 | /* We can't set cpumask in the initializer: damn C limitations! Set it | 1001 | /* We can't set cpumask in the initializer: damn C limitations! Set it |
1000 | * here and register our timer device. */ | 1002 | * here and register our timer device. */ |
@@ -1002,7 +1004,7 @@ static void lguest_time_init(void) | |||
1002 | clockevents_register_device(&lguest_clockevent); | 1004 | clockevents_register_device(&lguest_clockevent); |
1003 | 1005 | ||
1004 | /* Finally, we unblock the timer interrupt. */ | 1006 | /* Finally, we unblock the timer interrupt. */ |
1005 | enable_lguest_irq(0); | 1007 | clear_bit(0, lguest_data.blocked_interrupts); |
1006 | } | 1008 | } |
1007 | 1009 | ||
1008 | /* | 1010 | /* |
@@ -1349,9 +1351,6 @@ __init void lguest_init(void) | |||
1349 | */ | 1351 | */ |
1350 | switch_to_new_gdt(0); | 1352 | switch_to_new_gdt(0); |
1351 | 1353 | ||
1352 | /* We actually boot with all memory mapped, but let's say 128MB. */ | ||
1353 | max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT; | ||
1354 | |||
1355 | /* | 1354 | /* |
1356 | * The Host<->Guest Switcher lives at the top of our address space, and | 1355 | * The Host<->Guest Switcher lives at the top of our address space, and |
1357 | * the Host told us how big it is when we made LGUEST_INIT hypercall: | 1356 | * the Host told us how big it is when we made LGUEST_INIT hypercall: |