From patchwork Mon Nov 30 18:20:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonidas Da Silva Barbosa X-Patchwork-Id: 7728731 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D9439F1C2 for ; Mon, 30 Nov 2015 18:21:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B157A20553 for ; Mon, 30 Nov 2015 18:21:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9004320504 for ; Mon, 30 Nov 2015 18:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753810AbbK3SVB (ORCPT ); Mon, 30 Nov 2015 13:21:01 -0500 Received: from e24smtp03.br.ibm.com ([32.104.18.24]:51456 "EHLO e24smtp03.br.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754043AbbK3SU6 (ORCPT ); Mon, 30 Nov 2015 13:20:58 -0500 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Nov 2015 16:20:57 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Nov 2015 16:20:54 -0200 X-IBM-Helo: d24dlp02.br.ibm.com X-IBM-MailFrom: leosilva@linux.vnet.ibm.com X-IBM-RcptTo: linux-crypto@vger.kernel.org;linux-kernel@vger.kernel.org Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id BB9E81DC0051; Mon, 30 Nov 2015 13:20:50 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay01.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAUILQUO4776040; Mon, 30 Nov 2015 16:21:26 -0200 Received: from d24av02.br.ibm.com (localhost [127.0.0.1]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAUIKqGw009648; Mon, 30 Nov 2015 16:20:52 -0200 Received: from bluepex.com ([9.8.8.49]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id tAUIKp7s009631; Mon, 30 Nov 2015 16:20:51 -0200 Date: Mon, 30 Nov 2015 16:20:50 -0200 From: Leonidas Da Silva Barbosa To: Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pfsmorigo@linux.vnet.ibm.com Subject: [PATCH 2/2] Removing VRSAVE save and restore Message-ID: <20151130182046.GA16040@bluepex.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15113018-0025-0000-0000-0000056B934A Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With VSX it no longer makes any sense to try to save restore individual VRs. Also, each access to save and restore VRSAVE has a high cost in performance. Signed-off-by: Leonidas Da Silva Barbosa Signed-off-by: Paulo Smorigo --- drivers/crypto/vmx/aesp8-ppc.pl | 18 ------------------ drivers/crypto/vmx/ghashp8-ppc.pl | 11 ----------- 2 files changed, 29 deletions(-) diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl index 2280539..d0a820f 100644 --- a/drivers/crypto/vmx/aesp8-ppc.pl +++ b/drivers/crypto/vmx/aesp8-ppc.pl @@ -102,10 +102,6 @@ Lset_encrypt_key: andi. r0,$bits,0x3f bne- Lenc_key_abort - lis r0,0xfff0 - mfspr $vrsave,256 - mtspr 256,r0 - bl Lconsts mtlr r11 @@ -334,7 +330,6 @@ Ldone: vsel $in1,$outhead,$in1,$outmask stvx $in1,0,$inp li $ptr,0 - mtspr 256,$vrsave stw $rounds,0($out) Lenc_key_abort: @@ -402,10 +397,7 @@ my ($inp,$out,$key,$rounds,$idx)=map("r$_",(3..7)); $code.=<<___; .globl .${prefix}_${dir}crypt lwz $rounds,240($key) - lis r0,0xfc00 - mfspr $vrsave,256 li $idx,15 # 15 is not typo - mtspr 256,r0 lvx v0,0,$inp neg r11,$out @@ -459,7 +451,6 @@ Loop_${dir}c: vsel v0,v0,v4,v2 stvx v0,$idx,$out - mtspr 256,$vrsave blr .long 0 .byte 0,12,0x14,0,0,0,3,0 @@ -482,9 +473,6 @@ $code.=<<___; bltlr- cmpwi $enc,0 # test direction - lis r0,0xffe0 - mfspr $vrsave,256 - mtspr 256,r0 li $idx,15 vxor $rndkey0,$rndkey0,$rndkey0 @@ -630,7 +618,6 @@ Lcbc_done: vsel $inout,$ivec,$inptail,$outmask stvx $inout,$idx,$ivp - mtspr 256,$vrsave blr .long 0 .byte 0,12,0x14,0,0,0,6,0 @@ -1238,10 +1225,6 @@ $code.=<<___; ${UCMP}i $len,1 bltlr- - lis r0,0xfff0 - mfspr $vrsave,256 - mtspr 256,r0 - li $idx,15 vxor $rndkey0,$rndkey0,$rndkey0 le?vspltisb $tmp,0x0f @@ -1333,7 +1316,6 @@ Loop_ctr32_enc: vsel $inout,$outhead,$inout,$outmask stvx $inout,0,$out - mtspr 256,$vrsave blr .long 0 .byte 0,12,0x14,0,0,0,6,0 diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl b/drivers/crypto/vmx/ghashp8-ppc.pl index d8429cb..2f83abe 100644 --- a/drivers/crypto/vmx/ghashp8-ppc.pl +++ b/drivers/crypto/vmx/ghashp8-ppc.pl @@ -46,7 +46,6 @@ my ($Xip,$Htbl,$inp,$len)=map("r$_",(3..6)); # argument block my ($Xl,$Xm,$Xh,$IN)=map("v$_",(0..3)); my ($zero,$t0,$t1,$t2,$xC2,$H,$Hh,$Hl,$lemask)=map("v$_",(4..12)); -my $vrsave="r12"; $code=<<___; .machine "any" @@ -54,11 +53,8 @@ $code=<<___; .text .globl .gcm_init_p8 - lis r0,0xfff0 li r8,0x10 - mfspr $vrsave,256 li r9,0x20 - mtspr 256,r0 li r10,0x30 lvx_u $H,0,r4 # load H le?xor r7,r7,r7 @@ -94,7 +90,6 @@ $code=<<___; stvx_u $H, r9,r3 stvx_u $Hh,r10,r3 - mtspr 256,$vrsave blr .long 0 .byte 0,12,0x14,0,0,0,2,0 @@ -104,9 +99,7 @@ $code=<<___; .globl .gcm_gmult_p8 lis r0,0xfff8 li r8,0x10 - mfspr $vrsave,256 li r9,0x20 - mtspr 256,r0 li r10,0x30 lvx_u $IN,0,$Xip # load Xi @@ -142,7 +135,6 @@ $code=<<___; le?vperm $Xl,$Xl,$Xl,$lemask stvx_u $Xl,0,$Xip # write out Xi - mtspr 256,$vrsave blr .long 0 .byte 0,12,0x14,0,0,0,2,0 @@ -152,9 +144,7 @@ $code=<<___; .globl .gcm_ghash_p8 lis r0,0xfff8 li r8,0x10 - mfspr $vrsave,256 li r9,0x20 - mtspr 256,r0 li r10,0x30 lvx_u $Xl,0,$Xip # load Xi @@ -209,7 +199,6 @@ Loop: le?vperm $Xl,$Xl,$Xl,$lemask stvx_u $Xl,0,$Xip # write out Xi - mtspr 256,$vrsave blr .long 0 .byte 0,12,0x14,0,0,0,4,0