Skip to contentSkip to conversation

Remove 32-bit Xen PV guest support

PATCH In review Juergen Gross 4 participants 22 messages Aug 7, 2020 – Aug 10, 2020

Subsystems (7)
lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

v3 cover Remove 32-bit Xen PV guest support

The long term plan has been to replace Xen PV guests by PVH. The first victim of that plan are now 32-bit PV guests, as those are used only rather seldom these days. Xen on x86 requires 64-bit support and with Grub2 now supporting PVH officially since version 2.04 there is no need to keep 32-bit PV guest support alive in the Linux kernel. Additionally Meltdown mitigation is not available in the kernel running as 32-bit PV guest, so dropping this mode makes sense from security point of view, too.

Changes in V3:
- addressed comments to V2
- split patch 1 into 2 patches
- new patches 3 and 7

Changes in V2:
- rebase to 5.8 kernel
- addressed comments to V1
- new patches 3 and 4

Juergen Gross (7):
x86/xen: remove 32-bit Xen PV guest support
x86/xen: eliminate xen-asm_64.S
x86/xen: drop tests for highmem in pv code x86/paravirt: remove 32-bit support from PARAVIRT_XXL x86/paravirt: cleanup paravirt macros
x86/paravirt: use CONFIG_PARAVIRT_XXL instead of CONFIG_PARAVIRT x86/entry/32: revert "Fix XEN_PV build dependency"

 arch/x86/entry/entry_32.S                   | 109 +----
 arch/x86/entry/entry_64.S                   |   4 +-
 arch/x86/entry/vdso/vdso32/note.S           |  30 --
 arch/x86/entry/vdso/vdso32/vclock_gettime.c |   1 +
 arch/x86/include/asm/fixmap.h               |   2 +-
 arch/x86/include/asm/idtentry.h             |   4 +-
 arch/x86/include/asm/paravirt.h             | 107 +----
 arch/x86/include/asm/paravirt_types.h       |  21 -
 arch/x86/include/asm/pgtable-3level_types.h |   5 -
 arch/x86/include/asm/proto.h                |   2 +-
 arch/x86/include/asm/required-features.h    |   2 +-
 arch/x86/include/asm/segment.h              |   6 +-
 arch/x86/kernel/cpu/common.c                |   8 -
 arch/x86/kernel/head_32.S                   |  31 --
 arch/x86/kernel/kprobes/core.c              |   1 -
 arch/x86/kernel/kprobes/opt.c               |   1 -
 arch/x86/kernel/paravirt.c                  |  18 -
 arch/x86/kernel/paravirt_patch.c            |  17 -
 arch/x86/xen/Kconfig                        |   3 +-
 arch/x86/xen/Makefile                       |   3 +-
 arch/x86/xen/apic.c                         |  17 -
 arch/x86/xen/enlighten_pv.c                 |  78 +---
 arch/x86/xen/mmu_pv.c                       | 488 ++++----------------
 arch/x86/xen/p2m.c                          |   6 +-
 arch/x86/xen/setup.c                        |  36 +-
 arch/x86/xen/smp_pv.c                       |  18 -
 arch/x86/xen/vdso.h                         |   6 -
 arch/x86/xen/xen-asm.S                      | 193 +++++++-
 arch/x86/xen/xen-asm_32.S                   | 185 --------
 arch/x86/xen/xen-asm_64.S                   | 192 --------
 arch/x86/xen/xen-head.S                     |   6 -
 drivers/xen/Kconfig                         |   4 +-
 32 files changed, 305 insertions(+), 1299 deletions(-)
 delete mode 100644 arch/x86/xen/vdso.h
 delete mode 100644 arch/x86/xen/xen-asm_32.S
 delete mode 100644 arch/x86/xen/xen-asm_64.S
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH v3 1/7 x86/xen: remove 32-bit Xen PV guest support

Xen is requiring 64-bit machines today and since Xen 4.14 it can be built without 32-bit PV guest support. There is no need to carry the burden of 32-bit PV guest support in the kernel any longer, as new guests can be either HVM or PVH, or they can use a 64 bit kernel.

Remove the 32-bit Xen PV support from the kernel.

---
 arch/x86/entry/entry_32.S         | 109 +--------
 arch/x86/entry/vdso/vdso32/note.S |  30 ---
 arch/x86/include/asm/proto.h      |   2 +-
 arch/x86/include/asm/segment.h    |   2 +-
 arch/x86/kernel/head_32.S         |  31 ---
 arch/x86/xen/Kconfig              |   3 +-
 arch/x86/xen/apic.c               |  17 --
 arch/x86/xen/enlighten_pv.c       |  63 +-----
 arch/x86/xen/mmu_pv.c             | 352 ++++--------------------------
 arch/x86/xen/p2m.c                |   6 +-
 arch/x86/xen/setup.c              |  36 +--
 arch/x86/xen/smp_pv.c             |  18 --
 arch/x86/xen/vdso.h               |   6 -
 arch/x86/xen/xen-asm.S            |  14 --
 arch/x86/xen/xen-asm_32.S         | 185 ----------------
 arch/x86/xen/xen-head.S           |   6 -
 drivers/xen/Kconfig               |   4 +-
 17 files changed, 51 insertions(+), 833 deletions(-)
 delete mode 100644 arch/x86/xen/vdso.h
 delete mode 100644 arch/x86/xen/xen-asm_32.S
arch/x86/entry/entry_32.S +2 -107
index 29b7d52143e9..df8c017e6161 100644
@@ -449,8 +449,6 @@
 
 .macro SWITCH_TO_KERNEL_STACK
 
-	ALTERNATIVE     "", "jmp .Lend_\@", X86_FEATURE_XENPV
-
 	BUG_IF_WRONG_CR3
 
 	SWITCH_TO_KERNEL_CR3 scratch_reg=%eax
@@ -599,8 +597,6 @@
  */
 .macro SWITCH_TO_ENTRY_STACK
 
-	ALTERNATIVE     "", "jmp .Lend_\@", X86_FEATURE_XENPV
-
 	/* Bytes to copy */
 	movl	$PTREGS_SIZE, %ecx
 
@@ -872,17 +868,6 @@ SYM_ENTRY(__begin_SYSENTER_singlestep_region, SYM_L_GLOBAL, SYM_A_NONE)
  * will ignore all of the single-step traps generated in this range.
  */
 
-#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.
- */
-SYM_CODE_START(xen_sysenter_target)
-	addl	$5*4, %esp			/* remove xen-provided frame */
-	jmp	.Lsysenter_past_esp
-SYM_CODE_END(xen_sysenter_target)
-#endif
-
 /*
  * 32-bit SYSENTER entry.
  *
@@ -965,9 +950,8 @@ SYM_FUNC_START(entry_SYSENTER_32)
 
 	movl	%esp, %eax
 	call	do_SYSENTER_32
-	/* XEN PV guests always use IRET path */
-	ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
-		    "jmp .Lsyscall_32_done", X86_FEATURE_XENPV
+	testl	%eax, %eax
+	jz	.Lsyscall_32_done
 
 	STACKLEAK_ERASE
 
@@ -1165,95 +1149,6 @@ SYM_FUNC_END(entry_INT80_32)
 #endif
 .endm
 
