All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Huang <wei.huang2@amd.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [Xen-4.0][PATCH] xsave: move xsave initialization code to a common place
Date: Mon, 24 Oct 2011 15:50:46 -0500	[thread overview]
Message-ID: <4EA5CFA6.2030808@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

Please apply this patch to xen-4.0 tree.


This patch moves xsave option setting and initilization to CPU common
file. Without this Xen would crash on __context_switch() on xsave-capable
AMD CPUs. The crash was due to cpu_has_xsave reports true in domain.c
while xsave space wasn't initialized. This patch is adopted from xen
upstream.

Signed-off-by: Wei Huang <wei.huang2@amd.com>



[-- Attachment #2: xen-4-xsave-init-code-path.txt --]
[-- Type: text/plain, Size: 2042 bytes --]

# HG changeset patch
# User Wei Huang <wei.huang2@amd.com>
# Date 1319469115 18000
# Branch patches
# Node ID c863dbcd714987ca8f1ab93ffbf61ea64b394f23
# Parent  71b96c0b083f3de46f566a406e0aee16a427950f
xsave: Move xsave initialization code to a common place

This patch moves xsave option setting and initilization to CPU common
file. Without this Xen would crash on __context_switch() on xsave-capable
AMD CPUs. The crash was due to cpu_has_xsave reports true in domain.c
while xsave space wasn't initialized. This patch is adopted from xen
upstream.

Signed-off-by: Wei Huang <wei.huang2@amd.com>

diff -r 71b96c0b083f -r c863dbcd7149 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c	Mon Oct 24 10:04:25 2011 -0500
+++ b/xen/arch/x86/cpu/common.c	Mon Oct 24 10:11:55 2011 -0500
@@ -22,6 +22,9 @@
 static int disable_x86_fxsr __cpuinitdata;
 static int disable_x86_serial_nr __cpuinitdata;
 
+static int use_xsave;
+boolean_param("xsave", use_xsave);
+
 struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {};
 
 /*
@@ -391,6 +394,13 @@
 	if (this_cpu->c_init)
 		this_cpu->c_init(c);
 
+        /* Initialize xsave/xrstor features */
+	if ( !use_xsave )
+		clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
+
+	if ( cpu_has_xsave )
+		xsave_init();
+
 	/* Disable the PN if appropriate */
 	squash_the_stupid_serial_number(c);
 
diff -r 71b96c0b083f -r c863dbcd7149 xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c	Mon Oct 24 10:04:25 2011 -0500
+++ b/xen/arch/x86/cpu/intel.c	Mon Oct 24 10:11:55 2011 -0500
@@ -30,9 +30,6 @@
 integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
 integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
 
-static int use_xsave;
-boolean_param("xsave", use_xsave);
-
 #ifdef CONFIG_X86_INTEL_USERCOPY
 /*
  * Alignment at which movsl is preferred for bulk memory copies.
@@ -219,12 +216,6 @@
 		set_bit(X86_FEATURE_ARAT, c->x86_capability);
 
 	start_vmx();
-
-	if ( !use_xsave )
-		clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
-
-	if ( cpu_has_xsave )
-		xsave_init();
 }
 
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2011-10-24 20:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA5CFA6.2030808@amd.com \
    --to=wei.huang2@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.