mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 19:31:09 +07:00
crypto: caam/qi - don't allocate an extra platform device
Use the controller device for caam/qi instead of allocating a new platform device. This is needed as a preparation to add support for working behind an SMMU. A platform device allocated using platform_device_register_full() is not completely set up - most importantly .dma_configure() is not called. Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
1b46c90c8e
commit
6b175685b4
@ -2443,7 +2443,7 @@ static int caam_init_common(struct caam_ctx *ctx, struct caam_alg_entry *caam,
|
||||
ctx->cdata.algtype = OP_TYPE_CLASS1_ALG | caam->class1_alg_type;
|
||||
ctx->adata.algtype = OP_TYPE_CLASS2_ALG | caam->class2_alg_type;
|
||||
|
||||
ctx->qidev = priv->qidev;
|
||||
ctx->qidev = ctx->jrdev->parent;
|
||||
|
||||
spin_lock_init(&ctx->lock);
|
||||
ctx->drv_ctx[ENCRYPT] = NULL;
|
||||
@ -2602,7 +2602,7 @@ int caam_qi_algapi_init(struct device *ctrldev)
|
||||
|
||||
err = crypto_register_skcipher(&t_alg->skcipher);
|
||||
if (err) {
|
||||
dev_warn(priv->qidev, "%s alg registration failed\n",
|
||||
dev_warn(ctrldev, "%s alg registration failed\n",
|
||||
t_alg->skcipher.base.cra_driver_name);
|
||||
continue;
|
||||
}
|
||||
@ -2658,7 +2658,7 @@ int caam_qi_algapi_init(struct device *ctrldev)
|
||||
}
|
||||
|
||||
if (registered)
|
||||
dev_info(priv->qidev, "algorithms registered in /proc/crypto\n");
|
||||
dev_info(ctrldev, "algorithms registered in /proc/crypto\n");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ static int caam_remove(struct platform_device *pdev)
|
||||
of_platform_depopulate(ctrldev);
|
||||
|
||||
#ifdef CONFIG_CAAM_QI
|
||||
if (ctrlpriv->qidev)
|
||||
caam_qi_shutdown(ctrlpriv->qidev);
|
||||
if (ctrlpriv->qi_init)
|
||||
caam_qi_shutdown(ctrldev);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -900,8 +900,8 @@ static int caam_probe(struct platform_device *pdev)
|
||||
|
||||
shutdown_qi:
|
||||
#ifdef CONFIG_CAAM_QI
|
||||
if (ctrlpriv->qidev)
|
||||
caam_qi_shutdown(ctrlpriv->qidev);
|
||||
if (ctrlpriv->qi_init)
|
||||
caam_qi_shutdown(dev);
|
||||
#endif
|
||||
iounmap_ctrl:
|
||||
iounmap(ctrl);
|
||||
|
@ -63,10 +63,6 @@ struct caam_drv_private_jr {
|
||||
* Driver-private storage for a single CAAM block instance
|
||||
*/
|
||||
struct caam_drv_private {
|
||||
#ifdef CONFIG_CAAM_QI
|
||||
struct device *qidev;
|
||||
#endif
|
||||
|
||||
/* Physical-presence section */
|
||||
struct caam_ctrl __iomem *ctrl; /* controller region */
|
||||
struct caam_deco __iomem *deco; /* DECO/CCB views */
|
||||
@ -80,6 +76,9 @@ struct caam_drv_private {
|
||||
*/
|
||||
u8 total_jobrs; /* Total Job Rings in device */
|
||||
u8 qi_present; /* Nonzero if QI present in device */
|
||||
#ifdef CONFIG_CAAM_QI
|
||||
u8 qi_init; /* Nonzero if QI has been initialized */
|
||||
#endif
|
||||
u8 mc_en; /* Nonzero if MC f/w is active */
|
||||
int secvio_irq; /* Security violation interrupt number */
|
||||
int virt_en; /* Virtualization enabled in CAAM */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Queue Interface backend functionality
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* Copyright 2016-2017, 2019 NXP
|
||||
*/
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
@ -59,11 +59,9 @@ static DEFINE_PER_CPU(int, last_cpu);
|
||||
/*
|
||||
* caam_qi_priv - CAAM QI backend private params
|
||||
* @cgr: QMan congestion group
|
||||
* @qi_pdev: platform device for QI backend
|
||||
*/
|
||||
struct caam_qi_priv {
|
||||
struct qman_cgr cgr;
|
||||
struct platform_device *qi_pdev;
|
||||
};
|
||||
|
||||
static struct caam_qi_priv qipriv ____cacheline_aligned;
|
||||
@ -491,7 +489,7 @@ EXPORT_SYMBOL(caam_drv_ctx_rel);
|
||||
void caam_qi_shutdown(struct device *qidev)
|
||||
{
|
||||
int i;
|
||||
struct caam_qi_priv *priv = dev_get_drvdata(qidev);
|
||||
struct caam_qi_priv *priv = &qipriv;
|
||||
const cpumask_t *cpus = qman_affine_cpus();
|
||||
|
||||
for_each_cpu(i, cpus) {
|
||||
@ -509,8 +507,6 @@ void caam_qi_shutdown(struct device *qidev)
|
||||
qman_release_cgrid(priv->cgr.cgrid);
|
||||
|
||||
kmem_cache_destroy(qi_cache);
|
||||
|
||||
platform_device_unregister(priv->qi_pdev);
|
||||
}
|
||||
|
||||
static void cgr_cb(struct qman_portal *qm, struct qman_cgr *cgr, int congested)
|
||||
@ -695,33 +691,17 @@ static void free_rsp_fqs(void)
|
||||
int caam_qi_init(struct platform_device *caam_pdev)
|
||||
{
|
||||
int err, i;
|
||||
struct platform_device *qi_pdev;
|
||||
struct device *ctrldev = &caam_pdev->dev, *qidev;
|
||||
struct caam_drv_private *ctrlpriv;
|
||||
const cpumask_t *cpus = qman_affine_cpus();
|
||||
static struct platform_device_info qi_pdev_info = {
|
||||
.name = "caam_qi",
|
||||
.id = PLATFORM_DEVID_NONE
|
||||
};
|
||||
|
||||
qi_pdev_info.parent = ctrldev;
|
||||
qi_pdev_info.dma_mask = dma_get_mask(ctrldev);
|
||||
qi_pdev = platform_device_register_full(&qi_pdev_info);
|
||||
if (IS_ERR(qi_pdev))
|
||||
return PTR_ERR(qi_pdev);
|
||||
set_dma_ops(&qi_pdev->dev, get_dma_ops(ctrldev));
|
||||
|
||||
ctrlpriv = dev_get_drvdata(ctrldev);
|
||||
qidev = &qi_pdev->dev;
|
||||
|
||||
qipriv.qi_pdev = qi_pdev;
|
||||
dev_set_drvdata(qidev, &qipriv);
|
||||
qidev = ctrldev;
|
||||
|
||||
/* Initialize the congestion detection */
|
||||
err = init_cgr(qidev);
|
||||
if (err) {
|
||||
dev_err(qidev, "CGR initialization failed: %d\n", err);
|
||||
platform_device_unregister(qi_pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -730,7 +710,6 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
if (err) {
|
||||
dev_err(qidev, "Can't allocate CAAM response FQs: %d\n", err);
|
||||
free_rsp_fqs();
|
||||
platform_device_unregister(qi_pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -753,15 +732,11 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
napi_enable(irqtask);
|
||||
}
|
||||
|
||||
/* Hook up QI device to parent controlling caam device */
|
||||
ctrlpriv->qidev = qidev;
|
||||
|
||||
qi_cache = kmem_cache_create("caamqicache", CAAM_QI_MEMCACHE_SIZE, 0,
|
||||
SLAB_CACHE_DMA, NULL);
|
||||
if (!qi_cache) {
|
||||
dev_err(qidev, "Can't allocate CAAM cache\n");
|
||||
free_rsp_fqs();
|
||||
platform_device_unregister(qi_pdev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -769,6 +744,8 @@ int caam_qi_init(struct platform_device *caam_pdev)
|
||||
debugfs_create_file("qi_congested", 0444, ctrlpriv->ctl,
|
||||
×_congested, &caam_fops_u64_ro);
|
||||
#endif
|
||||
|
||||
ctrlpriv->qi_init = 1;
|
||||
dev_info(qidev, "Linux CAAM Queue I/F driver initialised\n");
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user