From: Borislav Petkov <bp@alien8.de>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
X86 ML <x86@kernel.org>,
david.e.box@intel.com, Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Lv Zheng <lv.zheng@intel.com>, Jan Beulich <JBeulich@suse.com>,
"H. Peter Anvin" <hpa@zytor.com>,
qiuxishi@huawei.com, cocci@systeme.lip6.fr,
Xen Devel <xen-devel@lists.xensource.com>,
Joerg Roedel <joro@8bytes.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Robert Moore <robert.moore@intel.com>,
Ingo Molnar <mingo@redhat.com>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Thomas Gleixner <tglx@linutronix.de>,
mcb30@ipxe.org, Juergen Gross <jgross@suse.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
"Luis R. Rodriguez" <mcgrof@kernel.org>,
long.wan
Subject: Re: [Xen-devel] [PATCH v2 3/3] paravirt: rename paravirt_enabled to paravirt_legacy
Date: Mon, 8 Feb 2016 17:35:26 +0100 [thread overview]
Message-ID: <20160208163526.GI28980@pd.tnic> (raw)
In-Reply-To: <56B8C2C8.8050406@oracle.com>
On Mon, Feb 08, 2016 at 11:31:04AM -0500, Boris Ostrovsky wrote:
> I think we are OK for PV because this code will be executed after pvops are
> set and so we will be calling xen_cpuid().
Not for the early loader - it is too early for pvops then. So you're
saying something like that won't work?
---
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
index 055ea9941dd5..f3e563e8b5c3 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -56,9 +56,11 @@ extern const struct hypervisor_x86 x86_hyper_kvm;
extern void init_hypervisor(struct cpuinfo_x86 *c);
extern void init_hypervisor_platform(void);
extern bool hypervisor_x2apic_available(void);
+bool is_xen_hypervisor(void);
#else
static inline void init_hypervisor(struct cpuinfo_x86 *c) { }
static inline void init_hypervisor_platform(void) { }
static inline bool hypervisor_x2apic_available(void) { return false; }
+static inline bool is_xen_hypervisor(void) { return false; }
#endif /* CONFIG_HYPERVISOR_GUEST */
#endif /* _ASM_X86_HYPERVISOR_H */
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index d820d8eae96b..bda29017f946 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -85,3 +85,24 @@ bool __init hypervisor_x2apic_available(void)
x86_hyper->x2apic_available &&
x86_hyper->x2apic_available();
}
+
+bool is_xen_hypervisor(void)
+{
+ u32 eax, ebx, ecx, edx;
+
+ eax = 0x4000000;
+ ecx = 0;
+ native_cpuid(&eax, &ebx, &ecx, &edx);
+
+ if (ebx == 0x566e6558 && ecx == 0x65584d4d && edx == 0x4d4d566e)
+ return true;
+
+ eax = 0x40000100;
+ ecx = 0;
+ native_cpuid(&eax, &ebx, &ecx, &edx);
+
+ if (ebx == 0x566e6558 && ecx == 0x65584d4d && edx == 0x4d4d566e)
+ return true;
+
+ return false;
+}
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index cea8552e2b3a..0a941ff8095c 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -35,6 +35,7 @@
#include <asm/microcode_intel.h>
#include <asm/cpu_device_id.h>
#include <asm/microcode_amd.h>
+#include <asm/hypervisor.h>
#include <asm/perf_event.h>
#include <asm/microcode.h>
#include <asm/processor.h>
@@ -86,7 +87,7 @@ static bool __init check_loader_disabled_bsp(void)
bool *res = &dis_ucode_ldr;
#endif
- if (cmdline_find_option_bool(cmdline, option))
+ if (cmdline_find_option_bool(cmdline, option) || is_xen_hypervisor())
*res = true;
return *res;
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
next prev parent reply other threads:[~2016-02-08 16:35 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-06 4:30 [PATCH v2 0/3] paravirt: rebrand paravirt_enabled as paravirt_legacy Luis R. Rodriguez
2016-02-06 4:30 ` [PATCH v2 1/3] paravirt: use bool for paravirt_enabled() and paravirt_has_feature() Luis R. Rodriguez
2016-02-06 4:30 ` [PATCH v2 2/3] paravirt: replace direct access to pv_info.paravirt_enabled Luis R. Rodriguez
2016-02-06 4:30 ` [PATCH v2 3/3] paravirt: rename paravirt_enabled to paravirt_legacy Luis R. Rodriguez
2016-02-06 7:11 ` Andy Lutomirski
2016-02-06 8:59 ` Luis R. Rodriguez
2016-02-06 20:05 ` Andy Lutomirski
2016-02-06 22:04 ` Borislav Petkov
2016-02-08 15:39 ` Boris Ostrovsky
2016-02-08 15:55 ` Borislav Petkov
2016-02-08 16:05 ` [Xen-devel] " Andrew Cooper
2016-02-08 16:12 ` Boris Ostrovsky
2016-02-08 16:26 ` Andrew Cooper
2016-02-08 16:31 ` Boris Ostrovsky
2016-02-08 16:32 ` Andrew Cooper
2016-02-08 16:35 ` Borislav Petkov [this message]
2016-02-08 16:38 ` Andrew Cooper
2016-02-08 16:45 ` Borislav Petkov
2016-02-08 16:52 ` Boris Ostrovsky
2016-02-08 20:45 ` Boris Ostrovsky
2016-02-08 21:06 ` Borislav Petkov
2016-02-08 16:53 ` Andrew Cooper
2016-02-08 17:13 ` Borislav Petkov
2016-02-09 6:22 ` Luis R. Rodriguez
2016-02-08 16:41 ` Boris Ostrovsky
2016-02-08 16:52 ` Borislav Petkov
2016-02-08 15:31 ` Boris Ostrovsky
2016-02-08 15:46 ` Borislav Petkov
2016-02-09 6:59 ` Luis R. Rodriguez
2016-02-08 21:04 ` Andy Lutomirski
2016-02-09 7:06 ` Luis R. Rodriguez
2016-02-17 20:07 ` Luis R. Rodriguez
2016-02-17 20:49 ` Borislav Petkov
2016-02-17 21:12 ` Luis R. Rodriguez
2016-02-17 21:21 ` Boris Ostrovsky
2016-02-17 22:03 ` Borislav Petkov
2016-02-17 22:18 ` Andy Lutomirski
2016-02-17 22:39 ` Boris Ostrovsky
2016-02-17 23:39 ` Borislav Petkov
2016-02-17 22:19 ` Boris Ostrovsky
2016-02-17 22:35 ` Luis R. Rodriguez
2016-02-09 6:41 ` Luis R. Rodriguez
2016-02-08 21:49 ` Boris Ostrovsky
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=20160208163526.GI28980@pd.tnic \
--to=bp@alien8.de \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=aryabinin@virtuozzo.com \
--cc=boris.ostrovsky@oracle.com \
--cc=cocci@systeme.lip6.fr \
--cc=david.e.box@intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=lv.zheng@intel.com \
--cc=mcb30@ipxe.org \
--cc=mcgrof@kernel.org \
--cc=mcgrof@suse.com \
--cc=mchehab@osg.samsung.com \
--cc=mingo@redhat.com \
--cc=qiuxishi@huawei.com \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=rusty@rustcorp.com.au \
--cc=ryabinin.a.a@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
/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).