From patchwork Wed Jul 27 00:10:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 9249141 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 88A0E607D8 for ; Wed, 27 Jul 2016 00:25:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78C3E26A4D for ; Wed, 27 Jul 2016 00:25:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B137276AE; Wed, 27 Jul 2016 00:25: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 DE8A526A4D for ; Wed, 27 Jul 2016 00:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757678AbcG0AZ2 (ORCPT ); Tue, 26 Jul 2016 20:25:28 -0400 Received: from mail-dm3nam03on0086.outbound.protection.outlook.com ([104.47.41.86]:48339 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757175AbcG0AZ0 (ORCPT ); Tue, 26 Jul 2016 20:25:26 -0400 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=Mp7IjpgtaIeKCG3JARhvUhAiywhdybl37DwdycyI1tg=; b=unR5VfDOFu4CSMQC4kD1HL84uby3cZjiEWuiYeKmBoyXuWXXpvubFagylADskEihmOO3O87Ri1iKdmj4WMXl4YgUzcECDrhCb5rIkMAEHKGZOYSctvP6fLiEHURodH/ApMaoEgABCbOuYYLZeCiY1K8OrqyL/uH1it6+sTSwoBE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by BY2PR12MB0337.namprd12.prod.outlook.com (10.162.84.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10; Wed, 27 Jul 2016 00:10:15 +0000 Subject: [PATCH 06/10] crypto: ccp - Refactor code to enable checks for queue space. From: Gary R Hook To: CC: , , Date: Tue, 26 Jul 2016 19:10:13 -0500 Message-ID: <20160727001013.24944.95785.stgit@taos> In-Reply-To: <20160727000652.24944.44919.stgit@taos> References: <20160727000652.24944.44919.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY1PR14CA0004.namprd14.prod.outlook.com (10.163.13.142) To BY2PR12MB0337.namprd12.prod.outlook.com (10.162.84.12) X-MS-Office365-Filtering-Correlation-Id: 88393480-41aa-4181-ef50-08d3b5b2631b X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0337; 2:Dpm1xi93RaJRbtFsZ+Zq34HH4GA56KcijJfrHiW9LhSavKuy/HVlVzv7ZYmFvALyXNPWmWqjN8rHx4f+pOHBx40IqtDXIeH191x/K6aadHtRc9Dqhe0mt9e3cpb9JKI0zSzIZkK672m6DPxOAB6i4ESR4AxpF+TV1gx7mjMfsYSHDpYWTseMRIRZMjskYpbE; 3:hWGcz2eiAyLPGyLPbHygcUcHMjB6WsDpj3ZSEFVW7dpBQUb2fSZ9Y9M7Wwid7KcchfIRV1YudX54ba4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-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR12MB0337; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0337; X-Forefront-PRVS: 0016DEFF96 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(199003)(189002)(76176999)(54356999)(305945005)(19580395003)(101416001)(33716001)(50986999)(105586002)(97746001)(189998001)(2950100001)(3846002)(6116002)(2906002)(47776003)(81166006)(7736002)(7846002)(92566002)(83506001)(81156014)(19580405001)(4326007)(106356001)(229853001)(230700001)(66066001)(103116003)(33646002)(50466002)(586003)(77096005)(42186005)(4001350100001)(68736007)(1076002)(23676002)(97736004)(110136002)(8676002)(575784001)(86362001)(9686002)(2351001)(71626007); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0337; H:[10.236.19.42]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyTUIwMzM3OzIzOjY4dXRzSnhJa0JTeFhNdUpSSGRDMDRzWjNC?= =?utf-8?B?WmV0UmJoY1ZQcmIrNTFLd0oyUktNeGpIWnpSVzV3SVkzeDNuK0lVVktsNjNZ?= =?utf-8?B?VlJCNC9BZmFrWHhEaEw0eDY3cUp0Q0IzNld1Sjcxd3BlTjRRa0d1N3BLdUZi?= =?utf-8?B?TUZaVzZHT0dnd1lId2V6OHhLdHFTbHR6akltWTJtblE1c3cvdHJNWHFnZzc5?= =?utf-8?B?VVM0MDJ4NDBrNTZ1UURQaXFLa1lQanIzU3QvT0x1UU9zVG1UTW5ncHJTaUpT?= =?utf-8?B?YXB4aTlkWG12c3h1MHRhenVVRURueklmUjFhRStGYUNVb0dOL2NzM0o2NHdL?= =?utf-8?B?dm1hYk9jdkVqaWppSVJV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7GTN0gx8YuhiPEgsYbRn2qrPek8PaZgPyt3dO4dANYY0xHfd9Af48bE/6L12kw4/xNPrtuoq8WxhDtjAXtHRJc=; 7:Cas/an+XnYXfSZjusaO+aCcAiYeFdCaUidFv24iC77CKkeV7fhPfBhIwjfaThEcPcoTh7cP9LxOlAGS/jW6+qooSFVTEy7tRn6qpeUfv3pGBCBTxb6hJo+jxOYd5SBM+h0QZ6yaxcwgtvXpAQqcqrc32pSRMdJdclA73De0YsgUHiK1UINeW4VJeOQSBcuEjHSBbXMV4vA6yejdJVjnhwu2uj2I9wIqeqgoND7TuttcoRNi38AXdLKrASUx2/Ec6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0337; 20:Rpvts25LEHFTjK4gzvHW4BQD4/eepj0PFdObZeEJFgOC7p/a5ZdqE4oM4i6V6zs4zUmu2yGPAi8/Wk9s/wJn8mF5vV6FxoVzI2ys0YyQsjsJVRHH6fdfii+BfGbps2jRwZeWQcLYHspjZgcW4n+bOxjz6D682kW6/jD8tuS44+YBeTn7sA6zyX12/HwiC6Wc8hJNtYAI9YszlL14u/hdVvYUVkISS2ehlpjeb3sO37WAhih+9/zME7dvZofvTNuZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2016 00:10:15.6809 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0337 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 Available queue space is used to decide (by counting free slots) if we have to put a command on hold or if it can be sent to the engine immediately. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev-v3.c | 8 +++++++- drivers/crypto/ccp/ccp-dev.h | 1 + drivers/crypto/ccp/ccp-ops.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c index 373ac4f..02c8c95 100644 --- a/drivers/crypto/ccp/ccp-dev-v3.c +++ b/drivers/crypto/ccp/ccp-dev-v3.c @@ -70,6 +70,11 @@ static void ccp_free_ksb(struct ccp_cmd_queue *cmd_q, unsigned int start, wake_up_interruptible_all(&ccp->sb_queue); } +static unsigned int ccp_get_free_slots(struct ccp_cmd_queue *cmd_q) +{ + return CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); +} + static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count) { struct ccp_cmd_queue *cmd_q = op->cmd_q; @@ -357,7 +362,7 @@ static int ccp_init(struct ccp_device *ccp) cmd_q->int_ok = 1 << (i * 2); cmd_q->int_err = 1 << ((i * 2) + 1); - cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); + cmd_q->free_slots = ccp_get_free_slots(cmd_q); init_waitqueue_head(&cmd_q->int_queue); @@ -559,6 +564,7 @@ static const struct ccp_actions ccp3_actions = { .sbfree = ccp_free_ksb, .init = ccp_init, .destroy = ccp_destroy, + .get_free_slots = ccp_get_free_slots, .irqhandler = ccp_irq_handler, }; diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 0c44c5e0..de90702 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h @@ -458,6 +458,7 @@ struct ccp_actions { u32 (*sballoc)(struct ccp_cmd_queue *, unsigned int); void (*sbfree)(struct ccp_cmd_queue *, unsigned int, unsigned int); + unsigned int (*get_free_slots)(struct ccp_cmd_queue *); int (*init)(struct ccp_device *); void (*destroy)(struct ccp_device *); irqreturn_t (*irqhandler)(int, void *); diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index bd9eb1d..fdab0ae 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -1765,7 +1765,7 @@ int ccp_run_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) cmd->engine_error = 0; cmd_q->cmd_error = 0; cmd_q->int_rcvd = 0; - cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); + cmd_q->free_slots = cmd_q->ccp->vdata->perform->get_free_slots(cmd_q); switch (cmd->engine) { case CCP_ENGINE_AES: