From: Juergen Gross <jgross@suse.com>
To: Borislav Petkov <bp@suse.de>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: Can't boot as Xen dom0 due to commit fe055896
Date: Fri, 16 Dec 2016 08:28:46 +0100 [thread overview]
Message-ID: <e5ebe7f8-62ce-4306-c57f-f5622c05ed2d@suse.com> (raw)
In-Reply-To: <20161215173609.ornfok6lk5oro2pj@pd.tnic>
[-- Attachment #1: Type: text/plain, Size: 772 bytes --]
On 15/12/16 18:36, Borislav Petkov wrote:
> On Thu, Dec 15, 2016 at 12:27:49PM -0500, Boris Ostrovsky wrote:
>> It will probably fix it but I don't think we want this: it's a
>> build-time solution. Most kernels have XEN on even though they are
>> booted bare-metal.
>
> Lemme tell you want I want: a way to detect I'm running on xen. Does
> CPUID(4) work really early, at load_ucode_bsp() time?
>
> IOW, can I use some of the functionality hypervisor_cpuid_base() uses to
> detect xen and stop loading any further?
What you really need is to avoid being called on a Xen pv guest. And
this is easy by using xen_domain().
Not trying to load ucode in _any_ guest is an optimization only.
The attached patch works for me in dom0, bare metal and Xen HVM guest.
Juergen
[-- Attachment #2: 0001-x86-microcode-don-t-try-to-load-microcode-when-runni.patch --]
[-- Type: text/x-patch, Size: 1403 bytes --]
>From 0b56d1f86679c5dc435ab6d96eb2f68b666271bb Mon Sep 17 00:00:00 2001
From: Juergen Gross <jgross@suse.com>
Date: Fri, 16 Dec 2016 07:18:34 +0100
Subject: [PATCH] x86/microcode: don't try to load microcode when running as a
xen pv guest
As a Xen pv guest some mechanisms to do microcode loading or
verification might not work. As the hypervisor is responsible for
loading the microcode just skip microcode loading in case of running
under Xen.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/kernel/cpu/microcode/core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 6996413..8dfc8bd 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -32,6 +32,8 @@
#include <linux/fs.h>
#include <linux/mm.h>
+#include <xen/xen.h>
+
#include <asm/microcode_intel.h>
#include <asm/cpu_device_id.h>
#include <asm/microcode_amd.h>
@@ -91,6 +93,9 @@ static bool __init check_loader_disabled_bsp(void)
if (cmdline_find_option_bool(cmdline, option))
*res = true;
+ if (xen_domain())
+ *res = true;
+
return *res;
}
@@ -143,6 +148,9 @@ void __init load_ucode_bsp(void)
static bool check_loader_disabled_ap(void)
{
+ if (xen_domain())
+ return true;
+
#ifdef CONFIG_X86_32
return *((bool *)__pa_nodebug(&dis_ucode_ldr));
#else
--
2.10.2
next prev parent reply other threads:[~2016-12-16 7:28 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 16:12 Juergen Gross
2016-12-15 16:46 ` Borislav Petkov
2016-12-15 16:53 ` [Xen-devel] " Jan Beulich
2016-12-15 16:59 ` Andrew Cooper
2016-12-15 17:14 ` Borislav Petkov
2016-12-15 17:00 ` Boris Ostrovsky
2016-12-15 17:17 ` Borislav Petkov
2016-12-15 17:27 ` Boris Ostrovsky
2016-12-15 17:36 ` Borislav Petkov
2016-12-15 19:08 ` Boris Ostrovsky
2016-12-15 19:23 ` Borislav Petkov
2016-12-15 19:36 ` Boris Ostrovsky
2016-12-15 20:03 ` Borislav Petkov
2016-12-15 22:56 ` Boris Ostrovsky
2016-12-15 23:04 ` Borislav Petkov
2016-12-16 3:56 ` Boris Ostrovsky
2016-12-16 9:01 ` Borislav Petkov
2016-12-16 9:14 ` [Xen-devel] " Andrew Cooper
2016-12-16 4:14 ` Henrique de Moraes Holschuh
2016-12-16 7:28 ` Juergen Gross [this message]
2016-12-16 9:02 ` Borislav Petkov
2016-12-16 9:20 ` Juergen Gross
2016-12-16 9:43 ` Borislav Petkov
2016-12-16 10:00 ` Juergen Gross
2016-12-16 10:45 ` Borislav Petkov
2016-12-16 12:15 ` Juergen Gross
2016-12-16 12:19 ` Borislav Petkov
2016-12-16 13:07 ` Borislav Petkov
2016-12-16 14:40 ` Boris Ostrovsky
2016-12-16 15:17 ` Borislav Petkov
2016-12-15 17:06 ` Juergen Gross
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=e5ebe7f8-62ce-4306-c57f-f5622c05ed2d@suse.com \
--to=jgross@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®