From patchwork Fri Dec 16 09:02:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 9477585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DDC6F607EE for ; Fri, 16 Dec 2016 09:04:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA72227F9F for ; Fri, 16 Dec 2016 09:04:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCD362880D; Fri, 16 Dec 2016 09:04:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F86A27F9F for ; Fri, 16 Dec 2016 09:04:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHoPT-0003Fs-TB; Fri, 16 Dec 2016 09:02:35 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHoPR-0003Ff-Ue for xen-devel@lists.xenproject.org; Fri, 16 Dec 2016 09:02:34 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 5F/FC-01392-9ADA3585; Fri, 16 Dec 2016 09:02:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNIsWRWlGSWpSXmKPExsVyuP0Ov+6KtcE RBjvna1t83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmzn65iLJjBU3HvxwPWBsZJXF2MnBwSAkYS byf+Y+pi5OIQEljIKPHj91wWkISQQLpE47KrYDaLgKrEjQnnWEFsNgElid+f1rGD2CICyhIfW 3vZQZqZBWYwSuxZvISti5GDQ1jASmLz6zSQGl4BU4np2zczQyy4zCRx4e4+NoiEoMTJmU/AFj ALqEv8mXeJGaSXWUBaYvk/DoiwvETz1tlgYU4BG4kp7wJBwqICKhKzLs9hmcAoMAvJoFlIBs1 CGDQLyaAFjCyrGNWLU4vKUot0zfSSijLTM0pyEzNzdA0NjPVyU4uLE9NTcxKTivWS83M3MQID tp6BgXEH45U250OMkhxMSqK8XrnBEUJ8SfkplRmJxRnxRaU5qcWHGDU4OAQ2r119gVGKJS8/L 1VJgrdtDVCdYFFqempFWmYOMKZgSiU4eJREeO+BpHmLCxJzizPTIVKnGBWlxHmDQBICIImM0j y4NlgcX2KUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzLsTZApPZl4J3PRXQIuZgBZbzANbXJK IkJJqYNzW8O56VArX1Geblpxj/3Tp+AfXDTHaT1i+yvkk7qpIq4xeI73ElWMLz7XFP0Mf8610 nqqmdPiUZPZXvdy/906X75p+T3VnCV/yF/666UwX7VqfLc9M11h7gW/6n521d98sibS7Lq+xz 62Xn+td/YWtXse9bAqunrXxs1q/+obEbK5rM2OX6UgrsRRnJBpqMRcVJwIAI0cQ6N4CAAA= X-Env-Sender: bp@suse.de X-Msg-Ref: server-11.tower-31.messagelabs.com!1481878952!45562650!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11952 invoked from network); 16 Dec 2016 09:02:32 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-11.tower-31.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 16 Dec 2016 09:02:32 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 06077AAB9; Fri, 16 Dec 2016 09:02:32 +0000 (UTC) Received: by pd.tnic (Postfix, from userid 1000) id 418C0160EE6; Fri, 16 Dec 2016 10:02:28 +0100 (CET) Date: Fri, 16 Dec 2016 10:02:28 +0100 From: Borislav Petkov To: Juergen Gross Message-ID: <20161216090228.ri4alokiaagqtibt@pd.tnic> References: <73a4d64b-b139-6579-a560-92311641d6c7@suse.com> <20161215164635.thm7ruio2ddnxszw@pd.tnic> <20161215171755.xpfuax7a6q3jofet@pd.tnic> <20161215173609.ornfok6lk5oro2pj@pd.tnic> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161014 (1.7.1) Cc: xen-devel , Boris Ostrovsky , Linux Kernel Mailing List Subject: Re: [Xen-devel] Can't boot as Xen dom0 due to commit fe055896 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Dec 16, 2016 at 08:28:46AM +0100, Juergen Gross wrote: > Not trying to load ucode in _any_ guest is an optimization only. Does the hunk below work too? I don't want to do hypervisor-specific solutions. diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 6996413c78c3..54219f619205 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -76,6 +76,7 @@ struct cpu_info_ctx { static bool __init check_loader_disabled_bsp(void) { static const char *__dis_opt_str = "dis_ucode_ldr"; + u32 a, b, c, d; #ifdef CONFIG_X86_32 const char *cmdline = (const char *)__pa_nodebug(boot_command_line); @@ -91,6 +92,17 @@ static bool __init check_loader_disabled_bsp(void) if (cmdline_find_option_bool(cmdline, option)) *res = true; + if (!have_cpuid_p()) + *res = true; + + a = 1; + c = 0; + native_cpuid(&a, &b, &c, &d); + + /* CPUID(1).ECX[31]: reserved for hypervisor use */ + if (c & BIT(31)) + *res = true; + return *res; } @@ -121,9 +133,6 @@ void __init load_ucode_bsp(void) if (check_loader_disabled_bsp()) return; - if (!have_cpuid_p()) - return; - vendor = x86_cpuid_vendor(); family = x86_cpuid_family(); @@ -157,9 +166,6 @@ void load_ucode_ap(void) if (check_loader_disabled_ap()) return; - if (!have_cpuid_p()) - return; - vendor = x86_cpuid_vendor(); family = x86_cpuid_family();