summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccp/ccp-dev.c
diff options
context:
space:
mode:
authorHook, Gary <Gary.Hook@amd.com>2019-07-09 15:07:22 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2019-07-26 22:08:03 +1000
commitc4a89279086e9c98eba659d7665b1732e0d5e3e3 (patch)
tree3b28fcadcc0bea7955a6d98362f612cee55fde01 /drivers/crypto/ccp/ccp-dev.c
parent93308baf075039dccf347391491773f272cc24f6 (diff)
downloadlinux-stable-c4a89279086e9c98eba659d7665b1732e0d5e3e3.tar.gz
linux-stable-c4a89279086e9c98eba659d7665b1732e0d5e3e3.tar.bz2
linux-stable-c4a89279086e9c98eba659d7665b1732e0d5e3e3.zip
crypto: ccp - Add a module parameter to specify a queue count
Add a module parameter to limit the number of queues per CCP. The default value (nqueues=0) is to set up every available queue on each device. The count of queues starts from the first one found on the device (which varies based on the device ID). Signed-off-by: Gary R Hook <gary.hook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-dev.c')
-rw-r--r--drivers/crypto/ccp/ccp-dev.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index f79eede71c62..352059d0c572 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -8,6 +8,7 @@
* Author: Gary R Hook <gary.hook@amd.com>
*/
+#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/sched.h>
@@ -26,6 +27,11 @@
#include "ccp-dev.h"
+/* Limit CCP use to a specifed number of queues per device */
+static unsigned int nqueues = 0;
+module_param(nqueues, uint, 0444);
+MODULE_PARM_DESC(nqueues, "Number of queues per CCP (minimum 1; default: all available)");
+
struct ccp_tasklet_data {
struct completion completion;
struct ccp_cmd *cmd;
@@ -592,6 +598,11 @@ int ccp_dev_init(struct sp_device *sp)
goto e_err;
sp->ccp_data = ccp;
+ if (!nqueues || (nqueues > MAX_HW_QUEUES))
+ ccp->max_q_count = MAX_HW_QUEUES;
+ else
+ ccp->max_q_count = nqueues;
+
ccp->vdata = (struct ccp_vdata *)sp->dev_vdata->ccp_vdata;
if (!ccp->vdata || !ccp->vdata->version) {
ret = -ENODEV;