From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760276AbbCDI11 (ORCPT ); Wed, 4 Mar 2015 03:27:27 -0500 Received: from numascale.com ([213.162.240.84]:35666 "EHLO numascale.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758198AbbCDI1W (ORCPT ); Wed, 4 Mar 2015 03:27:22 -0500 Message-ID: <54F6C1E0.4060706@numascale.com> Date: Wed, 04 Mar 2015 16:27:12 +0800 From: Daniel J Blueman Organization: Numascale AS User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Quentin Casasnovas , Steffen Persvold , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH] x86: Unbreak early processor microcode loading References: <1425395444-20969-1-git-send-email-daniel@numascale.com> <20150303163836.GC25768@pd.tnic> In-Reply-To: <20150303163836.GC25768@pd.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel21.proisp.no X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - numascale.com X-Get-Message-Sender-Via: cpanel21.proisp.no: authenticated_id: daniel@numascale.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/03/2015 00:38, Borislav Petkov wrote: > On Tue, Mar 03, 2015 at 11:10:44PM +0800, Daniel J Blueman wrote: >> The changes in 871b72dd "x86: microcode: use smp_call_function_single instead >> of set_cpus_allowed, cleanup of synchronization logic" introduced a check >> that prevents built-in microcode from being loaded before init starts. >> >> Conditionalise it on early microcode loading, so we get the expected behaviour >> when early microcode loading is enabled, and when it is not. This has potential >> importance as BIOSes often don't load the current microcode. > > ... probably because they don't have it. Which is also the main reason > for the existence of this microcode loader btw :) > >> >> Signed-off-by: Daniel J Blueman >> --- >> arch/x86/kernel/cpu/microcode/core.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c >> index 36a8361..fa7f9fc 100644 >> --- a/arch/x86/kernel/cpu/microcode/core.c >> +++ b/arch/x86/kernel/cpu/microcode/core.c >> @@ -391,9 +391,11 @@ static enum ucode_state microcode_init_cpu(int cpu, bool refresh_fw) >> if (collect_cpu_info(cpu)) >> return UCODE_ERROR; >> >> +#if !defined(CONFIG_MICROCODE_AMD_EARLY) && !defined(CONFIG_MICROCODE_INTEL_EARLY) >> /* --dimm. Trigger a delayed update? */ >> if (system_state != SYSTEM_RUNNING) >> return UCODE_NFOUND; >> +#endif > > Ok, let me try to understand this correctly: where is this microcode > built in, into the kernel? > > If yes, you should consider enabling the early loading > method and build in the microcode into the initrd, see > Documentation/x86/early-microcode.txt > > This is the preferred method as we're applying the microcode much > earlier. > > Back to you. Yes, it's built into the kernel with config: CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_EXTRA_FIRMWARE="amd-ucode/microcode_amd.bin amd-ucode/microcode_amd_fam15h.bin" CONFIG_EXTRA_FIRMWARE_DIR="../firmware" That's as some customer and in-house environments we use are initramfs-less and some we don't have direct control over the initramfs. I don't see why built-in microcode loading shouldn't work, so I guess the question is, why was that 'system_state .. RUNNING' check introduced? If just a cleanup and loading built-in microcode early was overlooked, it may be reasonable to conditionalise the check like so. Thanks, Daniel