From patchwork Fri Mar 10 18:28:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 9617807 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 115AB604D9 for ; Fri, 10 Mar 2017 18:28:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10B772768C for ; Fri, 10 Mar 2017 18:28:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0561228769; Fri, 10 Mar 2017 18:28:30 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434232768C for ; Fri, 10 Mar 2017 18:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933174AbdCJS22 (ORCPT ); Fri, 10 Mar 2017 13:28:28 -0500 Received: from mail-by2nam01on0081.outbound.protection.outlook.com ([104.47.34.81]:14008 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933059AbdCJS21 (ORCPT ); Fri, 10 Mar 2017 13:28:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PkH0se8SnEJUHVJMLb8SmKBj2AMMdm2ZJ09lGZc3lZU=; b=j+2XVQWArBMLa+5NRGnXHmc9X2pEFdjzEG++IbjvRxUyumlX/uEMTe90fAAOgs3PxuOuuJWveWFzGAb/UrAY180NlLshkqIePQYTZPePjlvMw301PcWf9KxytdEgCJ/rSUCvV3aMiJsNXaRkzvFKLgDQTwsPTcpUboD9aPnP9js= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from [10.236.19.42] (165.204.77.1) by BLUPR12MB0467.namprd12.prod.outlook.com (10.162.92.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 10 Mar 2017 18:28:22 +0000 Subject: [PATCH] crypto: ccp - Assign DMA commands to the channel's CCP From: Gary R Hook To: CC: , , , Date: Fri, 10 Mar 2017 12:28:18 -0600 Message-ID: <20170310182818.21186.92711.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN1PR19CA0003.namprd19.prod.outlook.com (10.163.220.13) To BLUPR12MB0467.namprd12.prod.outlook.com (10.162.92.148) X-MS-Office365-Filtering-Correlation-Id: f7ee814b-7740-4e0b-9be5-08d467e33c34 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:BLUPR12MB0467; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0467; 3:zLmvSS0MROIGJggvwcpH+p3K1tX7aBdmNgx2NxOrIW9W/3jdtKR0LjwLCaB5TWF4Rm0XVwXJbg5d/Br/07HBp5gkvK1gLP9oxkRgyeZ5JRVlff0fw5/305KszYKKX0YVwtBLkNPTX2WZgAt+oNlps07jPkn8viGvx8l5rDfW4pG7lNVAjGwHAqXqHY7+dy+3U9jqLNrhhneIqCU6JVmyWHGe9gJKOUM17uKw1J/YM3P+gSxUxqsRUN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xdcIW4FDSZESenU7N+IzEbzOv/o4rhN+QBuDL2llw1UWK1OQv/Pna1i2bI62VTwdvi83bp+q6XAI8UoIVAyQQZlLVwzbV+5/7y4cTKiCXoOdfAnm6yri7WsvcRwV/qmn11lpdZEsSF1acABDkJzuqS+vwUbfhaLEh5IZTnP1Ua9YJi9TzpnutzjbWK3aW95mymDr+mhdPiBc7oUT6fnF96G0UW53UV1Y6V3/QXP/572/MTMgYik621eeMHzLwIAM/2G4o9o7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(20161123555025)(6072148); SRVR:BLUPR12MB0467; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0467; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0467; 4:1e6Ejbv+Q5IEbFKCMHhX0Pg6d1G1UajQcGlVdRVwnZUWuFTPeNHdmvvXBcrMZPAlwfOVUEtWyGiNxXxIn1+i9TS4wekfwkRfT5XYR1M/ejfv7jyPzUeim1cgrnfyMw2+z8I4Ja2W+JFNk74VEi3bSopFQYx5lk0O3TerAGThQWz3zKbkR7Vic64wYIxZHRXYAj1GiyQVEayAClxCotZO1yfdSQrcdh+ZgoKVXbOxGdix2iIcXBsuOJUCAGcFc1pvBWTzRnWCrJiL7L8K2iFEt9yAZMON6wCZqCfWjYW+A02J4rc02nG+9SIkt6lk7bABfRfkhHemMSZ4o8PRPGFSEdkfHfz5JH5sTP/WEywUXu3Z1/k7lN8dBj9v6gZ1eIC5MDTsuMVFUnZAkYaJ5lS7u1D9mTtF7Uiy64oOstfs/zFJweKjpvnhknnLnm4VBNG5tk2F/XR82GmtCWV0D9XGmer5dMZTzfzgXOR3qgxyYPb96W/f917ucwlqKjd+eAZZbxjnPiyg0FmybFnSHkHsTiMUNgFHEn0EWFbCOtiPCKWo9o1S9RisDoTUKrQMwJ0faQq5Bs4wA1Eq0ENrR4AWcIy4yQ9TQmfPFdmqyY97YX5pQSgjQj8rzXqaY5K8+uP5eCSa4m7LMywYcJNayrSgGftsj/2pdYUKkiF7b+855XA737h/vOm6cM+y99zYiXFC X-Forefront-PRVS: 02426D11FE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(39860400002)(39410400002)(39850400002)(39450400003)(39840400002)(66066001)(23676002)(4001350100001)(103116003)(3846002)(97746001)(5660300001)(6116002)(83506001)(77096006)(9686003)(2351001)(2906002)(230700001)(90366009)(47776003)(50466002)(189998001)(54906002)(33646002)(305945005)(7736002)(110136004)(81166006)(50986999)(53936002)(1076002)(6486002)(4326008)(38730400002)(54356999)(8676002)(33716001)(86362001)(6666003)(575784001)(25786008)(6916009)(42186005); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0467; H:[10.236.19.42]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjEyTUIwNDY3OzIzOldtR0Rlb1ZLRnpkQWsyanMwN2U1SkVjNmxp?= =?utf-8?B?T0xKclFSWFhNNU0xUkc2WFh0eHJ2c3NrcW5hdXFQOFZTN3VhenBxTEF4eFUz?= =?utf-8?B?bnFKcDUvUVVyWVByMjNFWmFycnJaN1ZDdkZDU1M4dmVqZVR4dldFRE5WWVFi?= =?utf-8?B?cm1TdnRRTFBMdTFPaWkwT3h1eUxWajRHT25rRm52L1dWKzVtL0xDQnhaVWwx?= =?utf-8?B?aVl5MzNRTUhhaXRaazdJb1FjL1NLTHNMa0tqSDV3MG9jWDNzU0tLbUtGSi83?= =?utf-8?B?cUF3WmxBKzQ5NnZHd1luL2c4VHpWOTFlNlhXcSt2a1RxMTlhRGVjNEdEaEdS?= =?utf-8?B?eStBSkgzcGJjUDVUYnN5MitjOHN6ZWNJeXQ5L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NhP4ujDzPmKot6jxAGZQkb+q+calQSu/XzMtY1w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0467; 7:T50IyK3C0/onGRsf0pTLaNguV40lZRUKVBdxfhWmNgtNBi5xmPo9y38YjThtI1EIc9J8pqmpYan05QgK89l7NJrblZr9YOz/W9upc80jAPE63Be2ketc9polsc4E++TZX2EsBt+5TFjCS8uKlLFeIBvy8ZIRRHeCC7B1rxL/KoV0xWXueXF4R1BQ7EMoZZHqtrvq4wfwEP3jdYYcOpuzBh7x3+N1FlI+Gt91UaDjQqyTkwhhWuM5Rcs/WNyQtg2/5/axy70aoFmp6u2ZEm5qAGo6XTcH3HF1x5w8myz6iJJaj8aAq1IjDc6ccYDbNseyfReiKzFowpiqbWMifKzlyw==; 20:vBNWYy5ShfxHIf6lRqw5WWgbh5PXsBP8HQHFnB5GZ6HImhQhjxjYlg2ljWsgfb4XTse59UGScSEXD4lslJrtxYN/kkaiWn3CwsN90qK/JoqDEwjMckglEanZzVy9Tl6X8VOfm2F/L64YnpjxRkK6tzevjM6sf+KXLW4ujegmxD7rzvPajBfyR+ZET02pv5an17qwsAftP06mYhjvzDueto+bLMw0ZS6KRZfZmFiRVIp7lxBp5+xVDJCA7feZFKUq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2017 18:28:22.8275 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0467 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gary R Hook The CCP driver generally uses a round-robin approach when assigning operations to available CCPs. For the DMA engine, however, the DMA mappings of the SGs are associated with a specific CCP. When an IOMMU is enabled, the IOMMU is programmed based on this specific device. If the DMA operations are not performed by that specific CCP then addressing errors and I/O page faults will occur. Update the CCP driver to allow a specific CCP device to be requested for an operation and use this in the DMA engine support. Cc: # 4.9.x- Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev.c | 5 ++++- drivers/crypto/ccp/ccp-dmaengine.c | 1 + include/linux/ccp.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 511ab04..92d1c69 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -283,11 +283,14 @@ unsigned int ccp_version(void) */ int ccp_enqueue_cmd(struct ccp_cmd *cmd) { - struct ccp_device *ccp = ccp_get_device(); + struct ccp_device *ccp; unsigned long flags; unsigned int i; int ret; + /* Some commands might need to be sent to a specific device */ + ccp = cmd->ccp ? cmd->ccp : ccp_get_device(); + if (!ccp) return -ENODEV; diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index e5d9278..8d0eeb4 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -390,6 +390,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan, goto err; ccp_cmd = &cmd->ccp_cmd; + ccp_cmd->ccp = chan->ccp; ccp_pt = &ccp_cmd->u.passthru_nomap; ccp_cmd->flags = CCP_CMD_MAY_BACKLOG; ccp_cmd->flags |= CCP_CMD_PASSTHRU_NO_DMA_MAP; diff --git a/include/linux/ccp.h b/include/linux/ccp.h index c71dd8f..c41b8d99 100644 --- a/include/linux/ccp.h +++ b/include/linux/ccp.h @@ -556,7 +556,7 @@ enum ccp_engine { * struct ccp_cmd - CCP operation request * @entry: list element (ccp driver use only) * @work: work element used for callbacks (ccp driver use only) - * @ccp: CCP device to be run on (ccp driver use only) + * @ccp: CCP device to be run on * @ret: operation return code (ccp driver use only) * @flags: cmd processing flags * @engine: CCP operation to perform