x86/paravirt, xen: several cleanups
Subsystems (14)
Juergen Gross
maintainerPATCH v3 1/15 xen: move pv irq related functions under CONFIG_XEN_PV umbrella
In reply to Juergen GrossAll functions in arch/x86/xen/irq.c and arch/x86/xen/xen-asm*.S are specific to PV guests. Include them in the kernel with CONFIG_XEN_PV only.
Make the PV specific code in arch/x86/entry/entry_*.S dependent on CONFIG_XEN_PV instead of CONFIG_XEN.
The HVM specific code should depend on CONFIG_XEN_PVHVM.
While at it reformat the Makefile to make it more readable.
--- arch/x86/entry/entry_32.S | 8 +++++--- arch/x86/entry/entry_64.S | 8 +++++--- arch/x86/xen/Makefile | 41 +++++++++++++++++++++++++++++++---------- include/xen/events.h | 2 ++ 4 files changed, 43 insertions(+), 16 deletions(-)
arch/x86/entry/entry_32.S +5 -3
@@ -782,7 +782,7 @@ GLOBAL(__begin_SYSENTER_singlestep_region) * will ignore all of the single-step traps generated in this range. */ -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV /* * Xen doesn't set %esp to be precisely what the normal SYSENTER * entry point expects, so fix it up before using the normal path.
@@ -1240,7 +1240,7 @@ ENTRY(spurious_interrupt_bug) jmp common_exception END(spurious_interrupt_bug) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV ENTRY(xen_hypervisor_callback) pushl $-1 /* orig_ax = -1 => not a system call */ SAVE_ALL
@@ -1321,11 +1321,13 @@ ENTRY(xen_failsafe_callback) _ASM_EXTABLE(3b, 8b) _ASM_EXTABLE(4b, 9b) ENDPROC(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, xen_evtchn_do_upcall) +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV)
arch/x86/entry/entry_64.S +5 -3
@@ -1050,7 +1050,7 @@ ENTRY(do_softirq_own_stack) ret ENDPROC(do_softirq_own_stack) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry hypervisor_callback xen_do_hypervisor_callback has_error_code=0 /*
@@ -1130,11 +1130,13 @@ ENTRY(xen_failsafe_callback) ENCODE_FRAME_POINTER jmp error_exit END(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ xen_hvm_callback_vector xen_evtchn_do_upcall +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV) apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
@@ -1151,7 +1153,7 @@ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK idtentry int3 do_int3 has_error_code=0 idtentry stack_segment do_stack_segment has_error_code=1 -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry xennmi do_nmi has_error_code=0 idtentry xendebug do_debug has_error_code=0 idtentry xenint3 do_int3 has_error_code=0
arch/x86/xen/Makefile +31 -10
56 lines not on this page · raw message
include/xen/events.h +2 -0
@@ -89,11 +89,13 @@ unsigned irq_from_evtchn(unsigned int evtchn);int irq_from_virq (unsigned int cpu,unsigned int virq);unsigned int evtchn_from_irq (unsigned irq); +#ifdef CONFIG_XEN_PVHVM /* Xen HVM evtchn vector callback */ void xen_hvm_callback_vector (void );#ifdef CONFIG_TRACING #define trace_xen_hvm_callback_vector xen_hvm_callback_vector#endif +#endif int xen_set_callback_via (uint64_t via);void xen_evtchn_do_upcall (struct pt_regs *regs);void xen_hvm_evtchn_do_upcall (void );
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 2/15 xen: move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
In reply to Juergen GrossThere are some PV specific functions in arch/x86/xen/mmu.c which can be moved to mmu_pv.c. This in turn enables us to make multicalls.c dependent on CONFIG_XEN_PV.
---
V3:
- fix build failure on ARM (Boris Ostrovsky)
--- arch/arm/xen/enlighten.c | 34 -------- arch/x86/xen/Makefile | 2 +- arch/x86/xen/mmu.c | 186 ----------------------------------------- arch/x86/xen/mmu_pv.c | 138 ++++++++++++++++++++++++++++++ include/xen/interface/memory.h | 6 -- include/xen/xen-ops.h | 133 +++++++++++++++++++---------- 6 files changed, 227 insertions(+), 272 deletions(-)
arch/arm/xen/enlighten.c +0 -34
@@ -62,29 +62,6 @@ static __read_mostly unsigned int xen_events_irq;uint32_t xen_start_flags;EXPORT_SYMBOL (xen_start_flags); -int xen_remap_domain_gfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *gfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned domid, -struct page **pages) -{ -return xen_xlate_remap_gfn_array (vma, addr, gfn, nr, err_ptr, - prot, domid, pages); -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_array); - -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_gfn_range (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t gfn,int nr, -pgprot_t prot,unsigned domid, -struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_range); -int xen_unmap_domain_gfn_range (struct vm_area_struct *vma,int nr,struct page **pages) {
@@ -92,17 +69,6 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, }EXPORT_SYMBOL_GPL (xen_unmap_domain_gfn_range); -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_mfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *mfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned int domid,struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_mfn_array); -static void xen_read_wallclock (struct timespec64 *ts) {u32 version;
arch/x86/xen/Makefile +1 -1
@@ -15,7 +15,6 @@ CFLAGS_enlighten_pv.o := $(nostackp) CFLAGS_mmu_pv.o := $(nostackp) obj-y += enlighten.o -obj-y += multicalls.o obj-y += mmu.o obj-y += time.o obj-y += grant-table.o
@@ -34,6 +33,7 @@ obj-$(CONFIG_XEN_PV) += p2m.o obj-$(CONFIG_XEN_PV) += enlighten_pv.o obj-$(CONFIG_XEN_PV) += mmu_pv.o obj-$(CONFIG_XEN_PV) += irq.o +obj-$(CONFIG_XEN_PV) += multicalls.o obj-$(CONFIG_XEN_PV) += xen-asm.o obj-$(CONFIG_XEN_PV) += xen-asm_$(BITS).o
arch/x86/xen/mmu.c +0 -186
198 lines not on this page · raw message
arch/x86/xen/mmu_pv.c +138 -0
150 lines not on this page · raw message
include/xen/interface/memory.h +0 -6
@@ -244,12 +244,6 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);#define XENMEM_machine_memory_map 10 -/* -* Prevent the balloon driver from changing the memory reservation -* during a driver critical region. -*/ -extern spinlock_t xen_reservation_lock; -/* * Unmaps the page appearing at a particular GPFN from the specified guest's * pseudophysical address space.
include/xen/xen-ops.h +88 -45
176 lines not on this page · raw message
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 3/15 xen: link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
In reply to Juergen GrossInstead of using one large #ifdef CONFIG_XEN_PVHVM in arch/x86/xen/platform-pci-unplug.c add the object file depending on CONFIG_XEN_PVHVM being set.
--- arch/x86/xen/Makefile | 2 +- arch/x86/xen/platform-pci-unplug.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/x86/xen/Makefile +1 -1
@@ -19,11 +19,11 @@ obj-y += mmu.o obj-y += time.o obj-y += grant-table.o obj-y += suspend.o -obj-y += platform-pci-unplug.o obj-$(CONFIG_XEN_PVHVM) += enlighten_hvm.o obj-$(CONFIG_XEN_PVHVM) += mmu_hvm.o obj-$(CONFIG_XEN_PVHVM) += suspend_hvm.o +obj-$(CONFIG_XEN_PVHVM) += platform-pci-unplug.o obj-$(CONFIG_XEN_PV) += setup.o obj-$(CONFIG_XEN_PV) += apic.o
arch/x86/xen/platform-pci-unplug.c +0 -2
@@ -30,7 +30,6 @@#define XEN_PLATFORM_ERR_PROTOCOL -2#define XEN_PLATFORM_ERR_BLACKLIST -3 -#ifdef CONFIG_XEN_PVHVM /* store the value of xen_emul_unplug after the unplug is done */ static int xen_platform_pci_unplug;static int xen_emul_unplug;
@@ -214,4 +213,3 @@ static int __init parse_xen_emul_unplug(char *arg)return 0 ; }early_param ("xen_emul_unplug" , parse_xen_emul_unplug); -#endif
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 4/15 xen: add SPDX identifier in arch/x86/xen files
In reply to Juergen Gross--- arch/x86/xen/efi.c | 14 +------------- arch/x86/xen/enlighten.c | 2 ++ arch/x86/xen/enlighten_hvm.c | 2 ++ arch/x86/xen/grant-table.c | 25 +------------------------ arch/x86/xen/mmu.c | 2 ++ arch/x86/xen/mmu_pv.c | 2 ++ arch/x86/xen/p2m.c | 2 ++ arch/x86/xen/pci-swiotlb-xen.c | 2 ++ arch/x86/xen/platform-pci-unplug.c | 16 ++-------------- arch/x86/xen/vdso.h | 2 ++ arch/x86/xen/xen-pvh.S | 15 ++------------- 11 files changed, 20 insertions(+), 64 deletions(-)
arch/x86/xen/efi.c +1 -13
@@ -1,18 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2014 Oracle Co., Daniel Kiper -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/bitops.h>
arch/x86/xen/enlighten.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG #include <linux/bootmem.h> #endif
arch/x86/xen/enlighten_hvm.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/acpi.h> #include <linux/cpu.h> #include <linux/kexec.h>
arch/x86/xen/grant-table.c +1 -24
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT /****************************************************************************** * grant_table.c * x86 specific part
@@ -8,30 +9,6 @@* Copyright (c) 2004-2005, K A Fraser * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp> * VA Linux Systems Japan. Split out x86 specific part. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation; or, when distributed -* separately from the Linux kernel or incorporated into other -* software packages, subject to the following license: -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this source file (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, copy, modify, -* merge, publish, distribute, sublicense, and/or sell copies of the Software, -* and to permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -* IN THE SOFTWARE. */ #include <linux/sched.h>
arch/x86/xen/mmu.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/pfn.h> #include <asm/xen/page.h> #include <asm/xen/hypercall.h>
arch/x86/xen/mmu_pv.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Xen mmu operations *
arch/x86/xen/p2m.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Xen leaves the responsibility for maintaining p2m mappings to the * guests themselves, but it must also access and update the p2m array
arch/x86/xen/pci-swiotlb-xen.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Glue code to lib/swiotlb-xen.c */ #include <linux/dma-mapping.h>
arch/x86/xen/platform-pci-unplug.c +2 -14
@@ -1,22 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/****************************************************************************** * platform-pci-unplug.c * * Xen platform PCI device driver * Copyright (c) 2010, Citrix -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., 59 Temple -* Place - Suite 330, Boston, MA 02111-1307 USA. -* */ #include <linux/init.h>
arch/x86/xen/vdso.h +2 -0
@@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Bit used for the pseudo-hwcap for non-negative segments. We use bit 1 to avoid bugs in some versions of glibc when bit 0 is used; the choice is otherwise arbitrary. */
arch/x86/xen/xen-pvh.S +2 -13
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + /* * Copyright C 2016, Oracle and/or its affiliates. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. */ .code32
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 5/15 x86/paravirt: make paravirt_patch_call() and paravirt_patch_jmp() static
In reply to Juergen Grossparavirt_patch_call() and paravirt_patch_jmp() are used in paravirt.c only. Convert them to static.
--- arch/x86/include/asm/paravirt_types.h | 6 ------ arch/x86/kernel/paravirt.c | 12 ++++++------ 2 files changed, 6 insertions(+), 12 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -6
@@ -373,12 +373,6 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len); -unsigned paravirt_patch_jmp (void *insnbuf,const void *target, -unsigned long addr,unsigned len);unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf,unsigned long addr,unsigned len);
arch/x86/kernel/paravirt.c +6 -6
@@ -81,10 +81,10 @@ struct branch {u32 delta; } __attribute__((packed)); -unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf, +const void *target,u16 tgt_clobbers, +unsigned long addr,u16 site_clobbers, +unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -103,8 +103,8 @@ unsigned paravirt_patch_call(void *insnbuf,return 5 ; } -unsigned paravirt_patch_jmp (void *insnbuf,const void *target, -unsigned long addr,unsigned len) +static unsigned paravirt_patch_jmp (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 6/15 x86/paravirt: remove clobbers parameter from paravirt patch functions
In reply to Juergen GrossThe clobbers parameter from paravirt_patch_default() et al isn't used any longer. Remove it.
--- arch/x86/include/asm/paravirt_types.h | 7 +++---- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/paravirt.c | 14 +++++--------- arch/x86/kernel/paravirt_patch_32.c | 5 ++--- arch/x86/kernel/paravirt_patch_64.c | 5 ++--- arch/x86/kernel/vsmp_64.c | 6 +++--- 6 files changed, 16 insertions(+), 23 deletions(-)
arch/x86/include/asm/paravirt_types.h +3 -4
@@ -85,7 +85,7 @@ struct pv_init_ops {* the number of bytes of code generated, as we nop pad the * rest in generic code. */ -unsigned (*patch)(u8 type,u16 clobber,void *insnbuf, +unsigned (*patch)(u8 type,void *insnbuf,unsigned long addr,unsigned len); } __no_randomize_layout;
@@ -373,14 +373,13 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len);unsigned paravirt_patch_insns (void *insnbuf,unsigned len,const char *start,const char *end); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len); +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len);int paravirt_disable_iospace (void );
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, p->clobbers, insnbuf, + used = pv_init_ops.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/paravirt.c +5 -9
@@ -81,10 +81,8 @@ struct branch {u32 delta; } __attribute__((packed)); -static unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -149,7 +147,7 @@ static void *get_call_destination(u8 type)return *((void **)&tmpl + type); } -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len) {void *opfunc =get_call_destination (type);
@@ -172,10 +170,8 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); else -/* Otherwise call the function; assume target could -clobber any caller-save reg */ - ret =paravirt_patch_call (insnbuf, opfunc,CLBR_ANY , - addr, clobbers, len); +/* Otherwise call the function. */ + ret =paravirt_patch_call (insnbuf, opfunc, addr, len);return ret; }
arch/x86/kernel/paravirt_patch_32.c +2 -3
@@ -30,8 +30,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -70,7 +69,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/paravirt_patch_64.c +2 -3
@@ -38,8 +38,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -80,7 +79,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/vsmp_64.c +3 -3
@@ -69,7 +69,7 @@ asmlinkage __visible void vsmp_irq_enable(void) }PV_CALLEE_SAVE_REGS_THUNK (vsmp_irq_enable); -static unsigned __init vsmp_patch (u8 type,u16 clobbers,void *ibuf, +static unsigned __init vsmp_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {switch (type) {
@@ -77,9 +77,9 @@ static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,case PARAVIRT_PATCH (pv_irq_ops.irq_disable):case PARAVIRT_PATCH (pv_irq_ops.save_fl):case PARAVIRT_PATCH (pv_irq_ops.restore_fl): -return paravirt_patch_default (type, clobbers, ibuf, addr, len); +return paravirt_patch_default (type, ibuf, addr, len);default : -return native_patch (type, clobbers, ibuf, addr, len); +return native_patch (type, ibuf, addr, len); } }
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 7/15 x86/paravirt: remove clobbers from struct paravirt_patch_site
In reply to Juergen GrossThere is no need any longer to store the clobbers in struct paravirt_patch_site. Remove clobbers from the struct and from the related macros.
While at it fix some lines longer than 80 characters.
--- arch/x86/include/asm/paravirt.h | 33 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 1 - 2 files changed, 15 insertions(+), 19 deletions(-)
arch/x86/include/asm/paravirt.h +15 -18
@@ -827,7 +827,7 @@ extern void default_banner(void);#else /* __ASSEMBLY__ */ -#define _PVSITE (ptype, clobbers, ops, word, algn) \ +#define _PVSITE (ptype, ops, word, algn) \ 771:; \ ops; \ 772:; \
@@ -836,7 +836,6 @@ extern void default_banner(void); word 771b; \ .byte ptype; \ .byte 772b-771b; \ - .short clobbers; \ .popsection
@@ -869,7 +868,7 @@ extern void default_banner(void); COND_POP(set, CLBR_RAX, rax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 8) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .quad, 8)#define PARA_INDIRECT (addr) *addr(%rip)#else #define PV_SAVE_REGS (set) \
@@ -884,26 +883,26 @@ extern void default_banner(void); COND_POP(set, CLBR_EAX, eax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .long, 4)#define PARA_INDIRECT (addr) *%cs:addr#endif #define INTERRUPT_RETURN \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);)#define DISABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#define ENABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
@@ -921,8 +920,7 @@ extern void default_banner(void);* inlined, or the swapgs instruction must be trapped and emulated. */ #define SWAPGS_UNSAFE_STACK \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - swapgs) + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), swapgs)/* * Note: swapgs is very special, and in practise is either going to be
@@ -931,8 +929,8 @@ extern void default_banner(void);* it. */ #define SWAPGS \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \ )
@@ -942,15 +940,14 @@ extern void default_banner(void);#define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \ - CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);)#ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#endif
arch/x86/include/asm/paravirt_types.h +0 -1
@@ -681,7 +681,6 @@ struct paravirt_patch_site {u8 *instr;/* original instructions */ u8 instrtype;/* type of this instruction */ u8 len;/* length of original instruction */ -u16 clobbers;/* what registers you may clobber */ }; extern struct paravirt_patch_site __parainstructions[],
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 8/15 x86/paravirt: use a single ops structure
In reply to Juergen GrossInstead of using six globally visible paravirt ops structures combine them in a single structure, keeping the original structures as sub-structures.
This avoids the need to assemble struct paravirt_patch_template at runtime on the stack each time apply_paravirt() is being called (i.e. when loading a module).
---
V2:
- shorten pv_ops sub-structure names (Jan Beulich)
V3:
- rebase to master
- fix build failure on ARM
--- arch/arm/include/asm/paravirt.h | 9 +- arch/arm/kernel/paravirt.c | 4 +- arch/arm64/include/asm/paravirt.h | 9 +- arch/arm64/kernel/paravirt.c | 4 +- arch/x86/hyperv/mmu.c | 4 +- arch/x86/include/asm/paravirt.h | 275 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 25 ++- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/asm-offsets.c | 12 +- arch/x86/kernel/asm-offsets_64.c | 7 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/kvm.c | 19 +-- arch/x86/kernel/kvmclock.c | 4 +- arch/x86/kernel/paravirt-spinlocks.c | 15 +- arch/x86/kernel/paravirt.c | 283 ++++++++++++++++------------------ arch/x86/kernel/paravirt_patch_32.c | 48 +++--- arch/x86/kernel/paravirt_patch_64.c | 56 +++---- arch/x86/kernel/tsc.c | 2 +- arch/x86/kernel/vsmp_64.c | 18 +-- arch/x86/xen/enlighten_pv.c | 31 ++-- arch/x86/xen/irq.c | 2 +- arch/x86/xen/mmu_hvm.c | 2 +- arch/x86/xen/mmu_pv.c | 28 ++-- arch/x86/xen/spinlock.c | 11 +- arch/x86/xen/time.c | 4 +- drivers/xen/time.c | 2 +- 27 files changed, 427 insertions(+), 455 deletions(-)
arch/arm/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/arm64/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm64/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/x86/hyperv/mmu.c +2 -2
@@ -231,6 +231,6 @@ void hyperv_setup_mmu_ops(void)return ;pr_info ("Using hypercall for remote TLB flush\n" ); - pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = hyperv_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }
arch/x86/include/asm/paravirt.h +128 -147
781 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +10 -15
@@ -321,28 +321,23 @@ struct pv_lock_ops {* number for each function using the offset which we use to indicate * what to patch. */ struct paravirt_patch_template { -struct pv_init_ops pv_init_ops; -struct pv_time_ops pv_time_ops; -struct pv_cpu_ops pv_cpu_ops; -struct pv_irq_ops pv_irq_ops; -struct pv_mmu_ops pv_mmu_ops; -struct pv_lock_ops pv_lock_ops; +struct pv_init_ops init; +struct pv_time_ops time; +struct pv_cpu_ops cpu; +struct pv_irq_ops irq; +struct pv_mmu_ops mmu; +struct pv_lock_ops lock; } __no_randomize_layout;extern struct pv_info pv_info; -extern struct pv_init_ops pv_init_ops; -extern struct pv_time_ops pv_time_ops; -extern struct pv_cpu_ops pv_cpu_ops; -extern struct pv_irq_ops pv_irq_ops; -extern struct pv_mmu_ops pv_mmu_ops; -extern struct pv_lock_ops pv_lock_ops; +extern struct paravirt_patch_template pv_ops;#define PARAVIRT_PATCH (x) \ (offsetof(struct paravirt_patch_template, x) / sizeof(void *))#define paravirt_type (op) \ [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \ - [paravirt_opptr] "i" (&(op)) + [paravirt_opptr] "i" (&(pv_ops.op))#define paravirt_clobber (clobber) \ [paravirt_clobber] "i" (clobber)
@@ -503,9 +498,9 @@ int paravirt_disable_iospace(void);#endif /* CONFIG_X86_32 */ #ifdef CONFIG_PARAVIRT_DEBUG -#define PVOP_TEST_NULL (op) BUG_ON(op == NULL) +#define PVOP_TEST_NULL (op) BUG_ON(pv_ops.op == NULL)#else -#define PVOP_TEST_NULL (op) ((void)op) +#define PVOP_TEST_NULL (op) ((void)pv_ops.op)#endif #define PVOP_RETMASK (rettype) \
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, insnbuf, + used = pv_ops.init.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/asm-offsets.c +5 -7
@@ -66,13 +66,11 @@ void common(void) {#ifdef CONFIG_PARAVIRT BLANK (); -OFFSET (PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops); -OFFSET (PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops); -OFFSET (PV_IRQ_irq_disable, pv_irq_ops, irq_disable); -OFFSET (PV_IRQ_irq_enable, pv_irq_ops, irq_enable); -OFFSET (PV_CPU_iret, pv_cpu_ops, iret); -OFFSET (PV_CPU_read_cr0, pv_cpu_ops, read_cr0); -OFFSET (PV_MMU_read_cr2, pv_mmu_ops, read_cr2); +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); +OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0); +OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif #ifdef CONFIG_XEN
arch/x86/kernel/asm-offsets_64.c +4 -3
@@ -21,10 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT -OFFSET (PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64); -OFFSET (PV_CPU_swapgs, pv_cpu_ops, swapgs); +OFFSET (PV_CPU_usergs_sysret64, paravirt_patch_template, + cpu.usergs_sysret64); +OFFSET (PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs);#ifdef CONFIG_DEBUG_ENTRY -OFFSET (PV_IRQ_save_fl, pv_irq_ops, save_fl); +OFFSET (PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);#endif BLANK ();#endif
arch/x86/kernel/cpu/common.c +1 -1
@@ -1242,7 +1242,7 @@ static void generic_identify(struct cpuinfo_x86 *c)# ifdef CONFIG_PARAVIRT do {extern void native_iret (void ); -if (pv_cpu_ops.iret == native_iret) +if (pv_ops.cpu.iret == native_iret)set_cpu_bug (c,X86_BUG_ESPFIX ); }while (0 );# else
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -97,14 +97,14 @@ static void __init vmware_sched_clock_setup(void) d->cyc2ns_offset =mul_u64_u32_shr (tsc_now, d->cyc2ns_mul, d->cyc2ns_shift); - pv_time_ops.sched_clock = vmware_sched_clock; + pv_ops.time.sched_clock = vmware_sched_clock;pr_info ("using sched offset of %llu ns\n" , d->cyc2ns_offset); }static void __init vmware_paravirt_ops_setup (void ) { pv_info.name ="VMware hypervisor" ; - pv_cpu_ops.io_delay = paravirt_nop; + pv_ops.cpu.io_delay = paravirt_nop;if (vmware_tsc_khz && vmw_sched_clock)vmware_sched_clock_setup ();
arch/x86/kernel/kvm.c +10 -9
@@ -283,7 +283,7 @@ static void __init paravirt_ops_setup(void) pv_info.name ="KVM" ;if (kvm_para_has_feature (KVM_FEATURE_NOP_IO_DELAY )) - pv_cpu_ops.io_delay = kvm_io_delay; + pv_ops.cpu.io_delay = kvm_io_delay;#ifdef CONFIG_X86_IO_APIC no_timer_check =1 ;
@@ -632,14 +632,14 @@ static void __init kvm_guest_init(void)if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { has_steal_clock =1 ; - pv_time_ops.steal_clock = kvm_steal_clock; + pv_ops.time.steal_clock = kvm_steal_clock; }if (kvm_para_has_feature (KVM_FEATURE_PV_TLB_FLUSH ) && !kvm_para_has_hint (KVM_HINTS_REALTIME ) &&kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }if (kvm_para_has_feature (KVM_FEATURE_PV_EOI ))
@@ -850,13 +850,14 @@ void __init kvm_spinlock_init(void)return ;__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = kvm_wait; - pv_lock_ops.kick = kvm_kick_cpu; + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = kvm_wait; + pv_ops.lock.kick = kvm_kick_cpu;if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_lock_ops.vcpu_is_preempted = + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (__kvm_vcpu_is_preempted); } }
arch/x86/kernel/kvmclock.c +2 -2
@@ -116,13 +116,13 @@ static u64 kvm_sched_clock_read(void)static inline void kvm_sched_clock_init (bool stable) {if (!stable) { - pv_time_ops.sched_clock = kvm_clock_read; + pv_ops.time.sched_clock = kvm_clock_read;clear_sched_clock_stable ();return ; } kvm_sched_clock_offset =kvm_clock_read (); - pv_time_ops.sched_clock = kvm_sched_clock_read; + pv_ops.time.sched_clock = kvm_sched_clock_read;pr_info ("kvm-clock: using sched offset of %llu cycles" , kvm_sched_clock_offset);
arch/x86/kernel/paravirt-spinlocks.c +2 -13
@@ -17,7 +17,7 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock);bool pv_is_native_spin_unlock (void ) { -return pv_lock_ops.queued_spin_unlock.func == +return pv_ops.lock.queued_spin_unlock.func == __raw_callee_save___native_queued_spin_unlock; }
@@ -29,17 +29,6 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_vcpu_is_preempted);bool pv_is_native_vcpu_is_preempted (void ) { -return pv_lock_ops.vcpu_is_preempted.func == +return pv_ops.lock.vcpu_is_preempted.func == __raw_callee_save___native_vcpu_is_preempted; } - -struct pv_lock_ops pv_lock_ops = { -#ifdef CONFIG_SMP - .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath, - .queued_spin_unlock =PV_CALLEE_SAVE (__native_queued_spin_unlock), - .wait = paravirt_nop, - .kick = paravirt_nop, - .vcpu_is_preempted =PV_CALLEE_SAVE (__native_vcpu_is_preempted), -#endif /* SMP */ -}; -EXPORT_SYMBOL (pv_lock_ops);
arch/x86/kernel/paravirt.c +137 -146
336 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_32.c +24 -24
69 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_64.c +28 -28
81 lines not on this page · raw message
arch/x86/kernel/tsc.c +1 -1
@@ -246,7 +246,7 @@ unsigned long long sched_clock(void)bool using_native_sched_clock (void ) { -return pv_time_ops.sched_clock == native_sched_clock; +return pv_ops.time.sched_clock == native_sched_clock; }#else unsigned long long
arch/x86/kernel/vsmp_64.c +9 -9
@@ -73,10 +73,10 @@ static unsigned __init vsmp_patch(u8 type, void *ibuf, unsigned long addr, unsigned len) {switch (type) { -case PARAVIRT_PATCH (pv_irq_ops.irq_enable): -case PARAVIRT_PATCH (pv_irq_ops.irq_disable): -case PARAVIRT_PATCH (pv_irq_ops.save_fl): -case PARAVIRT_PATCH (pv_irq_ops.restore_fl): +case PARAVIRT_PATCH (irq.irq_enable): +case PARAVIRT_PATCH (irq.irq_disable): +case PARAVIRT_PATCH (irq.save_fl): +case PARAVIRT_PATCH (irq.restore_fl):return paravirt_patch_default (type, ibuf, addr, len);default :return native_patch (type, ibuf, addr, len);
@@ -111,11 +111,11 @@ static void __init set_vsmp_pv_ops(void)if (cap & ctl & (1 <<4 )) {/* Setup irq ops and turn on vSMP IRQ fastpath handling */ - pv_irq_ops.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); - pv_irq_ops.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); - pv_irq_ops.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); - pv_irq_ops.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); - pv_init_ops.patch = vsmp_patch; + pv_ops.irq.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); + pv_ops.irq.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); + pv_ops.irq.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); + pv_ops.irq.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); + pv_ops.init.patch = vsmp_patch; ctl &= ~(1 <<4 ); }writel (ctl, address +4 );
arch/x86/xen/enlighten_pv.c +18 -13
@@ -995,11 +995,14 @@ void __init xen_setup_vcpu_info_placement(void)* percpu area for all cpus, so make use of it. */ if (xen_have_vcpu_info_placement) { - pv_irq_ops.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); - pv_irq_ops.restore_fl =__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); - pv_irq_ops.irq_disable =__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); - pv_irq_ops.irq_enable =__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); - pv_mmu_ops.read_cr2 = xen_read_cr2_direct; + pv_ops.irq.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); + pv_ops.irq.restore_fl = +__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); + pv_ops.irq.irq_disable = +__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); + pv_ops.irq.irq_enable = +__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); + pv_ops.mmu.read_cr2 = xen_read_cr2_direct; } }
@@ -1174,14 +1177,14 @@ static void __init xen_boot_params_init_edd(void)*/ static void __init xen_setup_gdt (int cpu) { - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; - pv_cpu_ops.load_gdt = xen_load_gdt_boot; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry_boot; + pv_ops.cpu.load_gdt = xen_load_gdt_boot;setup_stack_canary_segment (cpu);switch_to_new_gdt (cpu); - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; - pv_cpu_ops.load_gdt = xen_load_gdt; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry; + pv_ops.cpu.load_gdt = xen_load_gdt; }static void __init xen_dom0_set_legacy_features (void )
@@ -1206,8 +1209,8 @@ asmlinkage __visible void __init xen_start_kernel(void)/* Install Xen paravirt ops */ pv_info = xen_info; - pv_init_ops.patch = paravirt_patch_default; - pv_cpu_ops = xen_cpu_ops; + pv_ops.init.patch = paravirt_patch_default; + pv_ops.cpu = xen_cpu_ops;xen_init_irq_ops ();/*
@@ -1276,8 +1279,10 @@ asmlinkage __visible void __init xen_start_kernel(void)#endif if (xen_feature (XENFEAT_mmu_pt_update_preserve_ad)) { - pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; - pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; + pv_ops.mmu.ptep_modify_prot_start = + xen_ptep_modify_prot_start; + pv_ops.mmu.ptep_modify_prot_commit = + xen_ptep_modify_prot_commit; } machine_ops = xen_machine_ops;
arch/x86/xen/irq.c +1 -1
@@ -128,6 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {void __init xen_init_irq_ops (void ) { - pv_irq_ops = xen_irq_ops; + pv_ops.irq = xen_irq_ops; x86_init.irqs.intr_init = xen_init_IRQ; }
arch/x86/xen/mmu_hvm.c +1 -1
@@ -73,7 +73,7 @@ static int is_pagetable_dying_supported(void)void __init xen_hvm_init_mmu_ops (void ) {if (is_pagetable_dying_supported ()) - pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap; + pv_ops.mmu.exit_mmap = xen_hvm_exit_mmap;#ifdef CONFIG_PROC_VMCORE WARN_ON (register_oldmem_pfn_is_ram (&xen_oldmem_pfn_is_ram));#endif
arch/x86/xen/mmu_pv.c +14 -14
@@ -2216,7 +2216,7 @@ static void __init xen_write_cr3_init(unsigned long cr3)set_page_prot (initial_page_table,PAGE_KERNEL );set_page_prot (initial_kernel_pmd,PAGE_KERNEL ); - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3; }/*
@@ -2365,27 +2365,27 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)static void __init xen_post_allocator_init (void ) { - pv_mmu_ops.set_pte = xen_set_pte; - pv_mmu_ops.set_pmd = xen_set_pmd; - pv_mmu_ops.set_pud = xen_set_pud; + pv_ops.mmu.set_pte = xen_set_pte; + pv_ops.mmu.set_pmd = xen_set_pmd; + pv_ops.mmu.set_pud = xen_set_pud;#ifdef CONFIG_X86_64 - pv_mmu_ops.set_p4d = xen_set_p4d; + pv_ops.mmu.set_p4d = xen_set_p4d;#endif /* This will work as long as patching hasn't happened yet (which it hasn't) */ - pv_mmu_ops.alloc_pte = xen_alloc_pte; - pv_mmu_ops.alloc_pmd = xen_alloc_pmd; - pv_mmu_ops.release_pte = xen_release_pte; - pv_mmu_ops.release_pmd = xen_release_pmd; + pv_ops.mmu.alloc_pte = xen_alloc_pte; + pv_ops.mmu.alloc_pmd = xen_alloc_pmd; + pv_ops.mmu.release_pte = xen_release_pte; + pv_ops.mmu.release_pmd = xen_release_pmd;#ifdef CONFIG_X86_64 - pv_mmu_ops.alloc_pud = xen_alloc_pud; - pv_mmu_ops.release_pud = xen_release_pud; + pv_ops.mmu.alloc_pud = xen_alloc_pud; + pv_ops.mmu.release_pud = xen_release_pud;#endif - pv_mmu_ops.make_pte =PV_CALLEE_SAVE (xen_make_pte); + pv_ops.mmu.make_pte =PV_CALLEE_SAVE (xen_make_pte);#ifdef CONFIG_X86_64 - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3;#endif }
@@ -2473,7 +2473,7 @@ void __init xen_init_mmu_ops(void) x86_init.paging.pagetable_init = xen_pagetable_init; x86_init.hyper.init_after_bootmem = xen_after_bootmem; - pv_mmu_ops = xen_mmu_ops; + pv_ops.mmu = xen_mmu_ops;memset (dummy_mapping,0xff ,PAGE_SIZE ); }
arch/x86/xen/spinlock.c +6 -5
@@ -141,11 +141,12 @@ void __init xen_init_spinlocks(void)printk (KERN_DEBUG "xen: PV spinlocks enabled\n" );__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = xen_qlock_wait; - pv_lock_ops.kick = xen_qlock_kick; - pv_lock_ops.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = xen_qlock_wait; + pv_ops.lock.kick = xen_qlock_kick; + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); }static __init int xen_parse_nopvspin (char *arg)
arch/x86/xen/time.c +2 -2
@@ -513,7 +513,7 @@ static void __init xen_time_init(void)void __init xen_init_time_ops (void ) { xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.timer_init = xen_time_init; x86_init.timers.setup_percpu_clockev = x86_init_noop;
@@ -555,7 +555,7 @@ void __init xen_hvm_init_time_ops(void) } xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.setup_percpu_clockev = xen_time_init; x86_cpuinit.setup_percpu_clockev = xen_hvm_setup_cpu_clockevents;
drivers/xen/time.c +1 -1
@@ -175,7 +175,7 @@ void __init xen_time_setup_guest(void) xen_runstate_remote = !HYPERVISOR_vm_assist (VMASST_CMD_enable, VMASST_TYPE_runstate_update_flag); - pv_time_ops.steal_clock = xen_steal_clock; + pv_ops.time.steal_clock = xen_steal_clock;static_key_slow_inc (¶virt_steal_enabled);if (xen_runstate_remote)
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 9/15 x86/paravirt: remove unused paravirt bits
In reply to Juergen GrossThe macros ENABLE_INTERRUPTS_SYSEXIT, GET_CR0_INTO_EAX and PARAVIRT_ADJUST_EXCEPTION_FRAME are used nowhere. Remove their definitions.
--- arch/x86/include/asm/irqflags.h | 4 ---- arch/x86/include/asm/paravirt.h | 9 +-------- arch/x86/kernel/asm-offsets.c | 1 - 3 files changed, 1 insertion(+), 13 deletions(-)
arch/x86/include/asm/irqflags.h +0 -4
@@ -134,8 +134,6 @@ static inline notrace unsigned long arch_local_irq_save(void)*/ #define SWAPGS_UNSAFE_STACK swapgs -#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ -#define INTERRUPT_RETURN jmp native_iret#define USERGS_SYSRET64 \ swapgs; \
@@ -149,8 +147,6 @@ static inline notrace unsigned long arch_local_irq_save(void)#endif #else #define INTERRUPT_RETURN iret -#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit -#define GET_CR0_INTO_EAX movl %cr0, %eax#endif
arch/x86/include/asm/paravirt.h +1 -8
@@ -887,14 +887,7 @@ extern void default_banner(void); call PARA_INDIRECT(pv_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) -#ifdef CONFIG_X86_32 -#define GET_CR0_INTO_EAX \ - push %ecx; push %edx; \ - ANNOTATE_RETPOLINE_SAFE; \ - call PARA_INDIRECT(pv_ops+PV_CPU_read_cr0); \ - pop %edx; pop %ecx -#else /* !CONFIG_X86_32 */ - +#ifdef CONFIG_X86_64 /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
arch/x86/kernel/asm-offsets.c +0 -1
@@ -69,7 +69,6 @@ void common(void) {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); -OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0);OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 10/15 x86/paravirt: introduce new config option PARAVIRT_XXL
In reply to Juergen GrossA large amount of paravirt ops is used by Xen PV guests only. Add a new config option PARAVIRT_XXL which is selected by XEN_PV. Later we can put the Xen PV only paravirt ops under the PARAVIRT_XXL umbrella.
Since irq related paravirt ops are used only by VSMP and Xen PV, let VSMP select PARAVIRT_XXL, too, in order to enable moving the irq ops under PARAVIRT_XXL.
---
V3:
- let VSMP select PARAVIRT_XXL (Peter Zijlstra)
--- arch/x86/Kconfig | 4 ++++ arch/x86/boot/compressed/misc.h | 1 + arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/xen/Kconfig | 1 + 4 files changed, 7 insertions(+)
arch/x86/Kconfig +4 -0
@@ -523,6 +523,7 @@ config X86_VSMP bool "ScaleMP vSMP" select HYPERVISOR_GUEST select PARAVIRT + select PARAVIRT_XXL depends on X86_64 && PCI depends on X86_EXTENDED_PLATFORM depends on SMP
@@ -754,6 +755,9 @@ config PARAVIRT over full virtualization. However, when run without a hypervisor the kernel is theoretically slower and slightly larger. +config PARAVIRT_XXL + bool + config PARAVIRT_DEBUG bool "paravirt-ops debugging" depends on PARAVIRT && DEBUG_KERNEL
arch/x86/boot/compressed/misc.h +1 -0
@@ -9,6 +9,7 @@* paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#undef CONFIG_KASAN
arch/x86/mm/mem_encrypt_identity.c +1 -0
@@ -27,6 +27,7 @@* be extended when new paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#include <linux/kernel.h>
arch/x86/xen/Kconfig +1 -0
@@ -18,6 +18,7 @@ config XEN_PV bool "Xen PV guest support" default y depends on XEN + select PARAVIRT_XXL select XEN_HAVE_PVMMU select XEN_HAVE_VPMU help
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 11/15 x86/paravirt: move items in pv_info under PARAVIRT_XXL umbrella
In reply to Juergen GrossAll items but name in pv_info are needed by Xen PV only. Define them with CONFIG_PARAVIRT_XXL set only.
--- arch/x86/include/asm/paravirt.h | 2 ++ arch/x86/include/asm/paravirt_types.h | 2 ++ arch/x86/include/asm/pgtable-3level_types.h | 2 +- arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/segment.h | 2 +- arch/x86/kernel/paravirt.c | 2 ++ 6 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/include/asm/paravirt.h +2 -0
@@ -104,7 +104,9 @@ static inline void wbinvd(void)PVOP_VCALL0 (cpu.wbinvd); } +#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) +#endif static inline u64 paravirt_read_msr (unsigned msr) {
arch/x86/include/asm/paravirt_types.h +2 -0
@@ -66,11 +66,13 @@ struct paravirt_callee_save {/* general info */ struct pv_info { +#ifdef CONFIG_PARAVIRT_XXL unsigned int kernel_rpl;int shared_kernel_pmd;#ifdef CONFIG_X86_64 u16 extra_user_64bit_cs;/* __USER_CS if none */ +#endif #endif const char *name;
arch/x86/include/asm/pgtable-3level_types.h +1 -1
@@ -20,7 +20,7 @@ typedef union { } pte_t;#endif /* !__ASSEMBLY__ */ -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #define SHARED_KERNEL_PMD ((!static_cpu_has(X86_FEATURE_PTI) && \ (pv_info.shared_kernel_pmd)))#else
arch/x86/include/asm/ptrace.h +1 -1
@@ -144,7 +144,7 @@ static inline int v8086_mode(struct pt_regs *regs)static inline bool user_64bit_mode (struct pt_regs *regs) {#ifdef CONFIG_X86_64 -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * On non-paravirt systems, this is the only long mode CPL 3 * selector. We do not allow long mode selectors in the LDT.
arch/x86/include/asm/segment.h +1 -1
@@ -211,7 +211,7 @@#endif -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL # define get_kernel_rpl () 0#endif
arch/x86/kernel/paravirt.c +2 -0
@@ -293,12 +293,14 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)struct pv_info pv_info = { .name ="bare hardware" , +#ifdef CONFIG_PARAVIRT_XXL .kernel_rpl =0 , .shared_kernel_pmd =1 ,/* Only used when CONFIG_X86_PAE is set */ #ifdef CONFIG_X86_64 .extra_user_64bit_cs = __USER_CS, #endif +#endif };#if defined(CONFIG_X86_32 ) && !defined(CONFIG_X86_PAE )
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 12/15 x86/paravirt: move the Xen-only pv_cpu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossMost of the paravirt ops defined in pv_cpu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/debugreg.h | 2 +- arch/x86/include/asm/desc.h | 4 ++-- arch/x86/include/asm/irqflags.h | 16 +++++++++++----- arch/x86/include/asm/msr.h | 4 ++-- arch/x86/include/asm/paravirt.h | 19 +++++++++++++++++-- arch/x86/include/asm/paravirt_types.h | 5 ++++- arch/x86/include/asm/pgtable.h | 6 ++++-- arch/x86/include/asm/processor.h | 4 ++-- arch/x86/include/asm/special_insns.h | 9 +++++++-- arch/x86/kernel/asm-offsets.c | 2 ++ arch/x86/kernel/asm-offsets_64.c | 2 ++ arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/head_64.S | 2 ++ arch/x86/kernel/paravirt.c | 13 ++++++++++++- arch/x86/kernel/paravirt_patch_32.c | 4 ++++ arch/x86/kernel/paravirt_patch_64.c | 6 +++++- 16 files changed, 78 insertions(+), 22 deletions(-)
arch/x86/include/asm/debugreg.h +1 -1
@@ -8,7 +8,7 @@ DECLARE_PER_CPU(unsigned long, cpu_dr7); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * These special macros can be used to get or set a debugging register */
arch/x86/include/asm/desc.h +2 -2
@@ -108,7 +108,7 @@ static inline int desc_empty(const void *ptr)return !(desc[0 ] | desc[1 ]); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define load_TR_desc () native_load_tr_desc()
@@ -134,7 +134,7 @@ static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries)static inline void paravirt_free_ldt (struct desc_struct *ldt,unsigned entries) { } -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #define store_ldt (ldt) asm("sldt %0" : "=m"(ldt))
arch/x86/include/asm/irqflags.h +11 -5
@@ -121,6 +121,16 @@ static inline notrace unsigned long arch_local_irq_save(void)#define ENABLE_INTERRUPTS (x) sti#define DISABLE_INTERRUPTS (x) cli +#ifdef CONFIG_X86_64 +#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/*
@@ -142,16 +152,12 @@ static inline notrace unsigned long arch_local_irq_save(void)swapgs ; \ sysretl -#ifdef CONFIG_DEBUG_ENTRY -#define SAVE_FLAGS (x) pushfq; popq %rax -#endif #else #define INTERRUPT_RETURN iret#endif -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #ifndef __ASSEMBLY__static inline int arch_irqs_disabled_flags (unsigned long flags)
arch/x86/include/asm/msr.h +2 -2
@@ -242,7 +242,7 @@ static inline unsigned long long native_read_pmc(int counter)return EAX_EDX_VAL (val, low, high); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #include <linux/errno.h>
@@ -305,7 +305,7 @@ do { \#define rdpmcl (counter, val) ((val) = native_read_pmc(counter)) -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ /* * 64-bit version of wrmsr_safe():
arch/x86/include/asm/paravirt.h +17 -2
@@ -17,6 +17,7 @@#include <linux/cpumask.h> #include <asm/frame.h> +#ifdef CONFIG_PARAVIRT_XXL static inline void load_sp0 (unsigned long sp0) {PVOP_VCALL1 (cpu.load_sp0, sp0);
@@ -51,6 +52,7 @@ static inline void write_cr0(unsigned long x) {PVOP_VCALL1 (cpu.write_cr0, x); } +#endif static inline unsigned long read_cr2 (void ) {
@@ -72,6 +74,7 @@ static inline void write_cr3(unsigned long x)PVOP_VCALL1 (mmu.write_cr3, x); } +#ifdef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {PVOP_VCALL1 (cpu.write_cr4, x);
@@ -88,6 +91,7 @@ static inline void write_cr8(unsigned long x)PVOP_VCALL1 (cpu.write_cr8, x); }#endif +#endif static inline void arch_safe_halt (void ) {
@@ -99,14 +103,13 @@ static inline void halt(void)PVOP_VCALL0 (irq.halt); } +#ifdef CONFIG_PARAVIRT_XXL static inline void wbinvd (void ) {PVOP_VCALL0 (cpu.wbinvd); } -#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) -#endif static inline u64 paravirt_read_msr (unsigned msr) {
@@ -171,6 +174,7 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) *p =paravirt_read_msr_safe (msr, &err); return err; } +#endif static inline unsigned long long paravirt_sched_clock (void ) {
@@ -186,6 +190,7 @@ static inline u64 paravirt_steal_clock(int cpu)return PVOP_CALL1 (u64, time.steal_clock, cpu); } +#ifdef CONFIG_PARAVIRT_XXL static inline unsigned long long paravirt_read_pmc (int counter) {return PVOP_CALL1 (u64, cpu.read_pmc, counter);
@@ -230,6 +235,7 @@ static inline unsigned long paravirt_store_tr(void) { return PVOP_CALL0(unsigned long, cpu.store_tr); } +#define store_tr (tr) ((tr) = paravirt_store_tr())static inline void load_TLS (struct thread_struct *t,unsigned cpu) {
@@ -263,6 +269,7 @@ static inline void set_iopl_mask(unsigned mask) {PVOP_VCALL1 (cpu.set_iopl_mask, mask); } +#endif /* The paravirtualized I/O functions */ static inline void slow_down_io (void )
@@ -618,6 +625,7 @@ static inline void pmd_clear(pmd_t *pmdp) }#endif /* CONFIG_X86_PAE */ +#ifdef CONFIG_PARAVIRT_XXL #define __HAVE_ARCH_START_CONTEXT_SWITCHstatic inline void arch_start_context_switch (struct task_struct *prev) {
@@ -628,6 +636,7 @@ static inline void arch_end_context_switch(struct task_struct *next) {PVOP_VCALL1 (cpu.end_context_switch, next); } +#endif #define __HAVE_ARCH_ENTER_LAZY_MMU_MODEstatic inline void arch_enter_lazy_mmu_mode (void )
@@ -870,10 +879,12 @@ extern void default_banner(void);#define PARA_INDIRECT (addr) *%cs:addr#endif +#ifdef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN \ 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), \
@@ -890,6 +901,7 @@ extern void default_banner(void); PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#ifdef CONFIG_X86_64 +#ifdef CONFIG_PARAVIRT_XXL /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
@@ -909,15 +921,18 @@ extern void default_banner(void);ANNOTATE_RETPOLINE_SAFE ; \ call PARA_INDIRECT(pv_ops+PV_CPU_swapgs); \ ) +#endif #define GET_CR2_INTO_RAX \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_ops+PV_MMU_read_cr2); +#ifdef CONFIG_PARAVIRT_XXL #define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(PV_CPU_usergs_sysret64), \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);) +#endif #ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \
arch/x86/include/asm/paravirt_types.h +4 -1
@@ -106,6 +106,9 @@ struct pv_time_ops {struct pv_cpu_ops {/* hooks for various privileged instructions */ +void (*io_delay)(void ); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*get_debugreg)(int regno);void (*set_debugreg)(int regno,unsigned long value);
@@ -143,7 +146,6 @@ struct pv_cpu_ops {void (*set_iopl_mask)(unsigned mask);void (*wbinvd)(void ); -void (*io_delay)(void );/* cpuid emulation, mostly so that caps bits can be disabled */ void (*cpuid)(unsigned int *eax, unsigned int *ebx,
@@ -178,6 +180,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); +#endif } __no_randomize_layout;struct pv_irq_ops {
arch/x86/include/asm/pgtable.h +4 -2
@@ -111,10 +111,12 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#define arch_end_context_switch (prev) do {} while(0) -#endif /* CONFIG_PARAVIRT */ +#ifndef CONFIG_PARAVIRT_XXL +#define arch_end_context_switch (prev) do {} while(0) +#endif /* CONFIG_PARAVIRT_XXL */ +/* * The following only work if pte_present() is true. * Undefined behaviour if not..
arch/x86/include/asm/processor.h +2 -2
@@ -576,7 +576,7 @@ static inline bool on_thread_stack(void) current_stack_pointer) < THREAD_SIZE; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define __cpuid native_cpuid
@@ -587,7 +587,7 @@ static inline void load_sp0(unsigned long sp0) }#define set_iopl_mask native_set_iopl_mask -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ /* Free all resources held by a thread. */ extern void release_thread (struct task_struct *);
arch/x86/include/asm/special_insns.h +7 -2
@@ -143,8 +143,9 @@ static inline unsigned long __read_cr4(void)#ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> -#else +#endif +#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -154,7 +155,9 @@ 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 ();
@@ -178,7 +181,9 @@ 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);
@@ -208,7 +213,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +2 -0
@@ -68,7 +68,9 @@ void common(void) {BLANK ();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);#endif
arch/x86/kernel/asm-offsets_64.c +2 -0
@@ -21,9 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL 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
arch/x86/kernel/cpu/common.c +1 -1
@@ -1239,7 +1239,7 @@ static void generic_identify(struct cpuinfo_x86 *c)* ESPFIX issue, we can change this. */ #ifdef CONFIG_X86_32 -# ifdef CONFIG_PARAVIRT +# ifdef CONFIG_PARAVIRT_XXL do { extern void native_iret(void); if (pv_ops.cpu.iret == native_iret)
arch/x86/kernel/head_64.S +2 -0
@@ -31,6 +31,8 @@ #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 +12 -1
@@ -101,6 +101,7 @@ static unsigned paravirt_patch_call(void *insnbuf, const void *target,return 5 ; } +#ifdef CONFIG_PARAVIRT_XXL static unsigned paravirt_patch_jmp (void *insnbuf,const void *target,unsigned long addr,unsigned len) {
@@ -119,6 +120,7 @@ static unsigned paravirt_patch_jmp(void *insnbuf, const void *target, return 5; } +#endif DEFINE_STATIC_KEY_TRUE (virt_spin_lock_key);
@@ -150,10 +152,12 @@ unsigned paravirt_patch_default(u8 type, void *insnbuf,else if (opfunc == _paravirt_ident_64) ret =paravirt_patch_ident_64 (insnbuf, len); +#ifdef CONFIG_PARAVIRT_XXL else if (type == PARAVIRT_PATCH(cpu.iret) || type == PARAVIRT_PATCH(cpu.usergs_sysret64))/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); +#endif else/* Otherwise call the function. */ ret =paravirt_patch_call (insnbuf, opfunc, addr, len);
@@ -262,6 +266,7 @@ void paravirt_flush_lazy_mmu(void)preempt_enable (); } +#ifdef CONFIG_PARAVIRT_XXL void paravirt_start_context_switch (struct task_struct *prev) {BUG_ON (preemptible ());
@@ -282,6 +287,7 @@ void paravirt_end_context_switch(struct task_struct *next)if (test_and_clear_ti_thread_flag (task_thread_info (next),TIF_LAZY_MMU_UPDATES )) arch_enter_lazy_mmu_mode(); } +#endif enum paravirt_lazy_mode paravirt_get_lazy_mode (void ) {
@@ -320,6 +326,9 @@ struct paravirt_patch_template pv_ops = { .time.steal_clock = native_steal_clock,/* Cpu ops. */ + .cpu.io_delay = native_io_delay, + +#ifdef CONFIG_PARAVIRT_XXL .cpu.cpuid = native_cpuid, .cpu.get_debugreg = native_get_debugreg, .cpu.set_debugreg = native_set_debugreg,
@@ -361,10 +370,10 @@ struct paravirt_patch_template pv_ops = { .cpu.swapgs = native_swapgs, .cpu.set_iopl_mask = native_set_iopl_mask, - .cpu.io_delay = native_io_delay, .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),
@@ -463,10 +472,12 @@ struct paravirt_patch_template pv_ops = {#endif }; +#ifdef CONFIG_PARAVIRT_XXL /* At this point, native_get/set_debugreg has real function entries */ NOKPROBE_SYMBOL (native_get_debugreg);NOKPROBE_SYMBOL (native_set_debugreg);NOKPROBE_SYMBOL (native_load_idt); +#endif EXPORT_SYMBOL_GPL (pv_ops);EXPORT_SYMBOL_GPL (pv_info);
arch/x86/kernel/paravirt_patch_32.c +4 -0
@@ -5,7 +5,9 @@ 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" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" );
@@ -45,7 +47,9 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3);
arch/x86/kernel/paravirt_patch_64.c +5 -1
@@ -10,10 +10,12 @@ DEF_NATIVE(irq, save_fl, "pushfq; popq %rax");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" );DEF_NATIVE (cpu, swapgs,"swapgs" ); +#endif DEF_NATIVE(, mov32, "mov %edi, %eax"); DEF_NATIVE(, mov64, "mov %rdi, %rax");
@@ -53,12 +55,14 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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); +#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); -PATCH_SITE (cpu, wbinvd);#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 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 · 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 · 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
Juergen Gross
maintainerPATCH v3 1/15 xen: move pv irq related functions under CONFIG_XEN_PV umbrella
In reply to Juergen GrossAll functions in arch/x86/xen/irq.c and arch/x86/xen/xen-asm*.S are specific to PV guests. Include them in the kernel with CONFIG_XEN_PV only.
Make the PV specific code in arch/x86/entry/entry_*.S dependent on CONFIG_XEN_PV instead of CONFIG_XEN.
The HVM specific code should depend on CONFIG_XEN_PVHVM.
While at it reformat the Makefile to make it more readable.
--- arch/x86/entry/entry_32.S | 8 +++++--- arch/x86/entry/entry_64.S | 8 +++++--- arch/x86/xen/Makefile | 41 +++++++++++++++++++++++++++++++---------- include/xen/events.h | 2 ++ 4 files changed, 43 insertions(+), 16 deletions(-)
arch/x86/entry/entry_32.S +5 -3
@@ -782,7 +782,7 @@ GLOBAL(__begin_SYSENTER_singlestep_region) * will ignore all of the single-step traps generated in this range. */ -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV /* * Xen doesn't set %esp to be precisely what the normal SYSENTER * entry point expects, so fix it up before using the normal path.
@@ -1240,7 +1240,7 @@ ENTRY(spurious_interrupt_bug) jmp common_exception END(spurious_interrupt_bug) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV ENTRY(xen_hypervisor_callback) pushl $-1 /* orig_ax = -1 => not a system call */ SAVE_ALL
@@ -1321,11 +1321,13 @@ ENTRY(xen_failsafe_callback) _ASM_EXTABLE(3b, 8b) _ASM_EXTABLE(4b, 9b) ENDPROC(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, xen_evtchn_do_upcall) +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV)
arch/x86/entry/entry_64.S +5 -3
@@ -1050,7 +1050,7 @@ ENTRY(do_softirq_own_stack) ret ENDPROC(do_softirq_own_stack) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry hypervisor_callback xen_do_hypervisor_callback has_error_code=0 /*
@@ -1130,11 +1130,13 @@ ENTRY(xen_failsafe_callback) ENCODE_FRAME_POINTER jmp error_exit END(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ xen_hvm_callback_vector xen_evtchn_do_upcall +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV) apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
@@ -1151,7 +1153,7 @@ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK idtentry int3 do_int3 has_error_code=0 idtentry stack_segment do_stack_segment has_error_code=1 -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry xennmi do_nmi has_error_code=0 idtentry xendebug do_debug has_error_code=0 idtentry xenint3 do_int3 has_error_code=0
arch/x86/xen/Makefile +31 -10
56 lines not on this page · raw message
include/xen/events.h +2 -0
@@ -89,11 +89,13 @@ unsigned irq_from_evtchn(unsigned int evtchn);int irq_from_virq (unsigned int cpu,unsigned int virq);unsigned int evtchn_from_irq (unsigned irq); +#ifdef CONFIG_XEN_PVHVM /* Xen HVM evtchn vector callback */ void xen_hvm_callback_vector (void );#ifdef CONFIG_TRACING #define trace_xen_hvm_callback_vector xen_hvm_callback_vector#endif +#endif int xen_set_callback_via (uint64_t via);void xen_evtchn_do_upcall (struct pt_regs *regs);void xen_hvm_evtchn_do_upcall (void );
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 2/15 xen: move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
In reply to Juergen GrossThere are some PV specific functions in arch/x86/xen/mmu.c which can be moved to mmu_pv.c. This in turn enables us to make multicalls.c dependent on CONFIG_XEN_PV.
---
V3:
- fix build failure on ARM (Boris Ostrovsky)
--- arch/arm/xen/enlighten.c | 34 -------- arch/x86/xen/Makefile | 2 +- arch/x86/xen/mmu.c | 186 ----------------------------------------- arch/x86/xen/mmu_pv.c | 138 ++++++++++++++++++++++++++++++ include/xen/interface/memory.h | 6 -- include/xen/xen-ops.h | 133 +++++++++++++++++++---------- 6 files changed, 227 insertions(+), 272 deletions(-)
arch/arm/xen/enlighten.c +0 -34
@@ -62,29 +62,6 @@ static __read_mostly unsigned int xen_events_irq;uint32_t xen_start_flags;EXPORT_SYMBOL (xen_start_flags); -int xen_remap_domain_gfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *gfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned domid, -struct page **pages) -{ -return xen_xlate_remap_gfn_array (vma, addr, gfn, nr, err_ptr, - prot, domid, pages); -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_array); - -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_gfn_range (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t gfn,int nr, -pgprot_t prot,unsigned domid, -struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_range); -int xen_unmap_domain_gfn_range (struct vm_area_struct *vma,int nr,struct page **pages) {
@@ -92,17 +69,6 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, }EXPORT_SYMBOL_GPL (xen_unmap_domain_gfn_range); -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_mfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *mfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned int domid,struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_mfn_array); -static void xen_read_wallclock (struct timespec64 *ts) {u32 version;
arch/x86/xen/Makefile +1 -1
@@ -15,7 +15,6 @@ CFLAGS_enlighten_pv.o := $(nostackp) CFLAGS_mmu_pv.o := $(nostackp) obj-y += enlighten.o -obj-y += multicalls.o obj-y += mmu.o obj-y += time.o obj-y += grant-table.o
@@ -34,6 +33,7 @@ obj-$(CONFIG_XEN_PV) += p2m.o obj-$(CONFIG_XEN_PV) += enlighten_pv.o obj-$(CONFIG_XEN_PV) += mmu_pv.o obj-$(CONFIG_XEN_PV) += irq.o +obj-$(CONFIG_XEN_PV) += multicalls.o obj-$(CONFIG_XEN_PV) += xen-asm.o obj-$(CONFIG_XEN_PV) += xen-asm_$(BITS).o
arch/x86/xen/mmu.c +0 -186
198 lines not on this page · raw message
arch/x86/xen/mmu_pv.c +138 -0
150 lines not on this page · raw message
include/xen/interface/memory.h +0 -6
@@ -244,12 +244,6 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);#define XENMEM_machine_memory_map 10 -/* -* Prevent the balloon driver from changing the memory reservation -* during a driver critical region. -*/ -extern spinlock_t xen_reservation_lock; -/* * Unmaps the page appearing at a particular GPFN from the specified guest's * pseudophysical address space.
include/xen/xen-ops.h +88 -45
176 lines not on this page · raw message
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 3/15 xen: link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
In reply to Juergen GrossInstead of using one large #ifdef CONFIG_XEN_PVHVM in arch/x86/xen/platform-pci-unplug.c add the object file depending on CONFIG_XEN_PVHVM being set.
--- arch/x86/xen/Makefile | 2 +- arch/x86/xen/platform-pci-unplug.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/x86/xen/Makefile +1 -1
@@ -19,11 +19,11 @@ obj-y += mmu.o obj-y += time.o obj-y += grant-table.o obj-y += suspend.o -obj-y += platform-pci-unplug.o obj-$(CONFIG_XEN_PVHVM) += enlighten_hvm.o obj-$(CONFIG_XEN_PVHVM) += mmu_hvm.o obj-$(CONFIG_XEN_PVHVM) += suspend_hvm.o +obj-$(CONFIG_XEN_PVHVM) += platform-pci-unplug.o obj-$(CONFIG_XEN_PV) += setup.o obj-$(CONFIG_XEN_PV) += apic.o
arch/x86/xen/platform-pci-unplug.c +0 -2
@@ -30,7 +30,6 @@#define XEN_PLATFORM_ERR_PROTOCOL -2#define XEN_PLATFORM_ERR_BLACKLIST -3 -#ifdef CONFIG_XEN_PVHVM /* store the value of xen_emul_unplug after the unplug is done */ static int xen_platform_pci_unplug;static int xen_emul_unplug;
@@ -214,4 +213,3 @@ static int __init parse_xen_emul_unplug(char *arg)return 0 ; }early_param ("xen_emul_unplug" , parse_xen_emul_unplug); -#endif
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 3/15 xen: link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
In reply to Juergen GrossInstead of using one large #ifdef CONFIG_XEN_PVHVM in arch/x86/xen/platform-pci-unplug.c add the object file depending on CONFIG_XEN_PVHVM being set.
--- arch/x86/xen/Makefile | 2 +- arch/x86/xen/platform-pci-unplug.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/x86/xen/Makefile +1 -1
@@ -19,11 +19,11 @@ obj-y += mmu.o obj-y += time.o obj-y += grant-table.o obj-y += suspend.o -obj-y += platform-pci-unplug.o obj-$(CONFIG_XEN_PVHVM) += enlighten_hvm.o obj-$(CONFIG_XEN_PVHVM) += mmu_hvm.o obj-$(CONFIG_XEN_PVHVM) += suspend_hvm.o +obj-$(CONFIG_XEN_PVHVM) += platform-pci-unplug.o obj-$(CONFIG_XEN_PV) += setup.o obj-$(CONFIG_XEN_PV) += apic.o
arch/x86/xen/platform-pci-unplug.c +0 -2
@@ -30,7 +30,6 @@#define XEN_PLATFORM_ERR_PROTOCOL -2#define XEN_PLATFORM_ERR_BLACKLIST -3 -#ifdef CONFIG_XEN_PVHVM /* store the value of xen_emul_unplug after the unplug is done */ static int xen_platform_pci_unplug;static int xen_emul_unplug;
@@ -214,4 +213,3 @@ static int __init parse_xen_emul_unplug(char *arg)return 0 ; }early_param ("xen_emul_unplug" , parse_xen_emul_unplug); -#endif
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 4/15 xen: add SPDX identifier in arch/x86/xen files
In reply to Juergen Gross--- arch/x86/xen/efi.c | 14 +------------- arch/x86/xen/enlighten.c | 2 ++ arch/x86/xen/enlighten_hvm.c | 2 ++ arch/x86/xen/grant-table.c | 25 +------------------------ arch/x86/xen/mmu.c | 2 ++ arch/x86/xen/mmu_pv.c | 2 ++ arch/x86/xen/p2m.c | 2 ++ arch/x86/xen/pci-swiotlb-xen.c | 2 ++ arch/x86/xen/platform-pci-unplug.c | 16 ++-------------- arch/x86/xen/vdso.h | 2 ++ arch/x86/xen/xen-pvh.S | 15 ++------------- 11 files changed, 20 insertions(+), 64 deletions(-)
arch/x86/xen/efi.c +1 -13
@@ -1,18 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2014 Oracle Co., Daniel Kiper -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/bitops.h>
arch/x86/xen/enlighten.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG #include <linux/bootmem.h> #endif
arch/x86/xen/enlighten_hvm.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/acpi.h> #include <linux/cpu.h> #include <linux/kexec.h>
arch/x86/xen/grant-table.c +1 -24
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT /****************************************************************************** * grant_table.c * x86 specific part
@@ -8,30 +9,6 @@* Copyright (c) 2004-2005, K A Fraser * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp> * VA Linux Systems Japan. Split out x86 specific part. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation; or, when distributed -* separately from the Linux kernel or incorporated into other -* software packages, subject to the following license: -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this source file (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, copy, modify, -* merge, publish, distribute, sublicense, and/or sell copies of the Software, -* and to permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -* IN THE SOFTWARE. */ #include <linux/sched.h>
arch/x86/xen/mmu.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/pfn.h> #include <asm/xen/page.h> #include <asm/xen/hypercall.h>
arch/x86/xen/mmu_pv.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Xen mmu operations *
arch/x86/xen/p2m.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Xen leaves the responsibility for maintaining p2m mappings to the * guests themselves, but it must also access and update the p2m array
arch/x86/xen/pci-swiotlb-xen.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Glue code to lib/swiotlb-xen.c */ #include <linux/dma-mapping.h>
arch/x86/xen/platform-pci-unplug.c +2 -14
@@ -1,22 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/****************************************************************************** * platform-pci-unplug.c * * Xen platform PCI device driver * Copyright (c) 2010, Citrix -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., 59 Temple -* Place - Suite 330, Boston, MA 02111-1307 USA. -* */ #include <linux/init.h>
arch/x86/xen/vdso.h +2 -0
@@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Bit used for the pseudo-hwcap for non-negative segments. We use bit 1 to avoid bugs in some versions of glibc when bit 0 is used; the choice is otherwise arbitrary. */
arch/x86/xen/xen-pvh.S +2 -13
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + /* * Copyright C 2016, Oracle and/or its affiliates. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. */ .code32
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 5/15 x86/paravirt: make paravirt_patch_call() and paravirt_patch_jmp() static
In reply to Juergen Grossparavirt_patch_call() and paravirt_patch_jmp() are used in paravirt.c only. Convert them to static.
--- arch/x86/include/asm/paravirt_types.h | 6 ------ arch/x86/kernel/paravirt.c | 12 ++++++------ 2 files changed, 6 insertions(+), 12 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -6
@@ -373,12 +373,6 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len); -unsigned paravirt_patch_jmp (void *insnbuf,const void *target, -unsigned long addr,unsigned len);unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf,unsigned long addr,unsigned len);
arch/x86/kernel/paravirt.c +6 -6
@@ -81,10 +81,10 @@ struct branch {u32 delta; } __attribute__((packed)); -unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf, +const void *target,u16 tgt_clobbers, +unsigned long addr,u16 site_clobbers, +unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -103,8 +103,8 @@ unsigned paravirt_patch_call(void *insnbuf,return 5 ; } -unsigned paravirt_patch_jmp (void *insnbuf,const void *target, -unsigned long addr,unsigned len) +static unsigned paravirt_patch_jmp (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerv3 cover x86/paravirt, xen: several cleanups
This series removes some no longer needed stuff from paravirt infrastructure and puts large quantities of paravirt ops under a new config option PARAVIRT_XXL which is selected by XEN_PV only.
Some Xen related cleanups:
- move some pv-only code from CONFIG_XEN to CONFIG_XEN_PV
- use CONFIG_XEN_PVHVM in Makefile instead of #ifdef around a complete source
- add SPDX identifier where missing
A pvops kernel without XEN_PV being configured is about 2.5% smaller with this series applied.
Changes in V3:
- merged with the Xen cleanup series which is a prerequisite for the pv cleanup
- fix build errors on ARM
- let VSMP select PARAVIRT_XXL, put all irq_ops under PARAVIRT_XXL
Changes in V2:
- patch 4: shorten pv_ops sub-structure names (Jan Beulich)
- patch 11: new patch
Juergen Gross (15):
xen: move pv irq related functions under CONFIG_XEN_PV umbrella
xen: move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
xen: link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
xen: add SPDX identifier in arch/x86/xen files x86/paravirt: make paravirt_patch_call() and paravirt_patch_jmp()
static
x86/paravirt: remove clobbers parameter from paravirt patch functions x86/paravirt: remove clobbers from struct paravirt_patch_site x86/paravirt: use a single ops structure
x86/paravirt: remove unused paravirt bits
x86/paravirt: introduce new config option PARAVIRT_XXL x86/paravirt: move items in pv_info under PARAVIRT_XXL umbrella x86/paravirt: move the Xen-only pv_cpu_ops under the PARAVIRT_XXL
umbrella
x86/paravirt: move the pv_irq_ops under the PARAVIRT_XXL umbrella x86/paravirt: move the Xen-only pv_mmu_ops under the PARAVIRT_XXL
umbrella
x86/paravirt: remove unneeded mmu related paravirt ops bits
arch/arm/include/asm/paravirt.h | 9 +- arch/arm/kernel/paravirt.c | 4 +- arch/arm/xen/enlighten.c | 34 --- arch/arm64/include/asm/paravirt.h | 9 +- arch/arm64/kernel/paravirt.c | 4 +- arch/x86/Kconfig | 4 + arch/x86/boot/compressed/misc.h | 1 + arch/x86/entry/entry_32.S | 8 +- arch/x86/entry/entry_64.S | 8 +- arch/x86/hyperv/mmu.c | 4 +- arch/x86/include/asm/debugreg.h | 2 +- arch/x86/include/asm/desc.h | 4 +- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/include/asm/irqflags.h | 16 +- arch/x86/include/asm/mmu_context.h | 4 +- arch/x86/include/asm/msr.h | 4 +- arch/x86/include/asm/paravirt.h | 415 +++++++++++++--------------- arch/x86/include/asm/paravirt_types.h | 82 +++--- arch/x86/include/asm/pgalloc.h | 2 +- arch/x86/include/asm/pgtable-3level_types.h | 2 +- arch/x86/include/asm/pgtable.h | 7 +- arch/x86/include/asm/processor.h | 4 +- arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/segment.h | 2 +- arch/x86/include/asm/special_insns.h | 4 +- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/asm-offsets.c | 13 +- arch/x86/kernel/asm-offsets_64.c | 9 +- arch/x86/kernel/cpu/common.c | 4 +- arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/head_64.S | 2 +- arch/x86/kernel/kvm.c | 19 +- arch/x86/kernel/kvmclock.c | 4 +- arch/x86/kernel/paravirt-spinlocks.c | 15 +- arch/x86/kernel/paravirt.c | 305 ++++++++++---------- arch/x86/kernel/paravirt_patch_32.c | 57 ++-- arch/x86/kernel/paravirt_patch_64.c | 65 ++--- arch/x86/kernel/tsc.c | 2 +- arch/x86/kernel/vsmp_64.c | 26 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/xen/Kconfig | 1 + arch/x86/xen/Makefile | 41 ++- arch/x86/xen/efi.c | 14 +- arch/x86/xen/enlighten.c | 2 + arch/x86/xen/enlighten_hvm.c | 2 + arch/x86/xen/enlighten_pv.c | 31 ++- arch/x86/xen/grant-table.c | 25 +- arch/x86/xen/irq.c | 2 +- arch/x86/xen/mmu.c | 188 +------------ arch/x86/xen/mmu_hvm.c | 2 +- arch/x86/xen/mmu_pv.c | 168 ++++++++++- arch/x86/xen/p2m.c | 2 + arch/x86/xen/pci-swiotlb-xen.c | 2 + arch/x86/xen/platform-pci-unplug.c | 18 +- arch/x86/xen/spinlock.c | 11 +- arch/x86/xen/time.c | 4 +- arch/x86/xen/vdso.h | 2 + arch/x86/xen/xen-pvh.S | 15 +- drivers/xen/time.c | 2 +- include/xen/events.h | 2 + include/xen/interface/memory.h | 6 - include/xen/xen-ops.h | 133 ++++++--- 62 files changed, 880 insertions(+), 958 deletions(-)
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 6/15 x86/paravirt: remove clobbers parameter from paravirt patch functions
The clobbers parameter from paravirt_patch_default() et al isn't used any longer. Remove it.
--- arch/x86/include/asm/paravirt_types.h | 7 +++---- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/paravirt.c | 14 +++++--------- arch/x86/kernel/paravirt_patch_32.c | 5 ++--- arch/x86/kernel/paravirt_patch_64.c | 5 ++--- arch/x86/kernel/vsmp_64.c | 6 +++--- 6 files changed, 16 insertions(+), 23 deletions(-)
arch/x86/include/asm/paravirt_types.h +3 -4
@@ -85,7 +85,7 @@ struct pv_init_ops {* the number of bytes of code generated, as we nop pad the * rest in generic code. */ -unsigned (*patch)(u8 type,u16 clobber,void *insnbuf, +unsigned (*patch)(u8 type,void *insnbuf,unsigned long addr,unsigned len); } __no_randomize_layout;
@@ -373,14 +373,13 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len);unsigned paravirt_patch_insns (void *insnbuf,unsigned len,const char *start,const char *end); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len); +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len);int paravirt_disable_iospace (void );
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, p->clobbers, insnbuf, + used = pv_init_ops.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/paravirt.c +5 -9
@@ -81,10 +81,8 @@ struct branch {u32 delta; } __attribute__((packed)); -static unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -149,7 +147,7 @@ static void *get_call_destination(u8 type)return *((void **)&tmpl + type); } -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len) {void *opfunc =get_call_destination (type);
@@ -172,10 +170,8 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); else -/* Otherwise call the function; assume target could -clobber any caller-save reg */ - ret =paravirt_patch_call (insnbuf, opfunc,CLBR_ANY , - addr, clobbers, len); +/* Otherwise call the function. */ + ret =paravirt_patch_call (insnbuf, opfunc, addr, len);return ret; }
arch/x86/kernel/paravirt_patch_32.c +2 -3
@@ -30,8 +30,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -70,7 +69,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/paravirt_patch_64.c +2 -3
@@ -38,8 +38,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -80,7 +79,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/vsmp_64.c +3 -3
@@ -69,7 +69,7 @@ asmlinkage __visible void vsmp_irq_enable(void) }PV_CALLEE_SAVE_REGS_THUNK (vsmp_irq_enable); -static unsigned __init vsmp_patch (u8 type,u16 clobbers,void *ibuf, +static unsigned __init vsmp_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {switch (type) {
@@ -77,9 +77,9 @@ static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,case PARAVIRT_PATCH (pv_irq_ops.irq_disable):case PARAVIRT_PATCH (pv_irq_ops.save_fl):case PARAVIRT_PATCH (pv_irq_ops.restore_fl): -return paravirt_patch_default (type, clobbers, ibuf, addr, len); +return paravirt_patch_default (type, ibuf, addr, len);default : -return native_patch (type, clobbers, ibuf, addr, len); +return native_patch (type, ibuf, addr, len); } }
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 7/15 x86/paravirt: remove clobbers from struct paravirt_patch_site
In reply to Juergen GrossThere is no need any longer to store the clobbers in struct paravirt_patch_site. Remove clobbers from the struct and from the related macros.
While at it fix some lines longer than 80 characters.
--- arch/x86/include/asm/paravirt.h | 33 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 1 - 2 files changed, 15 insertions(+), 19 deletions(-)
arch/x86/include/asm/paravirt.h +15 -18
@@ -827,7 +827,7 @@ extern void default_banner(void);#else /* __ASSEMBLY__ */ -#define _PVSITE (ptype, clobbers, ops, word, algn) \ +#define _PVSITE (ptype, ops, word, algn) \ 771:; \ ops; \ 772:; \
@@ -836,7 +836,6 @@ extern void default_banner(void); word 771b; \ .byte ptype; \ .byte 772b-771b; \ - .short clobbers; \ .popsection
@@ -869,7 +868,7 @@ extern void default_banner(void); COND_POP(set, CLBR_RAX, rax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 8) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .quad, 8)#define PARA_INDIRECT (addr) *addr(%rip)#else #define PV_SAVE_REGS (set) \
@@ -884,26 +883,26 @@ extern void default_banner(void); COND_POP(set, CLBR_EAX, eax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .long, 4)#define PARA_INDIRECT (addr) *%cs:addr#endif #define INTERRUPT_RETURN \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);)#define DISABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#define ENABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
@@ -921,8 +920,7 @@ extern void default_banner(void);* inlined, or the swapgs instruction must be trapped and emulated. */ #define SWAPGS_UNSAFE_STACK \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - swapgs) + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), swapgs)/* * Note: swapgs is very special, and in practise is either going to be
@@ -931,8 +929,8 @@ extern void default_banner(void);* it. */ #define SWAPGS \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \ )
@@ -942,15 +940,14 @@ extern void default_banner(void);#define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \ - CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);)#ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#endif
arch/x86/include/asm/paravirt_types.h +0 -1
@@ -681,7 +681,6 @@ struct paravirt_patch_site {u8 *instr;/* original instructions */ u8 instrtype;/* type of this instruction */ u8 len;/* length of original instruction */ -u16 clobbers;/* what registers you may clobber */ }; extern struct paravirt_patch_site __parainstructions[],
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 9/15 x86/paravirt: remove unused paravirt bits
In reply to Juergen GrossThe macros ENABLE_INTERRUPTS_SYSEXIT, GET_CR0_INTO_EAX and PARAVIRT_ADJUST_EXCEPTION_FRAME are used nowhere. Remove their definitions.
--- arch/x86/include/asm/irqflags.h | 4 ---- arch/x86/include/asm/paravirt.h | 9 +-------- arch/x86/kernel/asm-offsets.c | 1 - 3 files changed, 1 insertion(+), 13 deletions(-)
arch/x86/include/asm/irqflags.h +0 -4
@@ -134,8 +134,6 @@ static inline notrace unsigned long arch_local_irq_save(void)*/ #define SWAPGS_UNSAFE_STACK swapgs -#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ -#define INTERRUPT_RETURN jmp native_iret#define USERGS_SYSRET64 \ swapgs; \
@@ -149,8 +147,6 @@ static inline notrace unsigned long arch_local_irq_save(void)#endif #else #define INTERRUPT_RETURN iret -#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit -#define GET_CR0_INTO_EAX movl %cr0, %eax#endif
arch/x86/include/asm/paravirt.h +1 -8
@@ -887,14 +887,7 @@ extern void default_banner(void); call PARA_INDIRECT(pv_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) -#ifdef CONFIG_X86_32 -#define GET_CR0_INTO_EAX \ - push %ecx; push %edx; \ - ANNOTATE_RETPOLINE_SAFE; \ - call PARA_INDIRECT(pv_ops+PV_CPU_read_cr0); \ - pop %edx; pop %ecx -#else /* !CONFIG_X86_32 */ - +#ifdef CONFIG_X86_64 /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
arch/x86/kernel/asm-offsets.c +0 -1
@@ -69,7 +69,6 @@ void common(void) {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); -OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0);OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 11/15 x86/paravirt: move items in pv_info under PARAVIRT_XXL umbrella
In reply to Juergen GrossAll items but name in pv_info are needed by Xen PV only. Define them with CONFIG_PARAVIRT_XXL set only.
--- arch/x86/include/asm/paravirt.h | 2 ++ arch/x86/include/asm/paravirt_types.h | 2 ++ arch/x86/include/asm/pgtable-3level_types.h | 2 +- arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/segment.h | 2 +- arch/x86/kernel/paravirt.c | 2 ++ 6 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/include/asm/paravirt.h +2 -0
@@ -104,7 +104,9 @@ static inline void wbinvd(void)PVOP_VCALL0 (cpu.wbinvd); } +#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) +#endif static inline u64 paravirt_read_msr (unsigned msr) {
arch/x86/include/asm/paravirt_types.h +2 -0
@@ -66,11 +66,13 @@ struct paravirt_callee_save {/* general info */ struct pv_info { +#ifdef CONFIG_PARAVIRT_XXL unsigned int kernel_rpl;int shared_kernel_pmd;#ifdef CONFIG_X86_64 u16 extra_user_64bit_cs;/* __USER_CS if none */ +#endif #endif const char *name;
arch/x86/include/asm/pgtable-3level_types.h +1 -1
@@ -20,7 +20,7 @@ typedef union { } pte_t;#endif /* !__ASSEMBLY__ */ -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #define SHARED_KERNEL_PMD ((!static_cpu_has(X86_FEATURE_PTI) && \ (pv_info.shared_kernel_pmd)))#else
arch/x86/include/asm/ptrace.h +1 -1
@@ -144,7 +144,7 @@ static inline int v8086_mode(struct pt_regs *regs)static inline bool user_64bit_mode (struct pt_regs *regs) {#ifdef CONFIG_X86_64 -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * On non-paravirt systems, this is the only long mode CPL 3 * selector. We do not allow long mode selectors in the LDT.
arch/x86/include/asm/segment.h +1 -1
@@ -211,7 +211,7 @@#endif -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL # define get_kernel_rpl () 0#endif
arch/x86/kernel/paravirt.c +2 -0
@@ -293,12 +293,14 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)struct pv_info pv_info = { .name ="bare hardware" , +#ifdef CONFIG_PARAVIRT_XXL .kernel_rpl =0 , .shared_kernel_pmd =1 ,/* Only used when CONFIG_X86_PAE is set */ #ifdef CONFIG_X86_64 .extra_user_64bit_cs = __USER_CS, #endif +#endif };#if defined(CONFIG_X86_32 ) && !defined(CONFIG_X86_PAE )
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 1/15 xen: move pv irq related functions under CONFIG_XEN_PV umbrella
In reply to Juergen GrossAll functions in arch/x86/xen/irq.c and arch/x86/xen/xen-asm*.S are specific to PV guests. Include them in the kernel with CONFIG_XEN_PV only.
Make the PV specific code in arch/x86/entry/entry_*.S dependent on CONFIG_XEN_PV instead of CONFIG_XEN.
The HVM specific code should depend on CONFIG_XEN_PVHVM.
While at it reformat the Makefile to make it more readable.
--- arch/x86/entry/entry_32.S | 8 +++++--- arch/x86/entry/entry_64.S | 8 +++++--- arch/x86/xen/Makefile | 41 +++++++++++++++++++++++++++++++---------- include/xen/events.h | 2 ++ 4 files changed, 43 insertions(+), 16 deletions(-)
arch/x86/entry/entry_32.S +5 -3
@@ -782,7 +782,7 @@ GLOBAL(__begin_SYSENTER_singlestep_region) * will ignore all of the single-step traps generated in this range. */ -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV /* * Xen doesn't set %esp to be precisely what the normal SYSENTER * entry point expects, so fix it up before using the normal path.
@@ -1240,7 +1240,7 @@ ENTRY(spurious_interrupt_bug) jmp common_exception END(spurious_interrupt_bug) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV ENTRY(xen_hypervisor_callback) pushl $-1 /* orig_ax = -1 => not a system call */ SAVE_ALL
@@ -1321,11 +1321,13 @@ ENTRY(xen_failsafe_callback) _ASM_EXTABLE(3b, 8b) _ASM_EXTABLE(4b, 9b) ENDPROC(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, xen_evtchn_do_upcall) +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV)
arch/x86/entry/entry_64.S +5 -3
@@ -1050,7 +1050,7 @@ ENTRY(do_softirq_own_stack) ret ENDPROC(do_softirq_own_stack) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry hypervisor_callback xen_do_hypervisor_callback has_error_code=0 /*
@@ -1130,11 +1130,13 @@ ENTRY(xen_failsafe_callback) ENCODE_FRAME_POINTER jmp error_exit END(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ xen_hvm_callback_vector xen_evtchn_do_upcall +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV) apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
@@ -1151,7 +1153,7 @@ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK idtentry int3 do_int3 has_error_code=0 idtentry stack_segment do_stack_segment has_error_code=1 -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry xennmi do_nmi has_error_code=0 idtentry xendebug do_debug has_error_code=0 idtentry xenint3 do_int3 has_error_code=0
arch/x86/xen/Makefile +31 -10
56 lines not on this page · raw message
include/xen/events.h +2 -0
@@ -89,11 +89,13 @@ unsigned irq_from_evtchn(unsigned int evtchn);int irq_from_virq (unsigned int cpu,unsigned int virq);unsigned int evtchn_from_irq (unsigned irq); +#ifdef CONFIG_XEN_PVHVM /* Xen HVM evtchn vector callback */ void xen_hvm_callback_vector (void );#ifdef CONFIG_TRACING #define trace_xen_hvm_callback_vector xen_hvm_callback_vector#endif +#endif int xen_set_callback_via (uint64_t via);void xen_evtchn_do_upcall (struct pt_regs *regs);void xen_hvm_evtchn_do_upcall (void );
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 10/15 x86/paravirt: introduce new config option PARAVIRT_XXL
In reply to Juergen GrossA large amount of paravirt ops is used by Xen PV guests only. Add a new config option PARAVIRT_XXL which is selected by XEN_PV. Later we can put the Xen PV only paravirt ops under the PARAVIRT_XXL umbrella.
Since irq related paravirt ops are used only by VSMP and Xen PV, let VSMP select PARAVIRT_XXL, too, in order to enable moving the irq ops under PARAVIRT_XXL.
---
V3:
- let VSMP select PARAVIRT_XXL (Peter Zijlstra)
--- arch/x86/Kconfig | 4 ++++ arch/x86/boot/compressed/misc.h | 1 + arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/xen/Kconfig | 1 + 4 files changed, 7 insertions(+)
arch/x86/Kconfig +4 -0
@@ -523,6 +523,7 @@ config X86_VSMP bool "ScaleMP vSMP" select HYPERVISOR_GUEST select PARAVIRT + select PARAVIRT_XXL depends on X86_64 && PCI depends on X86_EXTENDED_PLATFORM depends on SMP
@@ -754,6 +755,9 @@ config PARAVIRT over full virtualization. However, when run without a hypervisor the kernel is theoretically slower and slightly larger. +config PARAVIRT_XXL + bool + config PARAVIRT_DEBUG bool "paravirt-ops debugging" depends on PARAVIRT && DEBUG_KERNEL
arch/x86/boot/compressed/misc.h +1 -0
@@ -9,6 +9,7 @@* paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#undef CONFIG_KASAN
arch/x86/mm/mem_encrypt_identity.c +1 -0
@@ -27,6 +27,7 @@* be extended when new paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#include <linux/kernel.h>
arch/x86/xen/Kconfig +1 -0
@@ -18,6 +18,7 @@ config XEN_PV bool "Xen PV guest support" default y depends on XEN + select PARAVIRT_XXL select XEN_HAVE_PVMMU select XEN_HAVE_VPMU help
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 12/15 x86/paravirt: move the Xen-only pv_cpu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossMost of the paravirt ops defined in pv_cpu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/debugreg.h | 2 +- arch/x86/include/asm/desc.h | 4 ++-- arch/x86/include/asm/irqflags.h | 16 +++++++++++----- arch/x86/include/asm/msr.h | 4 ++-- arch/x86/include/asm/paravirt.h | 19 +++++++++++++++++-- arch/x86/include/asm/paravirt_types.h | 5 ++++- arch/x86/include/asm/pgtable.h | 6 ++++-- arch/x86/include/asm/processor.h | 4 ++-- arch/x86/include/asm/special_insns.h | 9 +++++++-- arch/x86/kernel/asm-offsets.c | 2 ++ arch/x86/kernel/asm-offsets_64.c | 2 ++ arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/head_64.S | 2 ++ arch/x86/kernel/paravirt.c | 13 ++++++++++++- arch/x86/kernel/paravirt_patch_32.c | 4 ++++ arch/x86/kernel/paravirt_patch_64.c | 6 +++++- 16 files changed, 78 insertions(+), 22 deletions(-)
arch/x86/include/asm/debugreg.h +1 -1
@@ -8,7 +8,7 @@ DECLARE_PER_CPU(unsigned long, cpu_dr7); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * These special macros can be used to get or set a debugging register */
arch/x86/include/asm/desc.h +2 -2
@@ -108,7 +108,7 @@ static inline int desc_empty(const void *ptr)return !(desc[0 ] | desc[1 ]); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define load_TR_desc () native_load_tr_desc()
@@ -134,7 +134,7 @@ static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries)static inline void paravirt_free_ldt (struct desc_struct *ldt,unsigned entries) { } -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #define store_ldt (ldt) asm("sldt %0" : "=m"(ldt))
arch/x86/include/asm/irqflags.h +11 -5
@@ -121,6 +121,16 @@ static inline notrace unsigned long arch_local_irq_save(void)#define ENABLE_INTERRUPTS (x) sti#define DISABLE_INTERRUPTS (x) cli +#ifdef CONFIG_X86_64 +#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/*
@@ -142,16 +152,12 @@ static inline notrace unsigned long arch_local_irq_save(void)swapgs ; \ sysretl -#ifdef CONFIG_DEBUG_ENTRY -#define SAVE_FLAGS (x) pushfq; popq %rax -#endif #else #define INTERRUPT_RETURN iret#endif -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #ifndef __ASSEMBLY__static inline int arch_irqs_disabled_flags (unsigned long flags)
arch/x86/include/asm/msr.h +2 -2
@@ -242,7 +242,7 @@ static inline unsigned long long native_read_pmc(int counter)return EAX_EDX_VAL (val, low, high); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #include <linux/errno.h>
@@ -305,7 +305,7 @@ do { \#define rdpmcl (counter, val) ((val) = native_read_pmc(counter)) -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ /* * 64-bit version of wrmsr_safe():
arch/x86/include/asm/paravirt.h +17 -2
@@ -17,6 +17,7 @@#include <linux/cpumask.h> #include <asm/frame.h> +#ifdef CONFIG_PARAVIRT_XXL static inline void load_sp0 (unsigned long sp0) {PVOP_VCALL1 (cpu.load_sp0, sp0);
@@ -51,6 +52,7 @@ static inline void write_cr0(unsigned long x) {PVOP_VCALL1 (cpu.write_cr0, x); } +#endif static inline unsigned long read_cr2 (void ) {
@@ -72,6 +74,7 @@ static inline void write_cr3(unsigned long x)PVOP_VCALL1 (mmu.write_cr3, x); } +#ifdef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {PVOP_VCALL1 (cpu.write_cr4, x);
@@ -88,6 +91,7 @@ static inline void write_cr8(unsigned long x)PVOP_VCALL1 (cpu.write_cr8, x); }#endif +#endif static inline void arch_safe_halt (void ) {
@@ -99,14 +103,13 @@ static inline void halt(void)PVOP_VCALL0 (irq.halt); } +#ifdef CONFIG_PARAVIRT_XXL static inline void wbinvd (void ) {PVOP_VCALL0 (cpu.wbinvd); } -#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) -#endif static inline u64 paravirt_read_msr (unsigned msr) {
@@ -171,6 +174,7 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) *p =paravirt_read_msr_safe (msr, &err); return err; } +#endif static inline unsigned long long paravirt_sched_clock (void ) {
@@ -186,6 +190,7 @@ static inline u64 paravirt_steal_clock(int cpu)return PVOP_CALL1 (u64, time.steal_clock, cpu); } +#ifdef CONFIG_PARAVIRT_XXL static inline unsigned long long paravirt_read_pmc (int counter) {return PVOP_CALL1 (u64, cpu.read_pmc, counter);
@@ -230,6 +235,7 @@ static inline unsigned long paravirt_store_tr(void) { return PVOP_CALL0(unsigned long, cpu.store_tr); } +#define store_tr (tr) ((tr) = paravirt_store_tr())static inline void load_TLS (struct thread_struct *t,unsigned cpu) {
@@ -263,6 +269,7 @@ static inline void set_iopl_mask(unsigned mask) {PVOP_VCALL1 (cpu.set_iopl_mask, mask); } +#endif /* The paravirtualized I/O functions */ static inline void slow_down_io (void )
@@ -618,6 +625,7 @@ static inline void pmd_clear(pmd_t *pmdp) }#endif /* CONFIG_X86_PAE */ +#ifdef CONFIG_PARAVIRT_XXL #define __HAVE_ARCH_START_CONTEXT_SWITCHstatic inline void arch_start_context_switch (struct task_struct *prev) {
@@ -628,6 +636,7 @@ static inline void arch_end_context_switch(struct task_struct *next) {PVOP_VCALL1 (cpu.end_context_switch, next); } +#endif #define __HAVE_ARCH_ENTER_LAZY_MMU_MODEstatic inline void arch_enter_lazy_mmu_mode (void )
@@ -870,10 +879,12 @@ extern void default_banner(void);#define PARA_INDIRECT (addr) *%cs:addr#endif +#ifdef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN \ 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), \
@@ -890,6 +901,7 @@ extern void default_banner(void); PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#ifdef CONFIG_X86_64 +#ifdef CONFIG_PARAVIRT_XXL /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
@@ -909,15 +921,18 @@ extern void default_banner(void);ANNOTATE_RETPOLINE_SAFE ; \ call PARA_INDIRECT(pv_ops+PV_CPU_swapgs); \ ) +#endif #define GET_CR2_INTO_RAX \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_ops+PV_MMU_read_cr2); +#ifdef CONFIG_PARAVIRT_XXL #define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(PV_CPU_usergs_sysret64), \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);) +#endif #ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \
arch/x86/include/asm/paravirt_types.h +4 -1
@@ -106,6 +106,9 @@ struct pv_time_ops {struct pv_cpu_ops {/* hooks for various privileged instructions */ +void (*io_delay)(void ); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*get_debugreg)(int regno);void (*set_debugreg)(int regno,unsigned long value);
@@ -143,7 +146,6 @@ struct pv_cpu_ops {void (*set_iopl_mask)(unsigned mask);void (*wbinvd)(void ); -void (*io_delay)(void );/* cpuid emulation, mostly so that caps bits can be disabled */ void (*cpuid)(unsigned int *eax, unsigned int *ebx,
@@ -178,6 +180,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); +#endif } __no_randomize_layout;struct pv_irq_ops {
arch/x86/include/asm/pgtable.h +4 -2
@@ -111,10 +111,12 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#define arch_end_context_switch (prev) do {} while(0) -#endif /* CONFIG_PARAVIRT */ +#ifndef CONFIG_PARAVIRT_XXL +#define arch_end_context_switch (prev) do {} while(0) +#endif /* CONFIG_PARAVIRT_XXL */ +/* * The following only work if pte_present() is true. * Undefined behaviour if not..
arch/x86/include/asm/processor.h +2 -2
@@ -576,7 +576,7 @@ static inline bool on_thread_stack(void) current_stack_pointer) < THREAD_SIZE; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define __cpuid native_cpuid
@@ -587,7 +587,7 @@ static inline void load_sp0(unsigned long sp0) }#define set_iopl_mask native_set_iopl_mask -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ /* Free all resources held by a thread. */ extern void release_thread (struct task_struct *);
arch/x86/include/asm/special_insns.h +7 -2
@@ -143,8 +143,9 @@ static inline unsigned long __read_cr4(void)#ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> -#else +#endif +#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -154,7 +155,9 @@ 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 ();
@@ -178,7 +181,9 @@ 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);
@@ -208,7 +213,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +2 -0
@@ -68,7 +68,9 @@ void common(void) {BLANK ();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);#endif
arch/x86/kernel/asm-offsets_64.c +2 -0
@@ -21,9 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL 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
arch/x86/kernel/cpu/common.c +1 -1
@@ -1239,7 +1239,7 @@ static void generic_identify(struct cpuinfo_x86 *c)* ESPFIX issue, we can change this. */ #ifdef CONFIG_X86_32 -# ifdef CONFIG_PARAVIRT +# ifdef CONFIG_PARAVIRT_XXL do { extern void native_iret(void); if (pv_ops.cpu.iret == native_iret)
arch/x86/kernel/head_64.S +2 -0
@@ -31,6 +31,8 @@ #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 +12 -1
@@ -101,6 +101,7 @@ static unsigned paravirt_patch_call(void *insnbuf, const void *target,return 5 ; } +#ifdef CONFIG_PARAVIRT_XXL static unsigned paravirt_patch_jmp (void *insnbuf,const void *target,unsigned long addr,unsigned len) {
@@ -119,6 +120,7 @@ static unsigned paravirt_patch_jmp(void *insnbuf, const void *target, return 5; } +#endif DEFINE_STATIC_KEY_TRUE (virt_spin_lock_key);
@@ -150,10 +152,12 @@ unsigned paravirt_patch_default(u8 type, void *insnbuf,else if (opfunc == _paravirt_ident_64) ret =paravirt_patch_ident_64 (insnbuf, len); +#ifdef CONFIG_PARAVIRT_XXL else if (type == PARAVIRT_PATCH(cpu.iret) || type == PARAVIRT_PATCH(cpu.usergs_sysret64))/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); +#endif else/* Otherwise call the function. */ ret =paravirt_patch_call (insnbuf, opfunc, addr, len);
@@ -262,6 +266,7 @@ void paravirt_flush_lazy_mmu(void)preempt_enable (); } +#ifdef CONFIG_PARAVIRT_XXL void paravirt_start_context_switch (struct task_struct *prev) {BUG_ON (preemptible ());
@@ -282,6 +287,7 @@ void paravirt_end_context_switch(struct task_struct *next)if (test_and_clear_ti_thread_flag (task_thread_info (next),TIF_LAZY_MMU_UPDATES )) arch_enter_lazy_mmu_mode(); } +#endif enum paravirt_lazy_mode paravirt_get_lazy_mode (void ) {
@@ -320,6 +326,9 @@ struct paravirt_patch_template pv_ops = { .time.steal_clock = native_steal_clock,/* Cpu ops. */ + .cpu.io_delay = native_io_delay, + +#ifdef CONFIG_PARAVIRT_XXL .cpu.cpuid = native_cpuid, .cpu.get_debugreg = native_get_debugreg, .cpu.set_debugreg = native_set_debugreg,
@@ -361,10 +370,10 @@ struct paravirt_patch_template pv_ops = { .cpu.swapgs = native_swapgs, .cpu.set_iopl_mask = native_set_iopl_mask, - .cpu.io_delay = native_io_delay, .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),
@@ -463,10 +472,12 @@ struct paravirt_patch_template pv_ops = {#endif }; +#ifdef CONFIG_PARAVIRT_XXL /* At this point, native_get/set_debugreg has real function entries */ NOKPROBE_SYMBOL (native_get_debugreg);NOKPROBE_SYMBOL (native_set_debugreg);NOKPROBE_SYMBOL (native_load_idt); +#endif EXPORT_SYMBOL_GPL (pv_ops);EXPORT_SYMBOL_GPL (pv_info);
arch/x86/kernel/paravirt_patch_32.c +4 -0
@@ -5,7 +5,9 @@ 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" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" );
@@ -45,7 +47,9 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3);
arch/x86/kernel/paravirt_patch_64.c +5 -1
@@ -10,10 +10,12 @@ DEF_NATIVE(irq, save_fl, "pushfq; popq %rax");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" );DEF_NATIVE (cpu, swapgs,"swapgs" ); +#endif DEF_NATIVE(, mov32, "mov %edi, %eax"); DEF_NATIVE(, mov64, "mov %rdi, %rax");
@@ -53,12 +55,14 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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); +#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); -PATCH_SITE (cpu, wbinvd);#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 · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 8/15 x86/paravirt: use a single ops structure
In reply to Juergen GrossInstead of using six globally visible paravirt ops structures combine them in a single structure, keeping the original structures as sub-structures.
This avoids the need to assemble struct paravirt_patch_template at runtime on the stack each time apply_paravirt() is being called (i.e. when loading a module).
---
V2:
- shorten pv_ops sub-structure names (Jan Beulich)
V3:
- rebase to master
- fix build failure on ARM
--- arch/arm/include/asm/paravirt.h | 9 +- arch/arm/kernel/paravirt.c | 4 +- arch/arm64/include/asm/paravirt.h | 9 +- arch/arm64/kernel/paravirt.c | 4 +- arch/x86/hyperv/mmu.c | 4 +- arch/x86/include/asm/paravirt.h | 275 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 25 ++- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/asm-offsets.c | 12 +- arch/x86/kernel/asm-offsets_64.c | 7 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/kvm.c | 19 +-- arch/x86/kernel/kvmclock.c | 4 +- arch/x86/kernel/paravirt-spinlocks.c | 15 +- arch/x86/kernel/paravirt.c | 283 ++++++++++++++++------------------ arch/x86/kernel/paravirt_patch_32.c | 48 +++--- arch/x86/kernel/paravirt_patch_64.c | 56 +++---- arch/x86/kernel/tsc.c | 2 +- arch/x86/kernel/vsmp_64.c | 18 +-- arch/x86/xen/enlighten_pv.c | 31 ++-- arch/x86/xen/irq.c | 2 +- arch/x86/xen/mmu_hvm.c | 2 +- arch/x86/xen/mmu_pv.c | 28 ++-- arch/x86/xen/spinlock.c | 11 +- arch/x86/xen/time.c | 4 +- drivers/xen/time.c | 2 +- 27 files changed, 427 insertions(+), 455 deletions(-)
arch/arm/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/arm64/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm64/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/x86/hyperv/mmu.c +2 -2
@@ -231,6 +231,6 @@ void hyperv_setup_mmu_ops(void)return ;pr_info ("Using hypercall for remote TLB flush\n" ); - pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = hyperv_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }
arch/x86/include/asm/paravirt.h +128 -147
781 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +10 -15
@@ -321,28 +321,23 @@ struct pv_lock_ops {* number for each function using the offset which we use to indicate * what to patch. */ struct paravirt_patch_template { -struct pv_init_ops pv_init_ops; -struct pv_time_ops pv_time_ops; -struct pv_cpu_ops pv_cpu_ops; -struct pv_irq_ops pv_irq_ops; -struct pv_mmu_ops pv_mmu_ops; -struct pv_lock_ops pv_lock_ops; +struct pv_init_ops init; +struct pv_time_ops time; +struct pv_cpu_ops cpu; +struct pv_irq_ops irq; +struct pv_mmu_ops mmu; +struct pv_lock_ops lock; } __no_randomize_layout;extern struct pv_info pv_info; -extern struct pv_init_ops pv_init_ops; -extern struct pv_time_ops pv_time_ops; -extern struct pv_cpu_ops pv_cpu_ops; -extern struct pv_irq_ops pv_irq_ops; -extern struct pv_mmu_ops pv_mmu_ops; -extern struct pv_lock_ops pv_lock_ops; +extern struct paravirt_patch_template pv_ops;#define PARAVIRT_PATCH (x) \ (offsetof(struct paravirt_patch_template, x) / sizeof(void *))#define paravirt_type (op) \ [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \ - [paravirt_opptr] "i" (&(op)) + [paravirt_opptr] "i" (&(pv_ops.op))#define paravirt_clobber (clobber) \ [paravirt_clobber] "i" (clobber)
@@ -503,9 +498,9 @@ int paravirt_disable_iospace(void);#endif /* CONFIG_X86_32 */ #ifdef CONFIG_PARAVIRT_DEBUG -#define PVOP_TEST_NULL (op) BUG_ON(op == NULL) +#define PVOP_TEST_NULL (op) BUG_ON(pv_ops.op == NULL)#else -#define PVOP_TEST_NULL (op) ((void)op) +#define PVOP_TEST_NULL (op) ((void)pv_ops.op)#endif #define PVOP_RETMASK (rettype) \
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, insnbuf, + used = pv_ops.init.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/asm-offsets.c +5 -7
@@ -66,13 +66,11 @@ void common(void) {#ifdef CONFIG_PARAVIRT BLANK (); -OFFSET (PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops); -OFFSET (PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops); -OFFSET (PV_IRQ_irq_disable, pv_irq_ops, irq_disable); -OFFSET (PV_IRQ_irq_enable, pv_irq_ops, irq_enable); -OFFSET (PV_CPU_iret, pv_cpu_ops, iret); -OFFSET (PV_CPU_read_cr0, pv_cpu_ops, read_cr0); -OFFSET (PV_MMU_read_cr2, pv_mmu_ops, read_cr2); +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); +OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0); +OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif #ifdef CONFIG_XEN
arch/x86/kernel/asm-offsets_64.c +4 -3
@@ -21,10 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT -OFFSET (PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64); -OFFSET (PV_CPU_swapgs, pv_cpu_ops, swapgs); +OFFSET (PV_CPU_usergs_sysret64, paravirt_patch_template, + cpu.usergs_sysret64); +OFFSET (PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs);#ifdef CONFIG_DEBUG_ENTRY -OFFSET (PV_IRQ_save_fl, pv_irq_ops, save_fl); +OFFSET (PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);#endif BLANK ();#endif
arch/x86/kernel/cpu/common.c +1 -1
@@ -1242,7 +1242,7 @@ static void generic_identify(struct cpuinfo_x86 *c)# ifdef CONFIG_PARAVIRT do {extern void native_iret (void ); -if (pv_cpu_ops.iret == native_iret) +if (pv_ops.cpu.iret == native_iret)set_cpu_bug (c,X86_BUG_ESPFIX ); }while (0 );# else
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -97,14 +97,14 @@ static void __init vmware_sched_clock_setup(void) d->cyc2ns_offset =mul_u64_u32_shr (tsc_now, d->cyc2ns_mul, d->cyc2ns_shift); - pv_time_ops.sched_clock = vmware_sched_clock; + pv_ops.time.sched_clock = vmware_sched_clock;pr_info ("using sched offset of %llu ns\n" , d->cyc2ns_offset); }static void __init vmware_paravirt_ops_setup (void ) { pv_info.name ="VMware hypervisor" ; - pv_cpu_ops.io_delay = paravirt_nop; + pv_ops.cpu.io_delay = paravirt_nop;if (vmware_tsc_khz && vmw_sched_clock)vmware_sched_clock_setup ();
arch/x86/kernel/kvm.c +10 -9
@@ -283,7 +283,7 @@ static void __init paravirt_ops_setup(void) pv_info.name ="KVM" ;if (kvm_para_has_feature (KVM_FEATURE_NOP_IO_DELAY )) - pv_cpu_ops.io_delay = kvm_io_delay; + pv_ops.cpu.io_delay = kvm_io_delay;#ifdef CONFIG_X86_IO_APIC no_timer_check =1 ;
@@ -632,14 +632,14 @@ static void __init kvm_guest_init(void)if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { has_steal_clock =1 ; - pv_time_ops.steal_clock = kvm_steal_clock; + pv_ops.time.steal_clock = kvm_steal_clock; }if (kvm_para_has_feature (KVM_FEATURE_PV_TLB_FLUSH ) && !kvm_para_has_hint (KVM_HINTS_REALTIME ) &&kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }if (kvm_para_has_feature (KVM_FEATURE_PV_EOI ))
@@ -850,13 +850,14 @@ void __init kvm_spinlock_init(void)return ;__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = kvm_wait; - pv_lock_ops.kick = kvm_kick_cpu; + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = kvm_wait; + pv_ops.lock.kick = kvm_kick_cpu;if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_lock_ops.vcpu_is_preempted = + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (__kvm_vcpu_is_preempted); } }
arch/x86/kernel/kvmclock.c +2 -2
@@ -116,13 +116,13 @@ static u64 kvm_sched_clock_read(void)static inline void kvm_sched_clock_init (bool stable) {if (!stable) { - pv_time_ops.sched_clock = kvm_clock_read; + pv_ops.time.sched_clock = kvm_clock_read;clear_sched_clock_stable ();return ; } kvm_sched_clock_offset =kvm_clock_read (); - pv_time_ops.sched_clock = kvm_sched_clock_read; + pv_ops.time.sched_clock = kvm_sched_clock_read;pr_info ("kvm-clock: using sched offset of %llu cycles" , kvm_sched_clock_offset);
arch/x86/kernel/paravirt-spinlocks.c +2 -13
@@ -17,7 +17,7 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock);bool pv_is_native_spin_unlock (void ) { -return pv_lock_ops.queued_spin_unlock.func == +return pv_ops.lock.queued_spin_unlock.func == __raw_callee_save___native_queued_spin_unlock; }
@@ -29,17 +29,6 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_vcpu_is_preempted);bool pv_is_native_vcpu_is_preempted (void ) { -return pv_lock_ops.vcpu_is_preempted.func == +return pv_ops.lock.vcpu_is_preempted.func == __raw_callee_save___native_vcpu_is_preempted; } - -struct pv_lock_ops pv_lock_ops = { -#ifdef CONFIG_SMP - .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath, - .queued_spin_unlock =PV_CALLEE_SAVE (__native_queued_spin_unlock), - .wait = paravirt_nop, - .kick = paravirt_nop, - .vcpu_is_preempted =PV_CALLEE_SAVE (__native_vcpu_is_preempted), -#endif /* SMP */ -}; -EXPORT_SYMBOL (pv_lock_ops);
arch/x86/kernel/paravirt.c +137 -146
336 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_32.c +24 -24
69 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_64.c +28 -28
81 lines not on this page · raw message
arch/x86/kernel/tsc.c +1 -1
@@ -246,7 +246,7 @@ unsigned long long sched_clock(void)bool using_native_sched_clock (void ) { -return pv_time_ops.sched_clock == native_sched_clock; +return pv_ops.time.sched_clock == native_sched_clock; }#else unsigned long long
arch/x86/kernel/vsmp_64.c +9 -9
@@ -73,10 +73,10 @@ static unsigned __init vsmp_patch(u8 type, void *ibuf, unsigned long addr, unsigned len) {switch (type) { -case PARAVIRT_PATCH (pv_irq_ops.irq_enable): -case PARAVIRT_PATCH (pv_irq_ops.irq_disable): -case PARAVIRT_PATCH (pv_irq_ops.save_fl): -case PARAVIRT_PATCH (pv_irq_ops.restore_fl): +case PARAVIRT_PATCH (irq.irq_enable): +case PARAVIRT_PATCH (irq.irq_disable): +case PARAVIRT_PATCH (irq.save_fl): +case PARAVIRT_PATCH (irq.restore_fl):return paravirt_patch_default (type, ibuf, addr, len);default :return native_patch (type, ibuf, addr, len);
@@ -111,11 +111,11 @@ static void __init set_vsmp_pv_ops(void)if (cap & ctl & (1 <<4 )) {/* Setup irq ops and turn on vSMP IRQ fastpath handling */ - pv_irq_ops.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); - pv_irq_ops.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); - pv_irq_ops.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); - pv_irq_ops.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); - pv_init_ops.patch = vsmp_patch; + pv_ops.irq.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); + pv_ops.irq.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); + pv_ops.irq.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); + pv_ops.irq.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); + pv_ops.init.patch = vsmp_patch; ctl &= ~(1 <<4 ); }writel (ctl, address +4 );
arch/x86/xen/enlighten_pv.c +18 -13
@@ -995,11 +995,14 @@ void __init xen_setup_vcpu_info_placement(void)* percpu area for all cpus, so make use of it. */ if (xen_have_vcpu_info_placement) { - pv_irq_ops.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); - pv_irq_ops.restore_fl =__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); - pv_irq_ops.irq_disable =__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); - pv_irq_ops.irq_enable =__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); - pv_mmu_ops.read_cr2 = xen_read_cr2_direct; + pv_ops.irq.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); + pv_ops.irq.restore_fl = +__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); + pv_ops.irq.irq_disable = +__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); + pv_ops.irq.irq_enable = +__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); + pv_ops.mmu.read_cr2 = xen_read_cr2_direct; } }
@@ -1174,14 +1177,14 @@ static void __init xen_boot_params_init_edd(void)*/ static void __init xen_setup_gdt (int cpu) { - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; - pv_cpu_ops.load_gdt = xen_load_gdt_boot; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry_boot; + pv_ops.cpu.load_gdt = xen_load_gdt_boot;setup_stack_canary_segment (cpu);switch_to_new_gdt (cpu); - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; - pv_cpu_ops.load_gdt = xen_load_gdt; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry; + pv_ops.cpu.load_gdt = xen_load_gdt; }static void __init xen_dom0_set_legacy_features (void )
@@ -1206,8 +1209,8 @@ asmlinkage __visible void __init xen_start_kernel(void)/* Install Xen paravirt ops */ pv_info = xen_info; - pv_init_ops.patch = paravirt_patch_default; - pv_cpu_ops = xen_cpu_ops; + pv_ops.init.patch = paravirt_patch_default; + pv_ops.cpu = xen_cpu_ops;xen_init_irq_ops ();/*
@@ -1276,8 +1279,10 @@ asmlinkage __visible void __init xen_start_kernel(void)#endif if (xen_feature (XENFEAT_mmu_pt_update_preserve_ad)) { - pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; - pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; + pv_ops.mmu.ptep_modify_prot_start = + xen_ptep_modify_prot_start; + pv_ops.mmu.ptep_modify_prot_commit = + xen_ptep_modify_prot_commit; } machine_ops = xen_machine_ops;
arch/x86/xen/irq.c +1 -1
@@ -128,6 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {void __init xen_init_irq_ops (void ) { - pv_irq_ops = xen_irq_ops; + pv_ops.irq = xen_irq_ops; x86_init.irqs.intr_init = xen_init_IRQ; }
arch/x86/xen/mmu_hvm.c +1 -1
@@ -73,7 +73,7 @@ static int is_pagetable_dying_supported(void)void __init xen_hvm_init_mmu_ops (void ) {if (is_pagetable_dying_supported ()) - pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap; + pv_ops.mmu.exit_mmap = xen_hvm_exit_mmap;#ifdef CONFIG_PROC_VMCORE WARN_ON (register_oldmem_pfn_is_ram (&xen_oldmem_pfn_is_ram));#endif
arch/x86/xen/mmu_pv.c +14 -14
@@ -2216,7 +2216,7 @@ static void __init xen_write_cr3_init(unsigned long cr3)set_page_prot (initial_page_table,PAGE_KERNEL );set_page_prot (initial_kernel_pmd,PAGE_KERNEL ); - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3; }/*
@@ -2365,27 +2365,27 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)static void __init xen_post_allocator_init (void ) { - pv_mmu_ops.set_pte = xen_set_pte; - pv_mmu_ops.set_pmd = xen_set_pmd; - pv_mmu_ops.set_pud = xen_set_pud; + pv_ops.mmu.set_pte = xen_set_pte; + pv_ops.mmu.set_pmd = xen_set_pmd; + pv_ops.mmu.set_pud = xen_set_pud;#ifdef CONFIG_X86_64 - pv_mmu_ops.set_p4d = xen_set_p4d; + pv_ops.mmu.set_p4d = xen_set_p4d;#endif /* This will work as long as patching hasn't happened yet (which it hasn't) */ - pv_mmu_ops.alloc_pte = xen_alloc_pte; - pv_mmu_ops.alloc_pmd = xen_alloc_pmd; - pv_mmu_ops.release_pte = xen_release_pte; - pv_mmu_ops.release_pmd = xen_release_pmd; + pv_ops.mmu.alloc_pte = xen_alloc_pte; + pv_ops.mmu.alloc_pmd = xen_alloc_pmd; + pv_ops.mmu.release_pte = xen_release_pte; + pv_ops.mmu.release_pmd = xen_release_pmd;#ifdef CONFIG_X86_64 - pv_mmu_ops.alloc_pud = xen_alloc_pud; - pv_mmu_ops.release_pud = xen_release_pud; + pv_ops.mmu.alloc_pud = xen_alloc_pud; + pv_ops.mmu.release_pud = xen_release_pud;#endif - pv_mmu_ops.make_pte =PV_CALLEE_SAVE (xen_make_pte); + pv_ops.mmu.make_pte =PV_CALLEE_SAVE (xen_make_pte);#ifdef CONFIG_X86_64 - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3;#endif }
@@ -2473,7 +2473,7 @@ void __init xen_init_mmu_ops(void) x86_init.paging.pagetable_init = xen_pagetable_init; x86_init.hyper.init_after_bootmem = xen_after_bootmem; - pv_mmu_ops = xen_mmu_ops; + pv_ops.mmu = xen_mmu_ops;memset (dummy_mapping,0xff ,PAGE_SIZE ); }
arch/x86/xen/spinlock.c +6 -5
@@ -141,11 +141,12 @@ void __init xen_init_spinlocks(void)printk (KERN_DEBUG "xen: PV spinlocks enabled\n" );__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = xen_qlock_wait; - pv_lock_ops.kick = xen_qlock_kick; - pv_lock_ops.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = xen_qlock_wait; + pv_ops.lock.kick = xen_qlock_kick; + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); }static __init int xen_parse_nopvspin (char *arg)
arch/x86/xen/time.c +2 -2
@@ -513,7 +513,7 @@ static void __init xen_time_init(void)void __init xen_init_time_ops (void ) { xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.timer_init = xen_time_init; x86_init.timers.setup_percpu_clockev = x86_init_noop;
@@ -555,7 +555,7 @@ void __init xen_hvm_init_time_ops(void) } xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.setup_percpu_clockev = xen_time_init; x86_cpuinit.setup_percpu_clockev = xen_hvm_setup_cpu_clockevents;
drivers/xen/time.c +1 -1
@@ -175,7 +175,7 @@ void __init xen_time_setup_guest(void) xen_runstate_remote = !HYPERVISOR_vm_assist (VMASST_CMD_enable, VMASST_TYPE_runstate_update_flag); - pv_time_ops.steal_clock = xen_steal_clock; + pv_ops.time.steal_clock = xen_steal_clock;static_key_slow_inc (¶virt_steal_enabled);if (xen_runstate_remote)
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH v3 11/15 x86/paravirt: move items in pv_info under PARAVIRT_XXL umbrella
In reply to Juergen GrossAll items but name in pv_info are needed by Xen PV only. Define them with CONFIG_PARAVIRT_XXL set only.
--- arch/x86/include/asm/paravirt.h | 2 ++ arch/x86/include/asm/paravirt_types.h | 2 ++ arch/x86/include/asm/pgtable-3level_types.h | 2 +- arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/segment.h | 2 +- arch/x86/kernel/paravirt.c | 2 ++ 6 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/include/asm/paravirt.h +2 -0
@@ -104,7 +104,9 @@ static inline void wbinvd(void)PVOP_VCALL0 (cpu.wbinvd); } +#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) +#endif static inline u64 paravirt_read_msr (unsigned msr) {
arch/x86/include/asm/paravirt_types.h +2 -0
@@ -66,11 +66,13 @@ struct paravirt_callee_save {/* general info */ struct pv_info { +#ifdef CONFIG_PARAVIRT_XXL unsigned int kernel_rpl;int shared_kernel_pmd;#ifdef CONFIG_X86_64 u16 extra_user_64bit_cs;/* __USER_CS if none */ +#endif #endif const char *name;
arch/x86/include/asm/pgtable-3level_types.h +1 -1
@@ -20,7 +20,7 @@ typedef union { } pte_t;#endif /* !__ASSEMBLY__ */ -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #define SHARED_KERNEL_PMD ((!static_cpu_has(X86_FEATURE_PTI) && \ (pv_info.shared_kernel_pmd)))#else
arch/x86/include/asm/ptrace.h +1 -1
@@ -144,7 +144,7 @@ static inline int v8086_mode(struct pt_regs *regs)static inline bool user_64bit_mode (struct pt_regs *regs) {#ifdef CONFIG_X86_64 -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * On non-paravirt systems, this is the only long mode CPL 3 * selector. We do not allow long mode selectors in the LDT.
arch/x86/include/asm/segment.h +1 -1
@@ -211,7 +211,7 @@#endif -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL # define get_kernel_rpl () 0#endif
arch/x86/kernel/paravirt.c +2 -0
@@ -293,12 +293,14 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)struct pv_info pv_info = { .name ="bare hardware" , +#ifdef CONFIG_PARAVIRT_XXL .kernel_rpl =0 , .shared_kernel_pmd =1 ,/* Only used when CONFIG_X86_PAE is set */ #ifdef CONFIG_X86_64 .extra_user_64bit_cs = __USER_CS, #endif +#endif };#if defined(CONFIG_X86_32 ) && !defined(CONFIG_X86_PAE )
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 · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 8/15 x86/paravirt: use a single ops structure
In reply to Juergen GrossInstead of using six globally visible paravirt ops structures combine them in a single structure, keeping the original structures as sub-structures.
This avoids the need to assemble struct paravirt_patch_template at runtime on the stack each time apply_paravirt() is being called (i.e. when loading a module).
---
V2:
- shorten pv_ops sub-structure names (Jan Beulich)
V3:
- rebase to master
- fix build failure on ARM
--- arch/arm/include/asm/paravirt.h | 9 +- arch/arm/kernel/paravirt.c | 4 +- arch/arm64/include/asm/paravirt.h | 9 +- arch/arm64/kernel/paravirt.c | 4 +- arch/x86/hyperv/mmu.c | 4 +- arch/x86/include/asm/paravirt.h | 275 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 25 ++- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/asm-offsets.c | 12 +- arch/x86/kernel/asm-offsets_64.c | 7 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/kvm.c | 19 +-- arch/x86/kernel/kvmclock.c | 4 +- arch/x86/kernel/paravirt-spinlocks.c | 15 +- arch/x86/kernel/paravirt.c | 283 ++++++++++++++++------------------ arch/x86/kernel/paravirt_patch_32.c | 48 +++--- arch/x86/kernel/paravirt_patch_64.c | 56 +++---- arch/x86/kernel/tsc.c | 2 +- arch/x86/kernel/vsmp_64.c | 18 +-- arch/x86/xen/enlighten_pv.c | 31 ++-- arch/x86/xen/irq.c | 2 +- arch/x86/xen/mmu_hvm.c | 2 +- arch/x86/xen/mmu_pv.c | 28 ++-- arch/x86/xen/spinlock.c | 11 +- arch/x86/xen/time.c | 4 +- drivers/xen/time.c | 2 +- 27 files changed, 427 insertions(+), 455 deletions(-)
arch/arm/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/arm64/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm64/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/x86/hyperv/mmu.c +2 -2
@@ -231,6 +231,6 @@ void hyperv_setup_mmu_ops(void)return ;pr_info ("Using hypercall for remote TLB flush\n" ); - pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = hyperv_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }
arch/x86/include/asm/paravirt.h +128 -147
781 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +10 -15
@@ -321,28 +321,23 @@ struct pv_lock_ops {* number for each function using the offset which we use to indicate * what to patch. */ struct paravirt_patch_template { -struct pv_init_ops pv_init_ops; -struct pv_time_ops pv_time_ops; -struct pv_cpu_ops pv_cpu_ops; -struct pv_irq_ops pv_irq_ops; -struct pv_mmu_ops pv_mmu_ops; -struct pv_lock_ops pv_lock_ops; +struct pv_init_ops init; +struct pv_time_ops time; +struct pv_cpu_ops cpu; +struct pv_irq_ops irq; +struct pv_mmu_ops mmu; +struct pv_lock_ops lock; } __no_randomize_layout;extern struct pv_info pv_info; -extern struct pv_init_ops pv_init_ops; -extern struct pv_time_ops pv_time_ops; -extern struct pv_cpu_ops pv_cpu_ops; -extern struct pv_irq_ops pv_irq_ops; -extern struct pv_mmu_ops pv_mmu_ops; -extern struct pv_lock_ops pv_lock_ops; +extern struct paravirt_patch_template pv_ops;#define PARAVIRT_PATCH (x) \ (offsetof(struct paravirt_patch_template, x) / sizeof(void *))#define paravirt_type (op) \ [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \ - [paravirt_opptr] "i" (&(op)) + [paravirt_opptr] "i" (&(pv_ops.op))#define paravirt_clobber (clobber) \ [paravirt_clobber] "i" (clobber)
@@ -503,9 +498,9 @@ int paravirt_disable_iospace(void);#endif /* CONFIG_X86_32 */ #ifdef CONFIG_PARAVIRT_DEBUG -#define PVOP_TEST_NULL (op) BUG_ON(op == NULL) +#define PVOP_TEST_NULL (op) BUG_ON(pv_ops.op == NULL)#else -#define PVOP_TEST_NULL (op) ((void)op) +#define PVOP_TEST_NULL (op) ((void)pv_ops.op)#endif #define PVOP_RETMASK (rettype) \
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, insnbuf, + used = pv_ops.init.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/asm-offsets.c +5 -7
@@ -66,13 +66,11 @@ void common(void) {#ifdef CONFIG_PARAVIRT BLANK (); -OFFSET (PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops); -OFFSET (PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops); -OFFSET (PV_IRQ_irq_disable, pv_irq_ops, irq_disable); -OFFSET (PV_IRQ_irq_enable, pv_irq_ops, irq_enable); -OFFSET (PV_CPU_iret, pv_cpu_ops, iret); -OFFSET (PV_CPU_read_cr0, pv_cpu_ops, read_cr0); -OFFSET (PV_MMU_read_cr2, pv_mmu_ops, read_cr2); +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); +OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0); +OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif #ifdef CONFIG_XEN
arch/x86/kernel/asm-offsets_64.c +4 -3
@@ -21,10 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT -OFFSET (PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64); -OFFSET (PV_CPU_swapgs, pv_cpu_ops, swapgs); +OFFSET (PV_CPU_usergs_sysret64, paravirt_patch_template, + cpu.usergs_sysret64); +OFFSET (PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs);#ifdef CONFIG_DEBUG_ENTRY -OFFSET (PV_IRQ_save_fl, pv_irq_ops, save_fl); +OFFSET (PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);#endif BLANK ();#endif
arch/x86/kernel/cpu/common.c +1 -1
@@ -1242,7 +1242,7 @@ static void generic_identify(struct cpuinfo_x86 *c)# ifdef CONFIG_PARAVIRT do {extern void native_iret (void ); -if (pv_cpu_ops.iret == native_iret) +if (pv_ops.cpu.iret == native_iret)set_cpu_bug (c,X86_BUG_ESPFIX ); }while (0 );# else
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -97,14 +97,14 @@ static void __init vmware_sched_clock_setup(void) d->cyc2ns_offset =mul_u64_u32_shr (tsc_now, d->cyc2ns_mul, d->cyc2ns_shift); - pv_time_ops.sched_clock = vmware_sched_clock; + pv_ops.time.sched_clock = vmware_sched_clock;pr_info ("using sched offset of %llu ns\n" , d->cyc2ns_offset); }static void __init vmware_paravirt_ops_setup (void ) { pv_info.name ="VMware hypervisor" ; - pv_cpu_ops.io_delay = paravirt_nop; + pv_ops.cpu.io_delay = paravirt_nop;if (vmware_tsc_khz && vmw_sched_clock)vmware_sched_clock_setup ();
arch/x86/kernel/kvm.c +10 -9
@@ -283,7 +283,7 @@ static void __init paravirt_ops_setup(void) pv_info.name ="KVM" ;if (kvm_para_has_feature (KVM_FEATURE_NOP_IO_DELAY )) - pv_cpu_ops.io_delay = kvm_io_delay; + pv_ops.cpu.io_delay = kvm_io_delay;#ifdef CONFIG_X86_IO_APIC no_timer_check =1 ;
@@ -632,14 +632,14 @@ static void __init kvm_guest_init(void)if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { has_steal_clock =1 ; - pv_time_ops.steal_clock = kvm_steal_clock; + pv_ops.time.steal_clock = kvm_steal_clock; }if (kvm_para_has_feature (KVM_FEATURE_PV_TLB_FLUSH ) && !kvm_para_has_hint (KVM_HINTS_REALTIME ) &&kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }if (kvm_para_has_feature (KVM_FEATURE_PV_EOI ))
@@ -850,13 +850,14 @@ void __init kvm_spinlock_init(void)return ;__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = kvm_wait; - pv_lock_ops.kick = kvm_kick_cpu; + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = kvm_wait; + pv_ops.lock.kick = kvm_kick_cpu;if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_lock_ops.vcpu_is_preempted = + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (__kvm_vcpu_is_preempted); } }
arch/x86/kernel/kvmclock.c +2 -2
@@ -116,13 +116,13 @@ static u64 kvm_sched_clock_read(void)static inline void kvm_sched_clock_init (bool stable) {if (!stable) { - pv_time_ops.sched_clock = kvm_clock_read; + pv_ops.time.sched_clock = kvm_clock_read;clear_sched_clock_stable ();return ; } kvm_sched_clock_offset =kvm_clock_read (); - pv_time_ops.sched_clock = kvm_sched_clock_read; + pv_ops.time.sched_clock = kvm_sched_clock_read;pr_info ("kvm-clock: using sched offset of %llu cycles" , kvm_sched_clock_offset);
arch/x86/kernel/paravirt-spinlocks.c +2 -13
@@ -17,7 +17,7 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock);bool pv_is_native_spin_unlock (void ) { -return pv_lock_ops.queued_spin_unlock.func == +return pv_ops.lock.queued_spin_unlock.func == __raw_callee_save___native_queued_spin_unlock; }
@@ -29,17 +29,6 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_vcpu_is_preempted);bool pv_is_native_vcpu_is_preempted (void ) { -return pv_lock_ops.vcpu_is_preempted.func == +return pv_ops.lock.vcpu_is_preempted.func == __raw_callee_save___native_vcpu_is_preempted; } - -struct pv_lock_ops pv_lock_ops = { -#ifdef CONFIG_SMP - .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath, - .queued_spin_unlock =PV_CALLEE_SAVE (__native_queued_spin_unlock), - .wait = paravirt_nop, - .kick = paravirt_nop, - .vcpu_is_preempted =PV_CALLEE_SAVE (__native_vcpu_is_preempted), -#endif /* SMP */ -}; -EXPORT_SYMBOL (pv_lock_ops);
arch/x86/kernel/paravirt.c +137 -146
336 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_32.c +24 -24
69 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_64.c +28 -28
81 lines not on this page · raw message
arch/x86/kernel/tsc.c +1 -1
@@ -246,7 +246,7 @@ unsigned long long sched_clock(void)bool using_native_sched_clock (void ) { -return pv_time_ops.sched_clock == native_sched_clock; +return pv_ops.time.sched_clock == native_sched_clock; }#else unsigned long long
arch/x86/kernel/vsmp_64.c +9 -9
@@ -73,10 +73,10 @@ static unsigned __init vsmp_patch(u8 type, void *ibuf, unsigned long addr, unsigned len) {switch (type) { -case PARAVIRT_PATCH (pv_irq_ops.irq_enable): -case PARAVIRT_PATCH (pv_irq_ops.irq_disable): -case PARAVIRT_PATCH (pv_irq_ops.save_fl): -case PARAVIRT_PATCH (pv_irq_ops.restore_fl): +case PARAVIRT_PATCH (irq.irq_enable): +case PARAVIRT_PATCH (irq.irq_disable): +case PARAVIRT_PATCH (irq.save_fl): +case PARAVIRT_PATCH (irq.restore_fl):return paravirt_patch_default (type, ibuf, addr, len);default :return native_patch (type, ibuf, addr, len);
@@ -111,11 +111,11 @@ static void __init set_vsmp_pv_ops(void)if (cap & ctl & (1 <<4 )) {/* Setup irq ops and turn on vSMP IRQ fastpath handling */ - pv_irq_ops.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); - pv_irq_ops.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); - pv_irq_ops.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); - pv_irq_ops.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); - pv_init_ops.patch = vsmp_patch; + pv_ops.irq.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); + pv_ops.irq.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); + pv_ops.irq.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); + pv_ops.irq.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); + pv_ops.init.patch = vsmp_patch; ctl &= ~(1 <<4 ); }writel (ctl, address +4 );
arch/x86/xen/enlighten_pv.c +18 -13
@@ -995,11 +995,14 @@ void __init xen_setup_vcpu_info_placement(void)* percpu area for all cpus, so make use of it. */ if (xen_have_vcpu_info_placement) { - pv_irq_ops.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); - pv_irq_ops.restore_fl =__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); - pv_irq_ops.irq_disable =__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); - pv_irq_ops.irq_enable =__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); - pv_mmu_ops.read_cr2 = xen_read_cr2_direct; + pv_ops.irq.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); + pv_ops.irq.restore_fl = +__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); + pv_ops.irq.irq_disable = +__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); + pv_ops.irq.irq_enable = +__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); + pv_ops.mmu.read_cr2 = xen_read_cr2_direct; } }
@@ -1174,14 +1177,14 @@ static void __init xen_boot_params_init_edd(void)*/ static void __init xen_setup_gdt (int cpu) { - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; - pv_cpu_ops.load_gdt = xen_load_gdt_boot; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry_boot; + pv_ops.cpu.load_gdt = xen_load_gdt_boot;setup_stack_canary_segment (cpu);switch_to_new_gdt (cpu); - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; - pv_cpu_ops.load_gdt = xen_load_gdt; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry; + pv_ops.cpu.load_gdt = xen_load_gdt; }static void __init xen_dom0_set_legacy_features (void )
@@ -1206,8 +1209,8 @@ asmlinkage __visible void __init xen_start_kernel(void)/* Install Xen paravirt ops */ pv_info = xen_info; - pv_init_ops.patch = paravirt_patch_default; - pv_cpu_ops = xen_cpu_ops; + pv_ops.init.patch = paravirt_patch_default; + pv_ops.cpu = xen_cpu_ops;xen_init_irq_ops ();/*
@@ -1276,8 +1279,10 @@ asmlinkage __visible void __init xen_start_kernel(void)#endif if (xen_feature (XENFEAT_mmu_pt_update_preserve_ad)) { - pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; - pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; + pv_ops.mmu.ptep_modify_prot_start = + xen_ptep_modify_prot_start; + pv_ops.mmu.ptep_modify_prot_commit = + xen_ptep_modify_prot_commit; } machine_ops = xen_machine_ops;
arch/x86/xen/irq.c +1 -1
@@ -128,6 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {void __init xen_init_irq_ops (void ) { - pv_irq_ops = xen_irq_ops; + pv_ops.irq = xen_irq_ops; x86_init.irqs.intr_init = xen_init_IRQ; }
arch/x86/xen/mmu_hvm.c +1 -1
@@ -73,7 +73,7 @@ static int is_pagetable_dying_supported(void)void __init xen_hvm_init_mmu_ops (void ) {if (is_pagetable_dying_supported ()) - pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap; + pv_ops.mmu.exit_mmap = xen_hvm_exit_mmap;#ifdef CONFIG_PROC_VMCORE WARN_ON (register_oldmem_pfn_is_ram (&xen_oldmem_pfn_is_ram));#endif
arch/x86/xen/mmu_pv.c +14 -14
@@ -2216,7 +2216,7 @@ static void __init xen_write_cr3_init(unsigned long cr3)set_page_prot (initial_page_table,PAGE_KERNEL );set_page_prot (initial_kernel_pmd,PAGE_KERNEL ); - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3; }/*
@@ -2365,27 +2365,27 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)static void __init xen_post_allocator_init (void ) { - pv_mmu_ops.set_pte = xen_set_pte; - pv_mmu_ops.set_pmd = xen_set_pmd; - pv_mmu_ops.set_pud = xen_set_pud; + pv_ops.mmu.set_pte = xen_set_pte; + pv_ops.mmu.set_pmd = xen_set_pmd; + pv_ops.mmu.set_pud = xen_set_pud;#ifdef CONFIG_X86_64 - pv_mmu_ops.set_p4d = xen_set_p4d; + pv_ops.mmu.set_p4d = xen_set_p4d;#endif /* This will work as long as patching hasn't happened yet (which it hasn't) */ - pv_mmu_ops.alloc_pte = xen_alloc_pte; - pv_mmu_ops.alloc_pmd = xen_alloc_pmd; - pv_mmu_ops.release_pte = xen_release_pte; - pv_mmu_ops.release_pmd = xen_release_pmd; + pv_ops.mmu.alloc_pte = xen_alloc_pte; + pv_ops.mmu.alloc_pmd = xen_alloc_pmd; + pv_ops.mmu.release_pte = xen_release_pte; + pv_ops.mmu.release_pmd = xen_release_pmd;#ifdef CONFIG_X86_64 - pv_mmu_ops.alloc_pud = xen_alloc_pud; - pv_mmu_ops.release_pud = xen_release_pud; + pv_ops.mmu.alloc_pud = xen_alloc_pud; + pv_ops.mmu.release_pud = xen_release_pud;#endif - pv_mmu_ops.make_pte =PV_CALLEE_SAVE (xen_make_pte); + pv_ops.mmu.make_pte =PV_CALLEE_SAVE (xen_make_pte);#ifdef CONFIG_X86_64 - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3;#endif }
@@ -2473,7 +2473,7 @@ void __init xen_init_mmu_ops(void) x86_init.paging.pagetable_init = xen_pagetable_init; x86_init.hyper.init_after_bootmem = xen_after_bootmem; - pv_mmu_ops = xen_mmu_ops; + pv_ops.mmu = xen_mmu_ops;memset (dummy_mapping,0xff ,PAGE_SIZE ); }
arch/x86/xen/spinlock.c +6 -5
@@ -141,11 +141,12 @@ void __init xen_init_spinlocks(void)printk (KERN_DEBUG "xen: PV spinlocks enabled\n" );__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = xen_qlock_wait; - pv_lock_ops.kick = xen_qlock_kick; - pv_lock_ops.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = xen_qlock_wait; + pv_ops.lock.kick = xen_qlock_kick; + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); }static __init int xen_parse_nopvspin (char *arg)
arch/x86/xen/time.c +2 -2
@@ -513,7 +513,7 @@ static void __init xen_time_init(void)void __init xen_init_time_ops (void ) { xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.timer_init = xen_time_init; x86_init.timers.setup_percpu_clockev = x86_init_noop;
@@ -555,7 +555,7 @@ void __init xen_hvm_init_time_ops(void) } xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.setup_percpu_clockev = xen_time_init; x86_cpuinit.setup_percpu_clockev = xen_hvm_setup_cpu_clockevents;
drivers/xen/time.c +1 -1
@@ -175,7 +175,7 @@ void __init xen_time_setup_guest(void) xen_runstate_remote = !HYPERVISOR_vm_assist (VMASST_CMD_enable, VMASST_TYPE_runstate_update_flag); - pv_time_ops.steal_clock = xen_steal_clock; + pv_ops.time.steal_clock = xen_steal_clock;static_key_slow_inc (¶virt_steal_enabled);if (xen_runstate_remote)
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 2/15 xen: move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
In reply to Juergen GrossThere are some PV specific functions in arch/x86/xen/mmu.c which can be moved to mmu_pv.c. This in turn enables us to make multicalls.c dependent on CONFIG_XEN_PV.
---
V3:
- fix build failure on ARM (Boris Ostrovsky)
--- arch/arm/xen/enlighten.c | 34 -------- arch/x86/xen/Makefile | 2 +- arch/x86/xen/mmu.c | 186 ----------------------------------------- arch/x86/xen/mmu_pv.c | 138 ++++++++++++++++++++++++++++++ include/xen/interface/memory.h | 6 -- include/xen/xen-ops.h | 133 +++++++++++++++++++---------- 6 files changed, 227 insertions(+), 272 deletions(-)
arch/arm/xen/enlighten.c +0 -34
@@ -62,29 +62,6 @@ static __read_mostly unsigned int xen_events_irq;uint32_t xen_start_flags;EXPORT_SYMBOL (xen_start_flags); -int xen_remap_domain_gfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *gfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned domid, -struct page **pages) -{ -return xen_xlate_remap_gfn_array (vma, addr, gfn, nr, err_ptr, - prot, domid, pages); -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_array); - -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_gfn_range (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t gfn,int nr, -pgprot_t prot,unsigned domid, -struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_range); -int xen_unmap_domain_gfn_range (struct vm_area_struct *vma,int nr,struct page **pages) {
@@ -92,17 +69,6 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, }EXPORT_SYMBOL_GPL (xen_unmap_domain_gfn_range); -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_mfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *mfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned int domid,struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_mfn_array); -static void xen_read_wallclock (struct timespec64 *ts) {u32 version;
arch/x86/xen/Makefile +1 -1
@@ -15,7 +15,6 @@ CFLAGS_enlighten_pv.o := $(nostackp) CFLAGS_mmu_pv.o := $(nostackp) obj-y += enlighten.o -obj-y += multicalls.o obj-y += mmu.o obj-y += time.o obj-y += grant-table.o
@@ -34,6 +33,7 @@ obj-$(CONFIG_XEN_PV) += p2m.o obj-$(CONFIG_XEN_PV) += enlighten_pv.o obj-$(CONFIG_XEN_PV) += mmu_pv.o obj-$(CONFIG_XEN_PV) += irq.o +obj-$(CONFIG_XEN_PV) += multicalls.o obj-$(CONFIG_XEN_PV) += xen-asm.o obj-$(CONFIG_XEN_PV) += xen-asm_$(BITS).o
arch/x86/xen/mmu.c +0 -186
198 lines not on this page · raw message
arch/x86/xen/mmu_pv.c +138 -0
150 lines not on this page · raw message
include/xen/interface/memory.h +0 -6
@@ -244,12 +244,6 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);#define XENMEM_machine_memory_map 10 -/* -* Prevent the balloon driver from changing the memory reservation -* during a driver critical region. -*/ -extern spinlock_t xen_reservation_lock; -/* * Unmaps the page appearing at a particular GPFN from the specified guest's * pseudophysical address space.
include/xen/xen-ops.h +88 -45
176 lines not on this page · raw message
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 10/15 x86/paravirt: introduce new config option PARAVIRT_XXL
In reply to Juergen GrossA large amount of paravirt ops is used by Xen PV guests only. Add a new config option PARAVIRT_XXL which is selected by XEN_PV. Later we can put the Xen PV only paravirt ops under the PARAVIRT_XXL umbrella.
Since irq related paravirt ops are used only by VSMP and Xen PV, let VSMP select PARAVIRT_XXL, too, in order to enable moving the irq ops under PARAVIRT_XXL.
---
V3:
- let VSMP select PARAVIRT_XXL (Peter Zijlstra)
--- arch/x86/Kconfig | 4 ++++ arch/x86/boot/compressed/misc.h | 1 + arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/xen/Kconfig | 1 + 4 files changed, 7 insertions(+)
arch/x86/Kconfig +4 -0
@@ -523,6 +523,7 @@ config X86_VSMP bool "ScaleMP vSMP" select HYPERVISOR_GUEST select PARAVIRT + select PARAVIRT_XXL depends on X86_64 && PCI depends on X86_EXTENDED_PLATFORM depends on SMP
@@ -754,6 +755,9 @@ config PARAVIRT over full virtualization. However, when run without a hypervisor the kernel is theoretically slower and slightly larger. +config PARAVIRT_XXL + bool + config PARAVIRT_DEBUG bool "paravirt-ops debugging" depends on PARAVIRT && DEBUG_KERNEL
arch/x86/boot/compressed/misc.h +1 -0
@@ -9,6 +9,7 @@* paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#undef CONFIG_KASAN
arch/x86/mm/mem_encrypt_identity.c +1 -0
@@ -27,6 +27,7 @@* be extended when new paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#include <linux/kernel.h>
arch/x86/xen/Kconfig +1 -0
@@ -18,6 +18,7 @@ config XEN_PV bool "Xen PV guest support" default y depends on XEN + select PARAVIRT_XXL select XEN_HAVE_PVMMU select XEN_HAVE_VPMU help
Signature · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 12/15 x86/paravirt: move the Xen-only pv_cpu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen GrossMost of the paravirt ops defined in pv_cpu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/debugreg.h | 2 +- arch/x86/include/asm/desc.h | 4 ++-- arch/x86/include/asm/irqflags.h | 16 +++++++++++----- arch/x86/include/asm/msr.h | 4 ++-- arch/x86/include/asm/paravirt.h | 19 +++++++++++++++++-- arch/x86/include/asm/paravirt_types.h | 5 ++++- arch/x86/include/asm/pgtable.h | 6 ++++-- arch/x86/include/asm/processor.h | 4 ++-- arch/x86/include/asm/special_insns.h | 9 +++++++-- arch/x86/kernel/asm-offsets.c | 2 ++ arch/x86/kernel/asm-offsets_64.c | 2 ++ arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/head_64.S | 2 ++ arch/x86/kernel/paravirt.c | 13 ++++++++++++- arch/x86/kernel/paravirt_patch_32.c | 4 ++++ arch/x86/kernel/paravirt_patch_64.c | 6 +++++- 16 files changed, 78 insertions(+), 22 deletions(-)
arch/x86/include/asm/debugreg.h +1 -1
@@ -8,7 +8,7 @@ DECLARE_PER_CPU(unsigned long, cpu_dr7); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * These special macros can be used to get or set a debugging register */
arch/x86/include/asm/desc.h +2 -2
@@ -108,7 +108,7 @@ static inline int desc_empty(const void *ptr)return !(desc[0 ] | desc[1 ]); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define load_TR_desc () native_load_tr_desc()
@@ -134,7 +134,7 @@ static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries)static inline void paravirt_free_ldt (struct desc_struct *ldt,unsigned entries) { } -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #define store_ldt (ldt) asm("sldt %0" : "=m"(ldt))
arch/x86/include/asm/irqflags.h +11 -5
@@ -121,6 +121,16 @@ static inline notrace unsigned long arch_local_irq_save(void)#define ENABLE_INTERRUPTS (x) sti#define DISABLE_INTERRUPTS (x) cli +#ifdef CONFIG_X86_64 +#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/*
@@ -142,16 +152,12 @@ static inline notrace unsigned long arch_local_irq_save(void)swapgs ; \ sysretl -#ifdef CONFIG_DEBUG_ENTRY -#define SAVE_FLAGS (x) pushfq; popq %rax -#endif #else #define INTERRUPT_RETURN iret#endif -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #ifndef __ASSEMBLY__static inline int arch_irqs_disabled_flags (unsigned long flags)
arch/x86/include/asm/msr.h +2 -2
@@ -242,7 +242,7 @@ static inline unsigned long long native_read_pmc(int counter)return EAX_EDX_VAL (val, low, high); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #include <linux/errno.h>
@@ -305,7 +305,7 @@ do { \#define rdpmcl (counter, val) ((val) = native_read_pmc(counter)) -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ /* * 64-bit version of wrmsr_safe():
arch/x86/include/asm/paravirt.h +17 -2
@@ -17,6 +17,7 @@#include <linux/cpumask.h> #include <asm/frame.h> +#ifdef CONFIG_PARAVIRT_XXL static inline void load_sp0 (unsigned long sp0) {PVOP_VCALL1 (cpu.load_sp0, sp0);
@@ -51,6 +52,7 @@ static inline void write_cr0(unsigned long x) {PVOP_VCALL1 (cpu.write_cr0, x); } +#endif static inline unsigned long read_cr2 (void ) {
@@ -72,6 +74,7 @@ static inline void write_cr3(unsigned long x)PVOP_VCALL1 (mmu.write_cr3, x); } +#ifdef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {PVOP_VCALL1 (cpu.write_cr4, x);
@@ -88,6 +91,7 @@ static inline void write_cr8(unsigned long x)PVOP_VCALL1 (cpu.write_cr8, x); }#endif +#endif static inline void arch_safe_halt (void ) {
@@ -99,14 +103,13 @@ static inline void halt(void)PVOP_VCALL0 (irq.halt); } +#ifdef CONFIG_PARAVIRT_XXL static inline void wbinvd (void ) {PVOP_VCALL0 (cpu.wbinvd); } -#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) -#endif static inline u64 paravirt_read_msr (unsigned msr) {
@@ -171,6 +174,7 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) *p =paravirt_read_msr_safe (msr, &err); return err; } +#endif static inline unsigned long long paravirt_sched_clock (void ) {
@@ -186,6 +190,7 @@ static inline u64 paravirt_steal_clock(int cpu)return PVOP_CALL1 (u64, time.steal_clock, cpu); } +#ifdef CONFIG_PARAVIRT_XXL static inline unsigned long long paravirt_read_pmc (int counter) {return PVOP_CALL1 (u64, cpu.read_pmc, counter);
@@ -230,6 +235,7 @@ static inline unsigned long paravirt_store_tr(void) { return PVOP_CALL0(unsigned long, cpu.store_tr); } +#define store_tr (tr) ((tr) = paravirt_store_tr())static inline void load_TLS (struct thread_struct *t,unsigned cpu) {
@@ -263,6 +269,7 @@ static inline void set_iopl_mask(unsigned mask) {PVOP_VCALL1 (cpu.set_iopl_mask, mask); } +#endif /* The paravirtualized I/O functions */ static inline void slow_down_io (void )
@@ -618,6 +625,7 @@ static inline void pmd_clear(pmd_t *pmdp) }#endif /* CONFIG_X86_PAE */ +#ifdef CONFIG_PARAVIRT_XXL #define __HAVE_ARCH_START_CONTEXT_SWITCHstatic inline void arch_start_context_switch (struct task_struct *prev) {
@@ -628,6 +636,7 @@ static inline void arch_end_context_switch(struct task_struct *next) {PVOP_VCALL1 (cpu.end_context_switch, next); } +#endif #define __HAVE_ARCH_ENTER_LAZY_MMU_MODEstatic inline void arch_enter_lazy_mmu_mode (void )
@@ -870,10 +879,12 @@ extern void default_banner(void);#define PARA_INDIRECT (addr) *%cs:addr#endif +#ifdef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN \ 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), \
@@ -890,6 +901,7 @@ extern void default_banner(void); PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#ifdef CONFIG_X86_64 +#ifdef CONFIG_PARAVIRT_XXL /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
@@ -909,15 +921,18 @@ extern void default_banner(void);ANNOTATE_RETPOLINE_SAFE ; \ call PARA_INDIRECT(pv_ops+PV_CPU_swapgs); \ ) +#endif #define GET_CR2_INTO_RAX \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_ops+PV_MMU_read_cr2); +#ifdef CONFIG_PARAVIRT_XXL #define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(PV_CPU_usergs_sysret64), \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);) +#endif #ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \
arch/x86/include/asm/paravirt_types.h +4 -1
@@ -106,6 +106,9 @@ struct pv_time_ops {struct pv_cpu_ops {/* hooks for various privileged instructions */ +void (*io_delay)(void ); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*get_debugreg)(int regno);void (*set_debugreg)(int regno,unsigned long value);
@@ -143,7 +146,6 @@ struct pv_cpu_ops {void (*set_iopl_mask)(unsigned mask);void (*wbinvd)(void ); -void (*io_delay)(void );/* cpuid emulation, mostly so that caps bits can be disabled */ void (*cpuid)(unsigned int *eax, unsigned int *ebx,
@@ -178,6 +180,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); +#endif } __no_randomize_layout;struct pv_irq_ops {
arch/x86/include/asm/pgtable.h +4 -2
@@ -111,10 +111,12 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#define arch_end_context_switch (prev) do {} while(0) -#endif /* CONFIG_PARAVIRT */ +#ifndef CONFIG_PARAVIRT_XXL +#define arch_end_context_switch (prev) do {} while(0) +#endif /* CONFIG_PARAVIRT_XXL */ +/* * The following only work if pte_present() is true. * Undefined behaviour if not..
arch/x86/include/asm/processor.h +2 -2
@@ -576,7 +576,7 @@ static inline bool on_thread_stack(void) current_stack_pointer) < THREAD_SIZE; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define __cpuid native_cpuid
@@ -587,7 +587,7 @@ static inline void load_sp0(unsigned long sp0) }#define set_iopl_mask native_set_iopl_mask -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ /* Free all resources held by a thread. */ extern void release_thread (struct task_struct *);
arch/x86/include/asm/special_insns.h +7 -2
@@ -143,8 +143,9 @@ static inline unsigned long __read_cr4(void)#ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> -#else +#endif +#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -154,7 +155,9 @@ 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 ();
@@ -178,7 +181,9 @@ 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);
@@ -208,7 +213,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +2 -0
@@ -68,7 +68,9 @@ void common(void) {BLANK ();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);#endif
arch/x86/kernel/asm-offsets_64.c +2 -0
@@ -21,9 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL 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
arch/x86/kernel/cpu/common.c +1 -1
@@ -1239,7 +1239,7 @@ static void generic_identify(struct cpuinfo_x86 *c)* ESPFIX issue, we can change this. */ #ifdef CONFIG_X86_32 -# ifdef CONFIG_PARAVIRT +# ifdef CONFIG_PARAVIRT_XXL do { extern void native_iret(void); if (pv_ops.cpu.iret == native_iret)
arch/x86/kernel/head_64.S +2 -0
@@ -31,6 +31,8 @@ #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 +12 -1
@@ -101,6 +101,7 @@ static unsigned paravirt_patch_call(void *insnbuf, const void *target,return 5 ; } +#ifdef CONFIG_PARAVIRT_XXL static unsigned paravirt_patch_jmp (void *insnbuf,const void *target,unsigned long addr,unsigned len) {
@@ -119,6 +120,7 @@ static unsigned paravirt_patch_jmp(void *insnbuf, const void *target, return 5; } +#endif DEFINE_STATIC_KEY_TRUE (virt_spin_lock_key);
@@ -150,10 +152,12 @@ unsigned paravirt_patch_default(u8 type, void *insnbuf,else if (opfunc == _paravirt_ident_64) ret =paravirt_patch_ident_64 (insnbuf, len); +#ifdef CONFIG_PARAVIRT_XXL else if (type == PARAVIRT_PATCH(cpu.iret) || type == PARAVIRT_PATCH(cpu.usergs_sysret64))/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); +#endif else/* Otherwise call the function. */ ret =paravirt_patch_call (insnbuf, opfunc, addr, len);
@@ -262,6 +266,7 @@ void paravirt_flush_lazy_mmu(void)preempt_enable (); } +#ifdef CONFIG_PARAVIRT_XXL void paravirt_start_context_switch (struct task_struct *prev) {BUG_ON (preemptible ());
@@ -282,6 +287,7 @@ void paravirt_end_context_switch(struct task_struct *next)if (test_and_clear_ti_thread_flag (task_thread_info (next),TIF_LAZY_MMU_UPDATES )) arch_enter_lazy_mmu_mode(); } +#endif enum paravirt_lazy_mode paravirt_get_lazy_mode (void ) {
@@ -320,6 +326,9 @@ struct paravirt_patch_template pv_ops = { .time.steal_clock = native_steal_clock,/* Cpu ops. */ + .cpu.io_delay = native_io_delay, + +#ifdef CONFIG_PARAVIRT_XXL .cpu.cpuid = native_cpuid, .cpu.get_debugreg = native_get_debugreg, .cpu.set_debugreg = native_set_debugreg,
@@ -361,10 +370,10 @@ struct paravirt_patch_template pv_ops = { .cpu.swapgs = native_swapgs, .cpu.set_iopl_mask = native_set_iopl_mask, - .cpu.io_delay = native_io_delay, .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),
@@ -463,10 +472,12 @@ struct paravirt_patch_template pv_ops = {#endif }; +#ifdef CONFIG_PARAVIRT_XXL /* At this point, native_get/set_debugreg has real function entries */ NOKPROBE_SYMBOL (native_get_debugreg);NOKPROBE_SYMBOL (native_set_debugreg);NOKPROBE_SYMBOL (native_load_idt); +#endif EXPORT_SYMBOL_GPL (pv_ops);EXPORT_SYMBOL_GPL (pv_info);
arch/x86/kernel/paravirt_patch_32.c +4 -0
@@ -5,7 +5,9 @@ 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" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" );
@@ -45,7 +47,9 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3);
arch/x86/kernel/paravirt_patch_64.c +5 -1
@@ -10,10 +10,12 @@ DEF_NATIVE(irq, save_fl, "pushfq; popq %rax");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" );DEF_NATIVE (cpu, swapgs,"swapgs" ); +#endif DEF_NATIVE(, mov32, "mov %edi, %eax"); DEF_NATIVE(, mov64, "mov %rdi, %rax");
@@ -53,12 +55,14 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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); +#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); -PATCH_SITE (cpu, wbinvd);#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 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 7/15 x86/paravirt: remove clobbers from struct paravirt_patch_site
In reply to Juergen GrossThere is no need any longer to store the clobbers in struct paravirt_patch_site. Remove clobbers from the struct and from the related macros.
While at it fix some lines longer than 80 characters.
--- arch/x86/include/asm/paravirt.h | 33 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 1 - 2 files changed, 15 insertions(+), 19 deletions(-)
arch/x86/include/asm/paravirt.h +15 -18
@@ -827,7 +827,7 @@ extern void default_banner(void);#else /* __ASSEMBLY__ */ -#define _PVSITE (ptype, clobbers, ops, word, algn) \ +#define _PVSITE (ptype, ops, word, algn) \ 771:; \ ops; \ 772:; \
@@ -836,7 +836,6 @@ extern void default_banner(void); word 771b; \ .byte ptype; \ .byte 772b-771b; \ - .short clobbers; \ .popsection
@@ -869,7 +868,7 @@ extern void default_banner(void); COND_POP(set, CLBR_RAX, rax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 8) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .quad, 8)#define PARA_INDIRECT (addr) *addr(%rip)#else #define PV_SAVE_REGS (set) \
@@ -884,26 +883,26 @@ extern void default_banner(void); COND_POP(set, CLBR_EAX, eax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .long, 4)#define PARA_INDIRECT (addr) *%cs:addr#endif #define INTERRUPT_RETURN \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);)#define DISABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#define ENABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
@@ -921,8 +920,7 @@ extern void default_banner(void);* inlined, or the swapgs instruction must be trapped and emulated. */ #define SWAPGS_UNSAFE_STACK \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - swapgs) + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), swapgs)/* * Note: swapgs is very special, and in practise is either going to be
@@ -931,8 +929,8 @@ extern void default_banner(void);* it. */ #define SWAPGS \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \ )
@@ -942,15 +940,14 @@ extern void default_banner(void);#define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \ - CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);)#ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#endif
arch/x86/include/asm/paravirt_types.h +0 -1
@@ -681,7 +681,6 @@ struct paravirt_patch_site {u8 *instr;/* original instructions */ u8 instrtype;/* type of this instruction */ u8 len;/* length of original instruction */ -u16 clobbers;/* what registers you may clobber */ }; extern struct paravirt_patch_site __parainstructions[],
Signature · 1 line
2.16.4
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 · 1 line
2.16.4
Juergen Gross
maintainerPATCH v3 6/15 x86/paravirt: remove clobbers parameter from paravirt patch functions
In reply to Juergen GrossThe clobbers parameter from paravirt_patch_default() et al isn't used any longer. Remove it.
--- arch/x86/include/asm/paravirt_types.h | 7 +++---- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/paravirt.c | 14 +++++--------- arch/x86/kernel/paravirt_patch_32.c | 5 ++--- arch/x86/kernel/paravirt_patch_64.c | 5 ++--- arch/x86/kernel/vsmp_64.c | 6 +++--- 6 files changed, 16 insertions(+), 23 deletions(-)
arch/x86/include/asm/paravirt_types.h +3 -4
@@ -85,7 +85,7 @@ struct pv_init_ops {* the number of bytes of code generated, as we nop pad the * rest in generic code. */ -unsigned (*patch)(u8 type,u16 clobber,void *insnbuf, +unsigned (*patch)(u8 type,void *insnbuf,unsigned long addr,unsigned len); } __no_randomize_layout;
@@ -373,14 +373,13 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len);unsigned paravirt_patch_insns (void *insnbuf,unsigned len,const char *start,const char *end); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len); +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len);int paravirt_disable_iospace (void );
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, p->clobbers, insnbuf, + used = pv_init_ops.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/paravirt.c +5 -9
@@ -81,10 +81,8 @@ struct branch {u32 delta; } __attribute__((packed)); -static unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -149,7 +147,7 @@ static void *get_call_destination(u8 type)return *((void **)&tmpl + type); } -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len) {void *opfunc =get_call_destination (type);
@@ -172,10 +170,8 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); else -/* Otherwise call the function; assume target could -clobber any caller-save reg */ - ret =paravirt_patch_call (insnbuf, opfunc,CLBR_ANY , - addr, clobbers, len); +/* Otherwise call the function. */ + ret =paravirt_patch_call (insnbuf, opfunc, addr, len);return ret; }
arch/x86/kernel/paravirt_patch_32.c +2 -3
@@ -30,8 +30,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -70,7 +69,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/paravirt_patch_64.c +2 -3
@@ -38,8 +38,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -80,7 +79,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/vsmp_64.c +3 -3
@@ -69,7 +69,7 @@ asmlinkage __visible void vsmp_irq_enable(void) }PV_CALLEE_SAVE_REGS_THUNK (vsmp_irq_enable); -static unsigned __init vsmp_patch (u8 type,u16 clobbers,void *ibuf, +static unsigned __init vsmp_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {switch (type) {
@@ -77,9 +77,9 @@ static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,case PARAVIRT_PATCH (pv_irq_ops.irq_disable):case PARAVIRT_PATCH (pv_irq_ops.save_fl):case PARAVIRT_PATCH (pv_irq_ops.restore_fl): -return paravirt_patch_default (type, clobbers, ibuf, addr, len); +return paravirt_patch_default (type, ibuf, addr, len);default : -return native_patch (type, clobbers, ibuf, addr, len); +return native_patch (type, ibuf, addr, len); } }
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 · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
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
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/xen: Move pv irq related functions under CONFIG_XEN_PV umbrella
In reply to Juergen Grossx86/xen: Move pv irq related functions under CONFIG_XEN_PV umbrella
Commit-ID: 28c11b0f798c6727355bd44603b16bb04e3a044d Gitweb: https://git.kernel.org/tip/28c11b0f798c6727355bd44603b16bb04e3a044d Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:12 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:32 +0200
x86/xen: Move pv irq related functions under CONFIG_XEN_PV umbrella
All functions in arch/x86/xen/irq.c and arch/x86/xen/xen-asm*.S are specific to PV guests. Include them in the kernel with CONFIG_XEN_PV only.
Make the PV specific code in arch/x86/entry/entry_*.S dependent on CONFIG_XEN_PV instead of CONFIG_XEN.
The HVM specific code should depend on CONFIG_XEN_PVHVM.
While at it reformat the Makefile to make it more readable.
--- arch/x86/entry/entry_32.S | 8 +++++--- arch/x86/entry/entry_64.S | 8 +++++--- arch/x86/xen/Makefile | 41 +++++++++++++++++++++++++++++++---------- include/xen/events.h | 2 ++ 4 files changed, 43 insertions(+), 16 deletions(-)
arch/x86/entry/entry_32.S +5 -3
@@ -782,7 +782,7 @@ GLOBAL(__begin_SYSENTER_singlestep_region) * will ignore all of the single-step traps generated in this range. */ -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV /* * Xen doesn't set %esp to be precisely what the normal SYSENTER * entry point expects, so fix it up before using the normal path.
@@ -1240,7 +1240,7 @@ ENTRY(spurious_interrupt_bug) jmp common_exception END(spurious_interrupt_bug) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV ENTRY(xen_hypervisor_callback) pushl $-1 /* orig_ax = -1 => not a system call */ SAVE_ALL
@@ -1321,11 +1321,13 @@ ENTRY(xen_failsafe_callback) _ASM_EXTABLE(3b, 8b) _ASM_EXTABLE(4b, 9b) ENDPROC(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, xen_evtchn_do_upcall) +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV)
arch/x86/entry/entry_64.S +5 -3
@@ -1050,7 +1050,7 @@ ENTRY(do_softirq_own_stack) ret ENDPROC(do_softirq_own_stack) -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry hypervisor_callback xen_do_hypervisor_callback has_error_code=0 /*
@@ -1130,11 +1130,13 @@ ENTRY(xen_failsafe_callback) ENCODE_FRAME_POINTER jmp error_exit END(xen_failsafe_callback) +#endif /* CONFIG_XEN_PV */ +#ifdef CONFIG_XEN_PVHVM apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ xen_hvm_callback_vector xen_evtchn_do_upcall +#endif -#endif /* CONFIG_XEN */ #if IS_ENABLED(CONFIG_HYPERV) apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
@@ -1151,7 +1153,7 @@ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK idtentry int3 do_int3 has_error_code=0 idtentry stack_segment do_stack_segment has_error_code=1 -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV idtentry xennmi do_nmi has_error_code=0 idtentry xendebug do_debug has_error_code=0 idtentry xenint3 do_int3 has_error_code=0
arch/x86/xen/Makefile +31 -10
56 lines not on this page · raw message
include/xen/events.h +2 -0
@@ -89,11 +89,13 @@ unsigned irq_from_evtchn(unsigned int evtchn);int irq_from_virq (unsigned int cpu,unsigned int virq);unsigned int evtchn_from_irq (unsigned irq); +#ifdef CONFIG_XEN_PVHVM /* Xen HVM evtchn vector callback */ void xen_hvm_callback_vector (void );#ifdef CONFIG_TRACING #define trace_xen_hvm_callback_vector xen_hvm_callback_vector#endif +#endif int xen_set_callback_via (uint64_t via);void xen_evtchn_do_upcall (struct pt_regs *regs);void xen_hvm_evtchn_do_upcall (void );
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/xen: Move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
In reply to Juergen Grossx86/xen: Move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
Commit-ID: f030aade9165080f3539fb86fc2ce9ffc391813c Gitweb: https://git.kernel.org/tip/f030aade9165080f3539fb86fc2ce9ffc391813c Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:13 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:33 +0200
x86/xen: Move pv specific parts of arch/x86/xen/mmu.c to mmu_pv.c
There are some PV specific functions in arch/x86/xen/mmu.c which can be moved to mmu_pv.c. This in turn enables to build multicalls.c dependent on CONFIG_XEN_PV.
--- arch/arm/xen/enlighten.c | 34 -------- arch/x86/xen/Makefile | 2 +- arch/x86/xen/mmu.c | 186 ----------------------------------------- arch/x86/xen/mmu_pv.c | 138 ++++++++++++++++++++++++++++++ include/xen/interface/memory.h | 6 -- include/xen/xen-ops.h | 133 +++++++++++++++++++---------- 6 files changed, 227 insertions(+), 272 deletions(-)
arch/arm/xen/enlighten.c +0 -34
@@ -62,29 +62,6 @@ static __read_mostly unsigned int xen_events_irq;uint32_t xen_start_flags;EXPORT_SYMBOL (xen_start_flags); -int xen_remap_domain_gfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *gfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned domid, -struct page **pages) -{ -return xen_xlate_remap_gfn_array (vma, addr, gfn, nr, err_ptr, - prot, domid, pages); -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_array); - -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_gfn_range (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t gfn,int nr, -pgprot_t prot,unsigned domid, -struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_gfn_range); -int xen_unmap_domain_gfn_range (struct vm_area_struct *vma,int nr,struct page **pages) {
@@ -92,17 +69,6 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, }EXPORT_SYMBOL_GPL (xen_unmap_domain_gfn_range); -/* Not used by XENFEAT_auto_translated guests. */ -int xen_remap_domain_mfn_array (struct vm_area_struct *vma, -unsigned long addr, -xen_pfn_t *mfn,int nr, -int *err_ptr,pgprot_t prot, -unsigned int domid,struct page **pages) -{ -return -ENOSYS ; -} -EXPORT_SYMBOL_GPL (xen_remap_domain_mfn_array); -static void xen_read_wallclock (struct timespec64 *ts) {u32 version;
arch/x86/xen/Makefile +1 -1
@@ -15,7 +15,6 @@ CFLAGS_enlighten_pv.o := $(nostackp) CFLAGS_mmu_pv.o := $(nostackp) obj-y += enlighten.o -obj-y += multicalls.o obj-y += mmu.o obj-y += time.o obj-y += grant-table.o
@@ -34,6 +33,7 @@ obj-$(CONFIG_XEN_PV) += p2m.o obj-$(CONFIG_XEN_PV) += enlighten_pv.o obj-$(CONFIG_XEN_PV) += mmu_pv.o obj-$(CONFIG_XEN_PV) += irq.o +obj-$(CONFIG_XEN_PV) += multicalls.o obj-$(CONFIG_XEN_PV) += xen-asm.o obj-$(CONFIG_XEN_PV) += xen-asm_$(BITS).o
arch/x86/xen/mmu.c +0 -186
198 lines not on this page · raw message
arch/x86/xen/mmu_pv.c +138 -0
150 lines not on this page · raw message
include/xen/interface/memory.h +0 -6
@@ -244,12 +244,6 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);#define XENMEM_machine_memory_map 10 -/* -* Prevent the balloon driver from changing the memory reservation -* during a driver critical region. -*/ -extern spinlock_t xen_reservation_lock; -/* * Unmaps the page appearing at a particular GPFN from the specified guest's * pseudophysical address space.
include/xen/xen-ops.h +88 -45
176 lines not on this page · raw message
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/xen: Link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
In reply to Juergen Grossx86/xen: Link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
Commit-ID: 3013c2be600fe22d336ab4de91aedde258f1f7d5 Gitweb: https://git.kernel.org/tip/3013c2be600fe22d336ab4de91aedde258f1f7d5 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:14 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:33 +0200
x86/xen: Link platform-pci-unplug.o only if CONFIG_XEN_PVHVM
Instead of using one large #ifdef CONFIG_XEN_PVHVM in arch/x86/xen/platform-pci-unplug.c add the object file depending on CONFIG_XEN_PVHVM being set.
--- arch/x86/xen/Makefile | 2 +- arch/x86/xen/platform-pci-unplug.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/x86/xen/Makefile +1 -1
@@ -19,11 +19,11 @@ obj-y += mmu.o obj-y += time.o obj-y += grant-table.o obj-y += suspend.o -obj-y += platform-pci-unplug.o obj-$(CONFIG_XEN_PVHVM) += enlighten_hvm.o obj-$(CONFIG_XEN_PVHVM) += mmu_hvm.o obj-$(CONFIG_XEN_PVHVM) += suspend_hvm.o +obj-$(CONFIG_XEN_PVHVM) += platform-pci-unplug.o obj-$(CONFIG_XEN_PV) += setup.o obj-$(CONFIG_XEN_PV) += apic.o
arch/x86/xen/platform-pci-unplug.c +0 -2
@@ -30,7 +30,6 @@#define XEN_PLATFORM_ERR_PROTOCOL -2#define XEN_PLATFORM_ERR_BLACKLIST -3 -#ifdef CONFIG_XEN_PVHVM /* store the value of xen_emul_unplug after the unplug is done */ static int xen_platform_pci_unplug;static int xen_emul_unplug;
@@ -214,4 +213,3 @@ static int __init parse_xen_emul_unplug(char *arg)return 0 ; }early_param ("xen_emul_unplug" , parse_xen_emul_unplug); -#endif
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/xen: Add SPDX identifier in arch/x86/xen files
In reply to Juergen Grossx86/xen: Add SPDX identifier in arch/x86/xen files
Commit-ID: 901d209a8b0e448dadbc830bc7d7951d1c9621f9 Gitweb: https://git.kernel.org/tip/901d209a8b0e448dadbc830bc7d7951d1c9621f9 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:15 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:33 +0200
x86/xen: Add SPDX identifier in arch/x86/xen files
--- arch/x86/xen/efi.c | 14 +------------- arch/x86/xen/enlighten.c | 2 ++ arch/x86/xen/enlighten_hvm.c | 2 ++ arch/x86/xen/grant-table.c | 25 +------------------------ arch/x86/xen/mmu.c | 2 ++ arch/x86/xen/mmu_pv.c | 2 ++ arch/x86/xen/p2m.c | 2 ++ arch/x86/xen/pci-swiotlb-xen.c | 2 ++ arch/x86/xen/platform-pci-unplug.c | 16 ++-------------- arch/x86/xen/vdso.h | 2 ++ arch/x86/xen/xen-pvh.S | 15 ++------------- 11 files changed, 20 insertions(+), 64 deletions(-)
arch/x86/xen/efi.c +1 -13
@@ -1,18 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2014 Oracle Co., Daniel Kiper -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/bitops.h>
arch/x86/xen/enlighten.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG #include <linux/bootmem.h> #endif
arch/x86/xen/enlighten_hvm.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/acpi.h> #include <linux/cpu.h> #include <linux/kexec.h>
arch/x86/xen/grant-table.c +1 -24
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT /****************************************************************************** * grant_table.c * x86 specific part
@@ -8,30 +9,6 @@* Copyright (c) 2004-2005, K A Fraser * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp> * VA Linux Systems Japan. Split out x86 specific part. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation; or, when distributed -* separately from the Linux kernel or incorporated into other -* software packages, subject to the following license: -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this source file (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, copy, modify, -* merge, publish, distribute, sublicense, and/or sell copies of the Software, -* and to permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -* IN THE SOFTWARE. */ #include <linux/sched.h>
arch/x86/xen/mmu.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/pfn.h> #include <asm/xen/page.h> #include <asm/xen/hypercall.h>
arch/x86/xen/mmu_pv.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Xen mmu operations *
arch/x86/xen/p2m.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Xen leaves the responsibility for maintaining p2m mappings to the * guests themselves, but it must also access and update the p2m array
arch/x86/xen/pci-swiotlb-xen.c +2 -0
@@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Glue code to lib/swiotlb-xen.c */ #include <linux/dma-mapping.h>
arch/x86/xen/platform-pci-unplug.c +2 -14
@@ -1,22 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/****************************************************************************** * platform-pci-unplug.c * * Xen platform PCI device driver * Copyright (c) 2010, Citrix -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2, as published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., 59 Temple -* Place - Suite 330, Boston, MA 02111-1307 USA. -* */ #include <linux/init.h>
arch/x86/xen/vdso.h +2 -0
@@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Bit used for the pseudo-hwcap for non-negative segments. We use bit 1 to avoid bugs in some versions of glibc when bit 0 is used; the choice is otherwise arbitrary. */
arch/x86/xen/xen-pvh.S +2 -13
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + /* * Copyright C 2016, Oracle and/or its affiliates. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. */ .code32
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Make paravirt_patch_call() and paravirt_patch_jmp() static
In reply to Juergen Grossx86/paravirt: Make paravirt_patch_call() and paravirt_patch_jmp() static
Commit-ID: 7e4372028929e43a1f986438572a533b728dd266 Gitweb: https://git.kernel.org/tip/7e4372028929e43a1f986438572a533b728dd266 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:16 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:34 +0200
x86/paravirt: Make paravirt_patch_call() and paravirt_patch_jmp() static
paravirt_patch_call() and paravirt_patch_jmp() are used in paravirt.c only. Convert them to static.
--- arch/x86/include/asm/paravirt_types.h | 6 ------ arch/x86/kernel/paravirt.c | 12 ++++++------ 2 files changed, 6 insertions(+), 12 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -6
@@ -373,12 +373,6 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len); -unsigned paravirt_patch_jmp (void *insnbuf,const void *target, -unsigned long addr,unsigned len);unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf,unsigned long addr,unsigned len);
arch/x86/kernel/paravirt.c +6 -6
@@ -81,10 +81,10 @@ struct branch {u32 delta; } __attribute__((packed)); -unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf, +const void *target,u16 tgt_clobbers, +unsigned long addr,u16 site_clobbers, +unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -103,8 +103,8 @@ unsigned paravirt_patch_call(void *insnbuf,return 5 ; } -unsigned paravirt_patch_jmp (void *insnbuf,const void *target, -unsigned long addr,unsigned len) +static unsigned paravirt_patch_jmp (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Remove clobbers parameter from paravirt patch functions
In reply to Juergen Grossx86/paravirt: Remove clobbers parameter from paravirt patch functions
Commit-ID: abc745f85c1193d2a052addf0031d59b4436c246 Gitweb: https://git.kernel.org/tip/abc745f85c1193d2a052addf0031d59b4436c246 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:17 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:34 +0200
x86/paravirt: Remove clobbers parameter from paravirt patch functions
The clobbers parameter from paravirt_patch_default() et al isn't used any longer. Remove it.
--- arch/x86/include/asm/paravirt_types.h | 7 +++---- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/paravirt.c | 14 +++++--------- arch/x86/kernel/paravirt_patch_32.c | 5 ++--- arch/x86/kernel/paravirt_patch_64.c | 5 ++--- arch/x86/kernel/vsmp_64.c | 6 +++--- 6 files changed, 16 insertions(+), 23 deletions(-)
arch/x86/include/asm/paravirt_types.h +3 -4
@@ -85,7 +85,7 @@ struct pv_init_ops {* the number of bytes of code generated, as we nop pad the * rest in generic code. */ -unsigned (*patch)(u8 type,u16 clobber,void *insnbuf, +unsigned (*patch)(u8 type,void *insnbuf,unsigned long addr,unsigned len); } __no_randomize_layout;
@@ -373,14 +373,13 @@ extern struct pv_lock_ops pv_lock_ops;unsigned paravirt_patch_ident_32 (void *insnbuf,unsigned len);unsigned paravirt_patch_ident_64 (void *insnbuf,unsigned len); -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len);unsigned paravirt_patch_insns (void *insnbuf,unsigned len,const char *start,const char *end); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len); +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len);int paravirt_disable_iospace (void );
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, p->clobbers, insnbuf, + used = pv_init_ops.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/paravirt.c +5 -9
@@ -81,10 +81,8 @@ struct branch {u32 delta; } __attribute__((packed)); -static unsigned paravirt_patch_call (void *insnbuf, -const void *target,u16 tgt_clobbers, -unsigned long addr,u16 site_clobbers, -unsigned len) +static unsigned paravirt_patch_call (void *insnbuf,const void *target, +unsigned long addr,unsigned len) {struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 );
@@ -149,7 +147,7 @@ static void *get_call_destination(u8 type)return *((void **)&tmpl + type); } -unsigned paravirt_patch_default (u8 type,u16 clobbers,void *insnbuf, +unsigned paravirt_patch_default (u8 type,void *insnbuf,unsigned long addr,unsigned len) {void *opfunc =get_call_destination (type);
@@ -172,10 +170,8 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); else -/* Otherwise call the function; assume target could -clobber any caller-save reg */ - ret =paravirt_patch_call (insnbuf, opfunc,CLBR_ANY , - addr, clobbers, len); +/* Otherwise call the function. */ + ret =paravirt_patch_call (insnbuf, opfunc, addr, len);return ret; }
arch/x86/kernel/paravirt_patch_32.c +2 -3
@@ -30,8 +30,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -70,7 +69,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/paravirt_patch_64.c +2 -3
@@ -38,8 +38,7 @@ unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len)extern bool pv_is_native_spin_unlock (void );extern bool pv_is_native_vcpu_is_preempted (void ); -unsigned native_patch (u8 type,u16 clobbers,void *ibuf, -unsigned long addr,unsigned len) +unsigned native_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {const unsigned char *start, *end;unsigned ret;
@@ -80,7 +79,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,default : patch_default:__maybe_unused - ret =paravirt_patch_default (type, clobbers, ibuf, addr, len); + ret =paravirt_patch_default (type, ibuf, addr, len);break ; patch_site:
arch/x86/kernel/vsmp_64.c +3 -3
@@ -69,7 +69,7 @@ asmlinkage __visible void vsmp_irq_enable(void) }PV_CALLEE_SAVE_REGS_THUNK (vsmp_irq_enable); -static unsigned __init vsmp_patch (u8 type,u16 clobbers,void *ibuf, +static unsigned __init vsmp_patch (u8 type,void *ibuf,unsigned long addr,unsigned len) {switch (type) {
@@ -77,9 +77,9 @@ static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,case PARAVIRT_PATCH (pv_irq_ops.irq_disable):case PARAVIRT_PATCH (pv_irq_ops.save_fl):case PARAVIRT_PATCH (pv_irq_ops.restore_fl): -return paravirt_patch_default (type, clobbers, ibuf, addr, len); +return paravirt_patch_default (type, ibuf, addr, len);default : -return native_patch (type, clobbers, ibuf, addr, len); +return native_patch (type, ibuf, addr, len); } }
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Remove clobbers from struct paravirt_patch_site
In reply to Juergen Grossx86/paravirt: Remove clobbers from struct paravirt_patch_site
Commit-ID: 27876f3882fdd4acb3d3614a0133ecdc777fc292 Gitweb: https://git.kernel.org/tip/27876f3882fdd4acb3d3614a0133ecdc777fc292 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:18 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:34 +0200
x86/paravirt: Remove clobbers from struct paravirt_patch_site
There is no need any longer to store the clobbers in struct paravirt_patch_site. Remove clobbers from the struct and from the related macros.
While at it fix some lines longer than 80 characters.
--- arch/x86/include/asm/paravirt.h | 33 +++++++++++++++------------------ arch/x86/include/asm/paravirt_types.h | 1 - 2 files changed, 15 insertions(+), 19 deletions(-)
arch/x86/include/asm/paravirt.h +15 -18
@@ -827,7 +827,7 @@ extern void default_banner(void);#else /* __ASSEMBLY__ */ -#define _PVSITE (ptype, clobbers, ops, word, algn) \ +#define _PVSITE (ptype, ops, word, algn) \ 771:; \ ops; \ 772:; \
@@ -836,7 +836,6 @@ extern void default_banner(void); word 771b; \ .byte ptype; \ .byte 772b-771b; \ - .short clobbers; \ .popsection
@@ -869,7 +868,7 @@ extern void default_banner(void); COND_POP(set, CLBR_RAX, rax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 8) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .quad, 8)#define PARA_INDIRECT (addr) *addr(%rip)#else #define PV_SAVE_REGS (set) \
@@ -884,26 +883,26 @@ extern void default_banner(void); COND_POP(set, CLBR_EAX, eax)#define PARA_PATCH (struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4) -#define PARA_SITE (ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4) +#define PARA_SITE (ptype, ops) _PVSITE(ptype, ops, .long, 4)#define PARA_INDIRECT (addr) *%cs:addr#endif #define INTERRUPT_RETURN \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);)#define DISABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#define ENABLE_INTERRUPTS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
@@ -921,8 +920,7 @@ extern void default_banner(void);* inlined, or the swapgs instruction must be trapped and emulated. */ #define SWAPGS_UNSAFE_STACK \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - swapgs) + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), swapgs)/* * Note: swapgs is very special, and in practise is either going to be
@@ -931,8 +929,8 @@ extern void default_banner(void);* it. */ #define SWAPGS \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \ )
@@ -942,15 +940,14 @@ extern void default_banner(void);#define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \ - CLBR_NONE, \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);)#ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ - ANNOTATE_RETPOLINE_SAFE; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#endif
arch/x86/include/asm/paravirt_types.h +0 -1
@@ -681,7 +681,6 @@ struct paravirt_patch_site {u8 *instr;/* original instructions */ u8 instrtype;/* type of this instruction */ u8 len;/* length of original instruction */ -u16 clobbers;/* what registers you may clobber */ }; extern struct paravirt_patch_site __parainstructions[],
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Use a single ops structure
In reply to Juergen Grossx86/paravirt: Use a single ops structure
Commit-ID: 5c83511bdb9832c86be20fb86b783356e2f58062 Gitweb: https://git.kernel.org/tip/5c83511bdb9832c86be20fb86b783356e2f58062 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:19 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:35 +0200
x86/paravirt: Use a single ops structure
Instead of using six globally visible paravirt ops structures combine them in a single structure, keeping the original structures as sub-structures.
This avoids the need to assemble struct paravirt_patch_template at runtime on the stack each time apply_paravirt() is being called (i.e. when loading a module).
[ tglx: Made the struct and the initializer tabular for readability sake ]
--- arch/arm/include/asm/paravirt.h | 9 +- arch/arm/kernel/paravirt.c | 4 +- arch/arm64/include/asm/paravirt.h | 9 +- arch/arm64/kernel/paravirt.c | 4 +- arch/x86/hyperv/mmu.c | 4 +- arch/x86/include/asm/paravirt.h | 275 +++++++++++++++----------------- arch/x86/include/asm/paravirt_types.h | 25 ++- arch/x86/kernel/alternative.c | 2 +- arch/x86/kernel/asm-offsets.c | 12 +- arch/x86/kernel/asm-offsets_64.c | 7 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/kvm.c | 19 +-- arch/x86/kernel/kvmclock.c | 4 +- arch/x86/kernel/paravirt-spinlocks.c | 15 +- arch/x86/kernel/paravirt.c | 290 +++++++++++++++++----------------- arch/x86/kernel/paravirt_patch_32.c | 48 +++--- arch/x86/kernel/paravirt_patch_64.c | 56 +++---- arch/x86/kernel/tsc.c | 2 +- arch/x86/kernel/vsmp_64.c | 18 +-- arch/x86/xen/enlighten_pv.c | 31 ++-- arch/x86/xen/irq.c | 2 +- arch/x86/xen/mmu_hvm.c | 2 +- arch/x86/xen/mmu_pv.c | 28 ++-- arch/x86/xen/spinlock.c | 11 +- arch/x86/xen/time.c | 4 +- drivers/xen/time.c | 2 +- 27 files changed, 431 insertions(+), 458 deletions(-)
arch/arm/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/arm64/include/asm/paravirt.h +7 -2
@@ -10,11 +10,16 @@ extern struct static_key paravirt_steal_rq_enabled;struct pv_time_ops {unsigned long long (*steal_clock)(int cpu); }; -extern struct pv_time_ops pv_time_ops; + +struct paravirt_patch_template { +struct pv_time_ops time; +}; + +extern struct paravirt_patch_template pv_ops;static inline u64 paravirt_steal_clock (int cpu) { -return pv_time_ops.steal_clock (cpu); +return pv_ops.time.steal_clock (cpu); }#endif
arch/arm64/kernel/paravirt.c +2 -2
@@ -21,5 +21,5 @@struct static_key paravirt_steal_enabled;struct static_key paravirt_steal_rq_enabled; -struct pv_time_ops pv_time_ops; -EXPORT_SYMBOL_GPL (pv_time_ops); +struct paravirt_patch_template pv_ops; +EXPORT_SYMBOL_GPL (pv_ops);
arch/x86/hyperv/mmu.c +2 -2
@@ -231,6 +231,6 @@ void hyperv_setup_mmu_ops(void)return ;pr_info ("Using hypercall for remote TLB flush\n" ); - pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = hyperv_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }
arch/x86/include/asm/paravirt.h +128 -147
781 lines not on this page · raw message
arch/x86/include/asm/paravirt_types.h +10 -15
@@ -321,28 +321,23 @@ struct pv_lock_ops {* number for each function using the offset which we use to indicate * what to patch. */ struct paravirt_patch_template { -struct pv_init_ops pv_init_ops; -struct pv_time_ops pv_time_ops; -struct pv_cpu_ops pv_cpu_ops; -struct pv_irq_ops pv_irq_ops; -struct pv_mmu_ops pv_mmu_ops; -struct pv_lock_ops pv_lock_ops; +struct pv_init_ops init; +struct pv_time_ops time; +struct pv_cpu_ops cpu; +struct pv_irq_ops irq; +struct pv_mmu_ops mmu; +struct pv_lock_ops lock; } __no_randomize_layout;extern struct pv_info pv_info; -extern struct pv_init_ops pv_init_ops; -extern struct pv_time_ops pv_time_ops; -extern struct pv_cpu_ops pv_cpu_ops; -extern struct pv_irq_ops pv_irq_ops; -extern struct pv_mmu_ops pv_mmu_ops; -extern struct pv_lock_ops pv_lock_ops; +extern struct paravirt_patch_template pv_ops;#define PARAVIRT_PATCH (x) \ (offsetof(struct paravirt_patch_template, x) / sizeof(void *))#define paravirt_type (op) \ [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \ - [paravirt_opptr] "i" (&(op)) + [paravirt_opptr] "i" (&(pv_ops.op))#define paravirt_clobber (clobber) \ [paravirt_clobber] "i" (clobber)
@@ -503,9 +498,9 @@ int paravirt_disable_iospace(void);#endif /* CONFIG_X86_32 */ #ifdef CONFIG_PARAVIRT_DEBUG -#define PVOP_TEST_NULL (op) BUG_ON(op == NULL) +#define PVOP_TEST_NULL (op) BUG_ON(pv_ops.op == NULL)#else -#define PVOP_TEST_NULL (op) ((void)op) +#define PVOP_TEST_NULL (op) ((void)pv_ops.op)#endif #define PVOP_RETMASK (rettype) \
arch/x86/kernel/alternative.c +1 -1
@@ -594,7 +594,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,BUG_ON (p->len >MAX_PATCH_LEN );/* prep the buffer with the original instructions */ memcpy (insnbuf, p->instr, p->len); - used = pv_init_ops.patch (p->instrtype, insnbuf, + used = pv_ops.init.patch (p->instrtype, insnbuf, (unsigned long )p->instr, p->len);BUG_ON (used > p->len);
arch/x86/kernel/asm-offsets.c +5 -7
@@ -66,13 +66,11 @@ void common(void) {#ifdef CONFIG_PARAVIRT BLANK (); -OFFSET (PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops); -OFFSET (PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops); -OFFSET (PV_IRQ_irq_disable, pv_irq_ops, irq_disable); -OFFSET (PV_IRQ_irq_enable, pv_irq_ops, irq_enable); -OFFSET (PV_CPU_iret, pv_cpu_ops, iret); -OFFSET (PV_CPU_read_cr0, pv_cpu_ops, read_cr0); -OFFSET (PV_MMU_read_cr2, pv_mmu_ops, read_cr2); +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); +OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0); +OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif #ifdef CONFIG_XEN
arch/x86/kernel/asm-offsets_64.c +4 -3
@@ -21,10 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT -OFFSET (PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64); -OFFSET (PV_CPU_swapgs, pv_cpu_ops, swapgs); +OFFSET (PV_CPU_usergs_sysret64, paravirt_patch_template, + cpu.usergs_sysret64); +OFFSET (PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs);#ifdef CONFIG_DEBUG_ENTRY -OFFSET (PV_IRQ_save_fl, pv_irq_ops, save_fl); +OFFSET (PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);#endif BLANK ();#endif
arch/x86/kernel/cpu/common.c +1 -1
@@ -1243,7 +1243,7 @@ static void generic_identify(struct cpuinfo_x86 *c)# ifdef CONFIG_PARAVIRT do {extern void native_iret (void ); -if (pv_cpu_ops.iret == native_iret) +if (pv_ops.cpu.iret == native_iret)set_cpu_bug (c,X86_BUG_ESPFIX ); }while (0 );# else
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -97,14 +97,14 @@ static void __init vmware_sched_clock_setup(void) d->cyc2ns_offset =mul_u64_u32_shr (tsc_now, d->cyc2ns_mul, d->cyc2ns_shift); - pv_time_ops.sched_clock = vmware_sched_clock; + pv_ops.time.sched_clock = vmware_sched_clock;pr_info ("using sched offset of %llu ns\n" , d->cyc2ns_offset); }static void __init vmware_paravirt_ops_setup (void ) { pv_info.name ="VMware hypervisor" ; - pv_cpu_ops.io_delay = paravirt_nop; + pv_ops.cpu.io_delay = paravirt_nop;if (vmware_tsc_khz && vmw_sched_clock)vmware_sched_clock_setup ();
arch/x86/kernel/kvm.c +10 -9
@@ -283,7 +283,7 @@ static void __init paravirt_ops_setup(void) pv_info.name ="KVM" ;if (kvm_para_has_feature (KVM_FEATURE_NOP_IO_DELAY )) - pv_cpu_ops.io_delay = kvm_io_delay; + pv_ops.cpu.io_delay = kvm_io_delay;#ifdef CONFIG_X86_IO_APIC no_timer_check =1 ;
@@ -632,14 +632,14 @@ static void __init kvm_guest_init(void)if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { has_steal_clock =1 ; - pv_time_ops.steal_clock = kvm_steal_clock; + pv_ops.time.steal_clock = kvm_steal_clock; }if (kvm_para_has_feature (KVM_FEATURE_PV_TLB_FLUSH ) && !kvm_para_has_hint (KVM_HINTS_REALTIME ) &&kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others; - pv_mmu_ops.tlb_remove_table = tlb_remove_table; + pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; + pv_ops.mmu.tlb_remove_table = tlb_remove_table; }if (kvm_para_has_feature (KVM_FEATURE_PV_EOI ))
@@ -850,13 +850,14 @@ void __init kvm_spinlock_init(void)return ;__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = kvm_wait; - pv_lock_ops.kick = kvm_kick_cpu; + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = kvm_wait; + pv_ops.lock.kick = kvm_kick_cpu;if (kvm_para_has_feature (KVM_FEATURE_STEAL_TIME )) { - pv_lock_ops.vcpu_is_preempted = + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (__kvm_vcpu_is_preempted); } }
arch/x86/kernel/kvmclock.c +2 -2
@@ -116,13 +116,13 @@ static u64 kvm_sched_clock_read(void)static inline void kvm_sched_clock_init (bool stable) {if (!stable) { - pv_time_ops.sched_clock = kvm_clock_read; + pv_ops.time.sched_clock = kvm_clock_read;clear_sched_clock_stable ();return ; } kvm_sched_clock_offset =kvm_clock_read (); - pv_time_ops.sched_clock = kvm_sched_clock_read; + pv_ops.time.sched_clock = kvm_sched_clock_read;pr_info ("kvm-clock: using sched offset of %llu cycles" , kvm_sched_clock_offset);
arch/x86/kernel/paravirt-spinlocks.c +2 -13
@@ -17,7 +17,7 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock);bool pv_is_native_spin_unlock (void ) { -return pv_lock_ops.queued_spin_unlock.func == +return pv_ops.lock.queued_spin_unlock.func == __raw_callee_save___native_queued_spin_unlock; }
@@ -29,17 +29,6 @@ PV_CALLEE_SAVE_REGS_THUNK(__native_vcpu_is_preempted);bool pv_is_native_vcpu_is_preempted (void ) { -return pv_lock_ops.vcpu_is_preempted.func == +return pv_ops.lock.vcpu_is_preempted.func == __raw_callee_save___native_vcpu_is_preempted; } - -struct pv_lock_ops pv_lock_ops = { -#ifdef CONFIG_SMP - .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath, - .queued_spin_unlock =PV_CALLEE_SAVE (__native_queued_spin_unlock), - .wait = paravirt_nop, - .kick = paravirt_nop, - .vcpu_is_preempted =PV_CALLEE_SAVE (__native_vcpu_is_preempted), -#endif /* SMP */ -}; -EXPORT_SYMBOL (pv_lock_ops);
arch/x86/kernel/paravirt.c +141 -149
340 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_32.c +24 -24
69 lines not on this page · raw message
arch/x86/kernel/paravirt_patch_64.c +28 -28
81 lines not on this page · raw message
arch/x86/kernel/tsc.c +1 -1
@@ -246,7 +246,7 @@ unsigned long long sched_clock(void)bool using_native_sched_clock (void ) { -return pv_time_ops.sched_clock == native_sched_clock; +return pv_ops.time.sched_clock == native_sched_clock; }#else unsigned long long
arch/x86/kernel/vsmp_64.c +9 -9
@@ -73,10 +73,10 @@ static unsigned __init vsmp_patch(u8 type, void *ibuf, unsigned long addr, unsigned len) {switch (type) { -case PARAVIRT_PATCH (pv_irq_ops.irq_enable): -case PARAVIRT_PATCH (pv_irq_ops.irq_disable): -case PARAVIRT_PATCH (pv_irq_ops.save_fl): -case PARAVIRT_PATCH (pv_irq_ops.restore_fl): +case PARAVIRT_PATCH (irq.irq_enable): +case PARAVIRT_PATCH (irq.irq_disable): +case PARAVIRT_PATCH (irq.save_fl): +case PARAVIRT_PATCH (irq.restore_fl):return paravirt_patch_default (type, ibuf, addr, len);default :return native_patch (type, ibuf, addr, len);
@@ -111,11 +111,11 @@ static void __init set_vsmp_pv_ops(void)if (cap & ctl & (1 <<4 )) {/* Setup irq ops and turn on vSMP IRQ fastpath handling */ - pv_irq_ops.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); - pv_irq_ops.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); - pv_irq_ops.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); - pv_irq_ops.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); - pv_init_ops.patch = vsmp_patch; + pv_ops.irq.irq_disable =PV_CALLEE_SAVE (vsmp_irq_disable); + pv_ops.irq.irq_enable =PV_CALLEE_SAVE (vsmp_irq_enable); + pv_ops.irq.save_fl =PV_CALLEE_SAVE (vsmp_save_fl); + pv_ops.irq.restore_fl =PV_CALLEE_SAVE (vsmp_restore_fl); + pv_ops.init.patch = vsmp_patch; ctl &= ~(1 <<4 ); }writel (ctl, address +4 );
arch/x86/xen/enlighten_pv.c +18 -13
@@ -995,11 +995,14 @@ void __init xen_setup_vcpu_info_placement(void)* percpu area for all cpus, so make use of it. */ if (xen_have_vcpu_info_placement) { - pv_irq_ops.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); - pv_irq_ops.restore_fl =__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); - pv_irq_ops.irq_disable =__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); - pv_irq_ops.irq_enable =__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); - pv_mmu_ops.read_cr2 = xen_read_cr2_direct; + pv_ops.irq.save_fl =__PV_IS_CALLEE_SAVE (xen_save_fl_direct); + pv_ops.irq.restore_fl = +__PV_IS_CALLEE_SAVE (xen_restore_fl_direct); + pv_ops.irq.irq_disable = +__PV_IS_CALLEE_SAVE (xen_irq_disable_direct); + pv_ops.irq.irq_enable = +__PV_IS_CALLEE_SAVE (xen_irq_enable_direct); + pv_ops.mmu.read_cr2 = xen_read_cr2_direct; } }
@@ -1174,14 +1177,14 @@ static void __init xen_boot_params_init_edd(void)*/ static void __init xen_setup_gdt (int cpu) { - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; - pv_cpu_ops.load_gdt = xen_load_gdt_boot; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry_boot; + pv_ops.cpu.load_gdt = xen_load_gdt_boot;setup_stack_canary_segment (cpu);switch_to_new_gdt (cpu); - pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; - pv_cpu_ops.load_gdt = xen_load_gdt; + pv_ops.cpu.write_gdt_entry = xen_write_gdt_entry; + pv_ops.cpu.load_gdt = xen_load_gdt; }static void __init xen_dom0_set_legacy_features (void )
@@ -1206,8 +1209,8 @@ asmlinkage __visible void __init xen_start_kernel(void)/* Install Xen paravirt ops */ pv_info = xen_info; - pv_init_ops.patch = paravirt_patch_default; - pv_cpu_ops = xen_cpu_ops; + pv_ops.init.patch = paravirt_patch_default; + pv_ops.cpu = xen_cpu_ops;xen_init_irq_ops ();/*
@@ -1276,8 +1279,10 @@ asmlinkage __visible void __init xen_start_kernel(void)#endif if (xen_feature (XENFEAT_mmu_pt_update_preserve_ad)) { - pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; - pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; + pv_ops.mmu.ptep_modify_prot_start = + xen_ptep_modify_prot_start; + pv_ops.mmu.ptep_modify_prot_commit = + xen_ptep_modify_prot_commit; } machine_ops = xen_machine_ops;
arch/x86/xen/irq.c +1 -1
@@ -128,6 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {void __init xen_init_irq_ops (void ) { - pv_irq_ops = xen_irq_ops; + pv_ops.irq = xen_irq_ops; x86_init.irqs.intr_init = xen_init_IRQ; }
arch/x86/xen/mmu_hvm.c +1 -1
@@ -73,7 +73,7 @@ static int is_pagetable_dying_supported(void)void __init xen_hvm_init_mmu_ops (void ) {if (is_pagetable_dying_supported ()) - pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap; + pv_ops.mmu.exit_mmap = xen_hvm_exit_mmap;#ifdef CONFIG_PROC_VMCORE WARN_ON (register_oldmem_pfn_is_ram (&xen_oldmem_pfn_is_ram));#endif
arch/x86/xen/mmu_pv.c +14 -14
@@ -2213,7 +2213,7 @@ static void __init xen_write_cr3_init(unsigned long cr3)set_page_prot (initial_page_table,PAGE_KERNEL );set_page_prot (initial_kernel_pmd,PAGE_KERNEL ); - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3; }/*
@@ -2362,27 +2362,27 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)static void __init xen_post_allocator_init (void ) { - pv_mmu_ops.set_pte = xen_set_pte; - pv_mmu_ops.set_pmd = xen_set_pmd; - pv_mmu_ops.set_pud = xen_set_pud; + pv_ops.mmu.set_pte = xen_set_pte; + pv_ops.mmu.set_pmd = xen_set_pmd; + pv_ops.mmu.set_pud = xen_set_pud;#ifdef CONFIG_X86_64 - pv_mmu_ops.set_p4d = xen_set_p4d; + pv_ops.mmu.set_p4d = xen_set_p4d;#endif /* This will work as long as patching hasn't happened yet (which it hasn't) */ - pv_mmu_ops.alloc_pte = xen_alloc_pte; - pv_mmu_ops.alloc_pmd = xen_alloc_pmd; - pv_mmu_ops.release_pte = xen_release_pte; - pv_mmu_ops.release_pmd = xen_release_pmd; + pv_ops.mmu.alloc_pte = xen_alloc_pte; + pv_ops.mmu.alloc_pmd = xen_alloc_pmd; + pv_ops.mmu.release_pte = xen_release_pte; + pv_ops.mmu.release_pmd = xen_release_pmd;#ifdef CONFIG_X86_64 - pv_mmu_ops.alloc_pud = xen_alloc_pud; - pv_mmu_ops.release_pud = xen_release_pud; + pv_ops.mmu.alloc_pud = xen_alloc_pud; + pv_ops.mmu.release_pud = xen_release_pud;#endif - pv_mmu_ops.make_pte =PV_CALLEE_SAVE (xen_make_pte); + pv_ops.mmu.make_pte =PV_CALLEE_SAVE (xen_make_pte);#ifdef CONFIG_X86_64 - pv_mmu_ops.write_cr3 = &xen_write_cr3; + pv_ops.mmu.write_cr3 = &xen_write_cr3;#endif }
@@ -2470,7 +2470,7 @@ void __init xen_init_mmu_ops(void) x86_init.paging.pagetable_init = xen_pagetable_init; x86_init.hyper.init_after_bootmem = xen_after_bootmem; - pv_mmu_ops = xen_mmu_ops; + pv_ops.mmu = xen_mmu_ops;memset (dummy_mapping,0xff ,PAGE_SIZE ); }
arch/x86/xen/spinlock.c +6 -5
@@ -141,11 +141,12 @@ void __init xen_init_spinlocks(void)printk (KERN_DEBUG "xen: PV spinlocks enabled\n" );__pv_init_lock_hash (); - pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; - pv_lock_ops.queued_spin_unlock =PV_CALLEE_SAVE (__pv_queued_spin_unlock); - pv_lock_ops.wait = xen_qlock_wait; - pv_lock_ops.kick = xen_qlock_kick; - pv_lock_ops.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); + pv_ops.lock.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath; + pv_ops.lock.queued_spin_unlock = +PV_CALLEE_SAVE (__pv_queued_spin_unlock); + pv_ops.lock.wait = xen_qlock_wait; + pv_ops.lock.kick = xen_qlock_kick; + pv_ops.lock.vcpu_is_preempted =PV_CALLEE_SAVE (xen_vcpu_stolen); }static __init int xen_parse_nopvspin (char *arg)
arch/x86/xen/time.c +2 -2
@@ -513,7 +513,7 @@ static void __init xen_time_init(void)void __init xen_init_time_ops (void ) { xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.timer_init = xen_time_init; x86_init.timers.setup_percpu_clockev = x86_init_noop;
@@ -555,7 +555,7 @@ void __init xen_hvm_init_time_ops(void) } xen_sched_clock_offset =xen_clocksource_read (); - pv_time_ops = xen_time_ops; + pv_ops.time = xen_time_ops; x86_init.timers.setup_percpu_clockev = xen_time_init; x86_cpuinit.setup_percpu_clockev = xen_hvm_setup_cpu_clockevents;
drivers/xen/time.c +1 -1
@@ -175,7 +175,7 @@ void __init xen_time_setup_guest(void) xen_runstate_remote = !HYPERVISOR_vm_assist (VMASST_CMD_enable, VMASST_TYPE_runstate_update_flag); - pv_time_ops.steal_clock = xen_steal_clock; + pv_ops.time.steal_clock = xen_steal_clock;static_key_slow_inc (¶virt_steal_enabled);if (xen_runstate_remote)
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Remove unused paravirt bits
In reply to Juergen Grossx86/paravirt: Remove unused paravirt bits
Commit-ID: 5def7a4cd5bef80f7c997cf37c09022fa8c9cd76 Gitweb: https://git.kernel.org/tip/5def7a4cd5bef80f7c997cf37c09022fa8c9cd76 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:20 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:35 +0200
x86/paravirt: Remove unused paravirt bits
The macros ENABLE_INTERRUPTS_SYSEXIT, GET_CR0_INTO_EAX and PARAVIRT_ADJUST_EXCEPTION_FRAME are used nowhere.
Remove their definitions.
--- arch/x86/include/asm/irqflags.h | 4 ---- arch/x86/include/asm/paravirt.h | 9 +-------- arch/x86/kernel/asm-offsets.c | 1 - 3 files changed, 1 insertion(+), 13 deletions(-)
arch/x86/include/asm/irqflags.h +0 -4
@@ -135,8 +135,6 @@ static inline notrace unsigned long arch_local_irq_save(void)*/ #define SWAPGS_UNSAFE_STACK swapgs -#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ -#define INTERRUPT_RETURN jmp native_iret#define USERGS_SYSRET64 \ swapgs; \
@@ -150,8 +148,6 @@ static inline notrace unsigned long arch_local_irq_save(void)#endif #else #define INTERRUPT_RETURN iret -#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit -#define GET_CR0_INTO_EAX movl %cr0, %eax#endif
arch/x86/include/asm/paravirt.h +1 -8
@@ -887,14 +887,7 @@ extern void default_banner(void); call PARA_INDIRECT(pv_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) -#ifdef CONFIG_X86_32 -#define GET_CR0_INTO_EAX \ - push %ecx; push %edx; \ - ANNOTATE_RETPOLINE_SAFE; \ - call PARA_INDIRECT(pv_ops+PV_CPU_read_cr0); \ - pop %edx; pop %ecx -#else /* !CONFIG_X86_32 */ - +#ifdef CONFIG_X86_64 /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
arch/x86/kernel/asm-offsets.c +0 -1
@@ -69,7 +69,6 @@ void common(void) {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); -OFFSET (PV_CPU_read_cr0, paravirt_patch_template, cpu.read_cr0);OFFSET (PV_MMU_read_cr2, paravirt_patch_template, mmu.read_cr2);#endif
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Introduce new config option PARAVIRT_XXL
In reply to Juergen Grossx86/paravirt: Introduce new config option PARAVIRT_XXL
Commit-ID: c00a280a8efa4dc077596cf646bd50cbd13db3c8 Gitweb: https://git.kernel.org/tip/c00a280a8efa4dc077596cf646bd50cbd13db3c8 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:21 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:35 +0200
x86/paravirt: Introduce new config option PARAVIRT_XXL
A large amount of paravirt ops is used by Xen PV guests only. Add a new config option PARAVIRT_XXL which is selected by XEN_PV. Later we can put the Xen PV only paravirt ops under the PARAVIRT_XXL umbrella.
Since irq related paravirt ops are used only by VSMP and Xen PV, let VSMP select PARAVIRT_XXL, too, in order to enable moving the irq ops under PARAVIRT_XXL.
--- arch/x86/Kconfig | 4 ++++ arch/x86/boot/compressed/misc.h | 1 + arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/xen/Kconfig | 1 + 4 files changed, 7 insertions(+)
arch/x86/Kconfig +4 -0
@@ -523,6 +523,7 @@ config X86_VSMP bool "ScaleMP vSMP" select HYPERVISOR_GUEST select PARAVIRT + select PARAVIRT_XXL depends on X86_64 && PCI depends on X86_EXTENDED_PLATFORM depends on SMP
@@ -754,6 +755,9 @@ config PARAVIRT over full virtualization. However, when run without a hypervisor the kernel is theoretically slower and slightly larger. +config PARAVIRT_XXL + bool + config PARAVIRT_DEBUG bool "paravirt-ops debugging" depends on PARAVIRT && DEBUG_KERNEL
arch/x86/boot/compressed/misc.h +1 -0
@@ -9,6 +9,7 @@* paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#undef CONFIG_KASAN
arch/x86/mm/mem_encrypt_identity.c +1 -0
@@ -27,6 +27,7 @@* be extended when new paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT +#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS#include <linux/kernel.h>
arch/x86/xen/Kconfig +1 -0
@@ -18,6 +18,7 @@ config XEN_PV bool "Xen PV guest support" default y depends on XEN + select PARAVIRT_XXL select XEN_HAVE_PVMMU select XEN_HAVE_VPMU help
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Move items in pv_info under PARAVIRT_XXL umbrella
In reply to Juergen Grossx86/paravirt: Move items in pv_info under PARAVIRT_XXL umbrella
Commit-ID: 40181646db45fb72f46563a2f3b792adc5380710 Gitweb: https://git.kernel.org/tip/40181646db45fb72f46563a2f3b792adc5380710 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:22 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:36 +0200
x86/paravirt: Move items in pv_info under PARAVIRT_XXL umbrella
All items but name in pv_info are needed by Xen PV only. Define them with CONFIG_PARAVIRT_XXL set only.
--- arch/x86/include/asm/paravirt.h | 2 ++ arch/x86/include/asm/paravirt_types.h | 2 ++ arch/x86/include/asm/pgtable-3level_types.h | 2 +- arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/segment.h | 2 +- arch/x86/kernel/paravirt.c | 2 ++ 6 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/include/asm/paravirt.h +2 -0
@@ -104,7 +104,9 @@ static inline void wbinvd(void)PVOP_VCALL0 (cpu.wbinvd); } +#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) +#endif static inline u64 paravirt_read_msr (unsigned msr) {
arch/x86/include/asm/paravirt_types.h +2 -0
@@ -66,11 +66,13 @@ struct paravirt_callee_save {/* general info */ struct pv_info { +#ifdef CONFIG_PARAVIRT_XXL unsigned int kernel_rpl;int shared_kernel_pmd;#ifdef CONFIG_X86_64 u16 extra_user_64bit_cs;/* __USER_CS if none */ +#endif #endif const char *name;
arch/x86/include/asm/pgtable-3level_types.h +1 -1
@@ -20,7 +20,7 @@ typedef union { } pte_t;#endif /* !__ASSEMBLY__ */ -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #define SHARED_KERNEL_PMD ((!static_cpu_has(X86_FEATURE_PTI) && \ (pv_info.shared_kernel_pmd)))#else
arch/x86/include/asm/ptrace.h +1 -1
@@ -144,7 +144,7 @@ static inline int v8086_mode(struct pt_regs *regs)static inline bool user_64bit_mode (struct pt_regs *regs) {#ifdef CONFIG_X86_64 -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * On non-paravirt systems, this is the only long mode CPL 3 * selector. We do not allow long mode selectors in the LDT.
arch/x86/include/asm/segment.h +1 -1
@@ -211,7 +211,7 @@#endif -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL # define get_kernel_rpl () 0#endif
arch/x86/kernel/paravirt.c +2 -0
@@ -293,12 +293,14 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)struct pv_info pv_info = { .name ="bare hardware" , +#ifdef CONFIG_PARAVIRT_XXL .kernel_rpl =0 , .shared_kernel_pmd =1 ,/* Only used when CONFIG_X86_PAE is set */ #ifdef CONFIG_X86_64 .extra_user_64bit_cs = __USER_CS, #endif +#endif };#if defined(CONFIG_X86_32 ) && !defined(CONFIG_X86_PAE )
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Move the Xen-only pv_cpu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen Grossx86/paravirt: Move the Xen-only pv_cpu_ops under the PARAVIRT_XXL umbrella
Commit-ID: 9bad5658ea710f45e4ee68b88a01cfe1839d8b00 Gitweb: https://git.kernel.org/tip/9bad5658ea710f45e4ee68b88a01cfe1839d8b00 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:23 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:36 +0200
x86/paravirt: Move the Xen-only pv_cpu_ops under the PARAVIRT_XXL umbrella
Most of the paravirt ops defined in pv_cpu_ops are for Xen PV guests only. Define them only if CONFIG_PARAVIRT_XXL is set.
--- arch/x86/include/asm/debugreg.h | 2 +- arch/x86/include/asm/desc.h | 4 ++-- arch/x86/include/asm/irqflags.h | 16 +++++++++++----- arch/x86/include/asm/msr.h | 4 ++-- arch/x86/include/asm/paravirt.h | 19 +++++++++++++++++-- arch/x86/include/asm/paravirt_types.h | 5 ++++- arch/x86/include/asm/pgtable.h | 6 ++++-- arch/x86/include/asm/processor.h | 4 ++-- arch/x86/include/asm/special_insns.h | 9 +++++++-- arch/x86/kernel/asm-offsets.c | 2 ++ arch/x86/kernel/asm-offsets_64.c | 2 ++ arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/head_64.S | 2 ++ arch/x86/kernel/paravirt.c | 13 ++++++++++++- arch/x86/kernel/paravirt_patch_32.c | 4 ++++ arch/x86/kernel/paravirt_patch_64.c | 6 +++++- 16 files changed, 78 insertions(+), 22 deletions(-)
arch/x86/include/asm/debugreg.h +1 -1
@@ -8,7 +8,7 @@ DECLARE_PER_CPU(unsigned long, cpu_dr7); -#ifndef CONFIG_PARAVIRT +#ifndef CONFIG_PARAVIRT_XXL /* * These special macros can be used to get or set a debugging register */
arch/x86/include/asm/desc.h +2 -2
@@ -108,7 +108,7 @@ static inline int desc_empty(const void *ptr)return !(desc[0 ] | desc[1 ]); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define load_TR_desc () native_load_tr_desc()
@@ -134,7 +134,7 @@ static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries)static inline void paravirt_free_ldt (struct desc_struct *ldt,unsigned entries) { } -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #define store_ldt (ldt) asm("sldt %0" : "=m"(ldt))
arch/x86/include/asm/irqflags.h +11 -5
@@ -122,6 +122,16 @@ static inline notrace unsigned long arch_local_irq_save(void)#define ENABLE_INTERRUPTS (x) sti#define DISABLE_INTERRUPTS (x) cli +#ifdef CONFIG_X86_64 +#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/*
@@ -143,16 +153,12 @@ static inline notrace unsigned long arch_local_irq_save(void)swapgs ; \ sysretl -#ifdef CONFIG_DEBUG_ENTRY -#define SAVE_FLAGS (x) pushfq; popq %rax -#endif #else #define INTERRUPT_RETURN iret#endif -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ #ifndef __ASSEMBLY__static inline int arch_irqs_disabled_flags (unsigned long flags)
arch/x86/include/asm/msr.h +2 -2
@@ -242,7 +242,7 @@ static inline unsigned long long native_read_pmc(int counter)return EAX_EDX_VAL (val, low, high); } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #include <linux/errno.h>
@@ -305,7 +305,7 @@ do { \#define rdpmcl (counter, val) ((val) = native_read_pmc(counter)) -#endif /* !CONFIG_PARAVIRT */ +#endif /* !CONFIG_PARAVIRT_XXL */ /* * 64-bit version of wrmsr_safe():
arch/x86/include/asm/paravirt.h +17 -2
@@ -17,6 +17,7 @@#include <linux/cpumask.h> #include <asm/frame.h> +#ifdef CONFIG_PARAVIRT_XXL static inline void load_sp0 (unsigned long sp0) {PVOP_VCALL1 (cpu.load_sp0, sp0);
@@ -51,6 +52,7 @@ static inline void write_cr0(unsigned long x) {PVOP_VCALL1 (cpu.write_cr0, x); } +#endif static inline unsigned long read_cr2 (void ) {
@@ -72,6 +74,7 @@ static inline void write_cr3(unsigned long x)PVOP_VCALL1 (mmu.write_cr3, x); } +#ifdef CONFIG_PARAVIRT_XXL static inline void __write_cr4 (unsigned long x) {PVOP_VCALL1 (cpu.write_cr4, x);
@@ -88,6 +91,7 @@ static inline void write_cr8(unsigned long x)PVOP_VCALL1 (cpu.write_cr8, x); }#endif +#endif static inline void arch_safe_halt (void ) {
@@ -99,14 +103,13 @@ static inline void halt(void)PVOP_VCALL0 (irq.halt); } +#ifdef CONFIG_PARAVIRT_XXL static inline void wbinvd (void ) {PVOP_VCALL0 (cpu.wbinvd); } -#ifdef CONFIG_PARAVIRT_XXL #define get_kernel_rpl () (pv_info.kernel_rpl) -#endif static inline u64 paravirt_read_msr (unsigned msr) {
@@ -171,6 +174,7 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) *p =paravirt_read_msr_safe (msr, &err); return err; } +#endif static inline unsigned long long paravirt_sched_clock (void ) {
@@ -186,6 +190,7 @@ static inline u64 paravirt_steal_clock(int cpu)return PVOP_CALL1 (u64, time.steal_clock, cpu); } +#ifdef CONFIG_PARAVIRT_XXL static inline unsigned long long paravirt_read_pmc (int counter) {return PVOP_CALL1 (u64, cpu.read_pmc, counter);
@@ -230,6 +235,7 @@ static inline unsigned long paravirt_store_tr(void) { return PVOP_CALL0(unsigned long, cpu.store_tr); } +#define store_tr (tr) ((tr) = paravirt_store_tr())static inline void load_TLS (struct thread_struct *t,unsigned cpu) {
@@ -263,6 +269,7 @@ static inline void set_iopl_mask(unsigned mask) {PVOP_VCALL1 (cpu.set_iopl_mask, mask); } +#endif /* The paravirtualized I/O functions */ static inline void slow_down_io (void )
@@ -618,6 +625,7 @@ static inline void pmd_clear(pmd_t *pmdp) }#endif /* CONFIG_X86_PAE */ +#ifdef CONFIG_PARAVIRT_XXL #define __HAVE_ARCH_START_CONTEXT_SWITCHstatic inline void arch_start_context_switch (struct task_struct *prev) {
@@ -628,6 +636,7 @@ static inline void arch_end_context_switch(struct task_struct *next) {PVOP_VCALL1 (cpu.end_context_switch, next); } +#endif #define __HAVE_ARCH_ENTER_LAZY_MMU_MODEstatic inline void arch_enter_lazy_mmu_mode (void )
@@ -870,10 +879,12 @@ extern void default_banner(void);#define PARA_INDIRECT (addr) *%cs:addr#endif +#ifdef CONFIG_PARAVIRT_XXL #define INTERRUPT_RETURN \ 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), \
@@ -890,6 +901,7 @@ extern void default_banner(void); PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#ifdef CONFIG_X86_64 +#ifdef CONFIG_PARAVIRT_XXL /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be
@@ -909,15 +921,18 @@ extern void default_banner(void);ANNOTATE_RETPOLINE_SAFE ; \ call PARA_INDIRECT(pv_ops+PV_CPU_swapgs); \ ) +#endif #define GET_CR2_INTO_RAX \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_ops+PV_MMU_read_cr2); +#ifdef CONFIG_PARAVIRT_XXL #define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(PV_CPU_usergs_sysret64), \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);) +#endif #ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS (clobbers) \
arch/x86/include/asm/paravirt_types.h +4 -1
@@ -106,6 +106,9 @@ struct pv_time_ops {struct pv_cpu_ops {/* hooks for various privileged instructions */ +void (*io_delay)(void ); + +#ifdef CONFIG_PARAVIRT_XXL unsigned long (*get_debugreg)(int regno);void (*set_debugreg)(int regno,unsigned long value);
@@ -143,7 +146,6 @@ struct pv_cpu_ops {void (*set_iopl_mask)(unsigned mask);void (*wbinvd)(void ); -void (*io_delay)(void );/* cpuid emulation, mostly so that caps bits can be disabled */ void (*cpuid)(unsigned int *eax, unsigned int *ebx,
@@ -178,6 +180,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); +#endif } __no_randomize_layout;struct pv_irq_ops {
arch/x86/include/asm/pgtable.h +4 -2
@@ -111,10 +111,12 @@ extern pmdval_t early_pmd_flags;#define pte_val (x) native_pte_val(x)#define __pte (x) native_make_pte(x) -#define arch_end_context_switch (prev) do {} while(0) -#endif /* CONFIG_PARAVIRT */ +#ifndef CONFIG_PARAVIRT_XXL +#define arch_end_context_switch (prev) do {} while(0) +#endif /* CONFIG_PARAVIRT_XXL */ +/* * The following only work if pte_present() is true. * Undefined behaviour if not..
arch/x86/include/asm/processor.h +2 -2
@@ -578,7 +578,7 @@ static inline bool on_thread_stack(void) current_stack_pointer) < THREAD_SIZE; } -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define __cpuid native_cpuid
@@ -589,7 +589,7 @@ static inline void load_sp0(unsigned long sp0) }#define set_iopl_mask native_set_iopl_mask -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ /* Free all resources held by a thread. */ extern void release_thread (struct task_struct *);
arch/x86/include/asm/special_insns.h +7 -2
@@ -143,8 +143,9 @@ static inline unsigned long __read_cr4(void)#ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> -#else +#endif +#ifndef CONFIG_PARAVIRT_XXL static inline unsigned long read_cr0 (void ) {return native_read_cr0 ();
@@ -154,7 +155,9 @@ 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 ();
@@ -178,7 +181,9 @@ 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);
@@ -208,7 +213,7 @@ static inline void load_gs_index(unsigned selector)#endif -#endif /* CONFIG_PARAVIRT */ +#endif /* CONFIG_PARAVIRT_XXL */ static inline void clflush (volatile void *__p) {
arch/x86/kernel/asm-offsets.c +2 -0
@@ -68,7 +68,9 @@ void common(void) {BLANK ();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);#endif
arch/x86/kernel/asm-offsets_64.c +2 -0
@@ -21,9 +21,11 @@ static char syscalls_ia32[] = {int main (void ) {#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL 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
arch/x86/kernel/cpu/common.c +1 -1
@@ -1240,7 +1240,7 @@ static void generic_identify(struct cpuinfo_x86 *c)* ESPFIX issue, we can change this. */ #ifdef CONFIG_X86_32 -# ifdef CONFIG_PARAVIRT +# ifdef CONFIG_PARAVIRT_XXL do { extern void native_iret(void); if (pv_ops.cpu.iret == native_iret)
arch/x86/kernel/head_64.S +2 -0
@@ -31,6 +31,8 @@ #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 +12 -1
@@ -101,6 +101,7 @@ static unsigned paravirt_patch_call(void *insnbuf, const void *target,return 5 ; } +#ifdef CONFIG_PARAVIRT_XXL static unsigned paravirt_patch_jmp (void *insnbuf,const void *target,unsigned long addr,unsigned len) {
@@ -119,6 +120,7 @@ static unsigned paravirt_patch_jmp(void *insnbuf, const void *target, return 5; } +#endif DEFINE_STATIC_KEY_TRUE (virt_spin_lock_key);
@@ -150,10 +152,12 @@ unsigned paravirt_patch_default(u8 type, void *insnbuf,else if (opfunc == _paravirt_ident_64) ret =paravirt_patch_ident_64 (insnbuf, len); +#ifdef CONFIG_PARAVIRT_XXL else if (type == PARAVIRT_PATCH(cpu.iret) || type == PARAVIRT_PATCH(cpu.usergs_sysret64))/* If operation requires a jmp, then jmp */ ret =paravirt_patch_jmp (insnbuf, opfunc, addr, len); +#endif else/* Otherwise call the function. */ ret =paravirt_patch_call (insnbuf, opfunc, addr, len);
@@ -262,6 +266,7 @@ void paravirt_flush_lazy_mmu(void)preempt_enable (); } +#ifdef CONFIG_PARAVIRT_XXL void paravirt_start_context_switch (struct task_struct *prev) {BUG_ON (preemptible ());
@@ -282,6 +287,7 @@ void paravirt_end_context_switch(struct task_struct *next)if (test_and_clear_ti_thread_flag (task_thread_info (next),TIF_LAZY_MMU_UPDATES )) arch_enter_lazy_mmu_mode(); } +#endif enum paravirt_lazy_mode paravirt_get_lazy_mode (void ) {
@@ -320,6 +326,9 @@ struct paravirt_patch_template pv_ops = { .time.steal_clock = native_steal_clock,/* Cpu ops. */ + .cpu.io_delay = native_io_delay, + +#ifdef CONFIG_PARAVIRT_XXL .cpu.cpuid = native_cpuid, .cpu.get_debugreg = native_get_debugreg, .cpu.set_debugreg = native_set_debugreg,
@@ -361,10 +370,10 @@ struct paravirt_patch_template pv_ops = { .cpu.swapgs = native_swapgs, .cpu.set_iopl_mask = native_set_iopl_mask, - .cpu.io_delay = native_io_delay, .cpu.start_context_switch = paravirt_nop, .cpu.end_context_switch = paravirt_nop, +#endif /* CONFIG_PARAVIRT_XXL */ /* Irq ops. */ .irq.save_fl = __PV_IS_CALLEE_SAVE(native_save_fl),
@@ -464,10 +473,12 @@ struct paravirt_patch_template pv_ops = {#endif }; +#ifdef CONFIG_PARAVIRT_XXL /* At this point, native_get/set_debugreg has real function entries */ NOKPROBE_SYMBOL (native_get_debugreg);NOKPROBE_SYMBOL (native_set_debugreg);NOKPROBE_SYMBOL (native_load_idt); +#endif EXPORT_SYMBOL_GPL (pv_ops);EXPORT_SYMBOL_GPL (pv_info);
arch/x86/kernel/paravirt_patch_32.c +4 -0
@@ -5,7 +5,9 @@ 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" );DEF_NATIVE (mmu, write_cr3,"mov %eax, %cr3" );DEF_NATIVE (mmu, read_cr3,"mov %cr3, %eax" );
@@ -45,7 +47,9 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3);
arch/x86/kernel/paravirt_patch_64.c +5 -1
@@ -10,10 +10,12 @@ DEF_NATIVE(irq, save_fl, "pushfq; popq %rax");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" );DEF_NATIVE (cpu, swapgs,"swapgs" ); +#endif DEF_NATIVE(, mov32, "mov %edi, %eax"); DEF_NATIVE(, mov64, "mov %rdi, %rax");
@@ -53,12 +55,14 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len)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); +#endif PATCH_SITE (mmu, read_cr2);PATCH_SITE (mmu, read_cr3);PATCH_SITE (mmu, write_cr3); -PATCH_SITE (cpu, wbinvd);#if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (lock.queued_spin_unlock):if (pv_is_native_spin_unlock ()) {
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Move the pv_irq_ops under the PARAVIRT_XXL umbrella
In reply to Juergen Grossx86/paravirt: Move the pv_irq_ops under the PARAVIRT_XXL umbrella
Commit-ID: 6da63eb241a05b0e676d68975e793c0521387141 Gitweb: https://git.kernel.org/tip/6da63eb241a05b0e676d68975e793c0521387141 Author: Juergen Gross <[email protected]> AuthorDate: Tue, 28 Aug 2018 09:40:24 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 3 Sep 2018 16:50:36 +0200
x86/paravirt: Move the pv_irq_ops under the PARAVIRT_XXL umbrella
All 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.
--- 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
@@ -64,7 +64,7 @@ static inline __cpuidle void native_halt(void)#endif -#ifdef CONFIG_PARAVIRT +#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #ifndef __ASSEMBLY__
@@ -126,13 +126,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 /* CONFIG_PARAVIRT_XXL */ /* 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 /* CONFIG_PARAVIRT_XXL */ /* 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'
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Move the Xen-only pv_mmu_ops under the PARAVIRT_XXL umbrella
In reply to Juergen Grossx86/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 ()) {
tip-bot for Juergen Gross
merge bot[tip:x86/paravirt] x86/paravirt: Remove unneeded mmu related paravirt ops bits
In reply to Juergen Grossx86/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