diff options
Diffstat (limited to 'arch/x86/kernel/paravirt.c')
-rw-r--r-- | arch/x86/kernel/paravirt.c | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index e4c8fb608873..cea11c8e3049 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -44,6 +44,17 @@ void _paravirt_nop(void) | |||
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | /* identity function, which can be inlined */ | ||
48 | u32 _paravirt_ident_32(u32 x) | ||
49 | { | ||
50 | return x; | ||
51 | } | ||
52 | |||
53 | u64 _paravirt_ident_64(u64 x) | ||
54 | { | ||
55 | return x; | ||
56 | } | ||
57 | |||
47 | static void __init default_banner(void) | 58 | static void __init default_banner(void) |
48 | { | 59 | { |
49 | printk(KERN_INFO "Booting paravirtualized kernel on %s\n", | 60 | printk(KERN_INFO "Booting paravirtualized kernel on %s\n", |
@@ -138,9 +149,16 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf, | |||
138 | if (opfunc == NULL) | 149 | if (opfunc == NULL) |
139 | /* If there's no function, patch it with a ud2a (BUG) */ | 150 | /* If there's no function, patch it with a ud2a (BUG) */ |
140 | ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a)); | 151 | ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a)); |
141 | else if (opfunc == paravirt_nop) | 152 | else if (opfunc == _paravirt_nop) |
142 | /* If the operation is a nop, then nop the callsite */ | 153 | /* If the operation is a nop, then nop the callsite */ |
143 | ret = paravirt_patch_nop(); | 154 | ret = paravirt_patch_nop(); |
155 | |||
156 | /* identity functions just return their single argument */ | ||
157 | else if (opfunc == _paravirt_ident_32) | ||
158 | ret = paravirt_patch_ident_32(insnbuf, len); | ||
159 | else if (opfunc == _paravirt_ident_64) | ||
160 | ret = paravirt_patch_ident_64(insnbuf, len); | ||
161 | |||
144 | else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) || | 162 | else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) || |
145 | type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit) || | 163 | type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit) || |
146 | type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret32) || | 164 | type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret32) || |
@@ -292,10 +310,10 @@ struct pv_time_ops pv_time_ops = { | |||
292 | 310 | ||
293 | struct pv_irq_ops pv_irq_ops = { | 311 | struct pv_irq_ops pv_irq_ops = { |
294 | .init_IRQ = native_init_IRQ, | 312 | .init_IRQ = native_init_IRQ, |
295 | .save_fl = native_save_fl, | 313 | .save_fl = __PV_IS_CALLEE_SAVE(native_save_fl), |
296 | .restore_fl = native_restore_fl, | 314 | .restore_fl = __PV_IS_CALLEE_SAVE(native_restore_fl), |
297 | .irq_disable = native_irq_disable, | 315 | .irq_disable = __PV_IS_CALLEE_SAVE(native_irq_disable), |
298 | .irq_enable = native_irq_enable, | 316 | .irq_enable = __PV_IS_CALLEE_SAVE(native_irq_enable), |
299 | .safe_halt = native_safe_halt, | 317 | .safe_halt = native_safe_halt, |
300 | .halt = native_halt, | 318 | .halt = native_halt, |
301 | #ifdef CONFIG_X86_64 | 319 | #ifdef CONFIG_X86_64 |
@@ -373,6 +391,14 @@ struct pv_apic_ops pv_apic_ops = { | |||
373 | #endif | 391 | #endif |
374 | }; | 392 | }; |
375 | 393 | ||
394 | #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE) | ||
395 | /* 32-bit pagetable entries */ | ||
396 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_32) | ||
397 | #else | ||
398 | /* 64-bit pagetable entries */ | ||
399 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_64) | ||
400 | #endif | ||
401 | |||
376 | struct pv_mmu_ops pv_mmu_ops = { | 402 | struct pv_mmu_ops pv_mmu_ops = { |
377 | #ifndef CONFIG_X86_64 | 403 | #ifndef CONFIG_X86_64 |
378 | .pagetable_setup_start = native_pagetable_setup_start, | 404 | .pagetable_setup_start = native_pagetable_setup_start, |
@@ -424,22 +450,23 @@ struct pv_mmu_ops pv_mmu_ops = { | |||
424 | .pmd_clear = native_pmd_clear, | 450 | .pmd_clear = native_pmd_clear, |
425 | #endif | 451 | #endif |
426 | .set_pud = native_set_pud, | 452 | .set_pud = native_set_pud, |
427 | .pmd_val = native_pmd_val, | 453 | |
428 | .make_pmd = native_make_pmd, | 454 | .pmd_val = PTE_IDENT, |
455 | .make_pmd = PTE_IDENT, | ||
429 | 456 | ||
430 | #if PAGETABLE_LEVELS == 4 | 457 | #if PAGETABLE_LEVELS == 4 |
431 | .pud_val = native_pud_val, | 458 | .pud_val = PTE_IDENT, |
432 | .make_pud = native_make_pud, | 459 | .make_pud = PTE_IDENT, |
460 | |||
433 | .set_pgd = native_set_pgd, | 461 | .set_pgd = native_set_pgd, |
434 | #endif | 462 | #endif |
435 | #endif /* PAGETABLE_LEVELS >= 3 */ | 463 | #endif /* PAGETABLE_LEVELS >= 3 */ |
436 | 464 | ||
437 | .pte_val = native_pte_val, | 465 | .pte_val = PTE_IDENT, |
438 | .pte_flags = native_pte_flags, | 466 | .pgd_val = PTE_IDENT, |
439 | .pgd_val = native_pgd_val, | ||
440 | 467 | ||
441 | .make_pte = native_make_pte, | 468 | .make_pte = PTE_IDENT, |
442 | .make_pgd = native_make_pgd, | 469 | .make_pgd = PTE_IDENT, |
443 | 470 | ||
444 | .dup_mmap = paravirt_nop, | 471 | .dup_mmap = paravirt_nop, |
445 | .exit_mmap = paravirt_nop, | 472 | .exit_mmap = paravirt_nop, |