-#ifdef CONFIG_PARAVIRT
-SYM_CODE_START(native_iret)
-	iret
-	_ASM_EXTABLE(native_iret, asm_iret_error)
-SYM_CODE_END(native_iret)
-#endif
-
-#ifdef CONFIG_XEN_PV
-/*
- * See comment in entry_64.S for further explanation
- *
- * Note: This is not an actual IDT entry point. It's a XEN specific entry
- * point and therefore named to match the 64-bit trampoline counterpart.
- */
-SYM_FUNC_START(xen_asm_exc_xen_hypervisor_callback)
-	/*
-	 * Check to see if we got the event in the critical
-	 * region in xen_iret_direct, after we've reenabled
-	 * events and checked for pending events.  This simulates
-	 * iret instruction's behaviour where it delivers a
-	 * pending interrupt when enabling interrupts:
-	 */
-	cmpl	$xen_iret_start_crit, (%esp)
-	jb	1f
-	cmpl	$xen_iret_end_crit, (%esp)
-	jae	1f
-	call	xen_iret_crit_fixup
-1:
-	pushl	$-1				/* orig_ax = -1 => not a system call */
-	SAVE_ALL
-	ENCODE_FRAME_POINTER
-
-	mov	%esp, %eax
-	call	xen_pv_evtchn_do_upcall
-	jmp	handle_exception_return
-SYM_FUNC_END(xen_asm_exc_xen_hypervisor_callback)
-
-/*
- * Hypervisor uses this for application faults while it executes.
- * We get here for two reasons:
- *  1. Fault while reloading DS, ES, FS or GS
- *  2. Fault while executing IRET
- * Category 1 we fix up by reattempting the load, and zeroing the segment
- * register if the load fails.
- * Category 2 we fix up by jumping to do_iret_error. We cannot use the
- * normal Linux return path in this case because if we use the IRET hypercall
- * to pop the stack frame we end up in an infinite loop of failsafe callbacks.
- * We distinguish between categories by maintaining a status value in EAX.
- */
-SYM_FUNC_START(xen_failsafe_callback)
-	pushl	%eax
-	movl	$1, %eax
-1:	mov	4(%esp), %ds
-2:	mov	8(%esp), %es
-3:	mov	12(%esp), %fs
-4:	mov	16(%esp), %gs
-	/* EAX == 0 => Category 1 (Bad segment)
-	   EAX != 0 => Category 2 (Bad IRET) */
-	testl	%eax, %eax
-	popl	%eax
-	lea	16(%esp), %esp
-	jz	5f
-	jmp	asm_iret_error
-5:	pushl	$-1				/* orig_ax = -1 => not a system call */
-	SAVE_ALL
-	ENCODE_FRAME_POINTER
-	jmp	handle_exception_return
-
-.section .fixup, "ax"
-6:	xorl	%eax, %eax
-	movl	%eax, 4(%esp)
-	jmp	1b
-7:	xorl	%eax, %eax
-	movl	%eax, 8(%esp)
-	jmp	2b
-8:	xorl	%eax, %eax
-	movl	%eax, 12(%esp)
-	jmp	3b
-9:	xorl	%eax, %eax
-	movl	%eax, 16(%esp)
-	jmp	4b
-.previous
-	_ASM_EXTABLE(1b, 6b)
-	_ASM_EXTABLE(2b, 7b)
-	_ASM_EXTABLE(3b, 8b)
-	_ASM_EXTABLE(4b, 9b)
-SYM_FUNC_END(xen_failsafe_callback)
-#endif /* CONFIG_XEN_PV */
-
 SYM_CODE_START_LOCAL_NOALIGN(handle_exception)
 	/* the function address is in %gs's slot on the stack */
 	SAVE_ALL switch_stacks=1 skip_gs=1 unwind_espfix=1
arch/x86/entry/vdso/vdso32/note.S +0 -30
index e78047d119f6..2cbd39939dc6 100644
@@ -16,33 +16,3 @@ ELFNOTE_START(Linux, 0, "a")
 ELFNOTE_END
 
 BUILD_SALT
-
-#ifdef CONFIG_XEN
-/*
- * Add a special note telling glibc's dynamic linker a fake hardware
- * flavor that it will use to choose the search path for libraries in the
- * same way it uses real hardware capabilities like "mmx".
- * We supply "nosegneg" as the fake capability, to indicate that we
- * do not like negative offsets in instructions using segment overrides,
- * since we implement those inefficiently.  This makes it possible to
- * install libraries optimized to avoid those access patterns in someplace
- * like /lib/i686/tls/nosegneg.  Note that an /etc/ld.so.conf.d/file
- * corresponding to the bits here is needed to make ldconfig work right.
- * It should contain:
- *	hwcap 1 nosegneg
- * to match the mapping of bit to name that we give here.
- *
- * At runtime, the fake hardware feature will be considered to be present
- * if its bit is set in the mask word.  So, we start with the mask 0, and
- * at boot time we set VDSO_NOTE_NONEGSEG_BIT if running under Xen.
- */
-
-#include "../../xen/vdso.h"	/* Defines VDSO_NOTE_NONEGSEG_BIT.  */
-
-ELFNOTE_START(GNU, 2, "a")
-	.long 1			/* ncaps */
-VDSO32_NOTE_MASK:		/* Symbol used by arch/x86/xen/setup.c */
-	.long 0			/* mask */
-	.byte VDSO_NOTE_NONEGSEG_BIT; .asciz "nosegneg"	/* bit, name */
-ELFNOTE_END
-#endif
arch/x86/include/asm/proto.h +1 -1
index 6e81788a30c1..28996fe19301 100644
@@ -25,7 +25,7 @@ void entry_SYSENTER_compat(void);
 void __end_entry_SYSENTER_compat(void);
 void entry_SYSCALL_compat(void);
 void entry_INT80_compat(void);
-#if defined(CONFIG_X86_64) && defined(CONFIG_XEN_PV)
+#ifdef CONFIG_XEN_PV
 void xen_entry_INT80_compat(void);
 #endif
 #endif
arch/x86/include/asm/segment.h +1 -1
index 6669164abadc..9646c300f128 100644
@@ -301,7 +301,7 @@ static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node)
 extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_SIZE];
 extern void early_ignore_irq(void);
 
-#if defined(CONFIG_X86_64) && defined(CONFIG_XEN_PV)
+#ifdef CONFIG_XEN_PV
 extern const char xen_early_idt_handler_array[NUM_EXCEPTION_VECTORS][XEN_EARLY_IDT_HANDLER_SIZE];
 #endif
 
arch/x86/kernel/head_32.S +0 -31
index f66a6b90f954..7ed84c282233 100644
@@ -134,38 +134,7 @@ SYM_CODE_START(startup_32)
 	movl %eax,pa(initial_page_table+0xffc)
 #endif
 
-#ifdef CONFIG_PARAVIRT
-	/* This is can only trip for a broken bootloader... */
-	cmpw $0x207, pa(boot_params + BP_version)
-	jb .Ldefault_entry
-
-	/* Paravirt-compatible boot parameters.  Look to see what architecture
-		we're booting under. */
-	movl pa(boot_params + BP_hardware_subarch), %eax
-	cmpl $num_subarch_entries, %eax
-	jae .Lbad_subarch
-
-	movl pa(subarch_entries)(,%eax,4), %eax
-	subl $__PAGE_OFFSET, %eax
-	jmp *%eax
-
-.Lbad_subarch:
-SYM_INNER_LABEL_ALIGN(xen_entry, SYM_L_WEAK)
-	/* Unknown implementation; there's really
-	   nothing we can do at this point. */
-	ud2a
-
-	__INITDATA
-
-subarch_entries:
-	.long .Ldefault_entry		/* normal x86/PC */
-	.long xen_entry			/* Xen hypervisor */
-	.long .Ldefault_entry		/* Moorestown MID */
-num_subarch_entries = (. - subarch_entries) / 4
-.previous
-#else
 	jmp .Ldefault_entry
-#endif /* CONFIG_PARAVIRT */
 SYM_CODE_END(startup_32)
 
 #ifdef CONFIG_HOTPLUG_CPU
arch/x86/xen/Kconfig +2 -1
index 1aded63a95cb..218acbd5c7a0 100644
@@ -19,6 +19,7 @@ config XEN_PV
 	bool "Xen PV guest support"
 	default y
 	depends on XEN
+	depends on X86_64
 	select PARAVIRT_XXL
 	select XEN_HAVE_PVMMU
 	select XEN_HAVE_VPMU
@@ -50,7 +51,7 @@ config XEN_PVHVM_SMP
 
 config XEN_512GB
 	bool "Limit Xen pv-domain memory to 512GB"
-	depends on XEN_PV && X86_64
+	depends on XEN_PV
 	default y
 	help
 	  Limit paravirtualized user domains to 512GB of RAM.
arch/x86/xen/apic.c +0 -17
index 5e53bfbe5823..ea6e9c54da9d 100644
@@ -58,10 +58,6 @@ static u32 xen_apic_read(u32 reg)
 
 	if (reg == APIC_LVR)
 		return 0x14;
-#ifdef CONFIG_X86_32
-	if (reg == APIC_LDR)
-		return SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
-#endif
 	if (reg != APIC_ID)
 		return 0;
 
@@ -127,14 +123,6 @@ static int xen_phys_pkg_id(int initial_apic_id, int index_msb)
 	return initial_apic_id >> index_msb;
 }
 
-#ifdef CONFIG_X86_32
-static int xen_x86_32_early_logical_apicid(int cpu)
-{
-	/* Match with APIC_LDR read. Otherwise setup_local_APIC complains. */
-	return 1 << cpu;
-}
-#endif
-
 static void xen_noop(void)
 {
 }
@@ -197,11 +185,6 @@ static struct apic xen_pv_apic = {
 	.icr_write 			= xen_apic_icr_write,
 	.wait_icr_idle 			= xen_noop,
 	.safe_wait_icr_idle 		= xen_safe_apic_wait_icr_idle,
-
-#ifdef CONFIG_X86_32
-	/* generic_processor_info and setup_local_APIC. */
-	.x86_32_early_logical_apicid	= xen_x86_32_early_logical_apicid,
-#endif
 };
 
 static void __init xen_apic_check(void)
arch/x86/xen/enlighten_pv.c +3 -60

170 lines not on this page · raw message

arch/x86/xen/mmu_pv.c +39 -313

