The CCP driver is able to act as a DMA engine. Add a module parameter that allows this feature to be enabled/disabled. Signed-off-by: Gary R Hook <gary.hook@xxxxxxx> --- drivers/crypto/ccp/ccp-dev-v5.c | 11 +++++++---- drivers/crypto/ccp/ccp-dev.h | 1 + drivers/crypto/ccp/sp-pci.c | 8 ++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index ffd546b951b6..dfd803f6fb55 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c @@ -976,9 +976,11 @@ static int ccp5_init(struct ccp_device *ccp) goto e_kthread; /* Register the DMA engine support */ - ret = ccp_dmaengine_register(ccp); - if (ret) - goto e_hwrng; + if (ccp_register_dma()) { + ret = ccp_dmaengine_register(ccp); + if (ret) + goto e_hwrng; + } #ifdef CONFIG_CRYPTO_DEV_CCP_DEBUGFS /* Set up debugfs entries */ @@ -1013,7 +1015,8 @@ static void ccp5_destroy(struct ccp_device *ccp) unsigned int i; /* Unregister the DMA engine */ - ccp_dmaengine_unregister(ccp); + if (ccp_register_dma()) + ccp_dmaengine_unregister(ccp); /* Unregister the RNG */ ccp_unregister_rng(ccp); diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index cd1bd78d95cc..323f7d8ce454 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h @@ -647,6 +647,7 @@ int ccp_register_rng(struct ccp_device *ccp); void ccp_unregister_rng(struct ccp_device *ccp); int ccp_dmaengine_register(struct ccp_device *ccp); void ccp_dmaengine_unregister(struct ccp_device *ccp); +unsigned int ccp_register_dma(void); void ccp5_debugfs_setup(struct ccp_device *ccp); void ccp5_debugfs_destroy(void); diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index 86dee2a66f00..5b0a9c145c5a 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -57,6 +57,10 @@ static unsigned int nqueues = MAX_HW_QUEUES; module_param(nqueues, uint, 0444); MODULE_PARM_DESC(nqueues, "Number of queues per CCP (default: 5)"); +static unsigned int registerdma = 1; +module_param(registerdma, uint, 0444); +MODULE_PARM_DESC(registerdma, "Register services with the DMA engine (default: 1)"); + #define COMMA ',' static void ccp_parse_pci_buses(void) { @@ -154,6 +158,10 @@ unsigned int ccp_get_nqueues_param(void) { return nqueues; } +unsigned int ccp_register_dma(void) { + return registerdma; +} + #define MSIX_VECTORS 2 struct sp_pci {