From patchwork Tue Feb 28 12:58:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9595487 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 7B2F960429 for ; Tue, 28 Feb 2017 13:00:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68999284D4 for ; Tue, 28 Feb 2017 13:00:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AC22284F9; Tue, 28 Feb 2017 13:00:16 +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 ED77E284D4 for ; Tue, 28 Feb 2017 13:00:15 +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 1cihMA-00013z-Bw; Tue, 28 Feb 2017 12:58:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cihM9-00013c-7j for xen-devel@lists.xenproject.org; Tue, 28 Feb 2017 12:58:17 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 20/0B-21675-8E375B85; Tue, 28 Feb 2017 12:58:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRWlGSWpSXmKPExsXS6fjDS/d58dY Igy2vLCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oz/P04xFTzQruh+sJOlgfGpchcjJ4eQQJ7E jt2fWUBsXgE7icXHNzCB2BIChhJP319nA7FZBFQlXj1/wAxiswmoS7Q9287axcjBISJgIHHua BKIySygL7FtHdgUYQETibt7drNDTLeT+DTvDSOIzSlgL7Gq5RITSDmvgKDE3x3CEJ12Eh1dmh MYeWYhJGYhJGYBtTILaEk8/HWLBcLWlli28DUzRIm0xPJ/HBBhC4nd29rQlIDYzhJ/NnawLmD kWMWoUZxaVJZapGtorJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERimDECwg/HL soBDjJIcTEqivFnJWyOE+JLyUyozEosz4otKc1KLDzHKcHAoSfCKAsNeSLAoNT21Ii0zBxgxM GkJDh4lEV4tkDRvcUFibnFmOkTqFKMux5zZu98wCbHk5eelSonzTi8CKhIAKcoozYMbAYveS4 yyUsK8jEBHCfEUpBblZpagyr9iFOdgVBLmvQQyhSczrwRu0yugI5iAjnihAnZESSJCSqqBUXf XnGkt+zi3S7MkLc8/5ir4LUrXUF/nZEcD3/qTWZGHjoSVXF+oFpybHLQsfXn8xs9HPqwLN10p /6fzTt/rNycdOj4uvv20O33t7QU++47+fs0anb37ePEZ8ewD8Uldlx7wuF7e4s1QuNQhLKr28 kYht0kz12j96HkltkFP5fQJ3j33XnuxmiqxFGckGmoxFxUnAgDNNfRF2QIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1488286693!56403688!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests=SUBJECT_RANDOMQ X-StarScan-Received: X-StarScan-Version: 9.4.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53322 invoked from network); 28 Feb 2017 12:58:15 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-3.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 28 Feb 2017 12:58:15 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 28 Feb 2017 05:58:13 -0700 Message-Id: <58B581F2020000780013E2FD@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Tue, 28 Feb 2017 05:58:10 -0700 From: "Jan Beulich" To: "xen-devel" References: <58B57E43020000780013E26B@prv-mh.provo.novell.com> In-Reply-To: <58B57E43020000780013E26B@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH v4 15/17] x86emul: support PCLMULQDQ 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 ... and its AVX equivalent. Signed-off-by: Jan Beulich --- v3: New. x86emul: support PCLMULQDQ ... and its AVX equivalent. Signed-off-by: Jan Beulich --- v3: New. --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -393,6 +393,7 @@ static const struct { [0x22] = { .simd_size = simd_none }, [0x40 ... 0x41] = { .simd_size = simd_packed_fp }, [0x42] = { .simd_size = simd_packed_int }, + [0x44] = { .simd_size = simd_packed_int }, [0x4a ... 0x4b] = { .simd_size = simd_packed_fp, .four_op = 1 }, [0x4c] = { .simd_size = simd_packed_int, .four_op = 1 }, [0x60 ... 0x63] = { .simd_size = simd_packed_int, .two_op = 1 }, @@ -1457,6 +1458,7 @@ static bool vcpu_has( #define vcpu_has_sse() vcpu_has( 1, EDX, 25, ctxt, ops) #define vcpu_has_sse2() vcpu_has( 1, EDX, 26, ctxt, ops) #define vcpu_has_sse3() vcpu_has( 1, ECX, 0, ctxt, ops) +#define vcpu_has_pclmulqdq() vcpu_has( 1, ECX, 1, ctxt, ops) #define vcpu_has_ssse3() vcpu_has( 1, ECX, 9, ctxt, ops) #define vcpu_has_cx16() vcpu_has( 1, ECX, 13, ctxt, ops) #define vcpu_has_sse4_1() vcpu_has( 1, ECX, 19, ctxt, ops) @@ -7434,6 +7436,14 @@ x86_emulate( generate_exception_if(vex.l, EXC_UD); goto simd_0f_imm8_avx; + case X86EMUL_OPC_66(0x0f3a, 0x44): /* pclmulqdq $imm8,xmm/m128,xmm */ + case X86EMUL_OPC_VEX_66(0x0f3a, 0x44): /* vpclmulqdq $imm8,xmm/m128,xmm,xmm */ + host_and_vcpu_must_have(pclmulqdq); + if ( vex.opcx == vex_none ) + goto simd_0f3a_common; + generate_exception_if(vex.l, EXC_UD); + goto simd_0f_imm8_avx; + case X86EMUL_OPC_VEX_66(0x0f3a, 0x4a): /* vblendvps {x,y}mm,{x,y}mm/mem,{x,y}mm,{x,y}mm */ case X86EMUL_OPC_VEX_66(0x0f3a, 0x4b): /* vblendvpd {x,y}mm,{x,y}mm/mem,{x,y}mm,{x,y}mm */ generate_exception_if(vex.w, EXC_UD); --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -42,6 +42,7 @@ #define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) #define cpu_has_sse4_1 boot_cpu_has(X86_FEATURE_SSE4_1) #define cpu_has_sse4_2 boot_cpu_has(X86_FEATURE_SSE4_2) +#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) #define cpu_has_popcnt boot_cpu_has(X86_FEATURE_POPCNT) #define cpu_has_htt boot_cpu_has(X86_FEATURE_HTT) #define cpu_has_nx boot_cpu_has(X86_FEATURE_NX) --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -393,6 +393,7 @@ static const struct { [0x22] = { .simd_size = simd_none }, [0x40 ... 0x41] = { .simd_size = simd_packed_fp }, [0x42] = { .simd_size = simd_packed_int }, + [0x44] = { .simd_size = simd_packed_int }, [0x4a ... 0x4b] = { .simd_size = simd_packed_fp, .four_op = 1 }, [0x4c] = { .simd_size = simd_packed_int, .four_op = 1 }, [0x60 ... 0x63] = { .simd_size = simd_packed_int, .two_op = 1 }, @@ -1457,6 +1458,7 @@ static bool vcpu_has( #define vcpu_has_sse() vcpu_has( 1, EDX, 25, ctxt, ops) #define vcpu_has_sse2() vcpu_has( 1, EDX, 26, ctxt, ops) #define vcpu_has_sse3() vcpu_has( 1, ECX, 0, ctxt, ops) +#define vcpu_has_pclmulqdq() vcpu_has( 1, ECX, 1, ctxt, ops) #define vcpu_has_ssse3() vcpu_has( 1, ECX, 9, ctxt, ops) #define vcpu_has_cx16() vcpu_has( 1, ECX, 13, ctxt, ops) #define vcpu_has_sse4_1() vcpu_has( 1, ECX, 19, ctxt, ops) @@ -7434,6 +7436,14 @@ x86_emulate( generate_exception_if(vex.l, EXC_UD); goto simd_0f_imm8_avx; + case X86EMUL_OPC_66(0x0f3a, 0x44): /* pclmulqdq $imm8,xmm/m128,xmm */ + case X86EMUL_OPC_VEX_66(0x0f3a, 0x44): /* vpclmulqdq $imm8,xmm/m128,xmm,xmm */ + host_and_vcpu_must_have(pclmulqdq); + if ( vex.opcx == vex_none ) + goto simd_0f3a_common; + generate_exception_if(vex.l, EXC_UD); + goto simd_0f_imm8_avx; + case X86EMUL_OPC_VEX_66(0x0f3a, 0x4a): /* vblendvps {x,y}mm,{x,y}mm/mem,{x,y}mm,{x,y}mm */ case X86EMUL_OPC_VEX_66(0x0f3a, 0x4b): /* vblendvpd {x,y}mm,{x,y}mm/mem,{x,y}mm,{x,y}mm */ generate_exception_if(vex.w, EXC_UD); --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -42,6 +42,7 @@ #define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) #define cpu_has_sse4_1 boot_cpu_has(X86_FEATURE_SSE4_1) #define cpu_has_sse4_2 boot_cpu_has(X86_FEATURE_SSE4_2) +#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) #define cpu_has_popcnt boot_cpu_has(X86_FEATURE_POPCNT) #define cpu_has_htt boot_cpu_has(X86_FEATURE_HTT) #define cpu_has_nx boot_cpu_has(X86_FEATURE_NX)