aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-12-19 05:49:13 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-12-19 05:49:13 -0500
commit0fa85119cd480c1ded7a81ed64f723fe16a15355 (patch)
tree8648434601c5112a1d9ab091ab11507fe88e0962 /arch/x86/include
parentd6ccc3ec95251d8d3276f2900b59cbc468dd74f4 (diff)
parent1eab0e42450c6038e2bb17da438370fe639973f3 (diff)
Merge branch 'linus' into x86/cleanups
Pull in upstream changes so we can apply depending patches.
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/highmem.h1
-rw-r--r--arch/x86/include/asm/i8259.h1
-rw-r--r--arch/x86/include/asm/irq_remapping.h10
-rw-r--r--arch/x86/include/asm/kvm_emulate.h10
-rw-r--r--arch/x86/include/asm/kvm_host.h65
-rw-r--r--arch/x86/include/asm/msr-index.h10
-rw-r--r--arch/x86/include/asm/page_types.h16
-rw-r--r--arch/x86/include/asm/pgtable.h10
-rw-r--r--arch/x86/include/asm/pgtable_types.h14
-rw-r--r--arch/x86/include/asm/vmx.h6
-rw-r--r--arch/x86/include/asm/x86_init.h1
-rw-r--r--arch/x86/include/asm/xen/hypervisor.h5
-rw-r--r--arch/x86/include/asm/xen/page.h8
-rw-r--r--arch/x86/include/uapi/asm/hyperv.h18
-rw-r--r--arch/x86/include/uapi/asm/svm.h1
-rw-r--r--arch/x86/include/uapi/asm/vmx.h4
16 files changed, 130 insertions, 50 deletions
diff --git a/arch/x86/include/asm/highmem.h b/arch/x86/include/asm/highmem.h
index 04e9d023168f..1c0b43724ce3 100644
--- a/arch/x86/include/asm/highmem.h
+++ b/arch/x86/include/asm/highmem.h
@@ -68,7 +68,6 @@ void *kmap_atomic(struct page *page);
68void __kunmap_atomic(void *kvaddr); 68void __kunmap_atomic(void *kvaddr);
69void *kmap_atomic_pfn(unsigned long pfn); 69void *kmap_atomic_pfn(unsigned long pfn);
70void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot); 70void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot);
71struct page *kmap_atomic_to_page(void *ptr);
72 71
73#define flush_cache_kmaps() do { } while (0) 72#define flush_cache_kmaps() do { } while (0)
74 73
diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
index ccffa53750a8..39bcefc20de7 100644
--- a/arch/x86/include/asm/i8259.h
+++ b/arch/x86/include/asm/i8259.h
@@ -60,6 +60,7 @@ struct legacy_pic {
60 void (*mask_all)(void); 60 void (*mask_all)(void);
61 void (*restore_mask)(void); 61 void (*restore_mask)(void);
62 void (*init)(int auto_eoi); 62 void (*init)(int auto_eoi);
63 int (*probe)(void);
63 int (*irq_pending)(unsigned int irq); 64 int (*irq_pending)(unsigned int irq);
64 void (*make_irq)(unsigned int irq); 65 void (*make_irq)(unsigned int irq);
65}; 66};
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 046c7fb1ca43..a210eba2727c 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -33,6 +33,11 @@ enum irq_remap_cap {
33 IRQ_POSTING_CAP = 0, 33 IRQ_POSTING_CAP = 0,
34}; 34};
35 35
36struct vcpu_data {
37 u64 pi_desc_addr; /* Physical address of PI Descriptor */
38 u32 vector; /* Guest vector of the interrupt */
39};
40
36#ifdef CONFIG_IRQ_REMAP 41#ifdef CONFIG_IRQ_REMAP
37 42
38extern bool irq_remapping_cap(enum irq_remap_cap cap); 43extern bool irq_remapping_cap(enum irq_remap_cap cap);
@@ -58,11 +63,6 @@ static inline struct irq_domain *arch_get_ir_parent_domain(void)
58 return x86_vector_domain; 63 return x86_vector_domain;
59} 64}
60 65
61struct vcpu_data {
62 u64 pi_desc_addr; /* Physical address of PI Descriptor */
63 u32 vector; /* Guest vector of the interrupt */
64};
65
66#else /* CONFIG_IRQ_REMAP */ 66#else /* CONFIG_IRQ_REMAP */
67 67
68static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; } 68static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
index e16466ec473c..e9cd7befcb76 100644
--- a/arch/x86/include/asm/kvm_emulate.h
+++ b/arch/x86/include/asm/kvm_emulate.h
@@ -112,6 +112,16 @@ struct x86_emulate_ops {
112 struct x86_exception *fault); 112 struct x86_exception *fault);
113 113
114 /* 114 /*
115 * read_phys: Read bytes of standard (non-emulated/special) memory.
116 * Used for descriptor reading.
117 * @addr: [IN ] Physical address from which to read.
118 * @val: [OUT] Value read from memory.
119 * @bytes: [IN ] Number of bytes to read from memory.
120 */
121 int (*read_phys)(struct x86_emulate_ctxt *ctxt, unsigned long addr,
122 void *val, unsigned int bytes);
123
124 /*
115 * write_std: Write bytes of standard (non-emulated/special) memory. 125 * write_std: Write bytes of standard (non-emulated/special) memory.
116 * Used for descriptor writing. 126 * Used for descriptor writing.
117 * @addr: [IN ] Linear address to which to write. 127 * @addr: [IN ] Linear address to which to write.
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3a36ee704c30..30cfd64295a0 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -24,6 +24,7 @@
24#include <linux/perf_event.h> 24#include <linux/perf_event.h>
25#include <linux/pvclock_gtod.h> 25#include <linux/pvclock_gtod.h>
26#include <linux/clocksource.h> 26#include <linux/clocksource.h>
27#include <linux/irqbypass.h>
27 28
28#include <asm/pvclock-abi.h> 29#include <asm/pvclock-abi.h>
29#include <asm/desc.h> 30#include <asm/desc.h>
@@ -176,6 +177,8 @@ enum {
176 */ 177 */
177#define KVM_APIC_PV_EOI_PENDING 1 178#define KVM_APIC_PV_EOI_PENDING 1
178 179
180struct kvm_kernel_irq_routing_entry;
181
179/* 182/*
180 * We don't want allocation failures within the mmu code, so we preallocate 183 * We don't want allocation failures within the mmu code, so we preallocate
181 * enough memory for a single page fault in a cache. 184 * enough memory for a single page fault in a cache.
@@ -374,6 +377,7 @@ struct kvm_mtrr {
374/* Hyper-V per vcpu emulation context */ 377/* Hyper-V per vcpu emulation context */
375struct kvm_vcpu_hv { 378struct kvm_vcpu_hv {
376 u64 hv_vapic; 379 u64 hv_vapic;
380 s64 runtime_offset;
377}; 381};
378 382
379struct kvm_vcpu_arch { 383struct kvm_vcpu_arch {
@@ -396,6 +400,7 @@ struct kvm_vcpu_arch {
396 u64 efer; 400 u64 efer;
397 u64 apic_base; 401 u64 apic_base;
398 struct kvm_lapic *apic; /* kernel irqchip context */ 402 struct kvm_lapic *apic; /* kernel irqchip context */
403 u64 eoi_exit_bitmap[4];
399 unsigned long apic_attention; 404 unsigned long apic_attention;
400 int32_t apic_arb_prio; 405 int32_t apic_arb_prio;
401 int mp_state; 406 int mp_state;
@@ -500,6 +505,7 @@ struct kvm_vcpu_arch {
500 u32 virtual_tsc_mult; 505 u32 virtual_tsc_mult;
501 u32 virtual_tsc_khz; 506 u32 virtual_tsc_khz;
502 s64 ia32_tsc_adjust_msr; 507 s64 ia32_tsc_adjust_msr;
508 u64 tsc_scaling_ratio;
503 509
504 atomic_t nmi_queued; /* unprocessed asynchronous NMIs */ 510 atomic_t nmi_queued; /* unprocessed asynchronous NMIs */
505 unsigned nmi_pending; /* NMI queued after currently running handler */ 511 unsigned nmi_pending; /* NMI queued after currently running handler */
@@ -573,6 +579,9 @@ struct kvm_vcpu_arch {
573 struct { 579 struct {
574 bool pv_unhalted; 580 bool pv_unhalted;
575 } pv; 581 } pv;
582
583 int pending_ioapic_eoi;
584 int pending_external_vector;
576}; 585};
577 586
578struct kvm_lpage_info { 587struct kvm_lpage_info {
@@ -683,6 +692,9 @@ struct kvm_arch {
683 u32 bsp_vcpu_id; 692 u32 bsp_vcpu_id;
684 693
685 u64 disabled_quirks; 694 u64 disabled_quirks;
695
696 bool irqchip_split;
697 u8 nr_reserved_ioapic_pins;
686}; 698};
687 699
688struct kvm_vm_stat { 700struct kvm_vm_stat {
@@ -766,7 +778,7 @@ struct kvm_x86_ops {
766 void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu); 778 void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
767 void (*vcpu_put)(struct kvm_vcpu *vcpu); 779 void (*vcpu_put)(struct kvm_vcpu *vcpu);
768 780
769 void (*update_db_bp_intercept)(struct kvm_vcpu *vcpu); 781 void (*update_bp_intercept)(struct kvm_vcpu *vcpu);
770 int (*get_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr); 782 int (*get_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr);
771 int (*set_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr); 783 int (*set_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr);
772 u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg); 784 u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg);
@@ -819,10 +831,10 @@ struct kvm_x86_ops {
819 void (*enable_nmi_window)(struct kvm_vcpu *vcpu); 831 void (*enable_nmi_window)(struct kvm_vcpu *vcpu);
820 void (*enable_irq_window)(struct kvm_vcpu *vcpu); 832 void (*enable_irq_window)(struct kvm_vcpu *vcpu);
821 void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr); 833 void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr);
822 int (*vm_has_apicv)(struct kvm *kvm); 834 int (*cpu_uses_apicv)(struct kvm_vcpu *vcpu);
823 void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr); 835 void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr);
824 void (*hwapic_isr_update)(struct kvm *kvm, int isr); 836 void (*hwapic_isr_update)(struct kvm *kvm, int isr);
825 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); 837 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu);
826 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set); 838 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set);
827 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa); 839 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa);
828 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); 840 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
@@ -833,7 +845,7 @@ struct kvm_x86_ops {
833 int (*get_lpage_level)(void); 845 int (*get_lpage_level)(void);
834 bool (*rdtscp_supported)(void); 846 bool (*rdtscp_supported)(void);
835 bool (*invpcid_supported)(void); 847 bool (*invpcid_supported)(void);
836 void (*adjust_tsc_offset)(struct kvm_vcpu *vcpu, s64 adjustment, bool host); 848 void (*adjust_tsc_offset_guest)(struct kvm_vcpu *vcpu, s64 adjustment);
837 849
838 void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); 850 void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
839 851
@@ -841,11 +853,9 @@ struct kvm_x86_ops {
841 853
842 bool (*has_wbinvd_exit)(void); 854 bool (*has_wbinvd_exit)(void);
843 855
844 void (*set_tsc_khz)(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale);
845 u64 (*read_tsc_offset)(struct kvm_vcpu *vcpu); 856 u64 (*read_tsc_offset)(struct kvm_vcpu *vcpu);
846 void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset); 857 void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset);
847 858
848 u64 (*compute_tsc_offset)(struct kvm_vcpu *vcpu, u64 target_tsc);
849 u64 (*read_l1_tsc)(struct kvm_vcpu *vcpu, u64 host_tsc); 859 u64 (*read_l1_tsc)(struct kvm_vcpu *vcpu, u64 host_tsc);
850 860
851 void (*get_exit_info)(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2); 861 void (*get_exit_info)(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2);
@@ -887,6 +897,20 @@ struct kvm_x86_ops {
887 gfn_t offset, unsigned long mask); 897 gfn_t offset, unsigned long mask);
888 /* pmu operations of sub-arch */ 898 /* pmu operations of sub-arch */
889 const struct kvm_pmu_ops *pmu_ops; 899 const struct kvm_pmu_ops *pmu_ops;
900
901 /*
902 * Architecture specific hooks for vCPU blocking due to
903 * HLT instruction.
904 * Returns for .pre_block():
905 * - 0 means continue to block the vCPU.
906 * - 1 means we cannot block the vCPU since some event
907 * happens during this period, such as, 'ON' bit in
908 * posted-interrupts descriptor is set.
909 */
910 int (*pre_block)(struct kvm_vcpu *vcpu);
911 void (*post_block)(struct kvm_vcpu *vcpu);
912 int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq,
913 uint32_t guest_irq, bool set);
890}; 914};
891 915
892struct kvm_arch_async_pf { 916struct kvm_arch_async_pf {
@@ -898,17 +922,6 @@ struct kvm_arch_async_pf {
898 922
899extern struct kvm_x86_ops *kvm_x86_ops; 923extern struct kvm_x86_ops *kvm_x86_ops;
900 924
901static inline void adjust_tsc_offset_guest(struct kvm_vcpu *vcpu,
902 s64 adjustment)
903{
904 kvm_x86_ops->adjust_tsc_offset(vcpu, adjustment, false);
905}
906
907static inline void adjust_tsc_offset_host(struct kvm_vcpu *vcpu, s64 adjustment)
908{
909 kvm_x86_ops->adjust_tsc_offset(vcpu, adjustment, true);
910}
911
912int kvm_mmu_module_init(void); 925int kvm_mmu_module_init(void);
913void kvm_mmu_module_exit(void); 926void kvm_mmu_module_exit(void);
914 927
@@ -961,10 +974,12 @@ u64 vcpu_tsc_khz(struct kvm_vcpu *vcpu);
961 974
962/* control of guest tsc rate supported? */ 975/* control of guest tsc rate supported? */
963extern bool kvm_has_tsc_control; 976extern bool kvm_has_tsc_control;
964/* minimum supported tsc_khz for guests */
965extern u32 kvm_min_guest_tsc_khz;
966/* maximum supported tsc_khz for guests */ 977/* maximum supported tsc_khz for guests */
967extern u32 kvm_max_guest_tsc_khz; 978extern u32 kvm_max_guest_tsc_khz;
979/* number of bits of the fractional part of the TSC scaling ratio */
980extern u8 kvm_tsc_scaling_ratio_frac_bits;
981/* maximum allowed value of TSC scaling ratio */
982extern u64 kvm_max_tsc_scaling_ratio;
968 983
969enum emulation_result { 984enum emulation_result {
970 EMULATE_DONE, /* no further processing */ 985 EMULATE_DONE, /* no further processing */
@@ -1210,6 +1225,9 @@ void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
1210void kvm_define_shared_msr(unsigned index, u32 msr); 1225void kvm_define_shared_msr(unsigned index, u32 msr);
1211int kvm_set_shared_msr(unsigned index, u64 val, u64 mask); 1226int kvm_set_shared_msr(unsigned index, u64 val, u64 mask);
1212 1227
1228u64 kvm_scale_tsc(struct kvm_vcpu *vcpu, u64 tsc);
1229u64 kvm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc);
1230
1213unsigned long kvm_get_linear_rip(struct kvm_vcpu *vcpu); 1231unsigned long kvm_get_linear_rip(struct kvm_vcpu *vcpu);
1214bool kvm_is_linear_rip(struct kvm_vcpu *vcpu, unsigned long linear_rip); 1232bool kvm_is_linear_rip(struct kvm_vcpu *vcpu, unsigned long linear_rip);
1215 1233
@@ -1231,4 +1249,13 @@ int x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size);
1231bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu); 1249bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu);
1232bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu); 1250bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu);
1233 1251
1252bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq,
1253 struct kvm_vcpu **dest_vcpu);
1254
1255void kvm_set_msi_irq(struct kvm_kernel_irq_routing_entry *e,
1256 struct kvm_lapic_irq *irq);
1257
1258static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
1259static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
1260
1234#endif /* _ASM_X86_KVM_HOST_H */ 1261#endif /* _ASM_X86_KVM_HOST_H */
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index b8c14bb7fc8f..690b4027e17c 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -35,7 +35,7 @@
35#define MSR_IA32_PERFCTR0 0x000000c1 35#define MSR_IA32_PERFCTR0 0x000000c1
36#define MSR_IA32_PERFCTR1 0x000000c2 36#define MSR_IA32_PERFCTR1 0x000000c2
37#define MSR_FSB_FREQ 0x000000cd 37#define MSR_FSB_FREQ 0x000000cd
38#define MSR_NHM_PLATFORM_INFO 0x000000ce 38#define MSR_PLATFORM_INFO 0x000000ce
39 39
40#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2 40#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2
41#define NHM_C3_AUTO_DEMOTE (1UL << 25) 41#define NHM_C3_AUTO_DEMOTE (1UL << 25)
@@ -44,7 +44,6 @@
44#define SNB_C1_AUTO_UNDEMOTE (1UL << 27) 44#define SNB_C1_AUTO_UNDEMOTE (1UL << 27)
45#define SNB_C3_AUTO_UNDEMOTE (1UL << 28) 45#define SNB_C3_AUTO_UNDEMOTE (1UL << 28)
46 46
47#define MSR_PLATFORM_INFO 0x000000ce
48#define MSR_MTRRcap 0x000000fe 47#define MSR_MTRRcap 0x000000fe
49#define MSR_IA32_BBL_CR_CTL 0x00000119 48#define MSR_IA32_BBL_CR_CTL 0x00000119
50#define MSR_IA32_BBL_CR_CTL3 0x0000011e 49#define MSR_IA32_BBL_CR_CTL3 0x0000011e
@@ -206,6 +205,13 @@
206#define MSR_GFX_PERF_LIMIT_REASONS 0x000006B0 205#define MSR_GFX_PERF_LIMIT_REASONS 0x000006B0
207#define MSR_RING_PERF_LIMIT_REASONS 0x000006B1 206#define MSR_RING_PERF_LIMIT_REASONS 0x000006B1
208 207
208/* Config TDP MSRs */
209#define MSR_CONFIG_TDP_NOMINAL 0x00000648
210#define MSR_CONFIG_TDP_LEVEL1 0x00000649
211#define MSR_CONFIG_TDP_LEVEL2 0x0000064A
212#define MSR_CONFIG_TDP_CONTROL 0x0000064B
213#define MSR_TURBO_ACTIVATION_RATIO 0x0000064C
214
209/* Hardware P state interface */ 215/* Hardware P state interface */
210#define MSR_PPERF 0x0000064e 216#define MSR_PPERF 0x0000064e
211#define MSR_PERF_LIMIT_REASONS 0x0000064f 217#define MSR_PERF_LIMIT_REASONS 0x0000064f
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
index c5b7fb2774d0..cc071c6f7d4d 100644
--- a/arch/x86/include/asm/page_types.h
+++ b/arch/x86/include/asm/page_types.h
@@ -9,19 +9,21 @@
9#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 9#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
10#define PAGE_MASK (~(PAGE_SIZE-1)) 10#define PAGE_MASK (~(PAGE_SIZE-1))
11 11
12#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
13#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
14
15#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
16#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
17
12#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1)) 18#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
13#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) 19#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
14 20
15/* Cast PAGE_MASK to a signed type so that it is sign-extended if 21/* Cast *PAGE_MASK to a signed type so that it is sign-extended if
16 virtual addresses are 32-bits but physical addresses are larger 22 virtual addresses are 32-bits but physical addresses are larger
17 (ie, 32-bit PAE). */ 23 (ie, 32-bit PAE). */
18#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) 24#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
19 25#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
20#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) 26#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
21#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
22
23#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
24#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
25 27
26#define HPAGE_SHIFT PMD_SHIFT 28#define HPAGE_SHIFT PMD_SHIFT
27#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 29#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index e99cbe814ea8..d3eee663c41f 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -322,6 +322,16 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
322 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); 322 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
323} 323}
324 324
325static inline pte_t pte_clear_soft_dirty(pte_t pte)
326{
327 return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);
328}
329
330static inline pmd_t pmd_clear_soft_dirty(pmd_t pmd)
331{
332 return pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY);
333}
334
325#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ 335#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
326 336
327/* 337/*
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index dd5b0aa9dd2f..a471cadb9630 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -279,17 +279,14 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
279static inline pudval_t pud_pfn_mask(pud_t pud) 279static inline pudval_t pud_pfn_mask(pud_t pud)
280{ 280{
281 if (native_pud_val(pud) & _PAGE_PSE) 281 if (native_pud_val(pud) & _PAGE_PSE)
282 return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK; 282 return PHYSICAL_PUD_PAGE_MASK;
283 else 283 else
284 return PTE_PFN_MASK; 284 return PTE_PFN_MASK;
285} 285}
286 286
287static inline pudval_t pud_flags_mask(pud_t pud) 287static inline pudval_t pud_flags_mask(pud_t pud)
288{ 288{
289 if (native_pud_val(pud) & _PAGE_PSE) 289 return ~pud_pfn_mask(pud);
290 return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK);
291 else
292 return ~PTE_PFN_MASK;
293} 290}
294 291
295static inline pudval_t pud_flags(pud_t pud) 292static inline pudval_t pud_flags(pud_t pud)
@@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud)
300static inline pmdval_t pmd_pfn_mask(pmd_t pmd) 297static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
301{ 298{
302 if (native_pmd_val(pmd) & _PAGE_PSE) 299 if (native_pmd_val(pmd) & _PAGE_PSE)
303 return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK; 300 return PHYSICAL_PMD_PAGE_MASK;
304 else 301 else
305 return PTE_PFN_MASK; 302 return PTE_PFN_MASK;
306} 303}
307 304
308static inline pmdval_t pmd_flags_mask(pmd_t pmd) 305static inline pmdval_t pmd_flags_mask(pmd_t pmd)
309{ 306{
310 if (native_pmd_val(pmd) & _PAGE_PSE) 307 return ~pmd_pfn_mask(pmd);
311 return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK);
312 else
313 return ~PTE_PFN_MASK;
314} 308}
315 309
316static inline pmdval_t pmd_flags(pmd_t pmd) 310static inline pmdval_t pmd_flags(pmd_t pmd)
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 448b7ca61aee..14c63c7e8337 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -72,7 +72,8 @@
72#define SECONDARY_EXEC_SHADOW_VMCS 0x00004000 72#define SECONDARY_EXEC_SHADOW_VMCS 0x00004000
73#define SECONDARY_EXEC_ENABLE_PML 0x00020000 73#define SECONDARY_EXEC_ENABLE_PML 0x00020000
74#define SECONDARY_EXEC_XSAVES 0x00100000 74#define SECONDARY_EXEC_XSAVES 0x00100000
75 75#define SECONDARY_EXEC_PCOMMIT 0x00200000
76#define SECONDARY_EXEC_TSC_SCALING 0x02000000
76 77
77#define PIN_BASED_EXT_INTR_MASK 0x00000001 78#define PIN_BASED_EXT_INTR_MASK 0x00000001
78#define PIN_BASED_NMI_EXITING 0x00000008 79#define PIN_BASED_NMI_EXITING 0x00000008
@@ -167,6 +168,8 @@ enum vmcs_field {
167 VMWRITE_BITMAP = 0x00002028, 168 VMWRITE_BITMAP = 0x00002028,
168 XSS_EXIT_BITMAP = 0x0000202C, 169 XSS_EXIT_BITMAP = 0x0000202C,
169 XSS_EXIT_BITMAP_HIGH = 0x0000202D, 170 XSS_EXIT_BITMAP_HIGH = 0x0000202D,
171 TSC_MULTIPLIER = 0x00002032,
172 TSC_MULTIPLIER_HIGH = 0x00002033,
170 GUEST_PHYSICAL_ADDRESS = 0x00002400, 173 GUEST_PHYSICAL_ADDRESS = 0x00002400,
171 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401, 174 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401,
172 VMCS_LINK_POINTER = 0x00002800, 175 VMCS_LINK_POINTER = 0x00002800,
@@ -416,6 +419,7 @@ enum vmcs_field {
416#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) 419#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)
417#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) 420#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
418 421
422#define VMX_VPID_INVVPID_BIT (1ull << 0) /* (32 - 32) */
419#define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */ 423#define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */
420#define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */ 424#define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */
421 425
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 10002a46c593..1ae89a2721d6 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_X86_PLATFORM_H 1#ifndef _ASM_X86_PLATFORM_H
2#define _ASM_X86_PLATFORM_H 2#define _ASM_X86_PLATFORM_H
3 3
4#include <asm/pgtable_types.h>
5#include <asm/bootparam.h> 4#include <asm/bootparam.h>
6 5
7struct mpc_bus; 6struct mpc_bus;
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
index d866959e5685..8b2d4bea9962 100644
--- a/arch/x86/include/asm/xen/hypervisor.h
+++ b/arch/x86/include/asm/xen/hypervisor.h
@@ -57,4 +57,9 @@ static inline bool xen_x2apic_para_available(void)
57} 57}
58#endif 58#endif
59 59
60#ifdef CONFIG_HOTPLUG_CPU
61void xen_arch_register_cpu(int num);
62void xen_arch_unregister_cpu(int num);
63#endif
64
60#endif /* _ASM_X86_XEN_HYPERVISOR_H */ 65#endif /* _ASM_X86_XEN_HYPERVISOR_H */
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 0679e11d2cf7..f5fb840b43e8 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -12,7 +12,7 @@
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13 13
14#include <xen/interface/xen.h> 14#include <xen/interface/xen.h>
15#include <xen/grant_table.h> 15#include <xen/interface/grant_table.h>
16#include <xen/features.h> 16#include <xen/features.h>
17 17
18/* Xen machine address */ 18/* Xen machine address */
@@ -43,6 +43,8 @@ extern unsigned long *xen_p2m_addr;
43extern unsigned long xen_p2m_size; 43extern unsigned long xen_p2m_size;
44extern unsigned long xen_max_p2m_pfn; 44extern unsigned long xen_max_p2m_pfn;
45 45
46extern int xen_alloc_p2m_entry(unsigned long pfn);
47
46extern unsigned long get_phys_to_machine(unsigned long pfn); 48extern unsigned long get_phys_to_machine(unsigned long pfn);
47extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); 49extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
48extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn); 50extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
@@ -296,8 +298,8 @@ void make_lowmem_page_readwrite(void *vaddr);
296#define xen_unmap(cookie) iounmap((cookie)) 298#define xen_unmap(cookie) iounmap((cookie))
297 299
298static inline bool xen_arch_need_swiotlb(struct device *dev, 300static inline bool xen_arch_need_swiotlb(struct device *dev,
299 unsigned long pfn, 301 phys_addr_t phys,
300 unsigned long bfn) 302 dma_addr_t dev_addr)
301{ 303{
302 return false; 304 return false;
303} 305}
diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h
index f0412c50c47b..040d4083c24f 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -153,6 +153,12 @@
153/* MSR used to provide vcpu index */ 153/* MSR used to provide vcpu index */
154#define HV_X64_MSR_VP_INDEX 0x40000002 154#define HV_X64_MSR_VP_INDEX 0x40000002
155 155
156/* MSR used to reset the guest OS. */
157#define HV_X64_MSR_RESET 0x40000003
158
159/* MSR used to provide vcpu runtime in 100ns units */
160#define HV_X64_MSR_VP_RUNTIME 0x40000010
161
156/* MSR used to read the per-partition time reference counter */ 162/* MSR used to read the per-partition time reference counter */
157#define HV_X64_MSR_TIME_REF_COUNT 0x40000020 163#define HV_X64_MSR_TIME_REF_COUNT 0x40000020
158 164
@@ -251,4 +257,16 @@ typedef struct _HV_REFERENCE_TSC_PAGE {
251 __s64 tsc_offset; 257 __s64 tsc_offset;
252} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE; 258} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE;
253 259
260/* Define the number of synthetic interrupt sources. */
261#define HV_SYNIC_SINT_COUNT (16)
262/* Define the expected SynIC version. */
263#define HV_SYNIC_VERSION_1 (0x1)
264
265#define HV_SYNIC_CONTROL_ENABLE (1ULL << 0)
266#define HV_SYNIC_SIMP_ENABLE (1ULL << 0)
267#define HV_SYNIC_SIEFP_ENABLE (1ULL << 0)
268#define HV_SYNIC_SINT_MASKED (1ULL << 16)
269#define HV_SYNIC_SINT_AUTO_EOI (1ULL << 17)
270#define HV_SYNIC_SINT_VECTOR_MASK (0xFF)
271
254#endif 272#endif
diff --git a/arch/x86/include/uapi/asm/svm.h b/arch/x86/include/uapi/asm/svm.h
index b5d7640abc5d..8a4add8e4639 100644
--- a/arch/x86/include/uapi/asm/svm.h
+++ b/arch/x86/include/uapi/asm/svm.h
@@ -100,6 +100,7 @@
100 { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ 100 { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \
101 { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ 101 { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \
102 { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ 102 { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \
103 { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \
103 { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ 104 { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \
104 { SVM_EXIT_INTR, "interrupt" }, \ 105 { SVM_EXIT_INTR, "interrupt" }, \
105 { SVM_EXIT_NMI, "nmi" }, \ 106 { SVM_EXIT_NMI, "nmi" }, \
diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
index 37fee272618f..5b15d94a33f8 100644
--- a/arch/x86/include/uapi/asm/vmx.h
+++ b/arch/x86/include/uapi/asm/vmx.h
@@ -78,6 +78,7 @@
78#define EXIT_REASON_PML_FULL 62 78#define EXIT_REASON_PML_FULL 62
79#define EXIT_REASON_XSAVES 63 79#define EXIT_REASON_XSAVES 63
80#define EXIT_REASON_XRSTORS 64 80#define EXIT_REASON_XRSTORS 64
81#define EXIT_REASON_PCOMMIT 65
81 82
82#define VMX_EXIT_REASONS \ 83#define VMX_EXIT_REASONS \
83 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ 84 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \
@@ -126,7 +127,8 @@
126 { EXIT_REASON_INVVPID, "INVVPID" }, \ 127 { EXIT_REASON_INVVPID, "INVVPID" }, \
127 { EXIT_REASON_INVPCID, "INVPCID" }, \ 128 { EXIT_REASON_INVPCID, "INVPCID" }, \
128 { EXIT_REASON_XSAVES, "XSAVES" }, \ 129 { EXIT_REASON_XSAVES, "XSAVES" }, \
129 { EXIT_REASON_XRSTORS, "XRSTORS" } 130 { EXIT_REASON_XRSTORS, "XRSTORS" }, \
131 { EXIT_REASON_PCOMMIT, "PCOMMIT" }
130 132
131#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 133#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
132#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 134#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4