600 lines not on this page · raw message

arch/x86/xen/p2m.c +1 -5
index 0acba2c712ab..be4151f42611 100644
@@ -379,12 +379,8 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
 
 		if (type == P2M_TYPE_PFN || i < chunk) {
 			/* Use initial p2m page contents. */
-#ifdef CONFIG_X86_64
 			mfns = alloc_p2m_page();
 			copy_page(mfns, xen_p2m_addr + pfn);
-#else
-			mfns = xen_p2m_addr + pfn;
-#endif
 			ptep = populate_extra_pte((unsigned long)(p2m + pfn));
 			set_pte(ptep,
 				pfn_pte(PFN_DOWN(__pa(mfns)), PAGE_KERNEL));
@@ -467,7 +463,7 @@ EXPORT_SYMBOL_GPL(get_phys_to_machine);
  * Allocate new pmd(s). It is checked whether the old pmd is still in place.
  * If not, nothing is changed. This is okay as the only reason for allocating
  * a new pmd is to replace p2m_missing_pte or p2m_identity_pte by a individual
- * pmd. In case of PAE/x86-32 there are multiple pmds to allocate!
+ * pmd.
  */
 static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *pte_pg)
 {
arch/x86/xen/setup.c +1 -35
index 3566e37241d7..7eab14d56369 100644
@@ -32,7 +32,6 @@
 #include <xen/features.h>
 #include <xen/hvc-console.h>
 #include "xen-ops.h"
-#include "vdso.h"
 #include "mmu.h"
 
 #define GB(x) ((uint64_t)(x) * 1024 * 1024 * 1024)
@@ -545,13 +544,10 @@ static unsigned long __init xen_get_pages_limit(void)
 {
 	unsigned long limit;
 
-#ifdef CONFIG_X86_32
-	limit = GB(64) / PAGE_SIZE;
-#else
 	limit = MAXMEM / PAGE_SIZE;
 	if (!xen_initial_domain() && xen_512gb_limit)
 		limit = GB(512) / PAGE_SIZE;
-#endif
+
 	return limit;
 }
 
@@ -722,17 +718,8 @@ static void __init xen_reserve_xen_mfnlist(void)
 	if (!xen_is_e820_reserved(start, size))
 		return;
 
-#ifdef CONFIG_X86_32
-	/*
-	 * Relocating the p2m on 32 bit system to an arbitrary virtual address
-	 * is not supported, so just give up.
-	 */
-	xen_raw_console_write("Xen hypervisor allocated p2m list conflicts with E820 map\n");
-	BUG();
-#else
 	xen_relocate_p2m();
 	memblock_free(start, size);
-#endif
 }
 
 /**
@@ -921,20 +908,6 @@ char * __init xen_memory_setup(void)
 	return "Xen";
 }
 
-/*
- * Set the bit indicating "nosegneg" library variants should be used.
- * We only need to bother in pure 32-bit mode; compat 32-bit processes
- * can have un-truncated segments, so wrapping around is allowed.
- */
-static void __init fiddle_vdso(void)
-{
-#ifdef CONFIG_X86_32
-	u32 *mask = vdso_image_32.data +
-		vdso_image_32.sym_VDSO32_NOTE_MASK;
-	*mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
-#endif
-}
-
 static int register_callback(unsigned type, const void *func)
 {
 	struct callback_register callback = {
@@ -951,11 +924,7 @@ void xen_enable_sysenter(void)
 	int ret;
 	unsigned sysenter_feature;
 
-#ifdef CONFIG_X86_32
-	sysenter_feature = X86_FEATURE_SEP;
-#else
 	sysenter_feature = X86_FEATURE_SYSENTER32;
-#endif
 
 	if (!boot_cpu_has(sysenter_feature))
 		return;
@@ -967,7 +936,6 @@ void xen_enable_sysenter(void)
 
 void xen_enable_syscall(void)
 {
-#ifdef CONFIG_X86_64
 	int ret;
 
 	ret = register_callback(CALLBACKTYPE_syscall, xen_syscall_target);
@@ -983,7 +951,6 @@ void xen_enable_syscall(void)
 		if (ret != 0)
 			setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
 	}
-#endif /* CONFIG_X86_64 */
 }
 
 static void __init xen_pvmmu_arch_setup(void)
@@ -1024,7 +991,6 @@ void __init xen_arch_setup(void)
 	disable_cpuidle();
 	disable_cpufreq();
 	WARN_ON(xen_set_default_idle());
-	fiddle_vdso();
 #ifdef CONFIG_NUMA
 	numa_off = 1;
 #endif
arch/x86/xen/smp_pv.c +0 -18
index 9ea598dcc132..3a70cb1e9550 100644
@@ -210,15 +210,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void)
 		 * sure the old memory can be recycled. */
 		make_lowmem_page_readwrite(xen_initial_gdt);
 
-#ifdef CONFIG_X86_32
-	/*
-	 * Xen starts us with XEN_FLAT_RING1_DS, but linux code
-	 * expects __USER_DS
-	 */
-	loadsegment(ds, __USER_DS);
-	loadsegment(es, __USER_DS);
-#endif
-
 	xen_filter_cpu_maps();
 	xen_setup_vcpu_info_placement();
 
@@ -299,10 +290,6 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 
 	gdt = get_cpu_gdt_rw(cpu);
 
-#ifdef CONFIG_X86_32
-	ctxt->user_regs.fs = __KERNEL_PERCPU;
-	ctxt->user_regs.gs = __KERNEL_STACK_CANARY;
-#endif
 	memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
 
 	/*
@@ -340,12 +327,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 	ctxt->kernel_ss = __KERNEL_DS;
 	ctxt->kernel_sp = task_top_of_stack(idle);
 
-#ifdef CONFIG_X86_32
-	ctxt->event_callback_cs     = __KERNEL_CS;
-	ctxt->failsafe_callback_cs  = __KERNEL_CS;
-#else
 	ctxt->gs_base_kernel = per_cpu_offset(cpu);
-#endif
 	ctxt->event_callback_eip    =
 		(unsigned long)xen_asm_exc_xen_hypervisor_callback;
 	ctxt->failsafe_callback_eip =
arch/x86/xen/vdso.h deleted +0 -6
deleted file mode 100644
index 873c54c488fe..000000000000
@@ -1,6 +0,0 @@
-/* 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. */
-#define VDSO_NOTE_NONEGSEG_BIT	1
arch/x86/xen/xen-asm.S +0 -14
index 508fe204520b..c59d077510bf 100644
@@ -76,11 +76,7 @@ SYM_FUNC_END(xen_save_fl_direct)
  */
 SYM_FUNC_START(xen_restore_fl_direct)
 	FRAME_BEGIN
-#ifdef CONFIG_X86_64
 	testw $X86_EFLAGS_IF, %di
-#else
-	testb $X86_EFLAGS_IF>>8, %ah
-#endif
 	setz PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask
 	/*
 	 * Preempt here doesn't matter because that will deal with any
@@ -104,15 +100,6 @@ SYM_FUNC_END(xen_restore_fl_direct)
  */
 SYM_FUNC_START(check_events)
 	FRAME_BEGIN
-#ifdef CONFIG_X86_32
-	push %eax
-	push %ecx
-	push %edx
-	call xen_force_evtchn_callback
-	pop %edx
-	pop %ecx
-	pop %eax
-#else
 	push %rax
 	push %rcx
 	push %rdx
@@ -132,7 +119,6 @@ SYM_FUNC_START(check_events)
 	pop %rdx
 	pop %rcx
 	pop %rax
-#endif
 	FRAME_END
 	ret
 SYM_FUNC_END(check_events)
arch/x86/xen/xen-asm_32.S deleted +0 -185

185 lines not on this page · raw message

arch/x86/xen/xen-head.S +0 -6
index 1ba601df3a37..2d7c8f34f56c 100644
@@ -35,13 +35,8 @@ SYM_CODE_START(startup_xen)
 	rep __ASM_SIZE(stos)
 
 	mov %_ASM_SI, xen_start_info
-#ifdef CONFIG_X86_64
 	mov initial_stack(%rip), %rsp
-#else
-	mov initial_stack, %esp
-#endif
 
