x86/paravirt, xen: several cleanups
Subsystems (14)
Borislav Petkov
maintainerRe: [tip:x86/paravirt] x86/paravirt: Move the pv_irq_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossQuoted 1 line · Juergen Gross
And the fixing patch is already there:
Yeah, tglx just told me :)
Thx!
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.Juergen Gross
maintainerPATCH v3 13/15 x86/paravirt: move the pv_irq_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossAll of the paravirt ops defined in pv_irq_ops are for Xen PV guests or VSMP only. Define them only if CONFIG_PARAVIRT_XXL is set.
---
V3:
- put all irq ops under XXL (Peter Zijlstra)
--- arch/x86/include/asm/irqflags.h | 8 +------- arch/x86/include/asm/paravirt.h | 6 +++--- arch/x86/include/asm/paravirt_types.h | 3 ++- arch/x86/kernel/asm-offsets.c | 2 +- arch/x86/kernel/asm-offsets_64.c | 2 +- arch/x86/kernel/paravirt.c | 2 +- arch/x86/kernel/paravirt_patch_32.c | 4 ++-- arch/x86/kernel/paravirt_patch_64.c | 4 +++- arch/x86/kernel/vsmp_64.c | 2 +- 9 files changed, 15 insertions(+), 18 deletions(-)
arch/x86/include/asm/irqflags.h +1 -7
@@ -63,7 +63,7 @@ static inline __cpuidle void native_halt(void)#endif -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #ifndef __ASSEMBLY__
@@ -125,13 +125,7 @@ static inline notrace unsigned long arch_local_irq_save(void)#ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (x) pushfq; popq %rax#endif -#endif -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_PARAVIRT */ -#ifndef CONFIG_PARAVIRT_XXL -#ifdef __ASSEMBLY__ -#ifdef CONFIG_X86_64 #define SWAPGS swapgs/* * Currently paravirt can't handle swapgs nicely when we
arch/x86/include/asm/paravirt.h +3 -3
@@ -91,7 +91,6 @@ static inline void write_cr8(unsigned long x) PVOP_VCALL1(cpu.write_cr8, x); }#endif -#endif static inline void arch_safe_halt (void ) {
@@ -103,7 +102,6 @@ static inline void halt(void)PVOP_VCALL0 (irq.halt); } -#ifdef CONFIG_PARAVIRT_XXL static inline void wbinvd (void ) {PVOP_VCALL0 (cpu.wbinvd);
@@ -770,6 +768,7 @@ bool __raw_callee_save___native_vcpu_is_preempted(long cpu);#define __PV_IS_CALLEE_SAVE (func) \ ((struct paravirt_callee_save) { func }) +#ifdef CONFIG_PARAVIRT_XXL static inline notrace unsigned long arch_local_save_flags (void ) { return PVOP_CALLEE0(unsigned long, irq.save_fl);
@@ -798,6 +797,7 @@ static inline notrace unsigned long arch_local_irq_save(void)arch_local_irq_disable (); return f; } +#endif /* Make sure as little as possible of this mess escapes. */
@@ -884,7 +884,6 @@ extern void default_banner(void);PARA_SITE (PARA_PATCH (PV_CPU_iret), \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_ops+PV_CPU_iret);) -#endif #define DISABLE_INTERRUPTS (clobbers) \ PARA_SITE(PARA_PATCH(PV_IRQ_irq_disable), \
@@ -899,6 +898,7 @@ extern void default_banner(void);ANNOTATE_RETPOLINE_SAFE ; \ call PARA_INDIRECT(pv_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) +#endif #ifdef CONFIG_X86_64 #ifdef CONFIG_PARAVIRT_XXL
arch/x86/include/asm/paravirt_types.h +2 -1
@@ -184,6 +184,7 @@ struct pv_cpu_ops { } __no_randomize_layout;struct pv_irq_ops { +#ifdef CONFIG_PARAVIRT_XXL /* * Get/set interrupt state. save_fl and restore_fl are only * expected to use X86_EFLAGS_IF; all other bits
@@ -200,7 +201,7 @@ struct pv_irq_ops {void (*safe_halt)(void );void (*halt)(void ); - +#endif } __no_randomize_layout;struct pv_mmu_ops {
arch/x86/kernel/asm-offsets.c +1 -1
@@ -66,9 +66,9 @@ void common(void) {#ifdef CONFIG_PARAVIRT BLANK (); +#ifdef CONFIG_PARAVIRT_XXL OFFSET (PV_IRQ_irq_disable, paravirt_patch_template, irq.irq_disable);OFFSET (PV_IRQ_irq_enable, paravirt_patch_template, irq.irq_enable); -#ifdef CONFIG_PARAVIRT_XXL OFFSET (PV_CPU_iret, paravirt_patch_template, cpu.iret);#endif OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);
arch/x86/kernel/asm-offsets_64.c +1 -1
@@ -25,9 +25,9 @@ int main(void)OFFSET (PV_CPU_usergs_sysret64, paravirt_patch_template, cpu.usergs_sysret64);OFFSET (PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs); -#endif #ifdef CONFIG_DEBUG_ENTRY OFFSET (PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl); +#endif #endif BLANK ();#endif
arch/x86/kernel/paravirt.c +1 -1
@@ -373,7 +373,6 @@ struct paravirt_patch_template pv_ops = { .cpu.start_context_switch = paravirt_nop, .cpu.end_context_switch = paravirt_nop, -#endif /* Irq ops. */ .irq.save_fl = __PV_IS_CALLEE_SAVE(native_save_fl),
@@ -382,6 +381,7 @@ struct paravirt_patch_template pv_ops = { .irq.irq_enable = __PV_IS_CALLEE_SAVE(native_irq_enable), .irq.safe_halt = native_safe_halt, .irq.halt = native_halt, +#endif /* Mmu ops. */ .mmu.read_cr2 = native_read_cr2,
arch/x86/kernel/paravirt_patch_32.c +2 -2
@@ -1,11 +1,11 @@// SPDX-License-Identifier: GPL-2.0 #include <asm/paravirt.h> +#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (irq, irq_disable,"cli" );DEF_NATIVE (irq, irq_enable,"sti" );DEF_NATIVE (irq, restore_fl,"push %eax; popf" );DEF_NATIVE (irq, save_fl,"pushf; pop %eax" ); -#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (cpu, iret,"iret" );#endif DEF_NATIVE (mmu, read_cr2,"mov %cr2, %eax" );
@@ -43,11 +43,11 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len) end = end_##ops##_##x; \ goto patch_siteswitch (type) { +#ifdef CONFIG_PARAVIRT_XXL PATCH_SITE (irq, irq_disable);PATCH_SITE (irq, irq_enable);PATCH_SITE (irq, restore_fl);PATCH_SITE (irq, save_fl); -#ifdef CONFIG_PARAVIRT_XXL PATCH_SITE (cpu, iret);#endif PATCH_SITE (mmu, read_cr2);
arch/x86/kernel/paravirt_patch_64.c +3 -1
@@ -3,10 +3,12 @@#include <asm/asm-offsets.h> #include <linux/stringify.h> +#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (irq, irq_disable,"cli" );DEF_NATIVE (irq, irq_enable,"sti" );DEF_NATIVE (irq, restore_fl,"pushq %rdi; popfq" );DEF_NATIVE (irq, save_fl,"pushfq; popq %rax" ); +#endif DEF_NATIVE (mmu, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (mmu, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (mmu, write_cr3,"movq %rdi, %cr3" );
@@ -51,11 +53,11 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len) end = end_##ops##_##x; \ goto patch_siteswitch (type) { +#ifdef CONFIG_PARAVIRT_XXL PATCH_SITE (irq, restore_fl);PATCH_SITE (irq, save_fl);PATCH_SITE (irq, irq_enable);PATCH_SITE (irq, irq_disable); -#ifdef CONFIG_PARAVIRT_XXL PATCH_SITE (cpu, usergs_sysret64);PATCH_SITE (cpu, swapgs);PATCH_SITE (cpu, wbinvd);
arch/x86/kernel/vsmp_64.c +1 -1
@@ -26,7 +26,7 @@#define TOPOLOGY_REGISTER_OFFSET 0x10 -#if definedCONFIG_PCI && definedCONFIG_PARAVIRT +#if definedCONFIG_PCI && definedCONFIG_PARAVIRT_XXL /* * Interrupt control on vSMPowered systems: * ~AC is a shadow of IF. If IF is 'on' AC should be 'off'
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 14/15 x86/paravirt: move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossMost of the paravirt ops defined in pv_mmu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/include/asm/mmu_context.h | 4 +- arch/x86/include/asm/paravirt.h | 125 +++++++++++++++++----------------- arch/x86/include/asm/paravirt_types.h | 33 ++++----- arch/x86/include/asm/pgalloc.h | 2 +- arch/x86/include/asm/pgtable.h | 7 +- arch/x86/include/asm/special_insns.h | 11 +-- arch/x86/kernel/asm-offsets.c | 4 +- arch/x86/kernel/head_64.S | 4 +- arch/x86/kernel/paravirt.c | 15 ++-- arch/x86/kernel/paravirt_patch_32.c | 4 +- arch/x86/kernel/paravirt_patch_64.c | 4 +- 12 files changed, 103 insertions(+), 112 deletions(-)
arch/x86/include/asm/fixmap.h +1 -1
@@ -152,7 +152,7 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);void native_set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags) {
arch/x86/include/asm/mmu_context.h +2 -2
@@ -16,12 +16,12 @@extern atomic64_t last_mm_ctx_id; -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void paravirt_activate_mm (struct mm_struct *prev,struct mm_struct *next) { } -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ #ifdef CONFIG_PERF_EVENTS
arch/x86/include/asm/paravirt.h +63 -62
194 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +17 -16
@@ -91,13 +91,14 @@ struct pv_init_ops { unsigned long addr, unsigned len); } __no_randomize_layout; - +#ifdef CONFIG_PARAVIRT_XXL struct pv_lazy_ops {/* Set deferred update mode, used for batching operations. */ void (*enter)(void );void (*leave)(void );void (*flush)(void ); } __no_randomize_layout; +#endif struct pv_time_ops {unsigned long long (*sched_clock)(void );
@@ -205,31 +206,30 @@ struct pv_irq_ops { } __no_randomize_layout;struct pv_mmu_ops { +/* TLB operations */ +void (*flush_tlb_user)(void ); +void (*flush_tlb_kernel)(void ); +void (*flush_tlb_one_user)(unsigned long addr); +void (*flush_tlb_others)(const struct cpumask *cpus, +const struct flush_tlb_info *info); + +void (*tlb_remove_table)(struct mmu_gather *tlb,void *table); + +/* Hook for intercepting the destruction of an mm_struct. */ +void (*exit_mmap)(struct mm_struct *mm); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*read_cr2)(void );void (*write_cr2)(unsigned long );unsigned long (*read_cr3)(void );void (*write_cr3)(unsigned long ); -/* -* Hooks for intercepting the creation/use/destruction of an -* mm_struct. -*/ +/* Hooks for intercepting the creation/use of an mm_struct. */ void (*activate_mm)(struct mm_struct *prev,struct mm_struct *next);void (*dup_mmap)(struct mm_struct *oldmm,struct mm_struct *mm); -void (*exit_mmap)(struct mm_struct *mm); - - -/* TLB operations */ -void (*flush_tlb_user)(void ); -void (*flush_tlb_kernel)(void ); -void (*flush_tlb_one_user)(unsigned long addr); -void (*flush_tlb_others)(const struct cpumask *cpus, -const struct flush_tlb_info *info); - -void (*tlb_remove_table)(struct mmu_gather *tlb,void *table);/* Hooks for allocating and freeing a pagetable top-level */ int (*pgd_alloc)(struct mm_struct *mm);
@@ -304,6 +304,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); +#endif } __no_randomize_layout;struct arch_spinlock ;
arch/x86/include/asm/pgalloc.h +1 -1
@@ -8,7 +8,7 @@static inline int __paravirt_pgd_alloc (struct mm_struct *mm) {return 0 ; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define paravirt_pgd_alloc (mm) __paravirt_pgd_alloc(mm)
arch/x86/include/asm/pgtable.h +2 -5
@@ -55,9 +55,9 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);extern pmdval_t early_pmd_flags; -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#else /* !CONFIG_PARAVIRT */ +#else /* !CONFIG_PARAVIRT_XXL */ #define set_pte (ptep, pte) native_set_pte(ptep, pte)#define set_pte_at (mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
@@ -111,9 +111,6 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#endif /* CONFIG_PARAVIRT */ - -#ifndef CONFIG_PARAVIRT_XXL #define arch_end_context_switch (prev) do {} while(0)#endif /* CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/special_insns.h +3 -8
@@ -141,11 +141,10 @@ static inline unsigned long __read_cr4(void)return native_read_cr4 (); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#endif +#else -#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -155,9 +154,7 @@ static inline void write_cr0(unsigned long x) {native_write_cr0 (x); } -#endif -#ifndef CONFIG_PARAVIRT static inline unsigned long read_cr2 (void ) {return native_read_cr2 ();
@@ -181,9 +178,7 @@ static inline void write_cr3(unsigned long x) {native_write_cr3 (x); } -#endif -#ifndef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {native_write_cr4 (x);
@@ -213,7 +208,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT_XXL */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +1 -3
@@ -64,13 +64,11 @@ void common(void) {OFFSET (IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);#endif -#ifdef CONFIG_PARAVIRT -BLANK ();#ifdef CONFIG_PARAVIRT_XXL +BLANK ();OFFSET (PV_IRQ_irq_disable, paravirt_patch_template, irq.irq_disable);OFFSET (PV_IRQ_irq_enable, paravirt_patch_template, irq.irq_enable);OFFSET (PV_CPU_iret, paravirt_patch_template, cpu.iret); -#endif OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
arch/x86/kernel/head_64.S +1 -3
@@ -25,14 +25,12 @@ #include <asm/export.h> #include <asm/nospec-branch.h> -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/asm-offsets.h> #include <asm/paravirt.h> #define GET_CR2_INTO(reg) GET_CR2_INTO_RAX ; movq %rax, reg #else #define GET_CR2_INTO(reg) movq %cr2, reg -#endif -#ifndef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN iretq #endif
arch/x86/kernel/paravirt.c +9 -6
@@ -384,11 +384,6 @@ struct paravirt_patch_template pv_ops = {#endif /* Mmu ops. */ - .mmu.read_cr2 = native_read_cr2, - .mmu.write_cr2 = native_write_cr2, - .mmu.read_cr3 = __native_read_cr3, - .mmu.write_cr3 = native_write_cr3, - .mmu.flush_tlb_user = native_flush_tlb, .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user,
@@ -396,6 +391,14 @@ struct paravirt_patch_template pv_ops = { .mmu.tlb_remove_table = (void (*)(struct mmu_gather *, void *))tlb_remove_page, + .mmu.exit_mmap = paravirt_nop, + +#ifdef CONFIG_PARAVIRT_XXL + .mmu.read_cr2 = native_read_cr2, + .mmu.write_cr2 = native_write_cr2, + .mmu.read_cr3 = __native_read_cr3, + .mmu.write_cr3 = native_write_cr3, + .mmu.pgd_alloc = __paravirt_pgd_alloc, .mmu.pgd_free = paravirt_nop,
@@ -448,7 +451,6 @@ struct paravirt_patch_template pv_ops = { .mmu.make_pgd = PTE_IDENT, .mmu.dup_mmap = paravirt_nop, - .mmu.exit_mmap = paravirt_nop, .mmu.activate_mm = paravirt_nop, .mmu.lazy_mode = {
@@ -458,6 +460,7 @@ struct paravirt_patch_template pv_ops = { }, .mmu.set_fixmap = native_set_fixmap, +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )/* Lock ops. */
arch/x86/kernel/paravirt_patch_32.c +2 -2
@@ -7,10 +7,10 @@ DEF_NATIVE(irq, irq_enable, "sti");DEF_NATIVE (irq, restore_fl,"push %eax; popf" );DEF_NATIVE (irq, save_fl,"pushf; pop %eax" );DEF_NATIVE (cpu, iret,"iret" ); -#endif DEF_NATIVE (mmu, read_cr2,"mov %cr2, %eax" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" ); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )DEF_NATIVE (lock, queued_spin_unlock,"movb $0, (%eax)" );
@@ -49,10 +49,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (irq, restore_fl);PATCH_SITE (irq, save_fl);PATCH_SITE (cpu, iret); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
arch/x86/kernel/paravirt_patch_64.c +1 -3
@@ -8,11 +8,9 @@ DEF_NATIVE(irq, irq_disable, "cli");DEF_NATIVE (irq, irq_enable,"sti" );DEF_NATIVE (irq, restore_fl,"pushq %rdi; popfq" );DEF_NATIVE (irq, save_fl,"pushfq; popq %rax" ); -#endif DEF_NATIVE (mmu, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (mmu, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (mmu, write_cr3,"movq %rdi, %cr3" ); -#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (cpu, wbinvd,"wbinvd" );DEF_NATIVE (cpu, usergs_sysret64,"swapgs; sysretq" );
@@ -61,10 +59,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (cpu, usergs_sysret64);PATCH_SITE (cpu, swapgs);PATCH_SITE (cpu, wbinvd); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 14/15 x86/paravirt: move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossMost of the paravirt ops defined in pv_mmu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/include/asm/mmu_context.h | 4 +- arch/x86/include/asm/paravirt.h | 125 +++++++++++++++++----------------- arch/x86/include/asm/paravirt_types.h | 33 ++++----- arch/x86/include/asm/pgalloc.h | 2 +- arch/x86/include/asm/pgtable.h | 7 +- arch/x86/include/asm/special_insns.h | 11 +-- arch/x86/kernel/asm-offsets.c | 4 +- arch/x86/kernel/head_64.S | 4 +- arch/x86/kernel/paravirt.c | 15 ++-- arch/x86/kernel/paravirt_patch_32.c | 4 +- arch/x86/kernel/paravirt_patch_64.c | 4 +- 12 files changed, 103 insertions(+), 112 deletions(-)
arch/x86/include/asm/fixmap.h +1 -1
@@ -152,7 +152,7 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);void native_set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags) {
arch/x86/include/asm/mmu_context.h +2 -2
@@ -16,12 +16,12 @@extern atomic64_t last_mm_ctx_id; -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void paravirt_activate_mm (struct mm_struct *prev,struct mm_struct *next) { } -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ #ifdef CONFIG_PERF_EVENTS
arch/x86/include/asm/paravirt.h +63 -62
194 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +17 -16
@@ -91,13 +91,14 @@ struct pv_init_ops { unsigned long addr, unsigned len); } __no_randomize_layout; - +#ifdef CONFIG_PARAVIRT_XXL struct pv_lazy_ops {/* Set deferred update mode, used for batching operations. */ void (*enter)(void );void (*leave)(void );void (*flush)(void ); } __no_randomize_layout; +#endif struct pv_time_ops {unsigned long long (*sched_clock)(void );
@@ -205,31 +206,30 @@ struct pv_irq_ops { } __no_randomize_layout;struct pv_mmu_ops { +/* TLB operations */ +void (*flush_tlb_user)(void ); +void (*flush_tlb_kernel)(void ); +void (*flush_tlb_one_user)(unsigned long addr); +void (*flush_tlb_others)(const struct cpumask *cpus, +const struct flush_tlb_info *info); + +void (*tlb_remove_table)(struct mmu_gather *tlb,void *table); + +/* Hook for intercepting the destruction of an mm_struct. */ +void (*exit_mmap)(struct mm_struct *mm); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*read_cr2)(void );void (*write_cr2)(unsigned long );unsigned long (*read_cr3)(void );void (*write_cr3)(unsigned long ); -/* -* Hooks for intercepting the creation/use/destruction of an -* mm_struct. -*/ +/* Hooks for intercepting the creation/use of an mm_struct. */ void (*activate_mm)(struct mm_struct *prev,struct mm_struct *next);void (*dup_mmap)(struct mm_struct *oldmm,struct mm_struct *mm); -void (*exit_mmap)(struct mm_struct *mm); - - -/* TLB operations */ -void (*flush_tlb_user)(void ); -void (*flush_tlb_kernel)(void ); -void (*flush_tlb_one_user)(unsigned long addr); -void (*flush_tlb_others)(const struct cpumask *cpus, -const struct flush_tlb_info *info); - -void (*tlb_remove_table)(struct mmu_gather *tlb,void *table);/* Hooks for allocating and freeing a pagetable top-level */ int (*pgd_alloc)(struct mm_struct *mm);
@@ -304,6 +304,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); +#endif } __no_randomize_layout;struct arch_spinlock ;
arch/x86/include/asm/pgalloc.h +1 -1
@@ -8,7 +8,7 @@static inline int __paravirt_pgd_alloc (struct mm_struct *mm) {return 0 ; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define paravirt_pgd_alloc (mm) __paravirt_pgd_alloc(mm)
arch/x86/include/asm/pgtable.h +2 -5
@@ -55,9 +55,9 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);extern pmdval_t early_pmd_flags; -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#else /* !CONFIG_PARAVIRT */ +#else /* !CONFIG_PARAVIRT_XXL */ #define set_pte (ptep, pte) native_set_pte(ptep, pte)#define set_pte_at (mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
@@ -111,9 +111,6 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#endif /* CONFIG_PARAVIRT */ - -#ifndef CONFIG_PARAVIRT_XXL #define arch_end_context_switch (prev) do {} while(0)#endif /* CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/special_insns.h +3 -8
@@ -141,11 +141,10 @@ static inline unsigned long __read_cr4(void)return native_read_cr4 (); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#endif +#else -#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -155,9 +154,7 @@ static inline void write_cr0(unsigned long x) {native_write_cr0 (x); } -#endif -#ifndef CONFIG_PARAVIRT static inline unsigned long read_cr2 (void ) {return native_read_cr2 ();
@@ -181,9 +178,7 @@ static inline void write_cr3(unsigned long x) {native_write_cr3 (x); } -#endif -#ifndef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {native_write_cr4 (x);
@@ -213,7 +208,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT_XXL */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +1 -3
@@ -64,13 +64,11 @@ void common(void) {OFFSET (IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);#endif -#ifdef CONFIG_PARAVIRT -BLANK ();#ifdef CONFIG_PARAVIRT_XXL +BLANK ();OFFSET (PV_IRQ_irq_disable, paravirt_patch_template, irq.irq_disable);OFFSET (PV_IRQ_irq_enable, paravirt_patch_template, irq.irq_enable);OFFSET (PV_CPU_iret, paravirt_patch_template, cpu.iret); -#endif OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
arch/x86/kernel/head_64.S +1 -3
@@ -25,14 +25,12 @@ #include <asm/export.h> #include <asm/nospec-branch.h> -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/asm-offsets.h> #include <asm/paravirt.h> #define GET_CR2_INTO(reg) GET_CR2_INTO_RAX ; movq %rax, reg #else #define GET_CR2_INTO(reg) movq %cr2, reg -#endif -#ifndef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN iretq #endif
arch/x86/kernel/paravirt.c +9 -6
@@ -384,11 +384,6 @@ struct paravirt_patch_template pv_ops = {#endif /* Mmu ops. */ - .mmu.read_cr2 = native_read_cr2, - .mmu.write_cr2 = native_write_cr2, - .mmu.read_cr3 = __native_read_cr3, - .mmu.write_cr3 = native_write_cr3, - .mmu.flush_tlb_user = native_flush_tlb, .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user,
@@ -396,6 +391,14 @@ struct paravirt_patch_template pv_ops = { .mmu.tlb_remove_table = (void (*)(struct mmu_gather *, void *))tlb_remove_page, + .mmu.exit_mmap = paravirt_nop, + +#ifdef CONFIG_PARAVIRT_XXL + .mmu.read_cr2 = native_read_cr2, + .mmu.write_cr2 = native_write_cr2, + .mmu.read_cr3 = __native_read_cr3, + .mmu.write_cr3 = native_write_cr3, + .mmu.pgd_alloc = __paravirt_pgd_alloc, .mmu.pgd_free = paravirt_nop,
@@ -448,7 +451,6 @@ struct paravirt_patch_template pv_ops = { .mmu.make_pgd = PTE_IDENT, .mmu.dup_mmap = paravirt_nop, - .mmu.exit_mmap = paravirt_nop, .mmu.activate_mm = paravirt_nop, .mmu.lazy_mode = {
@@ -458,6 +460,7 @@ struct paravirt_patch_template pv_ops = { }, .mmu.set_fixmap = native_set_fixmap, +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )/* Lock ops. */
arch/x86/kernel/paravirt_patch_32.c +2 -2
@@ -7,10 +7,10 @@ DEF_NATIVE(irq, irq_enable, "sti");DEF_NATIVE (irq, restore_fl,"push %eax; popf" );DEF_NATIVE (irq, save_fl,"pushf; pop %eax" );DEF_NATIVE (cpu, iret,"iret" ); -#endif DEF_NATIVE (mmu, read_cr2,"mov %cr2, %eax" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" ); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )DEF_NATIVE (lock, queued_spin_unlock,"movb $0, (%eax)" );
@@ -49,10 +49,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (irq, restore_fl);PATCH_SITE (irq, save_fl);PATCH_SITE (cpu, iret); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
arch/x86/kernel/paravirt_patch_64.c +1 -3
@@ -8,11 +8,9 @@ DEF_NATIVE(irq, irq_disable, "cli");DEF_NATIVE (irq, irq_enable,"sti" );DEF_NATIVE (irq, restore_fl,"pushq %rdi; popfq" );DEF_NATIVE (irq, save_fl,"pushfq; popq %rax" ); -#endif DEF_NATIVE (mmu, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (mmu, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (mmu, write_cr3,"movq %rdi, %cr3" ); -#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (cpu, wbinvd,"wbinvd" );DEF_NATIVE (cpu, usergs_sysret64,"swapgs; sysretq" );
@@ -61,10 +59,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (cpu, usergs_sysret64);PATCH_SITE (cpu, swapgs);PATCH_SITE (cpu, wbinvd); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 14/15 x86/paravirt: move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossMost of the paravirt ops defined in pv_mmu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/include/asm/mmu_context.h | 4 +- arch/x86/include/asm/paravirt.h | 125 +++++++++++++++++----------------- arch/x86/include/asm/paravirt_types.h | 33 ++++----- arch/x86/include/asm/pgalloc.h | 2 +- arch/x86/include/asm/pgtable.h | 7 +- arch/x86/include/asm/special_insns.h | 11 +-- arch/x86/kernel/asm-offsets.c | 4 +- arch/x86/kernel/head_64.S | 4 +- arch/x86/kernel/paravirt.c | 15 ++-- arch/x86/kernel/paravirt_patch_32.c | 4 +- arch/x86/kernel/paravirt_patch_64.c | 4 +- 12 files changed, 103 insertions(+), 112 deletions(-)
arch/x86/include/asm/fixmap.h +1 -1
@@ -152,7 +152,7 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);void native_set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags) {
arch/x86/include/asm/mmu_context.h +2 -2
@@ -16,12 +16,12 @@extern atomic64_t last_mm_ctx_id; -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void paravirt_activate_mm (struct mm_struct *prev,struct mm_struct *next) { } -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ #ifdef CONFIG_PERF_EVENTS
arch/x86/include/asm/paravirt.h +63 -62
194 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +17 -16
@@ -91,13 +91,14 @@ struct pv_init_ops { unsigned long addr, unsigned len); } __no_randomize_layout; - +#ifdef CONFIG_PARAVIRT_XXL struct pv_lazy_ops {/* Set deferred update mode, used for batching operations. */ void (*enter)(void );void (*leave)(void );void (*flush)(void ); } __no_randomize_layout; +#endif struct pv_time_ops {unsigned long long (*sched_clock)(void );
@@ -205,31 +206,30 @@ struct pv_irq_ops { } __no_randomize_layout;struct pv_mmu_ops { +/* TLB operations */ +void (*flush_tlb_user)(void ); +void (*flush_tlb_kernel)(void ); +void (*flush_tlb_one_user)(unsigned long addr); +void (*flush_tlb_others)(const struct cpumask *cpus, +const struct flush_tlb_info *info); + +void (*tlb_remove_table)(struct mmu_gather *tlb,void *table); + +/* Hook for intercepting the destruction of an mm_struct. */ +void (*exit_mmap)(struct mm_struct *mm); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*read_cr2)(void );void (*write_cr2)(unsigned long );unsigned long (*read_cr3)(void );void (*write_cr3)(unsigned long ); -/* -* Hooks for intercepting the creation/use/destruction of an -* mm_struct. -*/ +/* Hooks for intercepting the creation/use of an mm_struct. */ void (*activate_mm)(struct mm_struct *prev,struct mm_struct *next);void (*dup_mmap)(struct mm_struct *oldmm,struct mm_struct *mm); -void (*exit_mmap)(struct mm_struct *mm); - - -/* TLB operations */ -void (*flush_tlb_user)(void ); -void (*flush_tlb_kernel)(void ); -void (*flush_tlb_one_user)(unsigned long addr); -void (*flush_tlb_others)(const struct cpumask *cpus, -const struct flush_tlb_info *info); - -void (*tlb_remove_table)(struct mmu_gather *tlb,void *table);/* Hooks for allocating and freeing a pagetable top-level */ int (*pgd_alloc)(struct mm_struct *mm);
@@ -304,6 +304,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); +#endif } __no_randomize_layout;struct arch_spinlock ;
arch/x86/include/asm/pgalloc.h +1 -1
@@ -8,7 +8,7 @@static inline int __paravirt_pgd_alloc (struct mm_struct *mm) {return 0 ; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define paravirt_pgd_alloc (mm) __paravirt_pgd_alloc(mm)
arch/x86/include/asm/pgtable.h +2 -5
@@ -55,9 +55,9 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);extern pmdval_t early_pmd_flags; -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#else /* !CONFIG_PARAVIRT */ +#else /* !CONFIG_PARAVIRT_XXL */ #define set_pte (ptep, pte) native_set_pte(ptep, pte)#define set_pte_at (mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
@@ -111,9 +111,6 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#endif /* CONFIG_PARAVIRT */ - -#ifndef CONFIG_PARAVIRT_XXL #define arch_end_context_switch (prev) do {} while(0)#endif /* CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/special_insns.h +3 -8
@@ -141,11 +141,10 @@ static inline unsigned long __read_cr4(void)return native_read_cr4 (); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#endif +#else -#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -155,9 +154,7 @@ static inline void write_cr0(unsigned long x) {native_write_cr0 (x); } -#endif -#ifndef CONFIG_PARAVIRT static inline unsigned long read_cr2 (void ) {return native_read_cr2 ();
@@ -181,9 +178,7 @@ static inline void write_cr3(unsigned long x) {native_write_cr3 (x); } -#endif -#ifndef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {native_write_cr4 (x);
@@ -213,7 +208,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT_XXL */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +1 -3
@@ -64,13 +64,11 @@ void common(void) {OFFSET (IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);#endif -#ifdef CONFIG_PARAVIRT -BLANK ();#ifdef CONFIG_PARAVIRT_XXL +BLANK ();OFFSET (PV_IRQ_irq_disable, paravirt_patch_template, irq.irq_disable);OFFSET (PV_IRQ_irq_enable, paravirt_patch_template, irq.irq_enable);OFFSET (PV_CPU_iret, paravirt_patch_template, cpu.iret); -#endif OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
arch/x86/kernel/head_64.S +1 -3
@@ -25,14 +25,12 @@ #include <asm/export.h> #include <asm/nospec-branch.h> -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/asm-offsets.h> #include <asm/paravirt.h> #define GET_CR2_INTO(reg) GET_CR2_INTO_RAX ; movq %rax, reg #else #define GET_CR2_INTO(reg) movq %cr2, reg -#endif -#ifndef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN iretq #endif
arch/x86/kernel/paravirt.c +9 -6
@@ -384,11 +384,6 @@ struct paravirt_patch_template pv_ops = {#endif /* Mmu ops. */ - .mmu.read_cr2 = native_read_cr2, - .mmu.write_cr2 = native_write_cr2, - .mmu.read_cr3 = __native_read_cr3, - .mmu.write_cr3 = native_write_cr3, - .mmu.flush_tlb_user = native_flush_tlb, .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user,
@@ -396,6 +391,14 @@ struct paravirt_patch_template pv_ops = { .mmu.tlb_remove_table = (void (*)(struct mmu_gather *, void *))tlb_remove_page, + .mmu.exit_mmap = paravirt_nop, + +#ifdef CONFIG_PARAVIRT_XXL + .mmu.read_cr2 = native_read_cr2, + .mmu.write_cr2 = native_write_cr2, + .mmu.read_cr3 = __native_read_cr3, + .mmu.write_cr3 = native_write_cr3, + .mmu.pgd_alloc = __paravirt_pgd_alloc, .mmu.pgd_free = paravirt_nop,
@@ -448,7 +451,6 @@ struct paravirt_patch_template pv_ops = { .mmu.make_pgd = PTE_IDENT, .mmu.dup_mmap = paravirt_nop, - .mmu.exit_mmap = paravirt_nop, .mmu.activate_mm = paravirt_nop, .mmu.lazy_mode = {
@@ -458,6 +460,7 @@ struct paravirt_patch_template pv_ops = { }, .mmu.set_fixmap = native_set_fixmap, +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )/* Lock ops. */
arch/x86/kernel/paravirt_patch_32.c +2 -2
@@ -7,10 +7,10 @@ DEF_NATIVE(irq, irq_enable, "sti");DEF_NATIVE (irq, restore_fl,"push %eax; popf" );DEF_NATIVE (irq, save_fl,"pushf; pop %eax" );DEF_NATIVE (cpu, iret,"iret" ); -#endif DEF_NATIVE (mmu, read_cr2,"mov %cr2, %eax" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" ); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )DEF_NATIVE (lock, queued_spin_unlock,"movb $0, (%eax)" );
@@ -49,10 +49,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (irq, restore_fl);PATCH_SITE (irq, save_fl);PATCH_SITE (cpu, iret); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
arch/x86/kernel/paravirt_patch_64.c +1 -3
@@ -8,11 +8,9 @@ DEF_NATIVE(irq, irq_disable, "cli");DEF_NATIVE (irq, irq_enable,"sti" );DEF_NATIVE (irq, restore_fl,"pushq %rdi; popfq" );DEF_NATIVE (irq, save_fl,"pushfq; popq %rax" ); -#endif DEF_NATIVE (mmu, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (mmu, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (mmu, write_cr3,"movq %rdi, %cr3" ); -#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (cpu, wbinvd,"wbinvd" );DEF_NATIVE (cpu, usergs_sysret64,"swapgs; sysretq" );
@@ -61,10 +59,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (cpu, usergs_sysret64);PATCH_SITE (cpu, swapgs);PATCH_SITE (cpu, wbinvd); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
Signature · 1 line
2.16.4
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
x86/paravirt: Move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
Commit-ID: fdc0269e8958a1ec95b8ac685c1d372c24c60faa Gitweb: https://git.kernel.org/tip/fdc0269e8958a1ec95b8ac685c1d372c24c60faa Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:25 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:37 +0200
x86/paravirt: Move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
Most of the paravirt ops defined in pv_mmu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/include/asm/mmu_context.h | 4 +- arch/x86/include/asm/paravirt.h | 125 +++++++++++++++++----------------- arch/x86/include/asm/paravirt_types.h | 33 ++++----- arch/x86/include/asm/pgalloc.h | 2 +- arch/x86/include/asm/pgtable.h | 7 +- arch/x86/include/asm/special_insns.h | 11 +-- arch/x86/kernel/asm-offsets.c | 4 +- arch/x86/kernel/head_64.S | 4 +- arch/x86/kernel/paravirt.c | 15 ++-- arch/x86/kernel/paravirt_patch_32.c | 4 +- arch/x86/kernel/paravirt_patch_64.c | 4 +- 12 files changed, 103 insertions(+), 112 deletions(-)
arch/x86/include/asm/fixmap.h +1 -1
@@ -152,7 +152,7 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);void native_set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags) {
arch/x86/include/asm/mmu_context.h +2 -2
@@ -16,12 +16,12 @@extern atomic64_t last_mm_ctx_id; -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL static inline void paravirt_activate_mm (struct mm_struct *prev,struct mm_struct *next) { } -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ #ifdef CONFIG_PERF_EVENTS
arch/x86/include/asm/paravirt.h +63 -62
194 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +17 -16
@@ -91,13 +91,14 @@ struct pv_init_ops { unsigned long addr, unsigned len); } __no_randomize_layout; - +#ifdef CONFIG_PARAVIRT_XXL struct pv_lazy_ops {/* Set deferred update mode, used for batching operations. */ void (*enter)(void );void (*leave)(void );void (*flush)(void ); } __no_randomize_layout; +#endif struct pv_time_ops {unsigned long long (*sched_clock)(void );
@@ -205,31 +206,30 @@ struct pv_irq_ops { } __no_randomize_layout;struct pv_mmu_ops { +/* TLB operations */ +void (*flush_tlb_user)(void ); +void (*flush_tlb_kernel)(void ); +void (*flush_tlb_one_user)(unsigned long addr); +void (*flush_tlb_others)(const struct cpumask *cpus, +const struct flush_tlb_info *info); + +void (*tlb_remove_table)(struct mmu_gather *tlb,void *table); + +/* Hook for intercepting the destruction of an mm_struct. */ +void (*exit_mmap)(struct mm_struct *mm); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*read_cr2)(void );void (*write_cr2)(unsigned long );unsigned long (*read_cr3)(void );void (*write_cr3)(unsigned long ); -/* -* Hooks for intercepting the creation/use/destruction of an -* mm_struct. -*/ +/* Hooks for intercepting the creation/use of an mm_struct. */ void (*activate_mm)(struct mm_struct *prev,struct mm_struct *next);void (*dup_mmap)(struct mm_struct *oldmm,struct mm_struct *mm); -void (*exit_mmap)(struct mm_struct *mm); - - -/* TLB operations */ -void (*flush_tlb_user)(void ); -void (*flush_tlb_kernel)(void ); -void (*flush_tlb_one_user)(unsigned long addr); -void (*flush_tlb_others)(const struct cpumask *cpus, -const struct flush_tlb_info *info); - -void (*tlb_remove_table)(struct mmu_gather *tlb,void *table);/* Hooks for allocating and freeing a pagetable top-level */ int (*pgd_alloc)(struct mm_struct *mm);
@@ -304,6 +304,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); +#endif } __no_randomize_layout;struct arch_spinlock ;
arch/x86/include/asm/pgalloc.h +1 -1
@@ -8,7 +8,7 @@static inline int __paravirt_pgd_alloc (struct mm_struct *mm) {return 0 ; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define paravirt_pgd_alloc (mm) __paravirt_pgd_alloc(mm)
arch/x86/include/asm/pgtable.h +2 -5
@@ -55,9 +55,9 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);extern pmdval_t early_pmd_flags; -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#else /* !CONFIG_PARAVIRT */ +#else /* !CONFIG_PARAVIRT_XXL */ #define set_pte (ptep, pte) native_set_pte(ptep, pte)#define set_pte_at (mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
@@ -111,9 +111,6 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#endif /* CONFIG_PARAVIRT */ - -#ifndef CONFIG_PARAVIRT_XXL #define arch_end_context_switch (prev) do {} while(0)#endif /* CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/special_insns.h +3 -8
@@ -141,11 +141,10 @@ static inline unsigned long __read_cr4(void)return native_read_cr4 (); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> -#endif +#else -#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -155,9 +154,7 @@ static inline void write_cr0(unsigned long x) {native_write_cr0 (x); } -#endif -#ifndef CONFIG_PARAVIRT static inline unsigned long read_cr2 (void ) {return native_read_cr2 ();
@@ -181,9 +178,7 @@ static inline void write_cr3(unsigned long x) {native_write_cr3 (x); } -#endif -#ifndef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {native_write_cr4 (x);
@@ -213,7 +208,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT_XXL */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +1 -3
@@ -64,13 +64,11 @@ void common(void) {OFFSET (IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);#endif -#ifdef CONFIG_PARAVIRT -BLANK ();#ifdef CONFIG_PARAVIRT_XXL +BLANK ();OFFSET (PV_IRQ_irq_disable, paravirt_patch_template, irq.irq_disable);OFFSET (PV_IRQ_irq_enable, paravirt_patch_template, irq.irq_enable);OFFSET (PV_CPU_iret, paravirt_patch_template, cpu.iret); -#endif OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
arch/x86/kernel/head_64.S +1 -3
@@ -25,14 +25,12 @@ #include <asm/export.h> #include <asm/nospec-branch.h> -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/asm-offsets.h> #include <asm/paravirt.h> #define GET_CR2_INTO(reg) GET_CR2_INTO_RAX ; movq %rax, reg #else #define GET_CR2_INTO(reg) movq %cr2, reg -#endif -#ifndef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN iretq #endif
arch/x86/kernel/paravirt.c +9 -6
@@ -384,11 +384,6 @@ struct paravirt_patch_template pv_ops = {#endif /* CONFIG_PARAVIRT_XXL */ /* Mmu ops. */ - .mmu.read_cr2 = native_read_cr2, - .mmu.write_cr2 = native_write_cr2, - .mmu.read_cr3 = __native_read_cr3, - .mmu.write_cr3 = native_write_cr3, - .mmu.flush_tlb_user = native_flush_tlb, .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user,
@@ -396,6 +391,14 @@ struct paravirt_patch_template pv_ops = { .mmu.tlb_remove_table = (void (*)(struct mmu_gather *, void *))tlb_remove_page, + .mmu.exit_mmap = paravirt_nop, + +#ifdef CONFIG_PARAVIRT_XXL + .mmu.read_cr2 = native_read_cr2, + .mmu.write_cr2 = native_write_cr2, + .mmu.read_cr3 = __native_read_cr3, + .mmu.write_cr3 = native_write_cr3, + .mmu.pgd_alloc = __paravirt_pgd_alloc, .mmu.pgd_free = paravirt_nop,
@@ -448,7 +451,6 @@ struct paravirt_patch_template pv_ops = { .mmu.make_pgd = PTE_IDENT, .mmu.dup_mmap = paravirt_nop, - .mmu.exit_mmap = paravirt_nop, .mmu.activate_mm = paravirt_nop, .mmu.lazy_mode = {
@@ -458,6 +460,7 @@ struct paravirt_patch_template pv_ops = { }, .mmu.set_fixmap = native_set_fixmap, +#endif /* CONFIG_PARAVIRT_XXL */ #if defined(CONFIG_PARAVIRT_SPINLOCKS )/* Lock ops. */
arch/x86/kernel/paravirt_patch_32.c +2 -2
@@ -7,10 +7,10 @@ DEF_NATIVE(irq, irq_enable, "sti");DEF_NATIVE (irq, restore_fl,"push %eax; popf" );DEF_NATIVE (irq, save_fl,"pushf; pop %eax" );DEF_NATIVE (cpu, iret,"iret" ); -#endif DEF_NATIVE (mmu, read_cr2,"mov %cr2, %eax" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" ); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )DEF_NATIVE (lock, queued_spin_unlock,"movb $0, (%eax)" );
@@ -49,10 +49,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (irq, restore_fl);PATCH_SITE (irq, save_fl);PATCH_SITE (cpu, iret); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
arch/x86/kernel/paravirt_patch_64.c +1 -3
@@ -8,11 +8,9 @@ DEF_NATIVE(irq, irq_disable, "cli");DEF_NATIVE (irq, irq_enable,"sti" );DEF_NATIVE (irq, restore_fl,"pushq %rdi; popfq" );DEF_NATIVE (irq, save_fl,"pushfq; popq %rax" ); -#endif DEF_NATIVE (mmu, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (mmu, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (mmu, write_cr3,"movq %rdi, %cr3" ); -#ifdef CONFIG_PARAVIRT_XXL DEF_NATIVE (cpu, wbinvd,"wbinvd" );DEF_NATIVE (cpu, usergs_sysret64,"swapgs; sysretq" );
@@ -61,10 +59,10 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)PATCH_SITE (cpu, usergs_sysret64);PATCH_SITE (cpu, swapgs);PATCH_SITE (cpu, wbinvd); -#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); +#endif #if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
Juergen Gross
maintainerPATCH v3 15/15 x86/paravirt: remove unneeded mmu related paravirt ops bits
In reply to Juergen GrossThere is no need to have 32-bit code for CONFIG_PGTABLE_LEVELS >= 4. Remove it.
--- arch/x86/include/asm/paravirt.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
arch/x86/include/asm/paravirt.h +3 -17
@@ -506,25 +506,14 @@ static inline pud_t __pud(pudval_t val) {pudval_t ret; -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.make_pud, val, (u64 )val >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val); + ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val);return (pud_t ) { ret }; }static inline pudval_t pud_val (pud_t pud) { -pudval_t ret; - -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.pud_val, - pud.pud, (u64 )pud.pud >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); - -return ret; +return PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); }static inline void pud_clear (pud_t *pudp)
@@ -536,10 +525,7 @@ static inline void set_p4d(p4d_t *p4dp, p4d_t p4d) {p4dval_t val =native_p4d_val (p4d); -if (sizeof (p4dval_t) >sizeof (long )) -PVOP_VCALL3 (mmu.set_p4d, p4dp, val, (u64 )val >>32 ); -else -PVOP_VCALL2 (mmu.set_p4d, p4dp, val); +PVOP_VCALL2 (mmu.set_p4d, p4dp, val); }#if CONFIG_PGTABLE_LEVELS >=5
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 15/15 x86/paravirt: remove unneeded mmu related paravirt ops bits
In reply to Juergen GrossThere is no need to have 32-bit code for CONFIG_PGTABLE_LEVELS >= 4. Remove it.
--- arch/x86/include/asm/paravirt.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
arch/x86/include/asm/paravirt.h +3 -17
@@ -506,25 +506,14 @@ static inline pud_t __pud(pudval_t val) {pudval_t ret; -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.make_pud, val, (u64 )val >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val); + ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val);return (pud_t ) { ret }; }static inline pudval_t pud_val (pud_t pud) { -pudval_t ret; - -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.pud_val, - pud.pud, (u64 )pud.pud >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); - -return ret; +return PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); }static inline void pud_clear (pud_t *pudp)
@@ -536,10 +525,7 @@ static inline void set_p4d(p4d_t *p4dp, p4d_t p4d) {p4dval_t val =native_p4d_val (p4d); -if (sizeof (p4dval_t) >sizeof (long )) -PVOP_VCALL3 (mmu.set_p4d, p4dp, val, (u64 )val >>32 ); -else -PVOP_VCALL2 (mmu.set_p4d, p4dp, val); +PVOP_VCALL2 (mmu.set_p4d, p4dp, val); }#if CONFIG_PGTABLE_LEVELS >=5
Signature · 1 line
2.16.4
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Remove unneeded mmu related paravirt ops bits
x86/paravirt: Remove unneeded mmu related paravirt ops bits
Commit-ID: 495310e4f2dd857c4d5a62806a04cb8ba53855c1 Gitweb: https://git.kernel.org/tip/495310e4f2dd857c4d5a62806a04cb8ba53855c1 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:26 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:37 +0200
x86/paravirt: Remove unneeded mmu related paravirt ops bits
There is no need to have 32-bit code for CONFIG_PGTABLE_LEVELS >= 4. Remove it.
--- arch/x86/include/asm/paravirt.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
arch/x86/include/asm/paravirt.h +3 -17
@@ -506,25 +506,14 @@ static inline pud_t __pud(pudval_t val) {pudval_t ret; -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.make_pud, val, (u64 )val >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val); + ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val);return (pud_t ) { ret }; }static inline pudval_t pud_val (pud_t pud) { -pudval_t ret; - -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.pud_val, - pud.pud, (u64 )pud.pud >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); - -return ret; +return PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); }static inline void pud_clear (pud_t *pudp)
@@ -536,10 +525,7 @@ static inline void set_p4d(p4d_t *p4dp, p4d_t p4d) {p4dval_t val =native_p4d_val (p4d); -if (sizeof (p4dval_t) >sizeof (long )) -PVOP_VCALL3 (mmu.set_p4d, p4dp, val, (u64 )val >>32 ); -else -PVOP_VCALL2 (mmu.set_p4d, p4dp, val); +PVOP_VCALL2 (mmu.set_p4d, p4dp, val); }#if CONFIG_PGTABLE_LEVELS >=5
Juergen Gross
maintainerPATCH v3 15/15 x86/paravirt: remove unneeded mmu related paravirt ops bits
In reply to Juergen GrossThere is no need to have 32-bit code for CONFIG_PGTABLE_LEVELS >= 4. Remove it.
--- arch/x86/include/asm/paravirt.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
arch/x86/include/asm/paravirt.h +3 -17
@@ -506,25 +506,14 @@ static inline pud_t __pud(pudval_t val) {pudval_t ret; -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.make_pud, val, (u64 )val >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val); + ret =PVOP_CALLEE1 (pudval_t, mmu.make_pud, val);return (pud_t ) { ret }; }static inline pudval_t pud_val (pud_t pud) { -pudval_t ret; - -if (sizeof (pudval_t) >sizeof (long )) - ret =PVOP_CALLEE2 (pudval_t, mmu.pud_val, - pud.pud, (u64 )pud.pud >>32 ); -else - ret =PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); - -return ret; +return PVOP_CALLEE1 (pudval_t, mmu.pud_val, pud.pud); }static inline void pud_clear (pud_t *pudp)
@@ -536,10 +525,7 @@ static inline void set_p4d(p4d_t *p4dp, p4d_t p4d) {p4dval_t val =native_p4d_val (p4d); -if (sizeof (p4dval_t) >sizeof (long )) -PVOP_VCALL3 (mmu.set_p4d, p4dp, val, (u64 )val >>32 ); -else -PVOP_VCALL2 (mmu.set_p4d, p4dp, val); +PVOP_VCALL2 (mmu.set_p4d, p4dp, val); }#if CONFIG_PGTABLE_LEVELS >=5
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel