Message ID | 20230914044805.301390-22-xin3.li@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp492830vqi; Thu, 14 Sep 2023 10:04:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYcviojPcNp77++w2vgQpfYTbF5rtuyAI8taYO+fJ/w3KYEHxeHD4a2UH+XyR6eUf46fwq X-Received: by 2002:a05:6a21:7748:b0:14b:3681:567e with SMTP id bc8-20020a056a21774800b0014b3681567emr5815268pzc.29.1694711062799; Thu, 14 Sep 2023 10:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694711062; cv=none; d=google.com; s=arc-20160816; b=nb2fdhVK9+81Q06cuXQ773soIeCEmx2oSw9AlW3E9QXrGmYu3u8P6NpZd6IAXnjuTN hybf2CMDs40sVivajMrkPYTlCJ6jRgFZNF1TMCbJwm/E2/ic6orWqoQ46TlrnWzg4qMf tzm7cBLf2EaZEF3jfCCnNBUDhXHxqxvb5X4xlKNJWEMSY2bFxKW3arVWjh10LCU9HHId r0l0zTbAuTAuMJ+WMQSuLf9S1YdaB2K+IM8SkofiydDO/OUCmNXVSEd43VSilw6YvZUX 56EFKz0tOAiTHsqn22CEgBlgOsuXWi/xXRAhJTdQVplampDIsv8Nq7PySvjPvcAUR0zB T9Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LCRDflOv8BGvouMz/P/NOgPdmMAO4XsG/D55UB1KVew=; fh=jqCbnajAXgJ+s7A1aA7DOHJD13/+EpD442pw8d+Ofss=; b=VLSKXXuw/n49qlW7X8CTjycSxRehg40AFyMwNQbzXHmqqZIh6yAWg0nk4NGqjErAW8 UDW61JmFVgy2p2CVeJMnJ+BFb0Byc5jRQqUzdTmoe8EVZ+tWo25iDYczi+/ipNhNKm/5 5FfbFLGxs2xBfMxTOaEiQ4bu7ceYyKsD+OiMDvnekQGg2OVacLegStsckAS51Kh4G/+j gxybMtfPvv+H81XkhpcW03XuJl5kDcDBpQuq9Ah9QdeM1hWydpW7BgUsttPvJzir0gek xqJU7QR/AIuczRX1wfQj1gWKKHqIRg4ohGpY+hyiDz+Rmd53IRppc1lcCyIenhjv6S5l aV1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c91nZfFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id bx25-20020a056a02051900b00573fc12065csi2043623pgb.242.2023.09.14.10.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c91nZfFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 12DBF85C4D6B; Wed, 13 Sep 2023 22:20:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234768AbjINFUI (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 01:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235124AbjINFT3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 01:19:29 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF25E1BD4; Wed, 13 Sep 2023 22:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694668761; x=1726204761; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=daicXFK30tmpTUp95RTD2ZQAe5K9xY8zuW1WSEbSaqA=; b=c91nZfFofOZKNdKrmUhQGL3nbvAwZhFXJyaEsMh+EWgPagnwj67J7ibY AmDAhHQG5z+A5fZxH6K6e89v7f3v62GSgMsjwN4vrOoIFdKrTaE3sTROY g6ncn/XW0XPwrolGq8g3y/2qCSaZLgV68/tjYeAHzaxhjqwkKHq+hH1tf GdopUPAphxt+gLtd5p6NIII77ZJHAz9DRqCaagaqCp9UOdyfooS6m/UHU Hhq6ev4aSvWBYPJn3k2/lEwAdBOHGR9SQxIwSGMU4vE0EsCVr/b8DgdSh LyYc5J+4G8Pe8XMcudmF838Ycq8Uz/Haeed/n9HqxjS3roqG5H1T1Egxu Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="382661341" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="382661341" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 22:17:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="779488802" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="779488802" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga001.jf.intel.com with ESMTP; 13 Sep 2023 22:17:39 -0700 From: Xin Li <xin3.li@intel.com> To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, pbonzini@redhat.com, seanjc@google.com, peterz@infradead.org, jgross@suse.com, ravi.v.shankar@intel.com, mhiramat@kernel.org, andrew.cooper3@citrix.com, jiangshanlai@gmail.com Subject: [PATCH v10 21/38] x86/fred: No ESPFIX needed when FRED is enabled Date: Wed, 13 Sep 2023 21:47:48 -0700 Message-Id: <20230914044805.301390-22-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914044805.301390-1-xin3.li@intel.com> References: <20230914044805.301390-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 22:20:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777033347553890307 X-GMAIL-MSGID: 1777033347553890307 |
Series |
x86: enable FRED for x86-64
|
|
Commit Message
Li, Xin3
Sept. 14, 2023, 4:47 a.m. UTC
From: "H. Peter Anvin (Intel)" <hpa@zytor.com> Because FRED always restores the full value of %rsp, ESPFIX is no longer needed when it's enabled. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Tested-by: Shan Kang <shan.kang@intel.com> Signed-off-by: Xin Li <xin3.li@intel.com> --- arch/x86/kernel/espfix_64.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c index 16f9814c9be0..6726e0473d0b 100644 --- a/arch/x86/kernel/espfix_64.c +++ b/arch/x86/kernel/espfix_64.c @@ -106,6 +106,10 @@ void __init init_espfix_bsp(void) pgd_t *pgd; p4d_t *p4d; + /* FRED systems always restore the full value of %rsp */ + if (cpu_feature_enabled(X86_FEATURE_FRED)) + return; + /* Install the espfix pud into the kernel page directory */ pgd = &init_top_pgt[pgd_index(ESPFIX_BASE_ADDR)]; p4d = p4d_alloc(&init_mm, pgd, ESPFIX_BASE_ADDR); @@ -129,6 +133,10 @@ void init_espfix_ap(int cpu) void *stack_page; pteval_t ptemask; + /* FRED systems always restore the full value of %rsp */ + if (cpu_feature_enabled(X86_FEATURE_FRED)) + return; + /* We only have to do this once... */ if (likely(per_cpu(espfix_stack, cpu))) return; /* Already initialized */