Message ID | 20230914044805.301390-27-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 h50csp359383vqi; Thu, 14 Sep 2023 06:46:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLqdmZRDpP1bIq+r6mAWXC7nOZeLH57jUwhBDwZdu8Gm2GMqtQxcFzQVXzB3uPq9Iw9OLb X-Received: by 2002:a05:6a21:66c9:b0:153:560e:e001 with SMTP id ze9-20020a056a2166c900b00153560ee001mr4943977pzb.48.1694699166093; Thu, 14 Sep 2023 06:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694699166; cv=none; d=google.com; s=arc-20160816; b=KLYVKy+K1yKMDuvwkEavfD+mU2F7LEi5NpSVAo/ufHmSemlhtTypcAz4xnVeGhjL8X f7+jvCGf1aYdUlSNRTxJlJsrLwv+fu1PtnRr9Izj1W6PwLiyK8F5Ev+nlMawFqRpNoi0 xNb834EOFm9vnQTuPOnuMuOM2Ua6k5MbeR1HjiRUJW1Nzx6cgixt4S7SZejz5uw2qJwo N0vxNfGli4LXB3vetuAq0t42N4g1AD3mlav6PPhhi9ci7GMsKdlPxS0kyJeuJcvh3PBR G+sAAowYZMvjSsp4uF8VcdAoXy9AFxw3uxMxp2hOf1uP63ZX8chHtSV/QR8SZxpf3SIM GS4Q== 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=r+yFV6fJFMjNXXwXe0MNwfnCD/5sVZQF9hrAHJEKg50=; fh=jqCbnajAXgJ+s7A1aA7DOHJD13/+EpD442pw8d+Ofss=; b=Ee4B15/ukWYrmHdstMEv45OAwqdktMRFLH09V/ZjRjFc/+w50ZlhxWYBG3UWxPhwOZ G4vUzeDw95JEbOcjMEt2aa3M3d72e225YEU2H/vcBDw5H+h5skWfej42ncXx0wg189PH 4KcMcnEi14EeFPq++6yFmMGE0p6Y+7KakN2Ue8c6Gtvfrbvym25y2e0vILdvRRGZMmXC 5eyhNw3MXi6b/FiX4yTSo1Xcoz518lWn+2OrPikIT2ChoqevLqBqj0MuX8N/pXJg8tVL SHokHFcktduY4Cd5jWoztekk8nz/PmF6inhRK6Rz6JTlsvJs9bUOjL9sufM5YcphWNIc XSaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jIncnZMV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id z13-20020a1709027e8d00b001ab1ba2572csi1374669pla.240.2023.09.14.06.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 06:46:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jIncnZMV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id A6CA28074537; Wed, 13 Sep 2023 22:20:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235689AbjINFUR (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 01:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235164AbjINFTa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 01:19:30 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9D01BD9; Wed, 13 Sep 2023 22:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694668762; x=1726204762; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FcZc1QeKj2isPTwOBVaGNTy+si5WeOaciLFU4yv7EQo=; b=jIncnZMVrIxcwet3pbSY+w+8fYvnN+RdF4lUowsl/oXQDZuU+8ssGNGe 97GTfAOF7Cjr6HxaJ73az9OLXKmMcdxGzANL7FLHEPLGoXOXmZMF3DNOs BYYQ0Ij5CvhNQ8Qw04nATKdmgXkNbd2Qlw/5cerzm6WsXW8vl4Rci25nt 2fn/fRT0knxHPUTw+iy0v4lwJPWuozezZagPZsbuqaoCf9D9cx0UubXxB 5atw500QOMAtwU0NFdxRbsKJuw+znOm4sCy0yoatf8xVBrZCS2fbmiEWk tucqwrhgAEF0zVk4xhw5P2yDPXzs7mkg7dohjxdOORO0uYbXRWG8G5dbw g==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="382661407" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="382661407" 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:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="779488817" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="779488817" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga001.jf.intel.com with ESMTP; 13 Sep 2023 22:17:42 -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 26/38] x86/fred: Add a NMI entry stub for FRED Date: Wed, 13 Sep 2023 21:47:53 -0700 Message-Id: <20230914044805.301390-27-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 (fry.vger.email [0.0.0.0]); Wed, 13 Sep 2023 22:20:45 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777020872675008257 X-GMAIL-MSGID: 1777020872675008257 |
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> On a FRED system, NMIs nest both with themselves and faults, transient information is saved into the stack frame, and NMI unblocking only happens when the stack frame indicates that so should happen. Thus, the NMI entry stub for FRED is really quite small... 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/nmi.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index a0c551846b35..58843fdf5cd0 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c @@ -34,6 +34,7 @@ #include <asm/cache.h> #include <asm/nospec-branch.h> #include <asm/sev.h> +#include <asm/fred.h> #define CREATE_TRACE_POINTS #include <trace/events/nmi.h> @@ -643,6 +644,33 @@ void nmi_backtrace_stall_check(const struct cpumask *btp) #endif +#ifdef CONFIG_X86_FRED +/* + * With FRED, CR2/DR6 is pushed to #PF/#DB stack frame during FRED + * event delivery, i.e., there is no problem of transient states. + * And NMI unblocking only happens when the stack frame indicates + * that so should happen. + * + * Thus, the NMI entry stub for FRED is really straightforward and + * as simple as most exception handlers. As such, #DB is allowed + * during NMI handling. + */ +DEFINE_FREDENTRY_NMI(exc_nmi) +{ + irqentry_state_t irq_state; + + if (IS_ENABLED(CONFIG_SMP) && arch_cpu_is_offline(smp_processor_id())) + return; + + irq_state = irqentry_nmi_enter(regs); + + inc_irq_stat(__nmi_count); + default_do_nmi(regs); + + irqentry_nmi_exit(regs, irq_state); +} +#endif + void stop_nmi(void) { ignore_nmis++;