-#ifdef CONFIG_X86_64
 	/* Set up %gs.
 	 *
 	 * The base of %gs always points to fixed_percpu_data.  If the
@@ -53,7 +48,6 @@ SYM_CODE_START(startup_xen)
 	movq	$INIT_PER_CPU_VAR(fixed_percpu_data),%rax
 	cdq
 	wrmsr
-#endif
 
 	call xen_start_kernel
 SYM_CODE_END(startup_xen)
drivers/xen/Kconfig +1 -3
index 1d339ef92422..ea6c1e7e3e42 100644
@@ -52,9 +52,7 @@ config XEN_BALLOON_MEMORY_HOTPLUG
 
 config XEN_BALLOON_MEMORY_HOTPLUG_LIMIT
 	int "Hotplugged memory limit (in GiB) for a PV guest"
-	default 512 if X86_64
-	default 4 if X86_32
-	range 0 64 if X86_32
+	default 512
 	depends on XEN_HAVE_PVMMU
 	depends on XEN_BALLOON_MEMORY_HOTPLUG
 	help
Signature · 1 line
2.26.2
reviewer Reviewed-by on v3 1/7
#2 lore raw

Re: [PATCH v3 1/7] x86/xen: remove 32-bit Xen PV guest support

Quoted 4 lines · Juergen Gross

void __init xen_reserve_top(void)
{

arch/x86/xen/mmu_pv.c static void xen_release_pud(unsigned long pfn) · line 1629

Quoted 10 lines
arch/x86/xen/mmu_pv.c +0 -9
-#ifdef CONFIG_X86_32
-	unsigned long top = HYPERVISOR_VIRT_START;
-	struct xen_platform_parameters pp;
-
-	if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0)
-		top = pp.virt_start;
-
-	reserve_top_address(-top);
-#endif	/* CONFIG_X86_32 */
 }

We should be able now to get rid of xen_reserve_top() altogether.

Other than that

-boris

author maintainer
#3 lore raw

Re: [PATCH v3 1/7] x86/xen: remove 32-bit Xen PV guest support

Quoted 18 lines · Boris Ostrovsky
Quoted 4 lines · Juergen Gross
  
  void __init xen_reserve_top(void)
  {

arch/x86/xen/mmu_pv.c static void xen_release_pud(unsigned long pfn) · line 1629

Quoted 10 lines
arch/x86/xen/mmu_pv.c +0 -9
-#ifdef CONFIG_X86_32
-	unsigned long top = HYPERVISOR_VIRT_START;
-	struct xen_platform_parameters pp;
-
-	if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0)
-		top = pp.virt_start;
-
-	reserve_top_address(-top);
-#endif	/* CONFIG_X86_32 */
  }

We should be able now to get rid of xen_reserve_top() altogether.

Oh, yes.

Quoted 6 lines

Other than that

Thanks,

Juergen

author maintainer
#4 lore raw

PATCH v3 2/7 x86/xen: eliminate xen-asm_64.S

In reply to Juergen Gross

With 32-bit pv-guest support removed xen-asm_64.S can be merged with xen-asm.S

---
 arch/x86/xen/Makefile     |   3 +-
 arch/x86/xen/xen-asm.S    | 179 +++++++++++++++++++++++++++++++++++
 arch/x86/xen/xen-asm_64.S | 192 --------------------------------------
 3 files changed, 180 insertions(+), 194 deletions(-)
 delete mode 100644 arch/x86/xen/xen-asm_64.S
arch/x86/xen/Makefile +1 -2
index 084de77a109e..5de137d536cc 100644
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-OBJECT_FILES_NON_STANDARD_xen-asm_$(BITS).o := y
+OBJECT_FILES_NON_STANDARD_xen-asm.o := y
 
 ifdef CONFIG_FUNCTION_TRACER
 # Do not profile debug and lowlevel utilities
@@ -34,7 +34,6 @@ 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
 
 obj-$(CONFIG_XEN_PVH)		+= enlighten_pvh.o
 
arch/x86/xen/xen-asm.S +179 -0

194 lines not on this page · raw message

arch/x86/xen/xen-asm_64.S deleted +0 -192

192 lines not on this page · raw message

Signature · 1 line
2.26.2
reviewer Reviewed-by on v3 2/7
#5 lore raw

Re: [PATCH v3 2/7] x86/xen: eliminate xen-asm_64.S

Quoted 4 lines · Juergen Gross

With 32-bit pv-guest support removed xen-asm_64.S can be merged with xen-asm.S

except for

Quoted 7 lines
arch/x86/xen/xen-asm.S +0 -0
index c59d077510bf..d1272a63f097 100644
@@ -6,12 +6,19 @@
  * operations here; the indirect forms are better handled in C.
  */

arch/x86/xen/xen-asm.S line 17

Quoted 10 lines
arch/x86/xen/xen-asm.S +4 -0
 
+#include <asm/errno.h>
 #include <asm/asm-offsets.h>
 #include <asm/percpu.h>
 #include <asm/processor-flags.h>
+#include <asm/segment.h>
+#include <asm/thread_info.h>
+#include <asm/asm.h>
 #include <asm/frame.h>
 #include <asm/asm.h>

asm/asm.h included twice now.

author maintainer
#6 lore raw

Re: [PATCH v3 2/7] x86/xen: eliminate xen-asm_64.S

Quoted 21 lines · Boris Ostrovsky
Quoted 4 lines · Juergen Gross

With 32-bit pv-guest support removed xen-asm_64.S can be merged with xen-asm.S

except for

Quoted 8 lines
arch/x86/xen/xen-asm.S +0 -0
index c59d077510bf..d1272a63f097 100644
@@ -6,12 +6,19 @@
   * operations here; the indirect forms are better handled in C.
   */
 
Quoted 12 lines

arch/x86/xen/xen-asm.S line 17

Quoted 9 lines
arch/x86/xen/xen-asm.S +4 -0
+#include <asm/errno.h>
  #include <asm/asm-offsets.h>
  #include <asm/percpu.h>
  #include <asm/processor-flags.h>
+#include <asm/segment.h>
+#include <asm/thread_info.h>
+#include <asm/asm.h>
  #include <asm/frame.h>
  #include <asm/asm.h>

asm/asm.h included twice now.

Right, will drop that.

Juergen

author maintainer
#7 lore raw

PATCH v3 3/7 x86/xen: drop tests for highmem in pv code

In reply to Juergen Gross

With support for 32-bit pv guests gone pure pv-code no longer needs to test for highmem. Dropping those tests removes the need for flushing in some places.

---
 arch/x86/xen/enlighten_pv.c |  11 ++-
 arch/x86/xen/mmu_pv.c       | 138 ++++++++++++++----------------------
 2 files changed, 57 insertions(+), 92 deletions(-)
arch/x86/xen/enlighten_pv.c +4 -7
index 7d90b3da8bb4..9fec952f84f3 100644
@@ -347,6 +347,7 @@ static void set_aliased_prot(void *v, pgprot_t prot)
 	unsigned long pfn;
 	struct page *page;
 	unsigned char dummy;
+	void *av;
 
 	ptep = lookup_address((unsigned long)v, &level);
 	BUG_ON(ptep == NULL);
@@ -383,14 +384,10 @@ static void set_aliased_prot(void *v, pgprot_t prot)
 	if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
 		BUG();
 
-	if (!PageHighMem(page)) {
-		void *av = __va(PFN_PHYS(pfn));
+	av = __va(PFN_PHYS(pfn));
 
-		if (av != v)
-			if (HYPERVISOR_update_va_mapping((unsigned long)av, pte, 0))
-				BUG();
-	} else
-		kmap_flush_unused();
+	if (av != v && HYPERVISOR_update_va_mapping((unsigned long)av, pte, 0))
+		BUG();
 
 	preempt_enable();
 }
arch/x86/xen/mmu_pv.c +53 -85

256 lines not on this page · raw message

Signature · 1 line
2.26.2
#8 lore raw

Re: [PATCH v3 3/7] x86/xen: drop tests for highmem in pv code

I love your patch! Perhaps something to improve:

Hi Juergen,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on tip/x86/asm v5.8 next-20200806] [cannot apply to xen-tip/linux-next tip/x86/vdso]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Juergen-Gross/Remove-32-bit-Xen-PV-guest-support/20200807-164058
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git ef2ff0f5d6008d325c9a068e20981c0d0acc4d6b
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

arch/x86/xen/enlighten_pv.c: In function 'set_aliased_prot':

>> arch/x86/xen/enlighten_pv.c:348:15: warning: variable 'page' set but not used [-Wunused-but-set-variable]
     348 |  struct page *page;
         |               ^~~~

arch/x86/xen/enlighten_pv.c: At top level:
arch/x86/xen/enlighten_pv.c:1198:34: warning: no previous prototype for 'xen_start_kernel' [-Wmissing-prototypes]
1198 | asmlinkage __visible void __init xen_start_kernel(void)
| ^~~~~~~~~~~~~~~~

vim +/page +348 arch/x86/xen/enlighten_pv.c

