From patchwork Wed Mar 23 16:36:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 8652181 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1ECE99F36E for ; Wed, 23 Mar 2016 17:01:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 26B84203C3 for ; Wed, 23 Mar 2016 17:01:54 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 74CF9203AB for ; Wed, 23 Mar 2016 17:01:51 +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 1aim8a-0005Jy-A4; Wed, 23 Mar 2016 17:00:04 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aim8Z-0005JR-CM for xen-devel@lists.xen.org; Wed, 23 Mar 2016 17:00:03 +0000 Received: from [193.109.254.147] by server-9.bemta-14.messagelabs.com id 85/FE-02984-29BC2F65; Wed, 23 Mar 2016 17:00:02 +0000 X-Env-Sender: prvs=883e14dc5=Andrew.Cooper3@citrix.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1458752400!32504128!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45380 invoked from network); 23 Mar 2016 17:00:02 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Mar 2016 17:00:02 -0000 X-IronPort-AV: E=Sophos;i="5.24,383,1454976000"; d="scan'208";a="341515133" From: Andrew Cooper To: Xen-devel Date: Wed, 23 Mar 2016 16:36:15 +0000 Message-ID: <1458750989-28967-13-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458750989-28967-1-git-send-email-andrew.cooper3@citrix.com> References: <1458750989-28967-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH v4 12/26] x86/cpu: Move set_cpumask() calls into c_early_init() 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before c/s 44e24f8567 "x86: don't call generic_identify() redundantly", the commandline-provided masks would take effect in Xen's view of the features. As the masks got applied after the query for features, the redundant call to generic_identify() would clobber the pre-masking feature information with the post-masking information. Move the set_cpumask() calls into c_early_init() so their effects take place before the main query for features in generic_identify(). The cpuid_mask_* command line parameters now limit the entire system, a feature XenServer was relying on for testing purposes. Subsequent changes will cause the mask MSRs to be context switched per-domain, removing the need to use the command line parameters for heterogeneous levelling purposes. Signed-off-by: Andrew Cooper Reviewed-by: Konrad Rzeszutek Wilk --- CC: Jan Beulich --- xen/arch/x86/cpu/amd.c | 8 ++++++-- xen/arch/x86/cpu/intel.c | 34 +++++++++++++++++----------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c index 47a38c6..5516777 100644 --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -407,6 +407,11 @@ static void amd_get_topology(struct cpuinfo_x86 *c) c->cpu_core_id); } +static void early_init_amd(struct cpuinfo_x86 *c) +{ + set_cpuidmask(c); +} + static void init_amd(struct cpuinfo_x86 *c) { u32 l, h; @@ -595,14 +600,13 @@ static void init_amd(struct cpuinfo_x86 *c) if ((smp_processor_id() == 1) && !cpu_has(c, X86_FEATURE_ITSC)) disable_c1_ramping(); - set_cpuidmask(c); - check_syscfg_dram_mod_en(); } static const struct cpu_dev amd_cpu_dev = { .c_vendor = "AMD", .c_ident = { "AuthenticAMD" }, + .c_early_init = early_init_amd, .c_init = init_amd, }; diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index bdf89f6..ad22375 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -189,6 +189,23 @@ static void early_init_intel(struct cpuinfo_x86 *c) if (boot_cpu_data.x86 == 0xF && boot_cpu_data.x86_model == 3 && (boot_cpu_data.x86_mask == 3 || boot_cpu_data.x86_mask == 4)) paddr_bits = 36; + + if (c == &boot_cpu_data && c->x86 == 6) { + if (probe_intel_cpuid_faulting()) + __set_bit(X86_FEATURE_CPUID_FAULTING, + c->x86_capability); + } else if (boot_cpu_has(X86_FEATURE_CPUID_FAULTING)) { + BUG_ON(!probe_intel_cpuid_faulting()); + __set_bit(X86_FEATURE_CPUID_FAULTING, c->x86_capability); + } + + if (!cpu_has_cpuid_faulting) + set_cpuidmask(c); + else if ((c == &boot_cpu_data) && + (~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx & + opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx & + opt_cpuid_mask_xsave_eax))) + printk("No CPUID feature masking support available\n"); } /* @@ -258,23 +275,6 @@ static void init_intel(struct cpuinfo_x86 *c) detect_ht(c); } - if (c == &boot_cpu_data && c->x86 == 6) { - if (probe_intel_cpuid_faulting()) - __set_bit(X86_FEATURE_CPUID_FAULTING, - c->x86_capability); - } else if (boot_cpu_has(X86_FEATURE_CPUID_FAULTING)) { - BUG_ON(!probe_intel_cpuid_faulting()); - __set_bit(X86_FEATURE_CPUID_FAULTING, c->x86_capability); - } - - if (!cpu_has_cpuid_faulting) - set_cpuidmask(c); - else if ((c == &boot_cpu_data) && - (~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx & - opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx & - opt_cpuid_mask_xsave_eax))) - printk("No CPUID feature masking support available\n"); - /* Work around errata */ Intel_errata_workarounds(c);