From patchwork Fri Mar 17 06:46:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9629897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7056260245 for ; Fri, 17 Mar 2017 06:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 605FE2869C for ; Fri, 17 Mar 2017 06:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52EC72869B; Fri, 17 Mar 2017 06:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E94342869B for ; Fri, 17 Mar 2017 06:48:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1colf1-0000ft-Qu; Fri, 17 Mar 2017 06:46:51 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1colf1-0000f1-Bh for xen-devel@lists.xen.org; Fri, 17 Mar 2017 06:46:51 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id F7/54-16699-A568BC85; Fri, 17 Mar 2017 06:46:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRWlGSWpSXmKPExsVywNxEWzeq7XS Ewe0HzBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8a9S9/YC17zVvw45dXAuIOri5GDQ0igQmLG 18ouRk4OCQFeiSPLZrCChCUEAiTm3XbvYuQCquhllHj+4AE7SA2bgL7EiscHWUFsEQFpiWufL zOC2MwC1RITp88Bs4UFQiXeT3zHBGKzCKhKzF7dDdbLK2AncWXzPFaIXfISF66eYgGxOYHiHx tvgdlCArYSjQ23mSYw8i5gZFjFqF6cWlSWWqRrqpdUlJmeUZKbmJmja2hgrJebWlycmJ6ak5h UrJecn7uJERgG9QwMjDsYL391OsQoycGkJMqrIngiQogvKT+lMiOxOCO+qDQntfgQowwHh5IE r/h8oJxgUWp6akVaZg4wIGHSEhw8SiK8tiBp3uKCxNzizHSI1ClGRSlx3qvzgBICIImM0jy4N lgUXGKUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzOsMMp4nM68EbvoroMVMQIsTfx4BWVySiJ CSamBUunukVUWPfcI+jklH506b+V/iPFeHAINHjKMMn3m9cM3vtzeaOq+KnOR5sF8/7N+qO98 4eTTd7XQi/x790Kqf66+o2HPf/uetp01Fi/U59+YvvL5HWnRZEd+Mvokbllz3jvVokrcy9Gj1 3J1qvuzVzJY+dzeP389ec3HUGu4+dkf1w5LZm/iVWIozEg21mIuKEwGx3n2PfQIAAA== X-Env-Sender: haozhong.zhang@intel.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1489733199!59832828!5 X-Originating-IP: [192.55.52.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12534 invoked from network); 17 Mar 2017 06:46:49 -0000 Received: from mga05.intel.com (HELO mga05.intel.com) (192.55.52.43) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 17 Mar 2017 06:46:49 -0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 16 Mar 2017 23:46:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.36,175,1486454400"; d="scan'208"; a="1109452671" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.153]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2017 23:46:47 -0700 From: Haozhong Zhang To: xen-devel@lists.xen.org Date: Fri, 17 Mar 2017 14:46:12 +0800 Message-Id: <20170317064614.23539-11-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170317064614.23539-1-haozhong.zhang@intel.com> References: <20170317064614.23539-1-haozhong.zhang@intel.com> Cc: Haozhong Zhang , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 10/12] xen/mce: add support of vLMCE injection to XEN_MC_inject_v2 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Haozhong Zhang --- Cc: Jan Beulich Cc: Andrew Cooper Changes in v2: * Remove the unnecessary local variable "cpu_nr". --- xen/arch/x86/cpu/mcheck/mce.c | 15 +++++++++++++++ xen/include/public/arch-x86/xen-mca.h | 1 + 2 files changed, 16 insertions(+) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 20ab678..e7c681b 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -1546,6 +1546,21 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc) } break; + case XEN_MC_INJECT_TYPE_LMCE: + if ( !lmce_support ) + { + ret = x86_mcerr("No LMCE support in platform", -EINVAL); + break; + } + /* Ensure at most one CPU is specified. */ + if ( nr_cpu_ids > cpumask_next(cpumask_first(cpumap), cpumap) ) + { + ret = x86_mcerr("More than one CPU specified", -EINVAL); + break; + } + on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1); + break; + default: ret = x86_mcerr("Wrong mca type\n", -EINVAL); break; diff --git a/xen/include/public/arch-x86/xen-mca.h b/xen/include/public/arch-x86/xen-mca.h index 7db9907..dc35267 100644 --- a/xen/include/public/arch-x86/xen-mca.h +++ b/xen/include/public/arch-x86/xen-mca.h @@ -414,6 +414,7 @@ struct xen_mc_mceinject { #define XEN_MC_INJECT_TYPE_MASK 0x7 #define XEN_MC_INJECT_TYPE_MCE 0x0 #define XEN_MC_INJECT_TYPE_CMCI 0x1 +#define XEN_MC_INJECT_TYPE_LMCE 0x2 #define XEN_MC_INJECT_CPU_BROADCAST 0x8