x86 fixes
Subsystems (4)
Linus,
Please pull the latest x86-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
# HEAD: bba42affa732d6fd5bd5c9678e6deacde2de1547 x86/mm: Fix dump_pagetables with Xen PV
Misc fixes: a pkeys fix for a bug that triggers with weird BIOS settings, and two Xen PV fixes: a paravirt interface fix, and pagetable dumping fix.
Thanks,
Ingo
------------------>
Juergen Gross (2):
x86/ioperm: Add new paravirt function update_io_bitmap() x86/mm: Fix dump_pagetables with Xen PV
Sean Christopherson (1):
x86/pkeys: Manually set X86_FEATURE_OSPKE to preserve existing changes
arch/x86/include/asm/io_bitmap.h | 9 ++++++++- arch/x86/include/asm/paravirt.h | 7 +++++++ arch/x86/include/asm/paravirt_types.h | 4 ++++ arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/paravirt.c | 5 +++++ arch/x86/kernel/process.c | 2 +- arch/x86/mm/dump_pagetables.c | 7 +------ arch/x86/xen/enlighten_pv.c | 25 +++++++++++++++++++++++++ 8 files changed, 52 insertions(+), 9 deletions(-)
arch/x86/include/asm/io_bitmap.h +8 -1
@@ -19,7 +19,14 @@ struct task_struct;void io_bitmap_share (struct task_struct *tsk);void io_bitmap_exit (void ); -void tss_update_io_bitmap (void ); +void native_tss_update_io_bitmap (void ); + +#ifdef CONFIG_PARAVIRT_XXL +#include <asm/paravirt.h> +#else +#define tss_update_io_bitmap native_tss_update_io_bitmap +#endif +#else static inline void io_bitmap_share (struct task_struct *tsk) { }static inline void io_bitmap_exit (void ) { }
arch/x86/include/asm/paravirt.h +7 -0
@@ -295,6 +295,13 @@ static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)PVOP_VCALL3 (cpu.write_idt_entry, dt, entry, g); } +#ifdef CONFIG_X86_IOPL_IOPERM +static inline void tss_update_io_bitmap (void ) +{ +PVOP_VCALL0 (cpu.update_io_bitmap); +} +#endif +static inline void paravirt_activate_mm (struct mm_struct *prev,struct mm_struct *next) {
arch/x86/include/asm/paravirt_types.h +4 -0
@@ -140,6 +140,10 @@ struct pv_cpu_ops {void (*load_sp0)(unsigned long sp0); +#ifdef CONFIG_X86_IOPL_IOPERM +void (*update_io_bitmap)(void ); +#endif +void (*wbinvd)(void );/* cpuid emulation, mostly so that caps bits can be disabled */
arch/x86/kernel/cpu/common.c +1 -1
@@ -445,7 +445,7 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c)* cpuid bit to be set. We need to ensure that we * update that bit in this CPU's "cpu_info". */ -get_cpu_cap (c); +set_cpu_cap (c,X86_FEATURE_OSPKE ); }#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
arch/x86/kernel/paravirt.c +5 -0
@@ -30,6 +30,7 @@#include <asm/timer.h> #include <asm/special_insns.h> #include <asm/tlb.h> +#include <asm/io_bitmap.h> /* * nop stub, which must not clobber anything *including the stack* to
@@ -341,6 +342,10 @@ struct paravirt_patch_template pv_ops = { .cpu.iret = native_iret, .cpu.swapgs = native_swapgs, +#ifdef CONFIG_X86_IOPL_IOPERM + .cpu.update_io_bitmap = native_tss_update_io_bitmap, +#endif + .cpu.start_context_switch = paravirt_nop, .cpu.end_context_switch = paravirt_nop,
arch/x86/kernel/process.c +1 -1
@@ -374,7 +374,7 @@ static void tss_copy_io_bitmap(struct tss_struct *tss, struct io_bitmap *iobm)/** * tss_update_io_bitmap - Update I/O bitmap before exiting to usermode */ -void tss_update_io_bitmap (void ) +void native_tss_update_io_bitmap (void ) {struct tss_struct *tss =this_cpu_ptr (&cpu_tss_rw);struct thread_struct *t = ¤t->thread;
arch/x86/mm/dump_pagetables.c +1 -6
@@ -363,13 +363,8 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, { const struct ptdump_range ptdump_ranges[] = {#ifdef CONFIG_X86_64 - -#define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1)) -#define normalize_addr (u) ((signed long)((u) << normalize_addr_shift) >> \ - normalize_addr_shift) - {0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2}, - {normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL}, + {GUARD_HOLE_END_ADDR, ~0UL}, #else {0, ~0UL}, #endif
arch/x86/xen/enlighten_pv.c +25 -0
@@ -72,6 +72,9 @@#include <asm/mwait.h> #include <asm/pci_x86.h> #include <asm/cpu.h> +#ifdef CONFIG_X86_IOPL_IOPERM +#include <asm/io_bitmap.h> +#endif #ifdef CONFIG_ACPI #include <linux/acpi.h>
@@ -837,6 +840,25 @@ static void xen_load_sp0(unsigned long sp0)this_cpu_write (cpu_tss_rw.x86_tss.sp0, sp0); } +#ifdef CONFIG_X86_IOPL_IOPERM +static void xen_update_io_bitmap (void ) +{ +struct physdev_set_iobitmap iobitmap; +struct tss_struct *tss =this_cpu_ptr (&cpu_tss_rw); + +native_tss_update_io_bitmap (); + + iobitmap.bitmap = (uint8_t *)(&tss->x86_tss) + + tss->x86_tss.io_bitmap_base; +if (tss->x86_tss.io_bitmap_base ==IO_BITMAP_OFFSET_INVALID ) + iobitmap.nr_ports =0 ; +else + iobitmap.nr_ports =IO_BITMAP_BITS ; + +HYPERVISOR_physdev_op (PHYSDEVOP_set_iobitmap, &iobitmap); +} +#endif +static void xen_io_delay (void ) { }
@@ -1047,6 +1069,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { .write_idt_entry = xen_write_idt_entry, .load_sp0 = xen_load_sp0, +#ifdef CONFIG_X86_IOPL_IOPERM + .update_io_bitmap = xen_update_io_bitmap, +#endif .io_delay = xen_io_delay,/* Xen takes care of %gs when switching to usermode for us */
The pull request you sent on Mon, 2 Mar 2020 09:49:54 +0100:
The pull request you sent on Mon, 2 Mar 2020 09:49:54 +0100:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitx86-urgent-for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/2873dc25477f483997c99981cf14b43a0d4f84d4
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker