All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/5] x86/CPU: Add native CPUID variants returning a single datum
Date: Mon,  9 Jan 2017 12:41:43 +0100	[thread overview]
Message-ID: <20170109114147.5082-2-bp@alien8.de> (raw)
In-Reply-To: <20170109114147.5082-1-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

... similarly to the cpuid_<reg>() variants.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/include/asm/processor.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index eaf100508c36..1be64da0384e 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -219,6 +219,24 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
 	    : "memory");
 }
 
+#define native_cpuid_reg(reg)					\
+static inline unsigned int native_cpuid_##reg(unsigned int op)	\
+{								\
+	unsigned int eax = op, ebx, ecx = 0, edx;		\
+								\
+	native_cpuid(&eax, &ebx, &ecx, &edx);			\
+								\
+	return reg;						\
+}
+
+/*
+ * Native CPUID functions returning a single datum.
+ */
+native_cpuid_reg(eax)
+native_cpuid_reg(ebx)
+native_cpuid_reg(ecx)
+native_cpuid_reg(edx)
+
 static inline void load_cr3(pgd_t *pgdir)
 {
 	write_cr3(__pa(pgdir));
-- 
2.11.0

  reply	other threads:[~2017-01-09 11:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 11:41 [PATCH 0/5] x86/microcode: More urgent fixes Borislav Petkov
2017-01-09 11:41 ` Borislav Petkov [this message]
2017-01-09 22:16   ` [tip:x86/urgent] x86/CPU: Add native CPUID variants returning a single datum tip-bot for Borislav Petkov
2017-01-10  0:19     ` hpa
2017-01-10  9:04       ` Borislav Petkov
2017-01-10 16:40         ` hpa
2017-01-10 17:09           ` Borislav Petkov
2017-01-09 11:41 ` [PATCH 2/5] x86/microcode: Use native CPUID to tickle out microcode revision Borislav Petkov
2017-01-09 22:16   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2017-01-09 11:41 ` [PATCH 3/5] x86/microcode/intel: Add a helper which gives the " Borislav Petkov
2017-01-09 22:17   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2017-01-09 11:41 ` [PATCH 4/5] x86/microcode/intel: Fix allocation size of struct ucode_patch Borislav Petkov
2017-01-09 11:41 ` [PATCH 5/5] x86/microcode/intel: Use correct buffer size for saving microcode data Borislav Petkov

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=20170109114147.5082-2-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.