e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  335  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  336  /*
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  337   * Set the page permissions for a particular virtual address.  If the
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  338   * address is a vmalloc mapping (or other non-linear mapping), then
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  339   * find the linear mapping of the page and also set its protections to
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  340   * match.
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  341   */
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  342  static void set_aliased_prot(void *v, pgprot_t prot)
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  343  {
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  344  	int level;
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  345  	pte_t *ptep;
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  346  	pte_t pte;
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  347  	unsigned long pfn;
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14 @348  	struct page *page;
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  349  	unsigned char dummy;
64aef3716eab524 Juergen Gross     2020-08-07  350  	void *av;
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  351  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  352  	ptep = lookup_address((unsigned long)v, &level);
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  353  	BUG_ON(ptep == NULL);
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  354  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  355  	pfn = pte_pfn(*ptep);
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  356  	page = pfn_to_page(pfn);
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  357  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  358  	pte = pfn_pte(pfn, prot);
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  359  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  360  	/*
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  361  	 * Careful: update_va_mapping() will fail if the virtual address
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  362  	 * we're poking isn't populated in the page tables.  We don't
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  363  	 * need to worry about the direct map (that's always in the page
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  364  	 * tables), but we need to be careful about vmap space.  In
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  365  	 * particular, the top level page table can lazily propagate
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  366  	 * entries between processes, so if we've switched mms since we
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  367  	 * vmapped the target in the first place, we might not have the
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  368  	 * top-level page table entry populated.
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  369  	 *
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  370  	 * We disable preemption because we want the same mm active when
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  371  	 * we probe the target and when we issue the hypercall.  We'll
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  372  	 * have the same nominal mm, but if we're a kernel thread, lazy
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  373  	 * mm dropping could change our pgd.
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  374  	 *
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  375  	 * Out of an abundance of caution, this uses __get_user() to fault
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  376  	 * in the target address just in case there's some obscure case
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  377  	 * in which the target address isn't readable.
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  378  	 */
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  379  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  380  	preempt_disable();
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  381  
fe557319aa06c23 Christoph Hellwig 2020-06-17  382  	copy_from_kernel_nofault(&dummy, v, 1);
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  383  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  384  	if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  385  		BUG();
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  386  
64aef3716eab524 Juergen Gross     2020-08-07  387  	av = __va(PFN_PHYS(pfn));
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  388  
64aef3716eab524 Juergen Gross     2020-08-07  389  	if (av != v && HYPERVISOR_update_va_mapping((unsigned long)av, pte, 0))
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  390  		BUG();
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  391  
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  392  	preempt_enable();
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  393  }
e1dab14cf68d1e0 Vitaly Kuznetsov  2017-03-14  394  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

reviewer Reviewed-by on v3 3/7
#9 lore raw

Re: [PATCH v3 3/7] x86/xen: drop tests for highmem in pv code

In reply to Juergen Gross
Quoted 5 lines · Juergen Gross

With support for 32-bit pv guests gone pure pv-code no longer needs to test for highmem. Dropping those tests removes the need for flushing in some places.

with a suggestion

Quoted 10 lines
---
 arch/x86/xen/enlighten_pv.c |  11 ++-
 arch/x86/xen/mmu_pv.c       | 138 ++++++++++++++----------------------
 2 files changed, 57 insertions(+), 92 deletions(-)
arch/x86/xen/enlighten_pv.c +0 -0
index 7d90b3da8bb4..9fec952f84f3 100644

arch/x86/xen/enlighten_pv.c static void set_aliased_prot(void *v, pgprot_t prot) · line 350

Quoted 4 lines
arch/x86/xen/enlighten_pv.c +1 -0
@@ -347,6 +347,7 @@ static void set_aliased_prot(void *v, pgprot_t prot)
 	unsigned long pfn;
 	struct page *page;
 	unsigned char dummy;
+	void *av;

to rename this to va since you are modifying those lines anyway.

Quoted 11 lines
arch/x86/xen/enlighten_pv.c +1 -2
 	ptep = lookup_address((unsigned long)v, &level);
 	BUG_ON(ptep == NULL);
@@ -383,14 +384,10 @@ static void set_aliased_prot(void *v, pgprot_t prot)
 	if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
 		BUG();
 
-	if (!PageHighMem(page)) {
-		void *av = __va(PFN_PHYS(pfn));
+	av = __va(PFN_PHYS(pfn));
 
author maintainer
#10 lore raw

Re: [PATCH v3 3/7] x86/xen: drop tests for highmem in pv code

Quoted 19 lines · Boris Ostrovsky
Quoted 5 lines · Juergen Gross

With support for 32-bit pv guests gone pure pv-code no longer needs to test for highmem. Dropping those tests removes the need for flushing in some places.

with a suggestion

Quoted 5 lines
---
  arch/x86/xen/enlighten_pv.c |  11 ++-
  arch/x86/xen/mmu_pv.c       | 138 ++++++++++++++----------------------
  2 files changed, 57 insertions(+), 92 deletions(-)
Quoted 12 lines

arch/x86/xen/enlighten_pv.c static void set_aliased_prot(void *v, pgprot_t prot) · line 350

Quoted 9 lines
arch/x86/xen/enlighten_pv.c +1 -0
index 7d90b3da8bb4..9fec952f84f3 100644
@@ -347,6 +347,7 @@ static void set_aliased_prot(void *v, pgprot_t prot)
  	unsigned long pfn;
  	struct page *page;
  	unsigned char dummy;
+	void *av;

to rename this to va since you are modifying those lines anyway.

Yes.

Juergen

author maintainer
#11 lore raw

PATCH v3 4/7 x86/paravirt: remove 32-bit support from PARAVIRT_XXL

In reply to Juergen Gross

The last 32-bit user of stuff under CONFIG_PARAVIRT_XXL is gone.

Remove 32-bit specific parts.

---
 arch/x86/entry/vdso/vdso32/vclock_gettime.c |  1 +
 arch/x86/include/asm/paravirt.h             | 92 +++------------------
 arch/x86/include/asm/paravirt_types.h       | 21 -----
 arch/x86/include/asm/pgtable-3level_types.h |  5 --
 arch/x86/include/asm/segment.h              |  4 -
 arch/x86/kernel/cpu/common.c                |  8 --
 arch/x86/kernel/kprobes/core.c              |  1 -
 arch/x86/kernel/kprobes/opt.c               |  1 -
 arch/x86/kernel/paravirt.c                  | 18 ----
 arch/x86/kernel/paravirt_patch.c            | 17 ----
 arch/x86/xen/enlighten_pv.c                 |  6 --
 11 files changed, 13 insertions(+), 161 deletions(-)
arch/x86/entry/vdso/vdso32/vclock_gettime.c +1 -0
index 84a4a73f77f7..283ed9d00426 100644
@@ -14,6 +14,7 @@
 #undef CONFIG_ILLEGAL_POINTER_VALUE
 #undef CONFIG_SPARSEMEM_VMEMMAP
 #undef CONFIG_NR_CPUS
+#undef CONFIG_PARAVIRT_XXL
 
 #define CONFIG_X86_32 1
 #define CONFIG_PGTABLE_LEVELS 2
arch/x86/include/asm/paravirt.h +12 -80

184 lines not on this page · raw message

arch/x86/include/asm/paravirt_types.h +0 -21
index 8dfcb2508e6d..f27c3febaa6e 100644
@@ -68,12 +68,7 @@ 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;
@@ -126,9 +121,7 @@ struct pv_cpu_ops {
 	void (*set_ldt)(const void *desc, unsigned entries);
 	unsigned long (*store_tr)(void);
 	void (*load_tls)(struct thread_struct *t, unsigned int cpu);
-#ifdef CONFIG_X86_64
 	void (*load_gs_index)(unsigned int idx);
-#endif
 	void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
 				const void *desc);
 	void (*write_gdt_entry)(struct desc_struct *,
@@ -264,21 +257,11 @@ struct pv_mmu_ops {
 	struct paravirt_callee_save pgd_val;
 	struct paravirt_callee_save make_pgd;
 
-#if CONFIG_PGTABLE_LEVELS >= 3
-#ifdef CONFIG_X86_PAE
-	void (*set_pte_atomic)(pte_t *ptep, pte_t pteval);
-	void (*pte_clear)(struct mm_struct *mm, unsigned long addr,
-			  pte_t *ptep);
-	void (*pmd_clear)(pmd_t *pmdp);
-
-#endif	/* CONFIG_X86_PAE */
-
 	void (*set_pud)(pud_t *pudp, pud_t pudval);
 
 	struct paravirt_callee_save pmd_val;
 	struct paravirt_callee_save make_pmd;
 
-#if CONFIG_PGTABLE_LEVELS >= 4
 	struct paravirt_callee_save pud_val;
 	struct paravirt_callee_save make_pud;
 
@@ -291,10 +274,6 @@ struct pv_mmu_ops {
 	void (*set_pgd)(pgd_t *pgdp, pgd_t pgdval);
 #endif	/* CONFIG_PGTABLE_LEVELS >= 5 */
 
-#endif	/* CONFIG_PGTABLE_LEVELS >= 4 */
-
-#endif	/* CONFIG_PGTABLE_LEVELS >= 3 */
-
 	struct pv_lazy_ops lazy_mode;
 
 	/* dom0 ops */
arch/x86/include/asm/pgtable-3level_types.h +0 -5
index 80fbb4a9ed87..56baf43befb4 100644
@@ -20,12 +20,7 @@ typedef union {
 } pte_t;
 #endif	/* !__ASSEMBLY__ */
 
-#ifdef CONFIG_PARAVIRT_XXL
-#define SHARED_KERNEL_PMD	((!static_cpu_has(X86_FEATURE_PTI) &&	\
-				 (pv_info.shared_kernel_pmd)))
-#else
 #define SHARED_KERNEL_PMD	(!static_cpu_has(X86_FEATURE_PTI))
-#endif
 
 #define ARCH_PAGE_TABLE_SYNC_MASK	(SHARED_KERNEL_PMD ? 0 : PGTBL_PMD_MODIFIED)
 
arch/x86/include/asm/segment.h +0 -4
index 9646c300f128..517920928989 100644
@@ -222,10 +222,6 @@
 
 #endif
 
-#ifndef CONFIG_PARAVIRT_XXL
-# define get_kernel_rpl()		0
-#endif
-
 #define IDT_ENTRIES			256
 #define NUM_EXCEPTION_VECTORS		32
 
arch/x86/kernel/cpu/common.c +0 -8
index 965474d78cef..ca89cea31e81 100644
@@ -1412,15 +1412,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	 * ESPFIX issue, we can change this.
 	 */
 #ifdef CONFIG_X86_32
-# ifdef CONFIG_PARAVIRT_XXL
-	do {
-		extern void native_iret(void);
-		if (pv_ops.cpu.iret == native_iret)
-			set_cpu_bug(c, X86_BUG_ESPFIX);
-	} while (0);
-# else
 	set_cpu_bug(c, X86_BUG_ESPFIX);
-# endif
 #endif
 }
 
arch/x86/kernel/kprobes/core.c +0 -1
index fdadc37d72af..2ca10b770cff 100644
@@ -793,7 +793,6 @@ __used __visible void *trampoline_handler(struct pt_regs *regs)
 	/* fixup registers */
 	regs->cs = __KERNEL_CS;
 #ifdef CONFIG_X86_32
-	regs->cs |= get_kernel_rpl();
 	regs->gs = 0;
 #endif
 	/* We use pt_regs->sp for return address holder. */
arch/x86/kernel/kprobes/opt.c +0 -1
index 40f380461e6d..b8dd113a1284 100644
@@ -181,7 +181,6 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
 		/* Save skipped registers */
 		regs->cs = __KERNEL_CS;
 #ifdef CONFIG_X86_32
-		regs->cs |= get_kernel_rpl();
 		regs->gs = 0;
 #endif
 		regs->ip = (unsigned long)op->kp.addr + INT3_INSN_SIZE;
arch/x86/kernel/paravirt.c +0 -18
index de2138ba38e5..e56a144c13b3 100644
@@ -263,13 +263,8 @@ 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
 };
 
 /* 64-bit pagetable entries */
