diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2006-12-06 20:14:08 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:08 -0500 |
commit | da181a8b3916aa7f2e3c5775d2bd2fe3454cf82d (patch) | |
tree | c5be6c957d57563b9854732df1210aad97027b03 /arch | |
parent | 13623d79309dd82e1964458fa017979d16f33fa8 (diff) |
[PATCH] paravirt: Add MMU virtualization to paravirt_ops
Add the three bare TLB accessor functions to paravirt-ops. Most amusingly,
flush_tlb is redefined on SMP, so I can't call the paravirt op flush_tlb.
Instead, I chose to indicate the actual flush type, kernel (global) vs. user
(non-global). Global in this sense means using the global bit in the page
table entry, which makes TLB entries persistent across CR3 reloads, not
global as in the SMP sense of invoking remote shootdowns, so the term is
confusingly overloaded.
AK: folded in fix from Zach for PAE compilation
Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/paravirt.c | 109 | ||||
-rw-r--r-- | arch/i386/mm/boot_ioremap.c | 1 |
2 files changed, 110 insertions, 0 deletions
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c index fe82eb3adf42..3dceab5828f1 100644 --- a/arch/i386/kernel/paravirt.c +++ b/arch/i386/kernel/paravirt.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/delay.h> | 31 | #include <asm/delay.h> |
32 | #include <asm/fixmap.h> | 32 | #include <asm/fixmap.h> |
33 | #include <asm/apic.h> | 33 | #include <asm/apic.h> |
34 | #include <asm/tlbflush.h> | ||
34 | 35 | ||
35 | /* nop stub */ | 36 | /* nop stub */ |
36 | static void native_nop(void) | 37 | static void native_nop(void) |
@@ -379,6 +380,97 @@ static fastcall void native_io_delay(void) | |||
379 | asm volatile("outb %al,$0x80"); | 380 | asm volatile("outb %al,$0x80"); |
380 | } | 381 | } |
381 | 382 | ||
383 | static fastcall void native_flush_tlb(void) | ||
384 | { | ||
385 | __native_flush_tlb(); | ||
386 | } | ||
387 | |||
388 | /* | ||
389 | * Global pages have to be flushed a bit differently. Not a real | ||
390 | * performance problem because this does not happen often. | ||
391 | */ | ||
392 | static fastcall void native_flush_tlb_global(void) | ||
393 | { | ||
394 | __native_flush_tlb_global(); | ||
395 | } | ||
396 | |||
397 | static fastcall void native_flush_tlb_single(u32 addr) | ||
398 | { | ||
399 | __native_flush_tlb_single(addr); | ||
400 | } | ||
401 | |||
402 | #ifndef CONFIG_X86_PAE | ||
403 | static fastcall void native_set_pte(pte_t *ptep, pte_t pteval) | ||
404 | { | ||
405 | *ptep = pteval; | ||
406 | } | ||
407 | |||
408 | static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) | ||
409 | { | ||
410 | *ptep = pteval; | ||
411 | } | ||
412 | |||
413 | static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) | ||
414 | { | ||
415 | *pmdp = pmdval; | ||
416 | } | ||
417 | |||
418 | #else /* CONFIG_X86_PAE */ | ||
419 | |||
420 | static fastcall void native_set_pte(pte_t *ptep, pte_t pte) | ||
421 | { | ||
422 | ptep->pte_high = pte.pte_high; | ||
423 | smp_wmb(); | ||
424 | ptep->pte_low = pte.pte_low; | ||
425 | } | ||
426 | |||
427 | static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte) | ||
428 | { | ||
429 | ptep->pte_high = pte.pte_high; | ||
430 | smp_wmb(); | ||
431 | ptep->pte_low = pte.pte_low; | ||
432 | } | ||
433 | |||
434 | static fastcall void native_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) | ||
435 | { | ||
436 | ptep->pte_low = 0; | ||
437 | smp_wmb(); | ||
438 | ptep->pte_high = pte.pte_high; | ||
439 | smp_wmb(); | ||
440 | ptep->pte_low = pte.pte_low; | ||
441 | } | ||
442 | |||
443 | static fastcall void native_set_pte_atomic(pte_t *ptep, pte_t pteval) | ||
444 | { | ||
445 | set_64bit((unsigned long long *)ptep,pte_val(pteval)); | ||
446 | } | ||
447 | |||
448 | static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) | ||
449 | { | ||
450 | set_64bit((unsigned long long *)pmdp,pmd_val(pmdval)); | ||
451 | } | ||
452 | |||
453 | static fastcall void native_set_pud(pud_t *pudp, pud_t pudval) | ||
454 | { | ||
455 | *pudp = pudval; | ||
456 | } | ||
457 | |||
458 | static fastcall void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
459 | { | ||
460 | ptep->pte_low = 0; | ||
461 | smp_wmb(); | ||
462 | ptep->pte_high = 0; | ||
463 | } | ||
464 | |||
465 | static fastcall void native_pmd_clear(pmd_t *pmd) | ||
466 | { | ||
467 | u32 *tmp = (u32 *)pmd; | ||
468 | *tmp = 0; | ||
469 | smp_wmb(); | ||
470 | *(tmp + 1) = 0; | ||
471 | } | ||
472 | #endif /* CONFIG_X86_PAE */ | ||
473 | |||
382 | /* These are in entry.S */ | 474 | /* These are in entry.S */ |
383 | extern fastcall void native_iret(void); | 475 | extern fastcall void native_iret(void); |
384 | extern fastcall void native_irq_enable_sysexit(void); | 476 | extern fastcall void native_irq_enable_sysexit(void); |
@@ -454,6 +546,23 @@ struct paravirt_ops paravirt_ops = { | |||
454 | .apic_read = native_apic_read, | 546 | .apic_read = native_apic_read, |
455 | #endif | 547 | #endif |
456 | 548 | ||
549 | .flush_tlb_user = native_flush_tlb, | ||
550 | .flush_tlb_kernel = native_flush_tlb_global, | ||
551 | .flush_tlb_single = native_flush_tlb_single, | ||
552 | |||
553 | .set_pte = native_set_pte, | ||
554 | .set_pte_at = native_set_pte_at, | ||
555 | .set_pmd = native_set_pmd, | ||
556 | .pte_update = (void *)native_nop, | ||
557 | .pte_update_defer = (void *)native_nop, | ||
558 | #ifdef CONFIG_X86_PAE | ||
559 | .set_pte_atomic = native_set_pte_atomic, | ||
560 | .set_pte_present = native_set_pte_present, | ||
561 | .set_pud = native_set_pud, | ||
562 | .pte_clear = native_pte_clear, | ||
563 | .pmd_clear = native_pmd_clear, | ||
564 | #endif | ||
565 | |||
457 | .irq_enable_sysexit = native_irq_enable_sysexit, | 566 | .irq_enable_sysexit = native_irq_enable_sysexit, |
458 | .iret = native_iret, | 567 | .iret = native_iret, |
459 | }; | 568 | }; |
diff --git a/arch/i386/mm/boot_ioremap.c b/arch/i386/mm/boot_ioremap.c index 4de11f508c3a..4de95a17a7d4 100644 --- a/arch/i386/mm/boot_ioremap.c +++ b/arch/i386/mm/boot_ioremap.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #undef CONFIG_X86_PAE | 18 | #undef CONFIG_X86_PAE |
19 | #undef CONFIG_PARAVIRT | ||
19 | #include <asm/page.h> | 20 | #include <asm/page.h> |
20 | #include <asm/pgtable.h> | 21 | #include <asm/pgtable.h> |
21 | #include <asm/tlbflush.h> | 22 | #include <asm/tlbflush.h> |