From patchwork Wed Jun 1 04:58:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luwei Kang X-Patchwork-Id: 9146055 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 033BA60757 for ; Wed, 1 Jun 2016 05:01:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFCF7200E7 for ; Wed, 1 Jun 2016 05:01:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E458F20499; Wed, 1 Jun 2016 05:01:00 +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 3E5C5200E7 for ; Wed, 1 Jun 2016 05:00:59 +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 1b7yEU-00060L-NQ; Wed, 01 Jun 2016 04:58:18 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b7yEU-00060F-04 for xen-devel@lists.xen.org; Wed, 01 Jun 2016 04:58:18 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 96/E6-14119-86B6E475; Wed, 01 Jun 2016 04:58:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRWlGSWpSXmKPExsVywNykQjc92y/ cYHWnusWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmvG5eRVTwT+2iln3XRoYt7N2MXJyCAlUSJya uYkJxJYQ4JU4smwGUJwDyPaXeP9cBqKkUuLNppuMIDabgLrE1vcbwVpFBKQlrn2+DBTn4mAWa GOUeNL9BiwhLGAr8XTOdbAGFgFViSfvz7CB2LwCLhLLWg+xQeySk7h5rpN5AiP3AkaGVYwaxa lFZalFuoameklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgb5lAIIdjA3bPQ8xSnI wKYny8gf4hQvxJeWnVGYkFmfEF5XmpBYfYtTg4BDYvHb1BUYplrz8vFQlCV6WLKA6waLU9NSK tMwcYPDBlEpw8CiJ8IaBpHmLCxJzizPTIVKnGI05tiy4sZaJY8GP22uZhMAmSYnzuoOUCoCUZ pTmwQ2CRcUlRlkpYV5GoDOFeApSi3IzS1DlXzGKczAqCfPGgEzhycwrgdv3CugUJqBT4jN8QE 4pSURISTUwbjqgtyW8wP7L5a/BjAeLl01NyFvykF3rdtvB2Gp5/uOLehr530d4Bv4tm5zlIb0 2++xF5vb5S+yDzV/VhQvereEoDn9or8Mgxbl3psvBLE6bGwZL3pnyhi362KWRsVo26f+yNqGN R2ueWj3xc4vbfDLC0eBBmcQpwSMHl8ppB0p9m2PgWFaqxFKckWioxVxUnAgAomcWXoUCAAA= X-Env-Sender: luwei.kang@intel.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1464757094!26639069!1 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 62647 invoked from network); 1 Jun 2016 04:58:15 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-16.tower-206.messagelabs.com with SMTP; 1 Jun 2016 04:58:15 -0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 31 May 2016 21:58:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,399,1459839600"; d="scan'208";a="818992374" Received: from vmm-dell.bj.intel.com ([10.238.145.44]) by orsmga003.jf.intel.com with ESMTP; 31 May 2016 21:58:11 -0700 From: Luwei Kang To: xen-devel@lists.xen.org Date: Wed, 1 Jun 2016 12:58:12 +0800 Message-Id: <1464757092-13177-1-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 Cc: andrew.cooper3@citrix.com, Luwei Kang , yong.y.wang@intel.com, jbeulich@suse.com, huaitong.han@intel.com Subject: [Xen-devel] [PATCH] x86/cpuid: fix dom0 crash on skylake machine 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 CPUID.0XD.0X0.EAX is from machine value for dom0, and dom0 kernel will xsetbv with xfeatures_mask that is from CPUID.0XD.0X0.EAX, but handle_xsetbv has ingored XSTATE_PKRU with hardware protection fault emulation, so dom0 kernel will crash on skylake machine with PKRU support. Signed-off-by: Luwei Kang Signed-off-by: Huaitong Han Reviewed-by: Huaitong Han --- xen/arch/x86/traps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 1ef8401..5e72e44 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1100,6 +1100,9 @@ void pv_cpuid(struct cpu_user_regs *regs) */ if ( !is_control_domain(currd) && !is_hardware_domain(currd) ) cpuid_count(leaf, subleaf, &tmp, &b, &tmp, &tmp); + + /* PV is not supported by XSTATE_PKRU. */ + a &= ~XSTATE_PKRU; break; }