@@ -305,9 +300,7 @@ struct paravirt_patch_template pv_ops = {
 	.cpu.load_idt		= native_load_idt,
 	.cpu.store_tr		= native_store_tr,
 	.cpu.load_tls		= native_load_tls,
-#ifdef CONFIG_X86_64
 	.cpu.load_gs_index	= native_load_gs_index,
-#endif
 	.cpu.write_ldt_entry	= native_write_ldt_entry,
 	.cpu.write_gdt_entry	= native_write_gdt_entry,
 	.cpu.write_idt_entry	= native_write_idt_entry,
@@ -317,9 +310,7 @@ struct paravirt_patch_template pv_ops = {
 
 	.cpu.load_sp0		= native_load_sp0,
 
-#ifdef CONFIG_X86_64
 	.cpu.usergs_sysret64	= native_usergs_sysret64,
-#endif
 	.cpu.iret		= native_iret,
 	.cpu.swapgs		= native_swapgs,
 
@@ -375,18 +366,11 @@ struct paravirt_patch_template pv_ops = {
 	.mmu.ptep_modify_prot_start	= __ptep_modify_prot_start,
 	.mmu.ptep_modify_prot_commit	= __ptep_modify_prot_commit,
 
-#if CONFIG_PGTABLE_LEVELS >= 3
-#ifdef CONFIG_X86_PAE
-	.mmu.set_pte_atomic	= native_set_pte_atomic,
-	.mmu.pte_clear		= native_pte_clear,
-	.mmu.pmd_clear		= native_pmd_clear,
-#endif
 	.mmu.set_pud		= native_set_pud,
 
 	.mmu.pmd_val		= PTE_IDENT,
 	.mmu.make_pmd		= PTE_IDENT,
 
-#if CONFIG_PGTABLE_LEVELS >= 4
 	.mmu.pud_val		= PTE_IDENT,
 	.mmu.make_pud		= PTE_IDENT,
 
@@ -398,8 +382,6 @@ struct paravirt_patch_template pv_ops = {
 
 	.mmu.set_pgd		= native_set_pgd,
 #endif /* CONFIG_PGTABLE_LEVELS >= 5 */
-#endif /* CONFIG_PGTABLE_LEVELS >= 4 */
-#endif /* CONFIG_PGTABLE_LEVELS >= 3 */
 
 	.mmu.pte_val		= PTE_IDENT,
 	.mmu.pgd_val		= PTE_IDENT,
arch/x86/kernel/paravirt_patch.c +0 -17
index 3eff63c090d2..ace6e334cb39 100644
@@ -26,14 +26,10 @@ struct patch_xxl {
 	const unsigned char	mmu_read_cr3[3];
 	const unsigned char	mmu_write_cr3[3];
 	const unsigned char	irq_restore_fl[2];
-# ifdef CONFIG_X86_64
 	const unsigned char	cpu_wbinvd[2];
 	const unsigned char	cpu_usergs_sysret64[6];
 	const unsigned char	cpu_swapgs[3];
 	const unsigned char	mov64[3];
-# else
-	const unsigned char	cpu_iret[1];
-# endif
 };
 
 static const struct patch_xxl patch_data_xxl = {
@@ -42,7 +38,6 @@ static const struct patch_xxl patch_data_xxl = {
 	.irq_save_fl		= { 0x9c, 0x58 },	// pushf; pop %[re]ax
 	.mmu_read_cr2		= { 0x0f, 0x20, 0xd0 },	// mov %cr2, %[re]ax
 	.mmu_read_cr3		= { 0x0f, 0x20, 0xd8 },	// mov %cr3, %[re]ax
-# ifdef CONFIG_X86_64
 	.mmu_write_cr3		= { 0x0f, 0x22, 0xdf },	// mov %rdi, %cr3
 	.irq_restore_fl		= { 0x57, 0x9d },	// push %rdi; popfq
 	.cpu_wbinvd		= { 0x0f, 0x09 },	// wbinvd
@@ -50,19 +45,11 @@ static const struct patch_xxl patch_data_xxl = {
 				    0x48, 0x0f, 0x07 },	// swapgs; sysretq
 	.cpu_swapgs		= { 0x0f, 0x01, 0xf8 },	// swapgs
 	.mov64			= { 0x48, 0x89, 0xf8 },	// mov %rdi, %rax
-# else
-	.mmu_write_cr3		= { 0x0f, 0x22, 0xd8 },	// mov %eax, %cr3
-	.irq_restore_fl		= { 0x50, 0x9d },	// push %eax; popf
-	.cpu_iret		= { 0xcf },		// iret
-# endif
 };
 
 unsigned int paravirt_patch_ident_64(void *insn_buff, unsigned int len)
 {
-#ifdef CONFIG_X86_64
 	return PATCH(xxl, mov64, insn_buff, len);
-#endif
-	return 0;
 }
 # endif /* CONFIG_PARAVIRT_XXL */
 
@@ -98,13 +85,9 @@ unsigned int native_patch(u8 type, void *insn_buff, unsigned long addr,
 	PATCH_CASE(mmu, read_cr3, xxl, insn_buff, len);
 	PATCH_CASE(mmu, write_cr3, xxl, insn_buff, len);
 
-# ifdef CONFIG_X86_64
 	PATCH_CASE(cpu, usergs_sysret64, xxl, insn_buff, len);
 	PATCH_CASE(cpu, swapgs, xxl, insn_buff, len);
 	PATCH_CASE(cpu, wbinvd, xxl, insn_buff, len);
-# else
-	PATCH_CASE(cpu, iret, xxl, insn_buff, len);
-# endif
 #endif
 
 #ifdef CONFIG_PARAVIRT_SPINLOCKS
arch/x86/xen/enlighten_pv.c +0 -6
index 9fec952f84f3..b84d3d47082b 100644
@@ -1017,8 +1017,6 @@ void __init xen_setup_vcpu_info_placement(void)
 }
 
 static const struct pv_info xen_info __initconst = {
-	.shared_kernel_pmd = 0,
-
 	.extra_user_64bit_cs = FLAT_USER_CS64,
 	.name = "Xen",
 };
@@ -1317,10 +1315,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
 				   xen_start_info->nr_pages);
 	xen_reserve_special_pages();
 
-	/* keep using Xen gdt for now; no urgent need to change it */
-
-	pv_info.kernel_rpl = 0;
-
 	/* set the limit of our address space */
 	xen_reserve_top();
 
Signature · 1 line
2.26.2
#12 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

Quoted 15 lines · Juergen Gross
arch/x86/kernel/paravirt_patch.c +0 -4
-# else
-	const unsigned char	cpu_iret[1];
-# endif
 };
 
 static const struct patch_xxl patch_data_xxl = {
@@ -42,7 +38,6 @@ static const struct patch_xxl patch_data_xxl = {
 	.irq_save_fl		= { 0x9c, 0x58 },	// pushf; pop %[re]ax
 	.mmu_read_cr2		= { 0x0f, 0x20, 0xd0 },	// mov %cr2, %[re]ax
 	.mmu_read_cr3		= { 0x0f, 0x20, 0xd8 },	// mov %cr3, %[re]ax
-# ifdef CONFIG_X86_64
 	.mmu_write_cr3		= { 0x0f, 0x22, 0xdf },	// mov %rdi, %cr3
 	.irq_restore_fl		= { 0x57, 0x9d },	// push %rdi; popfq
 	.cpu_wbinvd		= { 0x0f, 0x09 },	// wbinvd

arch/x86/kernel/paravirt_patch.c static const struct patch_xxl patch_data_xxl = { · line 57

Quoted 8 lines
arch/x86/kernel/paravirt_patch.c +0 -5
@@ -50,19 +45,11 @@ static const struct patch_xxl patch_data_xxl = {
 				    0x48, 0x0f, 0x07 },	// swapgs; sysretq
 	.cpu_swapgs		= { 0x0f, 0x01, 0xf8 },	// swapgs
 	.mov64			= { 0x48, 0x89, 0xf8 },	// mov %rdi, %rax
-# else
-	.mmu_write_cr3		= { 0x0f, 0x22, 0xd8 },	// mov %eax, %cr3
-	.irq_restore_fl		= { 0x50, 0x9d },	// push %eax; popf
-	.cpu_iret		= { 0xcf },		// iret
-# endif

I was looking at x86_64 paravirt the other day and found we actually have pv_ops.cpu.iret users there..

So we want to change the above to also patch iret on x86_64 or do we need to fix x86_64 to not have pv-iret?
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author maintainer
#13 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

Quoted 20 lines · On 07.08.20 11:39, [email protected] wrote:
Quoted 18 lines · Juergen Gross
arch/x86/kernel/paravirt_patch.c +0 -4
-# else
-	const unsigned char	cpu_iret[1];
-# endif
  };
 
  static const struct patch_xxl patch_data_xxl = {
@@ -42,7 +38,6 @@ static const struct patch_xxl patch_data_xxl = {
  	.irq_save_fl		= { 0x9c, 0x58 },	// pushf; pop %[re]ax
  	.mmu_read_cr2		= { 0x0f, 0x20, 0xd0 },	// mov %cr2, %[re]ax
  	.mmu_read_cr3		= { 0x0f, 0x20, 0xd8 },	// mov %cr3, %[re]ax
-# ifdef CONFIG_X86_64
  	.mmu_write_cr3		= { 0x0f, 0x22, 0xdf },	// mov %rdi, %cr3
  	.irq_restore_fl		= { 0x57, 0x9d },	// push %rdi; popfq
  	.cpu_wbinvd		= { 0x0f, 0x09 },	// wbinvd
@@ -50,19 +45,11 @@ static const struct patch_xxl patch_data_xxl = {
  				    0x48, 0x0f, 0x07 },	// swapgs; sysretq
  	.cpu_swapgs		= { 0x0f, 0x01, 0xf8 },	// swapgs
  	.mov64			= { 0x48, 0x89, 0xf8 },	// mov %rdi, %rax
Quoted 8 lines

arch/x86/kernel/paravirt_patch.c static const struct patch_xxl patch_data_xxl = { · line 57

Quoted 5 lines
arch/x86/kernel/paravirt_patch.c +0 -5
-# else
-	.mmu_write_cr3		= { 0x0f, 0x22, 0xd8 },	// mov %eax, %cr3
-	.irq_restore_fl		= { 0x50, 0x9d },	// push %eax; popf
-	.cpu_iret		= { 0xcf },		// iret
-# endif

I was looking at x86_64 paravirt the other day and found we actually have pv_ops.cpu.iret users there..

On x86_64 we have (without PARAVIRT_XXL):

#define INTERRUPT_RETURN jmp native_iret

and with PARAVIRT_XXL this is basically a jmp *pv_ops.cpu.iret which will then be patched to either jmp native_iret or jmp xen_iret.

On x86_32 INTERRUPT_RETURN was just "iret" for the non-paravirt case. This is the reason for above dropping of the static patch data.

Quoted 2 lines

So we want to change the above to also patch iret on x86_64 or do we need to fix x86_64 to not have pv-iret?

We want it to stay how it is. This will let both variants (PARVIRT y/n) continue to work.

Juergen

#14 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

Quoted 29 lines · Jürgen Groß
Quoted 19 lines · On 07.08.20 11:39, [email protected] wrote:
Quoted 17 lines · Juergen Gross
arch/x86/kernel/paravirt_patch.c +0 -4
-# else
-	const unsigned char	cpu_iret[1];
-# endif
  };
  static const struct patch_xxl patch_data_xxl = {
@@ -42,7 +38,6 @@ static const struct patch_xxl patch_data_xxl = {
  	.irq_save_fl		= { 0x9c, 0x58 },	// pushf; pop %[re]ax
  	.mmu_read_cr2		= { 0x0f, 0x20, 0xd0 },	// mov %cr2, %[re]ax
  	.mmu_read_cr3		= { 0x0f, 0x20, 0xd8 },	// mov %cr3, %[re]ax
-# ifdef CONFIG_X86_64
  	.mmu_write_cr3		= { 0x0f, 0x22, 0xdf },	// mov %rdi, %cr3
  	.irq_restore_fl		= { 0x57, 0x9d },	// push %rdi; popfq
  	.cpu_wbinvd		= { 0x0f, 0x09 },	// wbinvd
@@ -50,19 +45,11 @@ static const struct patch_xxl patch_data_xxl = {
  				    0x48, 0x0f, 0x07 },	// swapgs; sysretq
  	.cpu_swapgs		= { 0x0f, 0x01, 0xf8 },	// swapgs
  	.mov64			= { 0x48, 0x89, 0xf8 },	// mov %rdi, %rax
Quoted 8 lines

arch/x86/kernel/paravirt_patch.c static const struct patch_xxl patch_data_xxl = { · line 57

Quoted 5 lines
arch/x86/kernel/paravirt_patch.c +0 -5
-# else
-	.mmu_write_cr3		= { 0x0f, 0x22, 0xd8 },	// mov %eax, %cr3
-	.irq_restore_fl		= { 0x50, 0x9d },	// push %eax; popf
-	.cpu_iret		= { 0xcf },		// iret
-# endif

I was looking at x86_64 paravirt the other day and found we actually have pv_ops.cpu.iret users there..

Quoted 6 lines

On x86_64 we have (without PARAVIRT_XXL):

#define INTERRUPT_RETURN jmp native_iret

and with PARAVIRT_XXL this is basically a jmp *pv_ops.cpu.iret which will then be patched to either jmp native_iret or jmp xen_iret.

Ah, okay. Clearly I didn't look hard enough. Thanks!
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#15 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

In reply to Juergen Gross

arch/x86/include/asm/paravirt.h static inline pte_t __pte(pteval_t val) · line 378

Quoted 11 lines · Juergen Gross
arch/x86/include/asm/paravirt.h +1 -4
@@ -377,10 +373,7 @@ static inline pte_t __pte(pteval_t val)
 {
 	pteval_t ret;
 
-	if (sizeof(pteval_t) > sizeof(long))
-		ret = PVOP_CALLEE2(pteval_t, mmu.make_pte, val, (u64)val >> 32);
-	else
-		ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
+	ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
 
 	return (pte_t) { .pte = ret };

Can this now simply return (pte_t) ret?

-boris

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author maintainer
#16 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

Quoted 11 lines · Boris Ostrovsky
Quoted 10 lines · Juergen Gross
arch/x86/include/asm/paravirt.h +1 -4
@@ -377,10 +373,7 @@ static inline pte_t __pte(pteval_t val)
  {
  	pteval_t ret;
 
-	if (sizeof(pteval_t) > sizeof(long))
-		ret = PVOP_CALLEE2(pteval_t, mmu.make_pte, val, (u64)val >> 32);
-	else
-		ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
+	ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
 
Quoted 4 lines

arch/x86/include/asm/paravirt.h static inline pte_t __pte(pteval_t val) · line 378

Quoted 1 line
arch/x86/include/asm/paravirt.h +0 -0
  	return (pte_t) { .pte = ret };

Can this now simply return (pte_t) ret?

I don't think so, but I can turn it into

  return native_make_pte(PVOP_CALLEE1(...));

Juergen

#17 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

Quoted 16 lines · Jürgen Groß
Quoted 14 lines · Boris Ostrovsky

arch/x86/include/asm/paravirt.h static inline pte_t __pte(pteval_t val) · line 378

Quoted 10 lines · Juergen Gross
arch/x86/include/asm/paravirt.h +1 -3
@@ -377,10 +373,7 @@ static inline pte_t __pte(pteval_t val)
   {
       pteval_t ret;
   -    if (sizeof(pteval_t) > sizeof(long))
-        ret = PVOP_CALLEE2(pteval_t, mmu.make_pte, val, (u64)val >>
 32);
-    else
-        ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
+    ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
         return (pte_t) { .pte = ret };

Can this now simply return (pte_t) ret?

Quoted 3 lines

I don't think so, but I can turn it into

  return native_make_pte(PVOP_CALLEE1(...));

I thought that since now this is only built for 64-bit we don't have to worry about different pte_t definitions and can do what we do for example, for __pgd()?

-boris

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author maintainer
#18 lore raw

Re: [PATCH v3 4/7] x86/paravirt: remove 32-bit support from PARAVIRT_XXL

Quoted 17 lines · Boris Ostrovsky
Quoted 16 lines · Jürgen Groß
Quoted 14 lines · Boris Ostrovsky

arch/x86/include/asm/paravirt.h static inline pte_t __pte(pteval_t val) · line 378

Quoted 10 lines · Juergen Gross
arch/x86/include/asm/paravirt.h +1 -3
@@ -377,10 +373,7 @@ static inline pte_t __pte(pteval_t val)
   {
       pteval_t ret;
   -    if (sizeof(pteval_t) > sizeof(long))
-        ret = PVOP_CALLEE2(pteval_t, mmu.make_pte, val, (u64)val >>
 32);
-    else
-        ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
+    ret = PVOP_CALLEE1(pteval_t, mmu.make_pte, val);
         return (pte_t) { .pte = ret };

Can this now simply return (pte_t) ret?

Quoted 8 lines
Quoted 3 lines

I don't think so, but I can turn it into

  return native_make_pte(PVOP_CALLEE1(...));

I thought that since now this is only built for 64-bit we don't have to worry about different pte_t definitions and can do what we do for example, for __pgd()?

Yes, I did that:

return (pte_t) { ret };

Juergen

author maintainer
#19 lore raw

PATCH v3 5/7 x86/paravirt: cleanup paravirt macros

In reply to Juergen Gross

Some paravirt macros are no longer used, delete them.

---
 arch/x86/include/asm/paravirt.h | 15 ---------------
 1 file changed, 15 deletions(-)
arch/x86/include/asm/paravirt.h +0 -15
index dedc89a07826..99da08852df0 100644
@@ -614,16 +614,9 @@ bool __raw_callee_save___native_vcpu_is_preempted(long cpu);
 #endif /* SMP && PARAVIRT_SPINLOCKS */
 
 #ifdef CONFIG_X86_32
-#define PV_SAVE_REGS "pushl %ecx; pushl %edx;"
-#define PV_RESTORE_REGS "popl %edx; popl %ecx;"
-
 /* save and restore all caller-save registers, except return value */
 #define PV_SAVE_ALL_CALLER_REGS		"pushl %ecx;"
 #define PV_RESTORE_ALL_CALLER_REGS	"popl  %ecx;"
-
-#define PV_FLAGS_ARG "0"
-#define PV_EXTRA_CLOBBERS
-#define PV_VEXTRA_CLOBBERS
 #else
 /* save and restore all caller-save registers, except return value */
 #define PV_SAVE_ALL_CALLER_REGS						\
@@ -644,14 +637,6 @@ bool __raw_callee_save___native_vcpu_is_preempted(long cpu);
 	"pop %rsi;"							\
 	"pop %rdx;"							\
 	"pop %rcx;"
-
-/* We save some registers, but all of them, that's too much. We clobber all
- * caller saved registers but the argument parameter */
-#define PV_SAVE_REGS "pushq %%rdi;"
-#define PV_RESTORE_REGS "popq %%rdi;"
-#define PV_EXTRA_CLOBBERS EXTRA_CLOBBERS, "rcx" , "rdx", "rsi"
-#define PV_VEXTRA_CLOBBERS EXTRA_CLOBBERS, "rdi", "rcx" , "rdx", "rsi"
-#define PV_FLAGS_ARG "D"
 #endif
 
 /*
Signature · 6 lines
2.26.2

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
author maintainer
#20 lore raw

PATCH v3 6/7 x86/paravirt: use CONFIG_PARAVIRT_XXL instead of CONFIG_PARAVIRT

In reply to Juergen Gross

There are some code parts using CONFIG_PARAVIRT for Xen pvops related issues instead of the more stringent CONFIG_PARAVIRT_XXL.

---
 arch/x86/entry/entry_64.S                | 4 ++--
 arch/x86/include/asm/fixmap.h            | 2 +-
 arch/x86/include/asm/required-features.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/entry/entry_64.S +2 -2
index 70dea9337816..26fc9b42fadc 100644
@@ -46,13 +46,13 @@
 .code64
 .section .entry.text, "ax"
 
-#ifdef CONFIG_PARAVIRT
+#ifdef CONFIG_PARAVIRT_XXL
 SYM_CODE_START(native_usergs_sysret64)
 	UNWIND_HINT_EMPTY
 	swapgs
 	sysretq
 SYM_CODE_END(native_usergs_sysret64)
-#endif /* CONFIG_PARAVIRT */
+#endif /* CONFIG_PARAVIRT_XXL */
 
 /*
  * 64-bit SYSCALL instruction entry. Up to 6 arguments in registers.
arch/x86/include/asm/fixmap.h +1 -1
index b9527a54db99..f1422ada4ffe 100644
@@ -99,7 +99,7 @@ enum fixed_addresses {
 	FIX_PCIE_MCFG,
 #endif
 #endif
-#ifdef CONFIG_PARAVIRT
+#ifdef CONFIG_PARAVIRT_XXL
 	FIX_PARAVIRT_BOOTMAP,
 #endif
 #ifdef	CONFIG_X86_INTEL_MID
arch/x86/include/asm/required-features.h +1 -1
index 6847d85400a8..3ff0d48469f2 100644
@@ -54,7 +54,7 @@
 #endif
 
 #ifdef CONFIG_X86_64
-#ifdef CONFIG_PARAVIRT
+#ifdef CONFIG_PARAVIRT_XXL
 /* Paravirtualized systems may not have PSE or PGE available */
 #define NEED_PSE	0
 #define NEED_PGE	0
Signature · 1 line
2.26.2
author maintainer
#21 lore raw

PATCH v3 7/7 x86/entry/32: revert "Fix XEN_PV build dependency"

In reply to Juergen Gross

With 32-bit Xen PV support gone commit a4c0e91d1d65bc58 ("x86/entry/32: Fix XEN_PV build dependency") can be reverted again.

---
 arch/x86/include/asm/idtentry.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/idtentry.h +2 -2
index a43366191212..337dcfd45472 100644
@@ -547,7 +547,7 @@ DECLARE_IDTENTRY_RAW(X86_TRAP_MC,	exc_machine_check);
 
 /* NMI */
 DECLARE_IDTENTRY_NMI(X86_TRAP_NMI,	exc_nmi);
-#if defined(CONFIG_XEN_PV) && defined(CONFIG_X86_64)
+#ifdef CONFIG_XEN_PV
 DECLARE_IDTENTRY_RAW(X86_TRAP_NMI,	xenpv_exc_nmi);
 #endif
 
@@ -557,7 +557,7 @@ DECLARE_IDTENTRY_DEBUG(X86_TRAP_DB,	exc_debug);
 #else
 DECLARE_IDTENTRY_RAW(X86_TRAP_DB,	exc_debug);
 #endif
-#if defined(CONFIG_XEN_PV) && defined(CONFIG_X86_64)
+#ifdef CONFIG_XEN_PV
 DECLARE_IDTENTRY_RAW(X86_TRAP_DB,	xenpv_exc_debug);
 #endif
 
Signature · 1 line
2.26.2