xen+x86: misc fixes
Subsystems (2)
PATCH 1/1 xen+x86: misc fixes
Hi Ingo,
This series is just some small miscellaneous x86 and Xen fixes. There's nothing urgent here.
PATCH 1/1 xen: use hypercall rather than clts
Xen will trap and emulate clts, but its better to use a hypercall. Also, xenner doesn't handle clts.
--- arch/x86/xen/enlighten.c | 28 ++++++++++++++++++++++++++-- include/asm-x86/xen/hypercall.h | 7 +++++++ 2 files changed, 33 insertions(+), 2 deletions(-)
arch/x86/xen/enlighten.c +26 -2
@@ -607,6 +607,30 @@xen_mc_issue (PARAVIRT_LAZY_MMU ); } +static void xen_clts (void ) +{ +struct multicall_space mcs; + + mcs =xen_mc_entry (0 ); + +MULTI_fpu_taskswitch (mcs.mc,0 ); + +xen_mc_issue (PARAVIRT_LAZY_CPU ); +} + +static void xen_write_cr0 (unsigned long cr0) +{ +struct multicall_space mcs; + +/* Only pay attention to cr0.TS; everything else is +ignored. */ + mcs =xen_mc_entry (0 ); + +MULTI_fpu_taskswitch (mcs.mc, (cr0 &X86_CR0_TS ) !=0 ); + +xen_mc_issue (PARAVIRT_LAZY_CPU ); +} +static void xen_write_cr2 (unsigned long cr2) {x86_read_percpu (xen_vcpu)->arch.cr2 = cr2;
@@ -978,10 +1002,10 @@ .set_debugreg = xen_set_debugreg, .get_debugreg = xen_get_debugreg, - .clts = native_clts, + .clts = xen_clts, .read_cr0 = native_read_cr0, - .write_cr0 = native_write_cr0, + .write_cr0 = xen_write_cr0, .read_cr4 = native_read_cr4, .read_cr4_safe = native_read_cr4_safe,
include/asm-x86/xen/hypercall.h +7 -0
@@ -315,6 +315,13 @@ }static inline void +MULTI_fpu_taskswitch (struct multicall_entry *mcl,int set) +{ + mcl->op = __HYPERVISOR_fpu_taskswitch; + mcl->args[0 ] = set; +} + +static inline void MULTI_update_va_mapping (struct multicall_entry *mcl,unsigned long va,pte_t new_val,unsigned long flags) {
PATCH 1/1 xen: allow some cr4 updates
In reply to Jeremy FitzhardingeThe guest can legitimately change things like cr4.OSFXSR and OSXMMEXCPT, so let it.
--- arch/x86/xen/enlighten.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/xen/enlighten.c +4 -2
@@ -648,8 +648,10 @@static void xen_write_cr4 (unsigned long cr4) { -/* Just ignore cr4 changes; Xen doesn't allow us to do -anything anyway. */ + cr4 &= ~X86_CR4_PGE ; + cr4 &= ~X86_CR4_PSE ; + +native_write_cr4 (cr4); }static unsigned long xen_read_cr3 (void )
PATCH 1/1 xen: don't worry about preempt during xen_irq_enable()
In reply to Jeremy FitzhardingeWhen enabling interrupts, we don't need to worry about preemption, because we either enter with interrupts disabled - so no preemption - or the caller is confused and is re-enabling interrupts on some indeterminate processor.
--- arch/x86/xen/enlighten.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/xen/enlighten.c +5 -5
@@ -235,13 +235,13 @@ {struct vcpu_info *vcpu; -/* There's a one instruction preempt window here. We need to -make sure we're don't switch CPUs between getting the vcpu -pointer and updating the mask. */ -preempt_disable (); +/* We don't need to worry about being preempted here, since +either a) interrupts are disabled, so no preemption, or b) +the caller is confused and is trying to re-enable interrupts +on an indeterminate processor. */ + vcpu =x86_read_percpu (xen_vcpu); vcpu->evtchn_upcall_mask =0 ; -preempt_enable_no_resched ();/* Doesn't matter if we get preempted here, because any pending event will get dealt with anyway. */
PATCH 1/1 x86: use symbolic constant in stts()
In reply to Jeremy Fitzhardinge--- include/asm-x86/system.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-x86/system.h +1 -1
@@ -293,7 +293,7 @@#endif /* CONFIG_PARAVIRT */ -#define stts () write_cr0(8 | read_cr0()) +#define stts () write_cr0(read_cr0() | X86_CR0_TS)#endif /* __KERNEL__ */
PATCH 1/1 xen: use new sched_op
In reply to Jeremy FitzhardingeUse the new sched_op hypercall, mainly because xenner doesn't support the old one.
--- arch/x86/xen/enlighten.c | 6 ++++-- include/asm-x86/xen/hypercall.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/x86/xen/enlighten.c +4 -2
@@ -254,7 +254,7 @@static void xen_safe_halt (void ) {/* Blocking includes an implicit local_irq_enable(). */ -if (HYPERVISOR_sched_op (SCHEDOP_block,0 ) !=0 ) +if (HYPERVISOR_sched_op (SCHEDOP_block,NULL ) !=0 )BUG (); }
@@ -1139,11 +1139,13 @@static void xen_reboot (int reason) { +struct sched_shutdown r = { .reason = reason }; +#ifdef CONFIG_SMP smp_send_stop ();#endif -if (HYPERVISOR_sched_op (SCHEDOP_shutdown, reason)) +if (HYPERVISOR_sched_op (SCHEDOP_shutdown, &r))BUG (); }
include/asm-x86/xen/hypercall.h +2 -2
@@ -176,9 +176,9 @@ }static inline int -HYPERVISOR_sched_op (int cmd,unsigned long arg) +HYPERVISOR_sched_op (int cmd,void *arg) { -return _hypercall2 (int, sched_op, cmd, arg); +return _hypercall2 (int, sched_op_new, cmd, arg); } static inline long