linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Boris Ostrovsky <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, jgross@suse.com, tglx@linutronix.de,
	boris.ostrovsky@oracle.com, mingo@kernel.org, bp@suse.de,
	linux-kernel@vger.kernel.org
Subject: [tip:x86/urgent] x86/microcode/AMD: Use native_cpuid() in load_ucode_amd_bsp()
Date: Mon, 19 Dec 2016 01:56:53 -0800	[thread overview]
Message-ID: <tip-2b4c91569a40c4512ea1b413e0c817d179ce9868@git.kernel.org> (raw)
In-Reply-To: <20161218164414.9649-5-bp@alien8.de>

Commit-ID:  2b4c91569a40c4512ea1b413e0c817d179ce9868
Gitweb:     http://git.kernel.org/tip/2b4c91569a40c4512ea1b413e0c817d179ce9868
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Sun, 18 Dec 2016 17:44:14 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 19 Dec 2016 10:46:20 +0100

x86/microcode/AMD: Use native_cpuid() in load_ucode_amd_bsp()

When CONFIG_PARAVIRT is selected, cpuid() becomes a call. Since
for 32-bit kernels load_ucode_amd_bsp() is executed before paging
is enabled the call cannot be completed (as kernel virtual addresses
are not reachable yet).

Use native_cpuid() instead which is an asm wrapper for the CPUID
instruction.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Jürgen Gross <jgross@suse.com>
Link: http://lkml.kernel.org/r/1481906392-3847-1-git-send-email-boris.ostrovsky@oracle.com
Link: http://lkml.kernel.org/r/20161218164414.9649-5-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/cpu/microcode/amd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index dc80acf..6a31e26 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -301,6 +301,7 @@ static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
 void __init load_ucode_amd_bsp(unsigned int family)
 {
 	struct ucode_cpu_info *uci;
+	u32 eax, ebx, ecx, edx;
 	struct cpio_data cp;
 	const char *path;
 	bool use_pa;
@@ -322,7 +323,10 @@ void __init load_ucode_amd_bsp(unsigned int family)
 		return;
 
 	/* Get BSP's CPUID.EAX(1), needed in load_microcode_amd() */
-	uci->cpu_sig.sig = cpuid_eax(1);
+	eax = 1;
+	ecx = 0;
+	native_cpuid(&eax, &ebx, &ecx, &edx);
+	uci->cpu_sig.sig = eax;
 
 	apply_microcode_early_amd(cp.data, cp.size, true, NULL);
 }

  reply	other threads:[~2016-12-19  9:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 16:44 [PATCH 0/4] x86/microcode: Some 4.10 fixes Borislav Petkov
2016-12-18 16:44 ` [PATCH 1/4] x86/microcode/AMD: Make find_proper_container() sane again Borislav Petkov
2016-12-19  9:55   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2016-12-18 16:44 ` [PATCH 2/4] x86/microcode/AMD: Sanitize apply_microcode_early_amd() Borislav Petkov
2016-12-19  9:55   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2016-12-18 16:44 ` [PATCH 3/4] x86/microcode/AMD: Do not load when running on a hypervisor Borislav Petkov
2016-12-19  9:56   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2016-12-18 16:44 ` [PATCH 4/4] x86/microcode/AMD: Use native_cpuid() in load_ucode_amd_bsp() Borislav Petkov
2016-12-19  9:56   ` tip-bot for Boris Ostrovsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-12-16 16:39 [PATCH] x86/microcode: " Boris Ostrovsky
2016-12-16 16:37 ` 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=tip-2b4c91569a40c4512ea1b413e0c817d179ce9868@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).