Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5428044imm; Tue, 12 Jun 2018 07:43:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLym8mbQ/eFkH6DOpOhoDBrZ7RenDQlFRNJ6r1ZZXiTg07feRBbJjxRRuZMf9Jd5df03/dy X-Received: by 2002:a63:7741:: with SMTP id s62-v6mr576478pgc.103.1528814638829; Tue, 12 Jun 2018 07:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528814638; cv=none; d=google.com; s=arc-20160816; b=SwriuJcnWvjnrDFvsWHLmhPw5Xjggu2ji6wVJIkEruuWq9+3ZTEU+zmyXhVP4CzVDx 2/b3SIEL2Q+3N7WXLniYAne/YN9+5UM7xvp1+RRZomfBiJ+jnflq/QqkMKBSQJE32Wm7 H3ULgt3x4e5139I6RpEu91UZWvb38W9eBvfDZu6gBrjj+rNpmdrefMHK/H9+AlQ/sOEw cQDT4mQ7TaP+R7mgbmnOQo3oaP3qr/sBTaojI62zLJOzjDp2xs0bpC/FZ83naZlUXNxx YXKSjdq8i6WqqXNCI7QQ6xszMQr9pIIToXUjRg6GtLlx+sqHtWVTJhPzeNr0OeASrw6A Z+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=kEN1Mzc8H+Z6UysbnT0wSNUGmzpJTlfhaAa9RimnztQ=; b=Hi2dIU0aKiYGPWMCZhb1p0cC+CVH00oozzLEezhZbWJ5I2g1ExG01BL+6wbzFQFkHG g0HINifpnQDyXB3ncMMjcGFPso3bFNdit4FzLmuVOVEZc7f8DBZSVFq2AcqA9zbQMWZA CAXbbbWd/8kP5Akg1fgM4RLGQFz63n4vG3wvB4glvQBjHjVx49/4DZZqZAI8S++LiFFB E4oDYU+qJhZO89KgToJe9GksWUetQO3HOpVs/hX/P7tntQWFj1HdmkEVJEGJ7dMQH8+2 bTe4+9XAJTiz0ZE4C965oaDaS66ntGHWgpNbfCiqHbsWGbDyaLOSyGpxqte9Kr9uq5V+ YLSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1-v6si237532pgb.187.2018.06.12.07.43.44; Tue, 12 Jun 2018 07:43:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934478AbeFLOl7 (ORCPT + 99 others); Tue, 12 Jun 2018 10:41:59 -0400 Received: from mga09.intel.com ([134.134.136.24]:45389 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934243AbeFLOj1 (ORCPT ); Tue, 12 Jun 2018 10:39:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2018 07:39:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,215,1526367600"; d="scan'208";a="48384955" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 12 Jun 2018 07:39:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 2E9A753F; Tue, 12 Jun 2018 17:39:21 +0300 (EEST) From: "Kirill A. Shutemov" To: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky Cc: Dave Hansen , Kai Huang , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" Subject: [PATCHv3 13/17] x86/mm: Detect MKTME early Date: Tue, 12 Jun 2018 17:39:11 +0300 Message-Id: <20180612143915.68065-14-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> References: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to know number of KeyIDs before KALSR is initialized. Number of KeyIDs would determinate how much address space would be needed for per-KeyID direct mapping. KALSR initialization happens before full CPU initizliation is complete. Move detect_tme() call to early_init_intel(). Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/cpu/intel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index fb58776513e6..3322b0125353 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -158,6 +158,8 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c) return false; } +static void detect_tme(struct cpuinfo_x86 *c); + static void early_init_intel(struct cpuinfo_x86 *c) { u64 misc_enable; @@ -301,6 +303,9 @@ static void early_init_intel(struct cpuinfo_x86 *c) } check_mpx_erratum(c); + + if (cpu_has(c, X86_FEATURE_TME)) + detect_tme(c); } #ifdef CONFIG_X86_32 @@ -762,9 +767,6 @@ static void init_intel(struct cpuinfo_x86 *c) if (cpu_has(c, X86_FEATURE_VMX)) detect_vmx_virtcap(c); - if (cpu_has(c, X86_FEATURE_TME)) - detect_tme(c); - init_intel_energy_perf(c); init_intel_misc_features(c); -- 2.17.1