hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/crypto/caam/qi.c
....@@ -84,13 +84,6 @@
8484 #endif
8585
8686 /*
87
- * CPU from where the module initialised. This is required because QMan driver
88
- * requires CGRs to be removed from same CPU from where they were originally
89
- * allocated.
90
- */
91
-static int mod_init_cpu;
92
-
93
-/*
9487 * This is a a cache of buffers, from which the users of CAAM QI driver
9588 * can allocate short (CAAM_QI_MEMCACHE_SIZE) buffers. It's faster than
9689 * doing malloc on the hotpath.
....@@ -492,12 +485,11 @@
492485 }
493486 EXPORT_SYMBOL(caam_drv_ctx_rel);
494487
495
-int caam_qi_shutdown(struct device *qidev)
488
+void caam_qi_shutdown(struct device *qidev)
496489 {
497
- int i, ret;
490
+ int i;
498491 struct caam_qi_priv *priv = dev_get_drvdata(qidev);
499492 const cpumask_t *cpus = qman_affine_cpus();
500
- struct cpumask old_cpumask = current->cpus_allowed;
501493
502494 for_each_cpu(i, cpus) {
503495 struct napi_struct *irqtask;
....@@ -510,26 +502,12 @@
510502 dev_err(qidev, "Rsp FQ kill failed, cpu: %d\n", i);
511503 }
512504
513
- /*
514
- * QMan driver requires CGRs to be deleted from same CPU from where they
515
- * were instantiated. Hence we get the module removal execute from the
516
- * same CPU from where it was originally inserted.
517
- */
518
- set_cpus_allowed_ptr(current, get_cpu_mask(mod_init_cpu));
519
-
520
- ret = qman_delete_cgr(&priv->cgr);
521
- if (ret)
522
- dev_err(qidev, "Deletion of CGR failed: %d\n", ret);
523
- else
524
- qman_release_cgrid(priv->cgr.cgrid);
505
+ qman_delete_cgr_safe(&priv->cgr);
506
+ qman_release_cgrid(priv->cgr.cgrid);
525507
526508 kmem_cache_destroy(qi_cache);
527509
528
- /* Now that we're done with the CGRs, restore the cpus allowed mask */
529
- set_cpus_allowed_ptr(current, &old_cpumask);
530
-
531510 platform_device_unregister(priv->qi_pdev);
532
- return ret;
533511 }
534512
535513 static void cgr_cb(struct qman_portal *qm, struct qman_cgr *cgr, int congested)
....@@ -718,21 +696,10 @@
718696 struct device *ctrldev = &caam_pdev->dev, *qidev;
719697 struct caam_drv_private *ctrlpriv;
720698 const cpumask_t *cpus = qman_affine_cpus();
721
- struct cpumask old_cpumask = current->cpus_allowed;
722699 static struct platform_device_info qi_pdev_info = {
723700 .name = "caam_qi",
724701 .id = PLATFORM_DEVID_NONE
725702 };
726
-
727
- /*
728
- * QMAN requires CGRs to be removed from same CPU+portal from where it
729
- * was originally allocated. Hence we need to note down the
730
- * initialisation CPU and use the same CPU for module exit.
731
- * We select the first CPU to from the list of portal owning CPUs.
732
- * Then we pin module init to this CPU.
733
- */
734
- mod_init_cpu = cpumask_first(cpus);
735
- set_cpus_allowed_ptr(current, get_cpu_mask(mod_init_cpu));
736703
737704 qi_pdev_info.parent = ctrldev;
738705 qi_pdev_info.dma_mask = dma_get_mask(ctrldev);
....@@ -795,8 +762,6 @@
795762 return -ENOMEM;
796763 }
797764
798
- /* Done with the CGRs; restore the cpus allowed mask */
799
- set_cpus_allowed_ptr(current, &old_cpumask);
800765 #ifdef CONFIG_DEBUG_FS
801766 debugfs_create_file("qi_congested", 0444, ctrlpriv->ctl,
802767 &times_congested, &caam_fops_u64_ro);