mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Fenghua Yu" <fenghua.yu@intel.com>
To: "H. Peter Anvin" <hpa@linux.intel.com>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Asit K Mallick" <asit.k.mallick@intel.com>
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>,
	"x86" <x86@kernel.org>, "Fenghua Yu" <fenghua.yu@intel.com>
Subject: [PATCH 03/15] x86/alternative: Add alternative_input_2
Date: Mon, 26 May 2014 10:01:10 -0700	[thread overview]
Message-ID: <1401123682-5384-4-git-send-email-fenghua.yu@intel.com> (raw)
In-Reply-To: <1401123682-5384-1-git-send-email-fenghua.yu@intel.com>

From: Fenghua Yu <fenghua.yu@intel.com>

Add alternative_input_2 to take two features and respective instructions.

If CPU has feature2, newinstr2 is used.

Otherwise, if CPU has feature1, newinstr1 is used.

Otherwise, oldinstr is used.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 arch/x86/include/asm/alternative.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 0a3f9c9..eb8d80b 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -161,6 +161,19 @@ static inline int alternatives_text_reserved(void *start, void *end)
 	asm volatile (ALTERNATIVE(oldinstr, newinstr, feature)		\
 		: : "i" (0), ## input)
 
+/*
+ * Like alternative_input, but there are two features and respective
+ * instructions.
+ * If CPU has feature2, newinstr2 is used.
+ * Otherwise, if CPU has feature1, newinstr1 is used.
+ * Otherwise, oldinstr is used.
+ */
+#define alternative_input_2(oldinstr, newinstr1, feature1, newinstr2,	     \
+			   feature2, input...)				     \
+	asm volatile(ALTERNATIVE_2(oldinstr, newinstr1, feature1,	     \
+		newinstr2, feature2)					     \
+		: : "i" (0), ## input)
+
 /* Like alternative_input, but with a single output argument */
 #define alternative_io(oldinstr, newinstr, feature, output, input...)	\
 	asm volatile (ALTERNATIVE(oldinstr, newinstr, feature)		\
-- 
1.8.1.2


  parent reply	other threads:[~2014-05-26 17:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 17:01 [PATCH 0/15] x86/xsaves: Optimize xstate context switch by xsaves/xrstors Fenghua Yu
2014-05-26 17:01 ` [PATCH 01/15] x86/xsaves: Detect xsaves/xrstors feature Fenghua Yu
2014-05-26 17:01 ` [PATCH 02/15] x86/xsaves: Add kernel parameter to disable xsaves/xrstors Fenghua Yu
2014-05-26 17:01 ` Fenghua Yu [this message]
2014-05-26 17:01 ` [PATCH 04/15] x86/xsaves: Change compacted format xsave area header Fenghua Yu
2014-05-26 17:01 ` [PATCH 05/15] x86/xsaves: Define macros for xsave instructions Fenghua Yu
2014-05-26 17:01 ` [PATCH 06/15] x86/xsaves: Define macro for handle xsave/xrstor fault Fenghua Yu
2014-05-26 17:01 ` [PATCH 07/15] x86/xsaves: Use xsaves/xrstors for saving and restoring xsave area Fenghua Yu
2014-05-26 17:01 ` [PATCH 08/15] x86/xsaves: Use xsaves/xrstors for context switch Fenghua Yu
2014-05-26 17:01 ` [PATCH 09/15] x86/xsaves: Use xsave/xrstor for saving and restoring user space context Fenghua Yu
2014-05-26 17:01 ` [PATCH 10/15] x86/xsaves: Clear reserved bits in xsave header Fenghua Yu
2014-05-26 17:01 ` [PATCH 11/15] x86/xsaves: Add xsaves and xrstors support for booting time Fenghua Yu
2014-05-26 17:01 ` [PATCH 12/15] x86/xsaves: Save xstate to task's xsave area in __save_fpu during " Fenghua Yu
2014-05-26 17:01 ` [PATCH 13/15] x86/xsaves: Call booting time xsaves and xrstors in setup_init_fpu_buf Fenghua Yu
2014-05-26 17:01 ` [PATCH 14/15] x86/xsaves: Enable xsaves/xrstors Fenghua Yu
2014-05-26 17:01 ` [PATCH 15/15] Define kernel API to get address of each state in xsave area Fenghua Yu
2014-05-26 19:37 ` [PATCH 0/15] x86/xsaves: Optimize xstate context switch by xsaves/xrstors Andy Lutomirski
2014-05-26 20:13   ` Yu, Fenghua
2014-05-26 20:53     ` H. Peter Anvin
2014-05-26 21:40     ` Andy Lutomirski
2014-05-26 21:47       ` H. Peter Anvin

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=1401123682-5384-4-git-send-email-fenghua.yu@intel.com \
    --to=fenghua.yu@intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --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®