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>
此提交包含在:
@@ -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;
|
||||
}
|
||||
|
新增問題並參考
封鎖使用者