Message ID | 20230224070145.3572-21-xin3.li@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp756607wrd; Thu, 23 Feb 2023 23:30:22 -0800 (PST) X-Google-Smtp-Source: AK7set+b1DxAvldjRRa0Q8rdLHO9kU3i2c3J4qeHsg2QW+DBj/iBA8QjTPdy7FaF6Xq02WCfgs/U X-Received: by 2002:a05:6402:1219:b0:4ac:bdf7:dffd with SMTP id c25-20020a056402121900b004acbdf7dffdmr14022116edw.12.1677223822405; Thu, 23 Feb 2023 23:30:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677223822; cv=none; d=google.com; s=arc-20160816; b=WQfqD6JhUqtbQPHs3a3oap7A2EPc2uWsstAgk1Bt8/tg8VqsT9B4hOLglw40l+tTdE ZfsEANDgk3riI3ACiL1b8ImoTAf9LjA7HFX4Kg/q3sh3/WsT69x2t1BWjuynB9+NQYzc BFRrb0uDR4ctUpcT0tHoIifvCGZ0uEW54hhUuE/KSKOxh0YuyLsdfm+ZIDyo+zXguktn o7bvFHCAHoyg1t/+gVhjLWA93n0kyM77psljvl0YTMiD7OWENeBPCrDmVLbziYGb52Gs 1LR0Xz/49/YPFHYweV2amDQSlliTMXxi+tp0xhfsZ8g6jJ5Y9GR2seECyym24vV/FTdu zYeA== 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=jBCjc1ZvCh5by9uZXcaUOb4k7Q6Um3OJIMlf+Wbx3OI=; b=1Ftfy4w6ANZfOOg6Fj/G5BgCecEkKT27oDLvD89qCISSHwL5+6KZL9H96RzttFqcCL rBpokR0rub4+bqpnsGAkTAEczE2YzocXV3cWQ8FfRHSWlwtPUSsdDRrcc67qn84flZwZ iiFQXe3cACRMFDU6krC8vhPAMfMtM3/1B/e3gdBtwDfTxPlTBz2s6o+dJAAnUEKQRDYl XfO5+Io47EP/c0fslBLn8ghWH87rPmEJ8mxjJoOEnoiKzfoUwfLbHhG7Mkbb9UDHQUiy qcf1PgjISanyyISpYLyQZDWgUa25VENP5GvBH/NKK0crJBjnem7GDXB/T8qnKjgzKs9W EC6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EfY72VDu; 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 f17-20020a50ee91000000b004acc30ee8fbsi10683132edr.429.2023.02.23.23.29.59; Thu, 23 Feb 2023 23:30:22 -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=EfY72VDu; 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 S230035AbjBXH3F (ORCPT <rfc822;jeff.pang.chn@gmail.com> + 99 others); Fri, 24 Feb 2023 02:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbjBXH2W (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Feb 2023 02:28:22 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3B93CE03; Thu, 23 Feb 2023 23:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677223687; x=1708759687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EAqkkjbGdrJOIqCTsnl5LSVUAe8TJXgpl5ggPVVzxf0=; b=EfY72VDuZ+Be0HgGG2Ym+CtslreFGNRpklyX1U3NdE5em20quB6D+fr8 40+bZOJVNvsylymGnb6rAyZmgA1dDs+RuHcYPURmqrnCwhVIghAzF+mCT uhd4zGMzxxoymGVDBMTdFweTUDipU7t/8nr8hrfpd7lz6cn9H0+8/cmpl hR1CRr2ZwtyzztiYrHU1+CJ3A1SzQOjy5F7zYuZdJkDtWyNX5+ov3tZvD i2RSU31GR0qn3lOEpBzm/LBhwbiqrmWhJyZBCyA0srIgiFOKWM1fCqgAi 26o+J938TM3Kfr6wPphRsNGJbb/h5TtCDvqSgy2vbQnID21TP6Su4buwX g==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="334836088" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="334836088" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 23:27:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="815639251" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="815639251" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga001.fm.intel.com with ESMTP; 23 Feb 2023 23:27:24 -0800 From: Xin Li <xin3.li@intel.com> 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: [RFC PATCH v3 20/32] x86/fred: add a machine check entry stub for FRED Date: Thu, 23 Feb 2023 23:01:33 -0800 Message-Id: <20230224070145.3572-21-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230224070145.3572-1-xin3.li@intel.com> References: <20230224070145.3572-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758696647116525028?= X-GMAIL-MSGID: =?utf-8?q?1758696647116525028?= |
Series |
x86: enable FRED for x86-64
|
|
Commit Message
Li, Xin3
Feb. 24, 2023, 7:01 a.m. UTC
Add a machine check entry stub for FRED.
Unlike IDT, no need to save/restore dr7 in FRED machine check handler.
Signed-off-by: Xin Li <xin3.li@intel.com>
---
arch/x86/include/asm/fred.h | 1 +
arch/x86/kernel/cpu/mce/core.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/arch/x86/include/asm/fred.h b/arch/x86/include/asm/fred.h index 753ae2adf422..3d6c5c063eef 100644 --- a/arch/x86/include/asm/fred.h +++ b/arch/x86/include/asm/fred.h @@ -97,6 +97,7 @@ typedef DECLARE_FRED_HANDLER((*fred_handler)); DECLARE_FRED_HANDLER(fred_exc_nmi); DECLARE_FRED_HANDLER(fred_exc_debug); DECLARE_FRED_HANDLER(fred_exc_page_fault); +DECLARE_FRED_HANDLER(fred_exc_machine_check); #endif /* __ASSEMBLY__ */ diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 7832a69d170e..26fa7fa44f30 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -52,6 +52,7 @@ #include <asm/mce.h> #include <asm/msr.h> #include <asm/reboot.h> +#include <asm/fred.h> #include "internal.h" @@ -2111,6 +2112,16 @@ DEFINE_IDTENTRY_MCE_USER(exc_machine_check) exc_machine_check_user(regs); local_db_restore(dr7); } + +#ifdef CONFIG_X86_FRED +DEFINE_FRED_HANDLER(fred_exc_machine_check) +{ + if (user_mode(regs)) + exc_machine_check_user(regs); + else + exc_machine_check_kernel(regs); +} +#endif #else /* 32bit unified entry point */ DEFINE_IDTENTRY_RAW(exc_machine_check)