From: Zhenzhong Duan Date: Thu, 26 Jun 2014 09:18:23 +0000 (+0800) Subject: xen/microcode: Use dummy microcode_ops for non initial domain guest X-Git-Tag: v4.1.12-92~327^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cae15066089715fd10b03687283f47c7083c08ae;p=users%2Fjedix%2Flinux-maple.git xen/microcode: Use dummy microcode_ops for non initial domain guest Orabug: 19053626 Currently non initial domain guest use Intel or AMD specific ops. This will also slow up the startup on heavily overcommited guests (say 256VCPUs on 20 PCPU), as there are many read and write to x86 MSR registers which will trap to xen during microcode update. Finally it will fail and report errors. A dummy ops could fix that and also make udevd silent (bug18379824) by augmenting the commit c18a317f6892536851e5852b6aaa4ef42cbc11a2 "xen/microcode: Only load under initial domain." which fell short of its intended fix. Signed-off-by: Zhenzhong Duan Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Guangyu Sun (cherry picked from commit 62b84234f23c1020c690d162b7d8250042425e1e) Signed-off-by: Konrad Rzeszutek Wilk Conflicts: arch/x86/kernel/microcode_core.c --- diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 38186572bfcd8..805603100b1e8 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c @@ -546,7 +546,7 @@ static int __init microcode_init(void) struct cpuinfo_x86 *c = &cpu_data(0); int error; - if (xen_pv_domain()) + if (xen_domain()) microcode_ops = init_xen_microcode(); else if (c->x86_vendor == X86_VENDOR_INTEL) microcode_ops = init_intel_microcode(); diff --git a/arch/x86/kernel/microcode_xen.c b/arch/x86/kernel/microcode_xen.c index 34f2a3a6b7dd7..29ae2215b6f1a 100644 --- a/arch/x86/kernel/microcode_xen.c +++ b/arch/x86/kernel/microcode_xen.c @@ -194,9 +194,38 @@ static struct microcode_ops microcode_xen_ops = { .microcode_fini_cpu = xen_microcode_fini_cpu, }; +static int dummy_xen_microcode_update(int cpu) +{ + return 0; +} + +static enum ucode_state dummy_xen_request_microcode_fw(int cpu, struct device *device) +{ + return UCODE_OK; +} + +static enum ucode_state dummy_xen_request_microcode_user(int cpu, + const void __user *buf, size_t size) +{ + return UCODE_OK; +} + +static void dummy_xen_microcode_fini_cpu(int cpu) +{ +} + +static struct microcode_ops microcode_dummy_xen_ops = { + .request_microcode_user = dummy_xen_request_microcode_user, + .request_microcode_fw = dummy_xen_request_microcode_fw, + .collect_cpu_info = xen_collect_cpu_info, + .apply_microcode = dummy_xen_microcode_update, + .microcode_fini_cpu = dummy_xen_microcode_fini_cpu, +}; + struct microcode_ops * __init init_xen_microcode(void) { - if (!xen_initial_domain()) - return NULL; - return µcode_xen_ops; + if (xen_initial_domain()) + return µcode_xen_ops; + else + return µcode_dummy_xen_ops; }