{"id":808072,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808072/?format=json","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.0/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<1504163542.4681.5.camel@hbabu-laptop>","date":"2017-08-31T07:12:22","name":"[V4,2/7] crypto/nx: Create nx842_configure_crb function","commit_ref":"56c10d5ea68b9a1425df0dedbe5d2710cc7d8bfa","pull_url":null,"state":"accepted","archived":false,"hash":"c1d01b042ff8b39935de7cfedd347561b4e7ea12","submitter":{"id":12875,"url":"http://patchwork.ozlabs.org/api/1.0/people/12875/?format=json","name":"Haren Myneni","email":"haren@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504163542.4681.5.camel@hbabu-laptop/mbox/","series":[{"id":757,"url":"http://patchwork.ozlabs.org/api/1.0/series/757/?format=json","date":"2017-08-31T07:10:13","name":"Enable NX 842 compression engine on Power9","version":4,"mbox":"http://patchwork.ozlabs.org/series/757/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808072/checks/","tags":{},"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjYXf0zvjz9s7c\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 17:14:42 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xjYXf09VyzDqY3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 17:14:42 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xjYVK04SgzDqh4\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 31 Aug 2017 17:12:40 +1000 (AEST)","from pps.filterd (m0098394.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7V7BER4003517\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 31 Aug 2017 03:12:38 -0400","from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cp5805kt1-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 31 Aug 2017 03:12:38 -0400","from localhost\n\tby e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from <haren@linux.vnet.ibm.com>; \n\tThu, 31 Aug 2017 01:12:37 -0600","from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19)\n\tby e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tThu, 31 Aug 2017 01:12:34 -0600","from b03ledav003.gho.boulder.ibm.com\n\t(b03ledav003.gho.boulder.ibm.com [9.17.130.234])\n\tby b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v7V7CXBd64487542; Thu, 31 Aug 2017 00:12:33 -0700","from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 601566A043;\n\tThu, 31 Aug 2017 01:12:33 -0600 (MDT)","from [9.70.82.25] (unknown [9.70.82.25])\n\tby b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id C9FF36A03F;\n\tThu, 31 Aug 2017 01:12:32 -0600 (MDT)"],"Subject":"[PATCH V4 2/7] crypto/nx: Create nx842_configure_crb function","From":"Haren Myneni <haren@linux.vnet.ibm.com>","To":"mpe@ellerman.id.au, herbert@gondor.apana.org.au","Content-Type":"text/plain; charset=\"UTF-8\"","Date":"Thu, 31 Aug 2017 00:12:22 -0700","Mime-Version":"1.0","X-Mailer":"Evolution 2.28.3 ","Content-Transfer-Encoding":"7bit","X-TM-AS-GCONF":"00","x-cbid":"17083107-0008-0000-0000-0000088065CF","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007640; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000226; SDB=6.00910093; UDB=6.00456508;\n\tIPR=6.00690374; \n\tBA=6.00005562; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016938;\n\tXFM=3.00000015; UTC=2017-08-31 07:12:36","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17083107-0009-0000-0000-000043C8779D","Message-Id":"<1504163542.4681.5.camel@hbabu-laptop>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-31_02:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708310109","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"mikey@neuling.org, linuxram@us.ibm.com, npiggin@gmail.com,\n\tsuka@us.ibm.com, \n\tlinux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\tddstreet@ieee.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"Configure CRB is moved to nx842_configure_crb() so that it can\nbe used for icswx and VAS exec functions. VAS function will be\nadded later with P9 support.\n\nSigned-off-by: Haren Myneni <haren@us.ibm.com>\n---\n drivers/crypto/nx/nx-842-powernv.c | 57 +++++++++++++++++++++++++-------------\n 1 file changed, 38 insertions(+), 19 deletions(-)","diff":"diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c\nindex 161987698bbc..1bd19e03eb7d 100644\n--- a/drivers/crypto/nx/nx-842-powernv.c\n+++ b/drivers/crypto/nx/nx-842-powernv.c\n@@ -358,6 +358,40 @@ static int wait_for_csb(struct nx842_workmem *wmem,\n \treturn 0;\n }\n \n+static int nx842_config_crb(const unsigned char *in, unsigned int inlen,\n+\t\t\tunsigned char *out, unsigned int outlen,\n+\t\t\tstruct nx842_workmem *wmem)\n+{\n+\tstruct coprocessor_request_block *crb;\n+\tstruct coprocessor_status_block *csb;\n+\tu64 csb_addr;\n+\tint ret;\n+\n+\tcrb = &wmem->crb;\n+\tcsb = &crb->csb;\n+\n+\t/* Clear any previous values */\n+\tmemset(crb, 0, sizeof(*crb));\n+\n+\t/* set up DDLs */\n+\tret = setup_ddl(&crb->source, wmem->ddl_in,\n+\t\t\t(unsigned char *)in, inlen, true);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = setup_ddl(&crb->target, wmem->ddl_out,\n+\t\t\tout, outlen, false);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* set up CRB's CSB addr */\n+\tcsb_addr = nx842_get_pa(csb) & CRB_CSB_ADDRESS;\n+\tcsb_addr |= CRB_CSB_AT; /* Addrs are phys */\n+\tcrb->csb_addr = cpu_to_be64(csb_addr);\n+\n+\treturn 0;\n+}\n+\n /**\n  * nx842_exec_icswx - compress/decompress data using the 842 algorithm\n  *\n@@ -397,7 +431,6 @@ static int nx842_exec_icswx(const unsigned char *in, unsigned int inlen,\n \tstruct coprocessor_status_block *csb;\n \tstruct nx842_workmem *wmem;\n \tint ret;\n-\tu64 csb_addr;\n \tu32 ccw;\n \tunsigned int outlen = *outlenp;\n \n@@ -411,33 +444,19 @@ static int nx842_exec_icswx(const unsigned char *in, unsigned int inlen,\n \t\treturn -ENODEV;\n \t}\n \n-\tcrb = &wmem->crb;\n-\tcsb = &crb->csb;\n-\n-\t/* Clear any previous values */\n-\tmemset(crb, 0, sizeof(*crb));\n-\n-\t/* set up DDLs */\n-\tret = setup_ddl(&crb->source, wmem->ddl_in,\n-\t\t\t(unsigned char *)in, inlen, true);\n-\tif (ret)\n-\t\treturn ret;\n-\tret = setup_ddl(&crb->target, wmem->ddl_out,\n-\t\t\tout, outlen, false);\n+\tret = nx842_config_crb(in, inlen, out, outlen, wmem);\n \tif (ret)\n \t\treturn ret;\n \n+\tcrb = &wmem->crb;\n+\tcsb = &crb->csb;\n+\n \t/* set up CCW */\n \tccw = 0;\n \tccw = SET_FIELD(CCW_CT, ccw, nx842_ct);\n \tccw = SET_FIELD(CCW_CI_842, ccw, 0); /* use 0 for hw auto-selection */\n \tccw = SET_FIELD(CCW_FC_842, ccw, fc);\n \n-\t/* set up CRB's CSB addr */\n-\tcsb_addr = nx842_get_pa(csb) & CRB_CSB_ADDRESS;\n-\tcsb_addr |= CRB_CSB_AT; /* Addrs are phys */\n-\tcrb->csb_addr = cpu_to_be64(csb_addr);\n-\n \twmem->start = ktime_get();\n \n \t/* do ICSWX */\n","prefixes":["V4","2/7"]}