From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761715AbcLRQoU (ORCPT ); Sun, 18 Dec 2016 11:44:20 -0500 Received: from mail.skyhub.de ([78.46.96.112]:54815 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754491AbcLRQoR (ORCPT ); Sun, 18 Dec 2016 11:44:17 -0500 From: Borislav Petkov To: X86 ML Cc: Boris Ostrovsky , =?UTF-8?q?J=C3=BCrgen=20Gross?= , LKML Subject: [PATCH 4/4] x86/microcode/AMD: Use native_cpuid() in load_ucode_amd_bsp() Date: Sun, 18 Dec 2016 17:44:14 +0100 Message-Id: <20161218164414.9649-5-bp@alien8.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161218164414.9649-1-bp@alien8.de> References: <20161218164414.9649-1-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boris Ostrovsky 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 Cc: Jürgen Gross Cc: x86-ml Link: http://lkml.kernel.org/r/1481906392-3847-1-git-send-email-boris.ostrovsky@oracle.com Signed-off-by: Borislav Petkov --- 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 dc80acfa922d..6a31e2691f3a 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); } -- 2.11.0