aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2017-09-04 06:25:27 -0400
committerIngo Molnar <mingo@kernel.org>2017-09-13 04:55:15 -0400
commit87930019c713873a1c3b9bd55dde46e81f70c8f1 (patch)
tree87348b581ecc3b19298e45aa685810c335c33f10
parentc7ad5ad297e644601747d6dbee978bf85e14f7bc (diff)
x86/paravirt: Remove no longer used paravirt functions
With removal of lguest some of the paravirt functions are no longer needed: ->read_cr4() ->store_idt() ->set_pmd_at() ->set_pud_at() ->pte_update() Remove them. Signed-off-by: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: akataria@vmware.com Cc: boris.ostrovsky@oracle.com Cc: chrisw@sous-sol.org Cc: jeremy@goop.org Cc: rusty@rustcorp.com.au Cc: virtualization@lists.linux-foundation.org Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/20170904102527.25409-1-jgross@suse.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/desc.h3
-rw-r--r--arch/x86/include/asm/paravirt.h37
-rw-r--r--arch/x86/include/asm/paravirt_types.h9
-rw-r--r--arch/x86/include/asm/pgtable.h27
-rw-r--r--arch/x86/include/asm/special_insns.h10
-rw-r--r--arch/x86/kernel/paravirt.c5
-rw-r--r--arch/x86/kvm/vmx.c2
-rw-r--r--arch/x86/mm/pgtable.c7
-rw-r--r--arch/x86/xen/enlighten_pv.c2
-rw-r--r--arch/x86/xen/mmu_pv.c2
10 files changed, 12 insertions, 92 deletions
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 1a2ba368da39..9d0e13738ed3 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -121,7 +121,6 @@ static inline int desc_empty(const void *ptr)
121#define load_ldt(ldt) asm volatile("lldt %0"::"m" (ldt)) 121#define load_ldt(ldt) asm volatile("lldt %0"::"m" (ldt))
122 122
123#define store_gdt(dtr) native_store_gdt(dtr) 123#define store_gdt(dtr) native_store_gdt(dtr)
124#define store_idt(dtr) native_store_idt(dtr)
125#define store_tr(tr) (tr = native_store_tr()) 124#define store_tr(tr) (tr = native_store_tr())
126 125
127#define load_TLS(t, cpu) native_load_tls(t, cpu) 126#define load_TLS(t, cpu) native_load_tls(t, cpu)
@@ -228,7 +227,7 @@ static inline void native_store_gdt(struct desc_ptr *dtr)
228 asm volatile("sgdt %0":"=m" (*dtr)); 227 asm volatile("sgdt %0":"=m" (*dtr));
229} 228}
230 229
231static inline void native_store_idt(struct desc_ptr *dtr) 230static inline void store_idt(struct desc_ptr *dtr)
232{ 231{
233 asm volatile("sidt %0":"=m" (*dtr)); 232 asm volatile("sidt %0":"=m" (*dtr));
234} 233}
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index c25dd22f7c70..12deec722cf0 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -71,11 +71,6 @@ static inline void write_cr3(unsigned long x)
71 PVOP_VCALL1(pv_mmu_ops.write_cr3, x); 71 PVOP_VCALL1(pv_mmu_ops.write_cr3, x);
72} 72}
73 73
74static inline unsigned long __read_cr4(void)
75{
76 return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4);
77}
78
79static inline void __write_cr4(unsigned long x) 74static inline void __write_cr4(unsigned long x)
80{ 75{
81 PVOP_VCALL1(pv_cpu_ops.write_cr4, x); 76 PVOP_VCALL1(pv_cpu_ops.write_cr4, x);
@@ -228,10 +223,6 @@ static inline void set_ldt(const void *addr, unsigned entries)
228{ 223{
229 PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries); 224 PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries);
230} 225}
231static inline void store_idt(struct desc_ptr *dtr)
232{
233 PVOP_VCALL1(pv_cpu_ops.store_idt, dtr);
234}
235static inline unsigned long paravirt_store_tr(void) 226static inline unsigned long paravirt_store_tr(void)
236{ 227{
237 return PVOP_CALL0(unsigned long, pv_cpu_ops.store_tr); 228 return PVOP_CALL0(unsigned long, pv_cpu_ops.store_tr);
@@ -365,12 +356,6 @@ static inline void paravirt_release_p4d(unsigned long pfn)
365 PVOP_VCALL1(pv_mmu_ops.release_p4d, pfn); 356 PVOP_VCALL1(pv_mmu_ops.release_p4d, pfn);
366} 357}
367 358
368static inline void pte_update(struct mm_struct *mm, unsigned long addr,
369 pte_t *ptep)
370{
371 PVOP_VCALL3(pv_mmu_ops.pte_update, mm, addr, ptep);
372}
373
374static inline pte_t __pte(pteval_t val) 359static inline pte_t __pte(pteval_t val)
375{ 360{
376 pteval_t ret; 361 pteval_t ret;
@@ -472,28 +457,6 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
472 PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte); 457 PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte);
473} 458}
474 459
475static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
476 pmd_t *pmdp, pmd_t pmd)
477{
478 if (sizeof(pmdval_t) > sizeof(long))
479 /* 5 arg words */
480 pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd);
481 else
482 PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp,
483 native_pmd_val(pmd));
484}
485
486static inline void set_pud_at(struct mm_struct *mm, unsigned long addr,
487 pud_t *pudp, pud_t pud)
488{
489 if (sizeof(pudval_t) > sizeof(long))
490 /* 5 arg words */
491 pv_mmu_ops.set_pud_at(mm, addr, pudp, pud);
492 else
493 PVOP_VCALL4(pv_mmu_ops.set_pud_at, mm, addr, pudp,
494 native_pud_val(pud));
495}
496
497static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) 460static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
498{ 461{
499 pmdval_t val = native_pmd_val(pmd); 462 pmdval_t val = native_pmd_val(pmd);
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 6b64fc6367f2..42873edd9f9d 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -107,7 +107,6 @@ struct pv_cpu_ops {
107 unsigned long (*read_cr0)(void); 107 unsigned long (*read_cr0)(void);
108 void (*write_cr0)(unsigned long); 108 void (*write_cr0)(unsigned long);
109 109
110 unsigned long (*read_cr4)(void);
111 void (*write_cr4)(unsigned long); 110 void (*write_cr4)(unsigned long);
112 111
113#ifdef CONFIG_X86_64 112#ifdef CONFIG_X86_64
@@ -119,8 +118,6 @@ struct pv_cpu_ops {
119 void (*load_tr_desc)(void); 118 void (*load_tr_desc)(void);
120 void (*load_gdt)(const struct desc_ptr *); 119 void (*load_gdt)(const struct desc_ptr *);
121 void (*load_idt)(const struct desc_ptr *); 120 void (*load_idt)(const struct desc_ptr *);
122 /* store_gdt has been removed. */
123 void (*store_idt)(struct desc_ptr *);
124 void (*set_ldt)(const void *desc, unsigned entries); 121 void (*set_ldt)(const void *desc, unsigned entries);
125 unsigned long (*store_tr)(void); 122 unsigned long (*store_tr)(void);
126 void (*load_tls)(struct thread_struct *t, unsigned int cpu); 123 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
@@ -245,12 +242,6 @@ struct pv_mmu_ops {
245 void (*set_pte_at)(struct mm_struct *mm, unsigned long addr, 242 void (*set_pte_at)(struct mm_struct *mm, unsigned long addr,
246 pte_t *ptep, pte_t pteval); 243 pte_t *ptep, pte_t pteval);
247 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); 244 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
248 void (*set_pmd_at)(struct mm_struct *mm, unsigned long addr,
249 pmd_t *pmdp, pmd_t pmdval);
250 void (*set_pud_at)(struct mm_struct *mm, unsigned long addr,
251 pud_t *pudp, pud_t pudval);
252 void (*pte_update)(struct mm_struct *mm, unsigned long addr,
253 pte_t *ptep);
254 245
255 pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr, 246 pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr,
256 pte_t *ptep); 247 pte_t *ptep);
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 5b4c44d419c5..b714934512b3 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -55,8 +55,6 @@ extern pmdval_t early_pmd_flags;
55#else /* !CONFIG_PARAVIRT */ 55#else /* !CONFIG_PARAVIRT */
56#define set_pte(ptep, pte) native_set_pte(ptep, pte) 56#define set_pte(ptep, pte) native_set_pte(ptep, pte)
57#define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte) 57#define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
58#define set_pmd_at(mm, addr, pmdp, pmd) native_set_pmd_at(mm, addr, pmdp, pmd)
59#define set_pud_at(mm, addr, pudp, pud) native_set_pud_at(mm, addr, pudp, pud)
60 58
61#define set_pte_atomic(ptep, pte) \ 59#define set_pte_atomic(ptep, pte) \
62 native_set_pte_atomic(ptep, pte) 60 native_set_pte_atomic(ptep, pte)
@@ -87,8 +85,6 @@ extern pmdval_t early_pmd_flags;
87#define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep) 85#define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep)
88#define pmd_clear(pmd) native_pmd_clear(pmd) 86#define pmd_clear(pmd) native_pmd_clear(pmd)
89 87
90#define pte_update(mm, addr, ptep) do { } while (0)
91
92#define pgd_val(x) native_pgd_val(x) 88#define pgd_val(x) native_pgd_val(x)
93#define __pgd(x) native_make_pgd(x) 89#define __pgd(x) native_make_pgd(x)
94 90
@@ -979,31 +975,18 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
979 native_set_pte(ptep, pte); 975 native_set_pte(ptep, pte);
980} 976}
981 977
982static inline void native_set_pmd_at(struct mm_struct *mm, unsigned long addr, 978static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
983 pmd_t *pmdp , pmd_t pmd) 979 pmd_t *pmdp, pmd_t pmd)
984{ 980{
985 native_set_pmd(pmdp, pmd); 981 native_set_pmd(pmdp, pmd);
986} 982}
987 983
988static inline void native_set_pud_at(struct mm_struct *mm, unsigned long addr, 984static inline void set_pud_at(struct mm_struct *mm, unsigned long addr,
989 pud_t *pudp, pud_t pud) 985 pud_t *pudp, pud_t pud)
990{ 986{
991 native_set_pud(pudp, pud); 987 native_set_pud(pudp, pud);
992} 988}
993 989
994#ifndef CONFIG_PARAVIRT
995/*
996 * Rules for using pte_update - it must be called after any PTE update which
997 * has not been done using the set_pte / clear_pte interfaces. It is used by
998 * shadow mode hypervisors to resynchronize the shadow page tables. Kernel PTE
999 * updates should either be sets, clears, or set_pte_atomic for P->P
1000 * transitions, which means this hook should only be called for user PTEs.
1001 * This hook implies a P->P protection or access change has taken place, which
1002 * requires a subsequent TLB flush.
1003 */
1004#define pte_update(mm, addr, ptep) do { } while (0)
1005#endif
1006
1007/* 990/*
1008 * We only update the dirty/accessed state if we set 991 * We only update the dirty/accessed state if we set
1009 * the dirty bit by hand in the kernel, since the hardware 992 * the dirty bit by hand in the kernel, since the hardware
@@ -1031,7 +1014,6 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
1031 pte_t *ptep) 1014 pte_t *ptep)
1032{ 1015{
1033 pte_t pte = native_ptep_get_and_clear(ptep); 1016 pte_t pte = native_ptep_get_and_clear(ptep);
1034 pte_update(mm, addr, ptep);
1035 return pte; 1017 return pte;
1036} 1018}
1037 1019
@@ -1058,7 +1040,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm,
1058 unsigned long addr, pte_t *ptep) 1040 unsigned long addr, pte_t *ptep)
1059{ 1041{
1060 clear_bit(_PAGE_BIT_RW, (unsigned long *)&ptep->pte); 1042 clear_bit(_PAGE_BIT_RW, (unsigned long *)&ptep->pte);
1061 pte_update(mm, addr, ptep);
1062} 1043}
1063 1044
1064#define flush_tlb_fix_spurious_fault(vma, address) do { } while (0) 1045#define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index 9efaabf5b54b..a24dfcf79f4a 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -135,6 +135,11 @@ static inline void native_wbinvd(void)
135 135
136extern asmlinkage void native_load_gs_index(unsigned); 136extern asmlinkage void native_load_gs_index(unsigned);
137 137
138static inline unsigned long __read_cr4(void)
139{
140 return native_read_cr4();
141}
142
138#ifdef CONFIG_PARAVIRT 143#ifdef CONFIG_PARAVIRT
139#include <asm/paravirt.h> 144#include <asm/paravirt.h>
140#else 145#else
@@ -173,11 +178,6 @@ static inline void write_cr3(unsigned long x)
173 native_write_cr3(x); 178 native_write_cr3(x);
174} 179}
175 180
176static inline unsigned long __read_cr4(void)
177{
178 return native_read_cr4();
179}
180
181static inline void __write_cr4(unsigned long x) 181static inline void __write_cr4(unsigned long x)
182{ 182{
183 native_write_cr4(x); 183 native_write_cr4(x);
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index a14df9eecfed..19a3e8f961c7 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -327,7 +327,6 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
327 .set_debugreg = native_set_debugreg, 327 .set_debugreg = native_set_debugreg,
328 .read_cr0 = native_read_cr0, 328 .read_cr0 = native_read_cr0,
329 .write_cr0 = native_write_cr0, 329 .write_cr0 = native_write_cr0,
330 .read_cr4 = native_read_cr4,
331 .write_cr4 = native_write_cr4, 330 .write_cr4 = native_write_cr4,
332#ifdef CONFIG_X86_64 331#ifdef CONFIG_X86_64
333 .read_cr8 = native_read_cr8, 332 .read_cr8 = native_read_cr8,
@@ -343,7 +342,6 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
343 .set_ldt = native_set_ldt, 342 .set_ldt = native_set_ldt,
344 .load_gdt = native_load_gdt, 343 .load_gdt = native_load_gdt,
345 .load_idt = native_load_idt, 344 .load_idt = native_load_idt,
346 .store_idt = native_store_idt,
347 .store_tr = native_store_tr, 345 .store_tr = native_store_tr,
348 .load_tls = native_load_tls, 346 .load_tls = native_load_tls,
349#ifdef CONFIG_X86_64 347#ifdef CONFIG_X86_64
@@ -411,8 +409,6 @@ struct pv_mmu_ops pv_mmu_ops __ro_after_init = {
411 .set_pte = native_set_pte, 409 .set_pte = native_set_pte,
412 .set_pte_at = native_set_pte_at, 410 .set_pte_at = native_set_pte_at,
413 .set_pmd = native_set_pmd, 411 .set_pmd = native_set_pmd,
414 .set_pmd_at = native_set_pmd_at,
415 .pte_update = paravirt_nop,
416 412
417 .ptep_modify_prot_start = __ptep_modify_prot_start, 413 .ptep_modify_prot_start = __ptep_modify_prot_start,
418 .ptep_modify_prot_commit = __ptep_modify_prot_commit, 414 .ptep_modify_prot_commit = __ptep_modify_prot_commit,
@@ -424,7 +420,6 @@ struct pv_mmu_ops pv_mmu_ops __ro_after_init = {
424 .pmd_clear = native_pmd_clear, 420 .pmd_clear = native_pmd_clear,
425#endif 421#endif
426 .set_pud = native_set_pud, 422 .set_pud = native_set_pud,
427 .set_pud_at = native_set_pud_at,
428 423
429 .pmd_val = PTE_IDENT, 424 .pmd_val = PTE_IDENT,
430 .make_pmd = PTE_IDENT, 425 .make_pmd = PTE_IDENT,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4253adef9044..699704d4bc9e 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5192,7 +5192,7 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
5192 vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ 5192 vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */
5193 vmcs_write16(HOST_TR_SELECTOR, GDT_ENTRY_TSS*8); /* 22.2.4 */ 5193 vmcs_write16(HOST_TR_SELECTOR, GDT_ENTRY_TSS*8); /* 22.2.4 */
5194 5194
5195 native_store_idt(&dt); 5195 store_idt(&dt);
5196 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */ 5196 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */
5197 vmx->host_idt_base = dt.address; 5197 vmx->host_idt_base = dt.address;
5198 5198
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 218834a3e9ad..b372f3442bbf 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -426,10 +426,8 @@ int ptep_set_access_flags(struct vm_area_struct *vma,
426{ 426{
427 int changed = !pte_same(*ptep, entry); 427 int changed = !pte_same(*ptep, entry);
428 428
429 if (changed && dirty) { 429 if (changed && dirty)
430 *ptep = entry; 430 *ptep = entry;
431 pte_update(vma->vm_mm, address, ptep);
432 }
433 431
434 return changed; 432 return changed;
435} 433}
@@ -486,9 +484,6 @@ int ptep_test_and_clear_young(struct vm_area_struct *vma,
486 ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, 484 ret = test_and_clear_bit(_PAGE_BIT_ACCESSED,
487 (unsigned long *) &ptep->pte); 485 (unsigned long *) &ptep->pte);
488 486
489 if (ret)
490 pte_update(vma->vm_mm, addr, ptep);
491
492 return ret; 487 return ret;
493} 488}
494 489
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index ae2a2e2d6362..69b9deff7e5c 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1038,7 +1038,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
1038 .read_cr0 = xen_read_cr0, 1038 .read_cr0 = xen_read_cr0,
1039 .write_cr0 = xen_write_cr0, 1039 .write_cr0 = xen_write_cr0,
1040 1040
1041 .read_cr4 = native_read_cr4,
1042 .write_cr4 = xen_write_cr4, 1041 .write_cr4 = xen_write_cr4,
1043 1042
1044#ifdef CONFIG_X86_64 1043#ifdef CONFIG_X86_64
@@ -1073,7 +1072,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
1073 .alloc_ldt = xen_alloc_ldt, 1072 .alloc_ldt = xen_alloc_ldt,
1074 .free_ldt = xen_free_ldt, 1073 .free_ldt = xen_free_ldt,
1075 1074
1076 .store_idt = native_store_idt,
1077 .store_tr = xen_store_tr, 1075 .store_tr = xen_store_tr,
1078 1076
1079 .write_ldt_entry = xen_write_ldt_entry, 1077 .write_ldt_entry = xen_write_ldt_entry,
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index 6b983b300666..509f560bd0c6 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -2409,8 +2409,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
2409 .flush_tlb_single = xen_flush_tlb_single, 2409 .flush_tlb_single = xen_flush_tlb_single,
2410 .flush_tlb_others = xen_flush_tlb_others, 2410 .flush_tlb_others = xen_flush_tlb_others,
2411 2411
2412 .pte_update = paravirt_nop,
2413
2414 .pgd_alloc = xen_pgd_alloc, 2412 .pgd_alloc = xen_pgd_alloc,
2415 .pgd_free = xen_pgd_free, 2413 .pgd_free = xen_pgd_free,
2416 2414