diff options
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r-- | arch/x86/xen/enlighten.c | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 6f1bb71aa13a..6b3f7eef57e3 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -634,35 +634,27 @@ static void xen_flush_tlb_single(unsigned long addr) | |||
634 | preempt_enable(); | 634 | preempt_enable(); |
635 | } | 635 | } |
636 | 636 | ||
637 | static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm, | 637 | static void xen_flush_tlb_others(const struct cpumask *cpus, |
638 | unsigned long va) | 638 | struct mm_struct *mm, unsigned long va) |
639 | { | 639 | { |
640 | struct { | 640 | struct { |
641 | struct mmuext_op op; | 641 | struct mmuext_op op; |
642 | cpumask_t mask; | 642 | DECLARE_BITMAP(mask, NR_CPUS); |
643 | } *args; | 643 | } *args; |
644 | cpumask_t cpumask = *cpus; | ||
645 | struct multicall_space mcs; | 644 | struct multicall_space mcs; |
646 | 645 | ||
647 | /* | 646 | BUG_ON(cpumask_empty(cpus)); |
648 | * A couple of (to be removed) sanity checks: | ||
649 | * | ||
650 | * - current CPU must not be in mask | ||
651 | * - mask must exist :) | ||
652 | */ | ||
653 | BUG_ON(cpus_empty(cpumask)); | ||
654 | BUG_ON(cpu_isset(smp_processor_id(), cpumask)); | ||
655 | BUG_ON(!mm); | 647 | BUG_ON(!mm); |
656 | 648 | ||
657 | /* If a CPU which we ran on has gone down, OK. */ | ||
658 | cpus_and(cpumask, cpumask, cpu_online_map); | ||
659 | if (cpus_empty(cpumask)) | ||
660 | return; | ||
661 | |||
662 | mcs = xen_mc_entry(sizeof(*args)); | 649 | mcs = xen_mc_entry(sizeof(*args)); |
663 | args = mcs.args; | 650 | args = mcs.args; |
664 | args->mask = cpumask; | 651 | args->op.arg2.vcpumask = to_cpumask(args->mask); |
665 | args->op.arg2.vcpumask = &args->mask; | 652 | |
653 | /* Remove us, and any offline CPUS. */ | ||
654 | cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask); | ||
655 | cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask)); | ||
656 | if (unlikely(cpumask_empty(to_cpumask(args->mask)))) | ||
657 | goto issue; | ||
666 | 658 | ||
667 | if (va == TLB_FLUSH_ALL) { | 659 | if (va == TLB_FLUSH_ALL) { |
668 | args->op.cmd = MMUEXT_TLB_FLUSH_MULTI; | 660 | args->op.cmd = MMUEXT_TLB_FLUSH_MULTI; |
@@ -673,6 +665,7 @@ static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm, | |||
673 | 665 | ||
674 | MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF); | 666 | MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF); |
675 | 667 | ||
668 | issue: | ||
676 | xen_mc_issue(PARAVIRT_LAZY_MMU); | 669 | xen_mc_issue(PARAVIRT_LAZY_MMU); |
677 | } | 670 | } |
678 | 671 | ||
@@ -702,17 +695,17 @@ static void xen_write_cr0(unsigned long cr0) | |||
702 | 695 | ||
703 | static void xen_write_cr2(unsigned long cr2) | 696 | static void xen_write_cr2(unsigned long cr2) |
704 | { | 697 | { |
705 | x86_read_percpu(xen_vcpu)->arch.cr2 = cr2; | 698 | percpu_read(xen_vcpu)->arch.cr2 = cr2; |
706 | } | 699 | } |
707 | 700 | ||
708 | static unsigned long xen_read_cr2(void) | 701 | static unsigned long xen_read_cr2(void) |
709 | { | 702 | { |
710 | return x86_read_percpu(xen_vcpu)->arch.cr2; | 703 | return percpu_read(xen_vcpu)->arch.cr2; |
711 | } | 704 | } |
712 | 705 | ||
713 | static unsigned long xen_read_cr2_direct(void) | 706 | static unsigned long xen_read_cr2_direct(void) |
714 | { | 707 | { |
715 | return x86_read_percpu(xen_vcpu_info.arch.cr2); | 708 | return percpu_read(xen_vcpu_info.arch.cr2); |
716 | } | 709 | } |
717 | 710 | ||
718 | static void xen_write_cr4(unsigned long cr4) | 711 | static void xen_write_cr4(unsigned long cr4) |
@@ -725,12 +718,12 @@ static void xen_write_cr4(unsigned long cr4) | |||
725 | 718 | ||
726 | static unsigned long xen_read_cr3(void) | 719 | static unsigned long xen_read_cr3(void) |
727 | { | 720 | { |
728 | return x86_read_percpu(xen_cr3); | 721 | return percpu_read(xen_cr3); |
729 | } | 722 | } |
730 | 723 | ||
731 | static void set_current_cr3(void *v) | 724 | static void set_current_cr3(void *v) |
732 | { | 725 | { |
733 | x86_write_percpu(xen_current_cr3, (unsigned long)v); | 726 | percpu_write(xen_current_cr3, (unsigned long)v); |
734 | } | 727 | } |
735 | 728 | ||
736 | static void __xen_write_cr3(bool kernel, unsigned long cr3) | 729 | static void __xen_write_cr3(bool kernel, unsigned long cr3) |
@@ -755,7 +748,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3) | |||
755 | MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); | 748 | MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); |
756 | 749 | ||
757 | if (kernel) { | 750 | if (kernel) { |
758 | x86_write_percpu(xen_cr3, cr3); | 751 | percpu_write(xen_cr3, cr3); |
759 | 752 | ||
760 | /* Update xen_current_cr3 once the batch has actually | 753 | /* Update xen_current_cr3 once the batch has actually |
761 | been submitted. */ | 754 | been submitted. */ |
@@ -771,7 +764,7 @@ static void xen_write_cr3(unsigned long cr3) | |||
771 | 764 | ||
772 | /* Update while interrupts are disabled, so its atomic with | 765 | /* Update while interrupts are disabled, so its atomic with |
773 | respect to ipis */ | 766 | respect to ipis */ |
774 | x86_write_percpu(xen_cr3, cr3); | 767 | percpu_write(xen_cr3, cr3); |
775 | 768 | ||
776 | __xen_write_cr3(true, cr3); | 769 | __xen_write_cr3(true, cr3); |
777 | 770 | ||
@@ -1651,7 +1644,6 @@ asmlinkage void __init xen_start_kernel(void) | |||
1651 | #ifdef CONFIG_X86_64 | 1644 | #ifdef CONFIG_X86_64 |
1652 | /* Disable until direct per-cpu data access. */ | 1645 | /* Disable until direct per-cpu data access. */ |
1653 | have_vcpu_info_placement = 0; | 1646 | have_vcpu_info_placement = 0; |
1654 | x86_64_init_pda(); | ||
1655 | #endif | 1647 | #endif |
1656 | 1648 | ||
1657 | xen_smp_init(); | 1649 | xen_smp_init(); |