xen/24157-x86-xstate-init.patch
Charles Arnold ac6e56e6d7 - Upstream patches from Jan
23900-xzalloc.patch
  24144-cpufreq-turbo-crash.patch
  24148-shadow-pgt-dying-op-performance.patch
  24155-x86-ioapic-EOI-after-migration.patch
  24156-x86-ioapic-shared-vectors.patch
  24157-x86-xstate-init.patch
  24168-x86-vioapic-clear-remote_irr.patch

- submit fixes for bnc#649209 and bnc#711892
  xl-create-pv-with-qcow2-img.patch
  update suspend_evtchn_lock.patch
 

- Update trace.c, merge patches from upstream
  23050-xentrace_dynamic_tracebuffer_allocation.patch
  23091-xentrace_fix_t_info_pages_calculation..patch
  23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch
  23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch
  23094-xentrace_update_comments.patch
  23095-xentrace_use_consistent_printk_prefix.patch
  23128-xentrace_correct_formula_to_calculate_t_info_pages.patch
  23129-xentrace_remove_unneeded_debug_printk.patch
  23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch
  23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch
  23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch
  23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch
  23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch
  23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=160
2011-11-28 19:34:40 +00:00

97 lines
2.8 KiB
Diff

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321604565 -3600
# Node ID 7b5e1cb94bfa43a9268479b9a255fb88c07e4ce2
# Parent f29b5bd6e25fd78409baa5461914c67065f7579f
x86/xsave: provide guests with finit-like environment
Without the use of xsave, guests get their initial floating point
environment set up with finit. At least NetWare actually depends on
this (in particular on all exceptions being masked), so to be
consistent set the same environment also when using xsave. This is
also in line with all SSE exceptions getting masked initially.
To avoid further fragile casts in xstate_alloc_save_area() the patch
also changes xsave_struct's fpu_see member to have actually usable
fields.
The patch was tested in its technically identical, but modified-file-
wise different 4.1.2 version.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Charles Arnold <carnold@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -92,11 +92,14 @@ void setup_fpu(struct vcpu *v)
v->fpu_dirtied = 1;
}
+#define FCW_DEFAULT 0x037f
+#define MXCSR_DEFAULT 0x1f80
+
static void init_fpu(void)
{
asm volatile ( "fninit" );
if ( cpu_has_xmm )
- load_mxcsr(0x1f80);
+ load_mxcsr(MXCSR_DEFAULT);
}
void save_init_fpu(struct vcpu *v)
@@ -287,7 +290,7 @@ void xsave_init(void)
int xsave_alloc_save_area(struct vcpu *v)
{
- void *save_area;
+ struct xsave_struct *save_area;
if ( !cpu_has_xsave || is_idle_vcpu(v) )
return 0;
@@ -300,8 +303,9 @@ int xsave_alloc_save_area(struct vcpu *v
return -ENOMEM;
memset(save_area, 0, xsave_cntxt_size);
- ((u32 *)save_area)[6] = 0x1f80; /* MXCSR */
- *(uint64_t *)(save_area + 512) = XSTATE_FP_SSE; /* XSETBV */
+ save_area->fpu_sse.fcw = FCW_DEFAULT;
+ save_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
+ save_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
v->arch.xsave_area = save_area;
v->arch.xcr0 = XSTATE_FP_SSE;
--- a/xen/include/asm-x86/i387.h
+++ b/xen/include/asm-x86/i387.h
@@ -37,7 +37,29 @@ bool_t xsave_enabled(const struct vcpu *
struct xsave_struct
{
- struct { char x[512]; } fpu_sse; /* FPU/MMX, SSE */
+ union { /* FPU/MMX, SSE */
+ char x[512];
+ struct {
+ uint16_t fcw;
+ uint16_t fsw;
+ uint8_t ftw;
+ uint8_t rsvd1;
+ uint16_t fop;
+ union {
+#ifdef __x86_64__
+ uint64_t addr;
+#endif
+ struct {
+ uint32_t offs;
+ uint16_t sel;
+ uint16_t rsvd;
+ };
+ } fip, fdp;
+ uint32_t mxcsr;
+ uint32_t mxcsr_mask;
+ /* data registers follow here */
+ };
+ } fpu_sse;
struct {
u64 xstate_bv;