From patchwork Tue Dec 13 14:03:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9472345 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 05D6F60476 for ; Tue, 13 Dec 2016 14:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB32928484 for ; Tue, 13 Dec 2016 14:05:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDEFC28589; Tue, 13 Dec 2016 14:05:28 +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 6C25428484 for ; Tue, 13 Dec 2016 14:05:28 +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 1cGnfz-0004JU-Vl; Tue, 13 Dec 2016 14:03:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGnfy-0004JH-QG for xen-devel@lists.xenproject.org; Tue, 13 Dec 2016 14:03:26 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 23/A2-14854-DAFFF485; Tue, 13 Dec 2016 14:03:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsXS6fjDS3ftf/8 Ig55+NovvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPj3suMBZ0iFXtXbWFpYNzB38XIySEkkCfx YPMdti5GDg5eATuJR3sFQcISAoYST99fZwOxWQRUJZ69PsEOYrMJqEu0PdvOClIuImAgce5oE ojJLKAvsW0dC0iFMNCQe7dfs4CEhYDsbSuqQcKcAvYSx1vfMkPsEZT4u0MYJMwMVPH48l72CY w8sxAys5BkIGwtiYe/brFA2NoSyxa+Zp4FtlZaYvk/DpjyRy+eM6MqAbE9JVq/HmBcwMixilG 9OLWoLLVI11AvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVgvOT93EyMwSBmAYAfj8o9Ohxgl OZiURHk/V/tHCPEl5adUZiQWZ8QXleakFh9ilOHgUJLg3fsPKCdYlJqeWpGWmQOMF5i0BAePk gjvGpA0b3FBYm5xZjpE6hSjopQ47z6QhABIIqM0D64NFqOXGGWlhHkZgQ4R4ilILcrNLEGVf8 UozsGoJMxbBjKFJzOvBG76K6DFTECLRZeALS5JREhJNTD69J7deufavcynD39d0LfqL77sEif Bx7qUIUfsTcI591l+PPlBvcs3i7Ot3Xz+VcTEXac7PM7Z9P89oNb7umWGM7PFGYMDx28cZ/SK Mjtifc1H8YDO/8aNOZfvpJjITq5hfWWxY9+yWwuYt0nqxG+3mRI+U3xxePTJ+em2JYfj28qvB 87V83RXYinOSDTUYi4qTgQAJ1rvVcwCAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1481637802!59092665!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3863 invoked from network); 13 Dec 2016 14:03:24 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-12.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Dec 2016 14:03:24 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 13 Dec 2016 07:03:22 -0700 Message-Id: <58500DB802000078001289EF@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Tue, 13 Dec 2016 07:03:20 -0700 From: "Jan Beulich" To: "xen-devel" References: <58500ACA02000078001289CF@prv-mh.provo.novell.com> In-Reply-To: <58500ACA02000078001289CF@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 3/6] x86emul: check for CMPXCHG8B availability 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP We can't exclude someone wanting to hide the instruction from guests. Signed-off-by: Jan Beulich x86emul: check for CMPXCHG8B availability We can't exclude someone wanting to hide the instruction from guests. Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1285,6 +1285,7 @@ static bool vcpu_has( } #define vcpu_has_fpu() vcpu_has( 1, EDX, 0, ctxt, ops) +#define vcpu_has_cx8() vcpu_has( 1, EDX, 8, ctxt, ops) #define vcpu_has_cmov() vcpu_has( 1, EDX, 15, ctxt, ops) #define vcpu_has_clflush() vcpu_has( 1, EDX, 19, ctxt, ops) #define vcpu_has_mmx() vcpu_has( 1, EDX, 23, ctxt, ops) @@ -5296,7 +5297,10 @@ x86_emulate( op_bytes = 16; } else + { + vcpu_must_have(cx8); op_bytes = 8; + } old = container_of(&mmvalp->ymm[0], typeof(*old), u64[0]); aux = container_of(&mmvalp->ymm[2], typeof(*old), u64[0]); Reviewed-by: Andrew Cooper --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1285,6 +1285,7 @@ static bool vcpu_has( } #define vcpu_has_fpu() vcpu_has( 1, EDX, 0, ctxt, ops) +#define vcpu_has_cx8() vcpu_has( 1, EDX, 8, ctxt, ops) #define vcpu_has_cmov() vcpu_has( 1, EDX, 15, ctxt, ops) #define vcpu_has_clflush() vcpu_has( 1, EDX, 19, ctxt, ops) #define vcpu_has_mmx() vcpu_has( 1, EDX, 23, ctxt, ops) @@ -5296,7 +5297,10 @@ x86_emulate( op_bytes = 16; } else + { + vcpu_must_have(cx8); op_bytes = 8; + } old = container_of(&mmvalp->ymm[0], typeof(*old), u64[0]); aux = container_of(&mmvalp->ymm[2], typeof(*old), u64[0]);