From patchwork Tue Mar 7 02:39:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 65214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2209510wrd; Mon, 6 Mar 2023 19:06:57 -0800 (PST) X-Google-Smtp-Source: AK7set+zMNvpPro7oH+QBQrHjsCjxDbpeO67Rz6ODbo2HuKU4vnhITsMoe7Tq8QvgORFcT81uZMx X-Received: by 2002:a17:902:b706:b0:19c:36a6:99ea with SMTP id d6-20020a170902b70600b0019c36a699eamr10373129pls.68.1678158417023; Mon, 06 Mar 2023 19:06:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678158417; cv=none; d=google.com; s=arc-20160816; b=dsnCfmGQZDNTrTmCpofpXWu+ahWUU1FrNdsCBmhZRYsx52cdgaOuKCwH23OuEjzUGl +sHKAyN/8YKWjABq12L207Nt8aHkehNjnTQJ1fP8lS82D4cJOXiz8BUHeV0z6mULwra0 yo645DJ6bbYN0iyRFXrkhdEPG5cKabwXbZGlhauyOrTAgVzc5VmPLvB1dtf8H7D7CVXW wTBrE/HIyVWbIqD8kgBVHIloWSKfuKsHVgTJ9k+BaYbCI9i8ZeIKRoO2a4jfSpvw9sWl kbS5Obi6C6uOj/a+xkYm6QkyF/GTRNsalcvLO9YYjqj/TLoAyJHGo/7fcy1aIOXbPg2l Ltfw== 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=elR6gv7x2KRkhkEb5mXhzjhgXAhgUl9+ZReHm6RX/ac=; b=qmp3UFdfDJvturpgLv3nMsX74VjOJp/itVjOvvKxmjVUj03WEIJpUDDuUWfrsseXnT wmGES7990mvqXJ7P1P4vjVJX6vU3B62LFG2vMns9TcETwFTPZRC3rNbjReb+ecUyONJt wdz2SsXaD4fNXBQ9s/YNURGge0D64rywSlaYVsYdoErivFyIy5HoBSlM6xOpmEKwAXX0 84FjhoaBXmsOl8VZiwwAvp92czsnmY/nTRDRAWddurp/MBRPWvqQryeo7q8qH1dxRWvz V+Ja/o1G/p1UgJqShfR6iqMJH7p06j2Cmaw7TF2voWaTaZdmK4sHzTNf0vLbkcxPGP0O BANQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XsTBl/0p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a170902710300b0019639b61586si9676782pll.469.2023.03.06.19.06.44; Mon, 06 Mar 2023 19:06:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XsTBl/0p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbjCGDFp (ORCPT + 99 others); Mon, 6 Mar 2023 22:05:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjCGDF0 (ORCPT ); Mon, 6 Mar 2023 22:05:26 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 023D93D0BE; Mon, 6 Mar 2023 19:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678158324; x=1709694324; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4FK4WqdWHUwbUV2bYLBoNlxt9vIvY1YGaf10KKshT3E=; b=XsTBl/0pMThChbnj/xUhX9s1elCK7BIB1XNFp5owe2mFaG8j+V8iKIBK nI0r22QGAWwV9sjtfmOwC90F7XDHF9TlSink8/g+URFBRLpvlQvlJSKuU Jl+fOiAS3Sc98Ff9ZS7u6c4dGxo7OY8pskVPEmwQxmnFj9ymAhMknqjqN V8pLH/Vqq4q6V48YhMY6bOSCkVEqvnVtVwxo7xPagnikKoxwTvv4DICMH 5RRs0wuy3ogzsxZSZivIBGCVQVq6B6ZVmBzerll8VJllr1jWGWVdL2O8Y O8gV6u5hd0d0BHfZQ8P/eKH3hV5uCy9DmdNcb4lp/rfzrzYAZBqQwEhpb A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="338072360" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="338072360" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 19:05:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="676409729" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="676409729" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga002.jf.intel.com with ESMTP; 06 Mar 2023 19:05:12 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com Subject: [PATCH v5 06/34] x86/cpufeature: add the cpu feature bit for FRED Date: Mon, 6 Mar 2023 18:39:18 -0800 Message-Id: <20230307023946.14516-7-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307023946.14516-1-xin3.li@intel.com> References: <20230307023946.14516-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759676640637746079?= X-GMAIL-MSGID: =?utf-8?q?1759676640637746079?= From: "H. Peter Anvin (Intel)" Add the CPU feature bit for FRED (Flexible Return and Event Delivery). The Intel flexible return and event delivery (FRED) architecture defines simple new transitions that change privilege level (ring transitions). The FRED architecture was designed with the following goals: 1) Improve overall performance and response time by replacing event delivery through the interrupt descriptor table (IDT event delivery) and event return by the IRET instruction with lower latency transitions. 2) Improve software robustness by ensuring that event delivery establishes the full supervisor context and that event return establishes the full user context. The new transitions defined by the FRED architecture are FRED event delivery and, for returning from events, two FRED return instructions. FRED event delivery can effect a transition from ring 3 to ring 0, but it is used also to deliver events incident to ring 0. One FRED instruction (ERETU) effects a return from ring 0 to ring 3, while the other (ERETS) returns while remaining in ring 0. Search for the latest FRED spec in most search engines with this search pattern: site:intel.com FRED (flexible return and event delivery) specification Signed-off-by: H. Peter Anvin (Intel) Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/include/asm/cpufeatures.h | 1 + tools/arch/x86/include/asm/cpufeatures.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 73c9672c123b..1fa444478d33 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -318,6 +318,7 @@ #define X86_FEATURE_FZRM (12*32+10) /* "" Fast zero-length REP MOVSB */ #define X86_FEATURE_FSRS (12*32+11) /* "" Fast short REP STOSB */ #define X86_FEATURE_FSRC (12*32+12) /* "" Fast short REP {CMPSB,SCASB} */ +#define X86_FEATURE_FRED (12*32+17) /* Flexible Return and Event Delivery */ #define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */ #define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23) /* "" Support for VPMADD52[H,L]UQ */ diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index b70111a75688..b2218a7a0927 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -312,6 +312,7 @@ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ #define X86_FEATURE_CMPCCXADD (12*32+ 7) /* "" CMPccXADD instructions */ +#define X86_FEATURE_FRED (12*32+17) /* Flexible Return and Event Delivery */ #define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */ #define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23) /* "" Support for VPMADD52[H,L]UQ */