mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: linux-kernel@vger.kernel.org
Cc: Dave Hansen <dave@sr71.net>,
	dave.hansen@linux.intel.com, x86@kernel.org,
	fenghua.yu@intel.com, bp@alien8.de, oleg@redhat.com,
	luto@amacapital.net
Subject: [PATCH 1/2] x86, fpu: use kvm definition of compaction bit and make it generic
Date: Tue, 28 Apr 2015 10:00:09 -0700	[thread overview]
Message-ID: <20150428170009.3965F03E@viggo.jf.intel.com> (raw)


From: Dave Hansen <dave.hansen@linux.intel.com>

We will use this in non-KVM code in the next patch.

Note that we are also renaming the macro.  It is not really
an 'XSTATE' like would go in XSTATE_BV, or be used as part
of the "instruction mask".  It goes in XCOMP_BV, so make
that explicit in the name.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
---

 b/arch/x86/include/asm/xsave.h |    2 ++
 b/arch/x86/kvm/x86.c           |    7 +++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff -puN arch/x86/include/asm/xsave.h~x86-fpu-take-kvm-def-and-make-generic arch/x86/include/asm/xsave.h
--- a/arch/x86/include/asm/xsave.h~x86-fpu-take-kvm-def-and-make-generic	2015-04-28 09:15:28.503683137 -0700
+++ b/arch/x86/include/asm/xsave.h	2015-04-28 09:15:28.522683994 -0700
@@ -38,6 +38,8 @@
 /* All currently supported features */
 #define XCNTXT_MASK	(XSTATE_LAZY | XSTATE_EAGER)
 
+#define XCOMP_BV_COMPACTION_ENABLED (1ULL << 63)
+
 #ifdef CONFIG_X86_64
 #define REX_PREFIX	"0x48, "
 #else
diff -puN arch/x86/kvm/x86.c~x86-fpu-take-kvm-def-and-make-generic arch/x86/kvm/x86.c
--- a/arch/x86/kvm/x86.c~x86-fpu-take-kvm-def-and-make-generic	2015-04-28 09:15:28.508683362 -0700
+++ b/arch/x86/kvm/x86.c	2015-04-28 09:15:28.534684535 -0700
@@ -3169,8 +3169,6 @@ static int kvm_vcpu_ioctl_x86_set_debugr
 	return 0;
 }
 
-#define XSTATE_COMPACTION_ENABLED (1ULL << 63)
-
 static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu)
 {
 	struct xsave_struct *xsave = &vcpu->arch.guest_fpu.state->xsave;
@@ -3222,7 +3220,8 @@ static void load_xsave(struct kvm_vcpu *
 	/* Set XSTATE_BV and possibly XCOMP_BV.  */
 	xsave->xsave_hdr.xstate_bv = xstate_bv;
 	if (cpu_has_xsaves)
-		xsave->xsave_hdr.xcomp_bv = host_xcr0 | XSTATE_COMPACTION_ENABLED;
+		xsave->xsave_hdr.xcomp_bv =
+			host_xcr0 | XCOMP_BV_COMPACTION_ENABLED;
 
 	/*
 	 * Copy each region from the non-compacted offset to the
@@ -6992,7 +6991,7 @@ int fx_init(struct kvm_vcpu *vcpu)
 	fpu_finit(&vcpu->arch.guest_fpu);
 	if (cpu_has_xsaves)
 		vcpu->arch.guest_fpu.state->xsave.xsave_hdr.xcomp_bv =
-			host_xcr0 | XSTATE_COMPACTION_ENABLED;
+			host_xcr0 | XCOMP_BV_COMPACTION_ENABLED;
 
 	/*
 	 * Ensure guest xcr0 is valid for loading
_

             reply	other threads:[~2015-04-28 17:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 17:00 Dave Hansen [this message]
2015-04-28 17:00 ` [PATCH 2/2] x86, fpu: fix boot time GPF with eagerfpu=off Dave Hansen

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=20150428170009.3965F03E@viggo.jf.intel.com \
    --to=dave@sr71.net \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®