Home Home > GIT Browse > SLE11-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-06-08 15:32:47 +0200
committerJiri Kosina <jkosina@suse.cz>2018-06-08 15:32:47 +0200
commit840f2b9c88feefae3618c1881380b13be96e0234 (patch)
treec17276b6ff787ff295ff9cb2c6cfae1f275e1db1
parent03a7b12129e1154bf366b5a1b38617376ca0489d (diff)
parenta379559d2dbb44d4f881ac087f7a7cde9e06ec15 (diff)
Merge remote-tracking branch 'origin/users/jbeulich/SLE11-SP4/for-next' into SLE11-SP4
Pull xen fixes from Jan Beulich suse-commit: 865614d8b39e79d847261c2112758b32147f19fc
-rw-r--r--arch/x86/include/asm/thread_info.h2
-rw-r--r--arch/x86/kernel/cpu/bugs.c5
-rw-r--r--arch/x86/kernel/cpu/common-xen.c2
-rw-r--r--arch/x86/kernel/entry_64-xen.S2
-rw-r--r--arch/x86/kernel/process-xen.c33
-rw-r--r--arch/x86/kernel/traps-xen.c1
-rw-r--r--drivers/xen/balloon/balloon.c11
7 files changed, 49 insertions, 7 deletions
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 58dbed1eba8c..4a14c58cc04a 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -155,7 +155,7 @@ struct thread_info {
(_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP|_TIF_SSBD)
#else
-#define _TIF_WORK_CTXSW (_TIF_NOTSC /*todo | _TIF_BLOCKSTEP */)
+#define _TIF_WORK_CTXSW (_TIF_NOTSC /*todo | _TIF_BLOCKSTEP */ | _TIF_SSBD)
#endif
#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index cbac5034dc96..f0eaa2480d59 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -823,6 +823,11 @@ static void x86_amd_ssbd_disable(void)
{
u64 msrval = x86_amd_ls_cfg_base | x86_amd_ls_cfg_ssbd_mask;
+#ifdef CONFIG_XEN
+ if (x86_amd_ls_cfg_base & x86_amd_ls_cfg_ssbd_mask)
+ return;
+#endif
+
if (boot_cpu_has(X86_FEATURE_AMD_SSBD))
wrmsrl(MSR_AMD64_LS_CFG, msrval);
}
diff --git a/arch/x86/kernel/cpu/common-xen.c b/arch/x86/kernel/cpu/common-xen.c
index 78ecd7e55bd4..627ec4501533 100644
--- a/arch/x86/kernel/cpu/common-xen.c
+++ b/arch/x86/kernel/cpu/common-xen.c
@@ -1065,6 +1065,8 @@ void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c)
enable_sep_cpu();
#endif
mtrr_ap_init();
+
+ x86_spec_ctrl_setup_ap();
}
struct msr_range {
diff --git a/arch/x86/kernel/entry_64-xen.S b/arch/x86/kernel/entry_64-xen.S
index 981e04cbc96d..62710220e663 100644
--- a/arch/x86/kernel/entry_64-xen.S
+++ b/arch/x86/kernel/entry_64-xen.S
@@ -1183,7 +1183,7 @@ END(arch_unwind_init_running)
paranoidzeroentry_ist debug do_debug DEBUG_STACK
zeroentry nmi do_nmi_callback
-paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
+zeroentry int3 do_int3
errorentry stack_segment do_stack_segment
errorentry general_protection do_general_protection
errorentry page_fault do_page_fault
diff --git a/arch/x86/kernel/process-xen.c b/arch/x86/kernel/process-xen.c
index 589121c9da8b..197092c244f7 100644
--- a/arch/x86/kernel/process-xen.c
+++ b/arch/x86/kernel/process-xen.c
@@ -23,6 +23,7 @@
#include <asm/i387.h>
#include <asm/debugreg.h>
#include <asm/spec_ctrl.h>
+#include <asm/spec-ctrl.h>
#include <xen/evtchn.h>
struct kmem_cache *task_xstate_cachep;
@@ -193,9 +194,34 @@ int set_tsc_mode(unsigned int val)
return 0;
}
+static __always_inline void __speculative_store_bypass_update(int rds)
+{
+ u64 msr;
+
+ if (static_cpu_has(X86_FEATURE_AMD_SSBD)) {
+ msr = x86_amd_ls_cfg_base | ssbd_tif_to_amd_ls_cfg(rds);
+#ifdef CONFIG_XEN
+ /*
+ * At the moment Xen does not virtualize LS_CFG, and it
+ * unconditionally sets the flag in question (unless disabled).
+ * Avoid the MSR write when possible, as it triggers a (rate
+ * limited) hypervisor log message. (This could be further
+ * enhanced by also avoiding the write if the bit is fixed to
+ * zero, but that would be more involved. If any guest is to
+ * rely on the feature, Xen better had it enabled globally.)
+ */
+ if (!(x86_amd_ls_cfg_base & x86_amd_ls_cfg_ssbd_mask))
+#endif
+ wrmsrl(MSR_AMD64_LS_CFG, msr);
+ } else {
+ msr = x86_spec_ctrl_base | ssbd_tif_to_spec_ctrl(rds);
+ wrmsrl(MSR_IA32_SPEC_CTRL, msr);
+ }
+}
+
void speculative_store_bypass_update(void)
{
- /* Nothing to do for Xen here */
+ __speculative_store_bypass_update(current_thread_info()->flags);
}
void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p)
@@ -224,6 +250,11 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p)
else
hard_enable_TSC();
}
+
+ if (test_tsk_thread_flag(prev_p, TIF_SSBD) ^
+ test_tsk_thread_flag(next_p, TIF_SSBD))
+ __speculative_store_bypass_update(test_tsk_thread_flag(next_p, TIF_SSBD));
+
propagate_user_return_notify(prev_p, next_p);
}
diff --git a/arch/x86/kernel/traps-xen.c b/arch/x86/kernel/traps-xen.c
index 633945f4ed75..700fca2f7db7 100644
--- a/arch/x86/kernel/traps-xen.c
+++ b/arch/x86/kernel/traps-xen.c
@@ -471,7 +471,6 @@ void restart_nmi(void)
ignore_nmis--;
}
-/* May run on IST stack. */
dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code)
{
#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
diff --git a/drivers/xen/balloon/balloon.c b/drivers/xen/balloon/balloon.c
index 9fef56da85a7..46f1155cc80e 100644
--- a/drivers/xen/balloon/balloon.c
+++ b/drivers/xen/balloon/balloon.c
@@ -287,13 +287,18 @@ static int increase_reservation(unsigned long nr_pages)
page = balloon_first_page();
for (i = 0; i < nr_pages; i++) {
- BUG_ON(page == NULL);
- frame_list[i] = page_to_pfn(page);;
+ if (!page) {
+ if (i)
+ break;
+ rc = -ENXIO;
+ goto out;
+ }
+ frame_list[i] = page_to_pfn(page);
page = balloon_next_page(page);
}
set_xen_guest_handle(reservation.extent_start, frame_list);
- reservation.nr_extents = nr_pages;
+ reservation.nr_extents = i;
rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation);
if (rc < 0)
goto out;