diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/Kconfig | 8 | ||||
-rw-r--r-- | arch/x86/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/xen/page.h | 3 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_amd_ibs.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 25 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_ds.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_lbr.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_uncore.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/microcode_core.c | 3 | ||||
-rw-r--r-- | arch/x86/kvm/i8259.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 23 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 13 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 4 | ||||
-rw-r--r-- | arch/x86/xen/p2m.c | 27 |
16 files changed, 115 insertions, 34 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 8ec3a1aa4abd..50a1d1f9b6d3 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -746,10 +746,10 @@ config SWIOTLB | |||
746 | def_bool y if X86_64 | 746 | def_bool y if X86_64 |
747 | ---help--- | 747 | ---help--- |
748 | Support for software bounce buffers used on x86-64 systems | 748 | Support for software bounce buffers used on x86-64 systems |
749 | which don't have a hardware IOMMU (e.g. the current generation | 749 | which don't have a hardware IOMMU. Using this PCI devices |
750 | of Intel's x86-64 CPUs). Using this PCI devices which can only | 750 | which can only access 32-bits of memory can be used on systems |
751 | access 32-bits of memory can be used on systems with more than | 751 | with more than 3 GB of memory. |
752 | 3 GB of memory. If unsure, say Y. | 752 | If unsure, say Y. |
753 | 753 | ||
754 | config IOMMU_HELPER | 754 | config IOMMU_HELPER |
755 | def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) | 755 | def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 682e9c210baa..474ca35b1bce 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -142,7 +142,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,) | |||
142 | KBUILD_CFLAGS += $(mflags-y) | 142 | KBUILD_CFLAGS += $(mflags-y) |
143 | KBUILD_AFLAGS += $(mflags-y) | 143 | KBUILD_AFLAGS += $(mflags-y) |
144 | 144 | ||
145 | archscripts: | 145 | archscripts: scripts_basic |
146 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs | 146 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs |
147 | 147 | ||
148 | ### | 148 | ### |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 93971e841dd5..472b9b783019 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
@@ -51,7 +51,8 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s, | |||
51 | 51 | ||
52 | extern int m2p_add_override(unsigned long mfn, struct page *page, | 52 | extern int m2p_add_override(unsigned long mfn, struct page *page, |
53 | struct gnttab_map_grant_ref *kmap_op); | 53 | struct gnttab_map_grant_ref *kmap_op); |
54 | extern int m2p_remove_override(struct page *page, bool clear_pte); | 54 | extern int m2p_remove_override(struct page *page, |
55 | struct gnttab_map_grant_ref *kmap_op); | ||
55 | extern struct page *m2p_find_override(unsigned long mfn); | 56 | extern struct page *m2p_find_override(unsigned long mfn); |
56 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); | 57 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); |
57 | 58 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 6605a81ba339..8b6defe7eefc 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -586,6 +586,8 @@ extern struct event_constraint intel_westmere_pebs_event_constraints[]; | |||
586 | 586 | ||
587 | extern struct event_constraint intel_snb_pebs_event_constraints[]; | 587 | extern struct event_constraint intel_snb_pebs_event_constraints[]; |
588 | 588 | ||
589 | extern struct event_constraint intel_ivb_pebs_event_constraints[]; | ||
590 | |||
589 | struct event_constraint *intel_pebs_constraints(struct perf_event *event); | 591 | struct event_constraint *intel_pebs_constraints(struct perf_event *event); |
590 | 592 | ||
591 | void intel_pmu_pebs_enable(struct perf_event *event); | 593 | void intel_pmu_pebs_enable(struct perf_event *event); |
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c index 7bfb5bec8630..eebd5ffe1bba 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c +++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c | |||
@@ -209,6 +209,15 @@ static int perf_ibs_precise_event(struct perf_event *event, u64 *config) | |||
209 | return -EOPNOTSUPP; | 209 | return -EOPNOTSUPP; |
210 | } | 210 | } |
211 | 211 | ||
212 | static const struct perf_event_attr ibs_notsupp = { | ||
213 | .exclude_user = 1, | ||
214 | .exclude_kernel = 1, | ||
215 | .exclude_hv = 1, | ||
216 | .exclude_idle = 1, | ||
217 | .exclude_host = 1, | ||
218 | .exclude_guest = 1, | ||
219 | }; | ||
220 | |||
212 | static int perf_ibs_init(struct perf_event *event) | 221 | static int perf_ibs_init(struct perf_event *event) |
213 | { | 222 | { |
214 | struct hw_perf_event *hwc = &event->hw; | 223 | struct hw_perf_event *hwc = &event->hw; |
@@ -229,6 +238,9 @@ static int perf_ibs_init(struct perf_event *event) | |||
229 | if (event->pmu != &perf_ibs->pmu) | 238 | if (event->pmu != &perf_ibs->pmu) |
230 | return -ENOENT; | 239 | return -ENOENT; |
231 | 240 | ||
241 | if (perf_flags(&event->attr) & perf_flags(&ibs_notsupp)) | ||
242 | return -EINVAL; | ||
243 | |||
232 | if (config & ~perf_ibs->config_mask) | 244 | if (config & ~perf_ibs->config_mask) |
233 | return -EINVAL; | 245 | return -EINVAL; |
234 | 246 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 7f2739e03e79..6bca492b8547 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -2008,6 +2008,7 @@ __init int intel_pmu_init(void) | |||
2008 | break; | 2008 | break; |
2009 | 2009 | ||
2010 | case 28: /* Atom */ | 2010 | case 28: /* Atom */ |
2011 | case 54: /* Cedariew */ | ||
2011 | memcpy(hw_cache_event_ids, atom_hw_cache_event_ids, | 2012 | memcpy(hw_cache_event_ids, atom_hw_cache_event_ids, |
2012 | sizeof(hw_cache_event_ids)); | 2013 | sizeof(hw_cache_event_ids)); |
2013 | 2014 | ||
@@ -2047,7 +2048,6 @@ __init int intel_pmu_init(void) | |||
2047 | case 42: /* SandyBridge */ | 2048 | case 42: /* SandyBridge */ |
2048 | case 45: /* SandyBridge, "Romely-EP" */ | 2049 | case 45: /* SandyBridge, "Romely-EP" */ |
2049 | x86_add_quirk(intel_sandybridge_quirk); | 2050 | x86_add_quirk(intel_sandybridge_quirk); |
2050 | case 58: /* IvyBridge */ | ||
2051 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 2051 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
2052 | sizeof(hw_cache_event_ids)); | 2052 | sizeof(hw_cache_event_ids)); |
2053 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, | 2053 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, |
@@ -2072,6 +2072,29 @@ __init int intel_pmu_init(void) | |||
2072 | 2072 | ||
2073 | pr_cont("SandyBridge events, "); | 2073 | pr_cont("SandyBridge events, "); |
2074 | break; | 2074 | break; |
2075 | case 58: /* IvyBridge */ | ||
2076 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | ||
2077 | sizeof(hw_cache_event_ids)); | ||
2078 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, | ||
2079 | sizeof(hw_cache_extra_regs)); | ||
2080 | |||
2081 | intel_pmu_lbr_init_snb(); | ||
2082 | |||
2083 | x86_pmu.event_constraints = intel_snb_event_constraints; | ||
2084 | x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints; | ||
2085 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
2086 | x86_pmu.extra_regs = intel_snb_extra_regs; | ||
2087 | /* all extra regs are per-cpu when HT is on */ | ||
2088 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | ||
2089 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | ||
2090 | |||
2091 | /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */ | ||
2092 | intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = | ||
2093 | X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1); | ||
2094 | |||
2095 | pr_cont("IvyBridge events, "); | ||
2096 | break; | ||
2097 | |||
2075 | 2098 | ||
2076 | default: | 2099 | default: |
2077 | switch (x86_pmu.version) { | 2100 | switch (x86_pmu.version) { |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index e38d97bf4259..826054a4f2ee 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -407,6 +407,20 @@ struct event_constraint intel_snb_pebs_event_constraints[] = { | |||
407 | EVENT_CONSTRAINT_END | 407 | EVENT_CONSTRAINT_END |
408 | }; | 408 | }; |
409 | 409 | ||
410 | struct event_constraint intel_ivb_pebs_event_constraints[] = { | ||
411 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ | ||
412 | INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ | ||
413 | INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ | ||
414 | INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ | ||
415 | INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ | ||
416 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ | ||
417 | INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ | ||
418 | INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
419 | INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
420 | INTEL_EVENT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ | ||
421 | EVENT_CONSTRAINT_END | ||
422 | }; | ||
423 | |||
410 | struct event_constraint *intel_pebs_constraints(struct perf_event *event) | 424 | struct event_constraint *intel_pebs_constraints(struct perf_event *event) |
411 | { | 425 | { |
412 | struct event_constraint *c; | 426 | struct event_constraint *c; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c index 520b4265fcd2..da02e9cc3754 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c | |||
@@ -686,7 +686,8 @@ void intel_pmu_lbr_init_atom(void) | |||
686 | * to have an operational LBR which can freeze | 686 | * to have an operational LBR which can freeze |
687 | * on PMU interrupt | 687 | * on PMU interrupt |
688 | */ | 688 | */ |
689 | if (boot_cpu_data.x86_mask < 10) { | 689 | if (boot_cpu_data.x86_model == 28 |
690 | && boot_cpu_data.x86_mask < 10) { | ||
690 | pr_cont("LBR disabled due to erratum"); | 691 | pr_cont("LBR disabled due to erratum"); |
691 | return; | 692 | return; |
692 | } | 693 | } |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 0a5571080e74..38e4894165b9 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -661,6 +661,11 @@ static void snb_uncore_msr_init_box(struct intel_uncore_box *box) | |||
661 | } | 661 | } |
662 | } | 662 | } |
663 | 663 | ||
664 | static struct uncore_event_desc snb_uncore_events[] = { | ||
665 | INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff,umask=0x00"), | ||
666 | { /* end: all zeroes */ }, | ||
667 | }; | ||
668 | |||
664 | static struct attribute *snb_uncore_formats_attr[] = { | 669 | static struct attribute *snb_uncore_formats_attr[] = { |
665 | &format_attr_event.attr, | 670 | &format_attr_event.attr, |
666 | &format_attr_umask.attr, | 671 | &format_attr_umask.attr, |
@@ -704,6 +709,7 @@ static struct intel_uncore_type snb_uncore_cbox = { | |||
704 | .constraints = snb_uncore_cbox_constraints, | 709 | .constraints = snb_uncore_cbox_constraints, |
705 | .ops = &snb_uncore_msr_ops, | 710 | .ops = &snb_uncore_msr_ops, |
706 | .format_group = &snb_uncore_format_group, | 711 | .format_group = &snb_uncore_format_group, |
712 | .event_descs = snb_uncore_events, | ||
707 | }; | 713 | }; |
708 | 714 | ||
709 | static struct intel_uncore_type *snb_msr_uncores[] = { | 715 | static struct intel_uncore_type *snb_msr_uncores[] = { |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 4873e62db6a1..9e5bcf1e2376 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
@@ -225,6 +225,9 @@ static ssize_t microcode_write(struct file *file, const char __user *buf, | |||
225 | if (do_microcode_update(buf, len) == 0) | 225 | if (do_microcode_update(buf, len) == 0) |
226 | ret = (ssize_t)len; | 226 | ret = (ssize_t)len; |
227 | 227 | ||
228 | if (ret > 0) | ||
229 | perf_check_microcode(); | ||
230 | |||
228 | mutex_unlock(µcode_mutex); | 231 | mutex_unlock(µcode_mutex); |
229 | put_online_cpus(); | 232 | put_online_cpus(); |
230 | 233 | ||
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index e498b18f010c..9fc9aa7ac703 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
@@ -318,7 +318,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) | |||
318 | if (val & 0x10) { | 318 | if (val & 0x10) { |
319 | u8 edge_irr = s->irr & ~s->elcr; | 319 | u8 edge_irr = s->irr & ~s->elcr; |
320 | int i; | 320 | int i; |
321 | bool found; | 321 | bool found = false; |
322 | struct kvm_vcpu *vcpu; | 322 | struct kvm_vcpu *vcpu; |
323 | 323 | ||
324 | s->init4 = val & 1; | 324 | s->init4 = val & 1; |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c00f03de1b79..b1eb202ee76a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3619,6 +3619,7 @@ static void seg_setup(int seg) | |||
3619 | 3619 | ||
3620 | static int alloc_apic_access_page(struct kvm *kvm) | 3620 | static int alloc_apic_access_page(struct kvm *kvm) |
3621 | { | 3621 | { |
3622 | struct page *page; | ||
3622 | struct kvm_userspace_memory_region kvm_userspace_mem; | 3623 | struct kvm_userspace_memory_region kvm_userspace_mem; |
3623 | int r = 0; | 3624 | int r = 0; |
3624 | 3625 | ||
@@ -3633,7 +3634,13 @@ static int alloc_apic_access_page(struct kvm *kvm) | |||
3633 | if (r) | 3634 | if (r) |
3634 | goto out; | 3635 | goto out; |
3635 | 3636 | ||
3636 | kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); | 3637 | page = gfn_to_page(kvm, 0xfee00); |
3638 | if (is_error_page(page)) { | ||
3639 | r = -EFAULT; | ||
3640 | goto out; | ||
3641 | } | ||
3642 | |||
3643 | kvm->arch.apic_access_page = page; | ||
3637 | out: | 3644 | out: |
3638 | mutex_unlock(&kvm->slots_lock); | 3645 | mutex_unlock(&kvm->slots_lock); |
3639 | return r; | 3646 | return r; |
@@ -3641,6 +3648,7 @@ out: | |||
3641 | 3648 | ||
3642 | static int alloc_identity_pagetable(struct kvm *kvm) | 3649 | static int alloc_identity_pagetable(struct kvm *kvm) |
3643 | { | 3650 | { |
3651 | struct page *page; | ||
3644 | struct kvm_userspace_memory_region kvm_userspace_mem; | 3652 | struct kvm_userspace_memory_region kvm_userspace_mem; |
3645 | int r = 0; | 3653 | int r = 0; |
3646 | 3654 | ||
@@ -3656,8 +3664,13 @@ static int alloc_identity_pagetable(struct kvm *kvm) | |||
3656 | if (r) | 3664 | if (r) |
3657 | goto out; | 3665 | goto out; |
3658 | 3666 | ||
3659 | kvm->arch.ept_identity_pagetable = gfn_to_page(kvm, | 3667 | page = gfn_to_page(kvm, kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); |
3660 | kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); | 3668 | if (is_error_page(page)) { |
3669 | r = -EFAULT; | ||
3670 | goto out; | ||
3671 | } | ||
3672 | |||
3673 | kvm->arch.ept_identity_pagetable = page; | ||
3661 | out: | 3674 | out: |
3662 | mutex_unlock(&kvm->slots_lock); | 3675 | mutex_unlock(&kvm->slots_lock); |
3663 | return r; | 3676 | return r; |
@@ -6575,7 +6588,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | |||
6575 | /* Exposing INVPCID only when PCID is exposed */ | 6588 | /* Exposing INVPCID only when PCID is exposed */ |
6576 | best = kvm_find_cpuid_entry(vcpu, 0x7, 0); | 6589 | best = kvm_find_cpuid_entry(vcpu, 0x7, 0); |
6577 | if (vmx_invpcid_supported() && | 6590 | if (vmx_invpcid_supported() && |
6578 | best && (best->ecx & bit(X86_FEATURE_INVPCID)) && | 6591 | best && (best->ebx & bit(X86_FEATURE_INVPCID)) && |
6579 | guest_cpuid_has_pcid(vcpu)) { | 6592 | guest_cpuid_has_pcid(vcpu)) { |
6580 | exec_control |= SECONDARY_EXEC_ENABLE_INVPCID; | 6593 | exec_control |= SECONDARY_EXEC_ENABLE_INVPCID; |
6581 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, | 6594 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, |
@@ -6585,7 +6598,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | |||
6585 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, | 6598 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, |
6586 | exec_control); | 6599 | exec_control); |
6587 | if (best) | 6600 | if (best) |
6588 | best->ecx &= ~bit(X86_FEATURE_INVPCID); | 6601 | best->ebx &= ~bit(X86_FEATURE_INVPCID); |
6589 | } | 6602 | } |
6590 | } | 6603 | } |
6591 | 6604 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 148ed666e311..2966c847d489 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5113,17 +5113,20 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu) | |||
5113 | !kvm_event_needs_reinjection(vcpu); | 5113 | !kvm_event_needs_reinjection(vcpu); |
5114 | } | 5114 | } |
5115 | 5115 | ||
5116 | static void vapic_enter(struct kvm_vcpu *vcpu) | 5116 | static int vapic_enter(struct kvm_vcpu *vcpu) |
5117 | { | 5117 | { |
5118 | struct kvm_lapic *apic = vcpu->arch.apic; | 5118 | struct kvm_lapic *apic = vcpu->arch.apic; |
5119 | struct page *page; | 5119 | struct page *page; |
5120 | 5120 | ||
5121 | if (!apic || !apic->vapic_addr) | 5121 | if (!apic || !apic->vapic_addr) |
5122 | return; | 5122 | return 0; |
5123 | 5123 | ||
5124 | page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); | 5124 | page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); |
5125 | if (is_error_page(page)) | ||
5126 | return -EFAULT; | ||
5125 | 5127 | ||
5126 | vcpu->arch.apic->vapic_page = page; | 5128 | vcpu->arch.apic->vapic_page = page; |
5129 | return 0; | ||
5127 | } | 5130 | } |
5128 | 5131 | ||
5129 | static void vapic_exit(struct kvm_vcpu *vcpu) | 5132 | static void vapic_exit(struct kvm_vcpu *vcpu) |
@@ -5430,7 +5433,11 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
5430 | } | 5433 | } |
5431 | 5434 | ||
5432 | vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); | 5435 | vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); |
5433 | vapic_enter(vcpu); | 5436 | r = vapic_enter(vcpu); |
5437 | if (r) { | ||
5438 | srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); | ||
5439 | return r; | ||
5440 | } | ||
5434 | 5441 | ||
5435 | r = 1; | 5442 | r = 1; |
5436 | while (r > 0) { | 5443 | while (r > 0) { |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index e0e6990723e9..ab1f6a93b527 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -319,7 +319,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
319 | */ | 319 | */ |
320 | int devmem_is_allowed(unsigned long pagenr) | 320 | int devmem_is_allowed(unsigned long pagenr) |
321 | { | 321 | { |
322 | if (pagenr <= 256) | 322 | if (pagenr < 256) |
323 | return 1; | 323 | return 1; |
324 | if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) | 324 | if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) |
325 | return 0; | 325 | return 0; |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 9642d4a38602..1fbe75a95f15 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1452,6 +1452,10 @@ asmlinkage void __init xen_start_kernel(void) | |||
1452 | pci_request_acs(); | 1452 | pci_request_acs(); |
1453 | 1453 | ||
1454 | xen_acpi_sleep_register(); | 1454 | xen_acpi_sleep_register(); |
1455 | |||
1456 | /* Avoid searching for BIOS MP tables */ | ||
1457 | x86_init.mpparse.find_smp_config = x86_init_noop; | ||
1458 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; | ||
1455 | } | 1459 | } |
1456 | #ifdef CONFIG_PCI | 1460 | #ifdef CONFIG_PCI |
1457 | /* PCI BIOS service won't work from a PV guest. */ | 1461 | /* PCI BIOS service won't work from a PV guest. */ |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 76ba0e97e530..72213da605f5 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -828,9 +828,6 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
828 | 828 | ||
829 | xen_mc_issue(PARAVIRT_LAZY_MMU); | 829 | xen_mc_issue(PARAVIRT_LAZY_MMU); |
830 | } | 830 | } |
831 | /* let's use dev_bus_addr to record the old mfn instead */ | ||
832 | kmap_op->dev_bus_addr = page->index; | ||
833 | page->index = (unsigned long) kmap_op; | ||
834 | } | 831 | } |
835 | spin_lock_irqsave(&m2p_override_lock, flags); | 832 | spin_lock_irqsave(&m2p_override_lock, flags); |
836 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); | 833 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); |
@@ -857,7 +854,8 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
857 | return 0; | 854 | return 0; |
858 | } | 855 | } |
859 | EXPORT_SYMBOL_GPL(m2p_add_override); | 856 | EXPORT_SYMBOL_GPL(m2p_add_override); |
860 | int m2p_remove_override(struct page *page, bool clear_pte) | 857 | int m2p_remove_override(struct page *page, |
858 | struct gnttab_map_grant_ref *kmap_op) | ||
861 | { | 859 | { |
862 | unsigned long flags; | 860 | unsigned long flags; |
863 | unsigned long mfn; | 861 | unsigned long mfn; |
@@ -887,10 +885,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
887 | WARN_ON(!PagePrivate(page)); | 885 | WARN_ON(!PagePrivate(page)); |
888 | ClearPagePrivate(page); | 886 | ClearPagePrivate(page); |
889 | 887 | ||
890 | if (clear_pte) { | 888 | set_phys_to_machine(pfn, page->index); |
891 | struct gnttab_map_grant_ref *map_op = | 889 | if (kmap_op != NULL) { |
892 | (struct gnttab_map_grant_ref *) page->index; | ||
893 | set_phys_to_machine(pfn, map_op->dev_bus_addr); | ||
894 | if (!PageHighMem(page)) { | 890 | if (!PageHighMem(page)) { |
895 | struct multicall_space mcs; | 891 | struct multicall_space mcs; |
896 | struct gnttab_unmap_grant_ref *unmap_op; | 892 | struct gnttab_unmap_grant_ref *unmap_op; |
@@ -902,13 +898,13 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
902 | * issued. In this case handle is going to -1 because | 898 | * issued. In this case handle is going to -1 because |
903 | * it hasn't been modified yet. | 899 | * it hasn't been modified yet. |
904 | */ | 900 | */ |
905 | if (map_op->handle == -1) | 901 | if (kmap_op->handle == -1) |
906 | xen_mc_flush(); | 902 | xen_mc_flush(); |
907 | /* | 903 | /* |
908 | * Now if map_op->handle is negative it means that the | 904 | * Now if kmap_op->handle is negative it means that the |
909 | * hypercall actually returned an error. | 905 | * hypercall actually returned an error. |
910 | */ | 906 | */ |
911 | if (map_op->handle == GNTST_general_error) { | 907 | if (kmap_op->handle == GNTST_general_error) { |
912 | printk(KERN_WARNING "m2p_remove_override: " | 908 | printk(KERN_WARNING "m2p_remove_override: " |
913 | "pfn %lx mfn %lx, failed to modify kernel mappings", | 909 | "pfn %lx mfn %lx, failed to modify kernel mappings", |
914 | pfn, mfn); | 910 | pfn, mfn); |
@@ -918,8 +914,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
918 | mcs = xen_mc_entry( | 914 | mcs = xen_mc_entry( |
919 | sizeof(struct gnttab_unmap_grant_ref)); | 915 | sizeof(struct gnttab_unmap_grant_ref)); |
920 | unmap_op = mcs.args; | 916 | unmap_op = mcs.args; |
921 | unmap_op->host_addr = map_op->host_addr; | 917 | unmap_op->host_addr = kmap_op->host_addr; |
922 | unmap_op->handle = map_op->handle; | 918 | unmap_op->handle = kmap_op->handle; |
923 | unmap_op->dev_bus_addr = 0; | 919 | unmap_op->dev_bus_addr = 0; |
924 | 920 | ||
925 | MULTI_grant_table_op(mcs.mc, | 921 | MULTI_grant_table_op(mcs.mc, |
@@ -930,10 +926,9 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
930 | set_pte_at(&init_mm, address, ptep, | 926 | set_pte_at(&init_mm, address, ptep, |
931 | pfn_pte(pfn, PAGE_KERNEL)); | 927 | pfn_pte(pfn, PAGE_KERNEL)); |
932 | __flush_tlb_single(address); | 928 | __flush_tlb_single(address); |
933 | map_op->host_addr = 0; | 929 | kmap_op->host_addr = 0; |
934 | } | 930 | } |
935 | } else | 931 | } |
936 | set_phys_to_machine(pfn, page->index); | ||
937 | 932 | ||
938 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present | 933 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present |
939 | * somewhere in this domain, even before being added to the | 934 | * somewhere in this domain, even before being added to the |