.. | .. |
---|
84 | 84 | #endif |
---|
85 | 85 | |
---|
86 | 86 | /* |
---|
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 | | -/* |
---|
94 | 87 | * This is a a cache of buffers, from which the users of CAAM QI driver |
---|
95 | 88 | * can allocate short (CAAM_QI_MEMCACHE_SIZE) buffers. It's faster than |
---|
96 | 89 | * doing malloc on the hotpath. |
---|
.. | .. |
---|
492 | 485 | } |
---|
493 | 486 | EXPORT_SYMBOL(caam_drv_ctx_rel); |
---|
494 | 487 | |
---|
495 | | -int caam_qi_shutdown(struct device *qidev) |
---|
| 488 | +void caam_qi_shutdown(struct device *qidev) |
---|
496 | 489 | { |
---|
497 | | - int i, ret; |
---|
| 490 | + int i; |
---|
498 | 491 | struct caam_qi_priv *priv = dev_get_drvdata(qidev); |
---|
499 | 492 | const cpumask_t *cpus = qman_affine_cpus(); |
---|
500 | | - struct cpumask old_cpumask = current->cpus_allowed; |
---|
501 | 493 | |
---|
502 | 494 | for_each_cpu(i, cpus) { |
---|
503 | 495 | struct napi_struct *irqtask; |
---|
.. | .. |
---|
510 | 502 | dev_err(qidev, "Rsp FQ kill failed, cpu: %d\n", i); |
---|
511 | 503 | } |
---|
512 | 504 | |
---|
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); |
---|
525 | 507 | |
---|
526 | 508 | kmem_cache_destroy(qi_cache); |
---|
527 | 509 | |
---|
528 | | - /* Now that we're done with the CGRs, restore the cpus allowed mask */ |
---|
529 | | - set_cpus_allowed_ptr(current, &old_cpumask); |
---|
530 | | - |
---|
531 | 510 | platform_device_unregister(priv->qi_pdev); |
---|
532 | | - return ret; |
---|
533 | 511 | } |
---|
534 | 512 | |
---|
535 | 513 | static void cgr_cb(struct qman_portal *qm, struct qman_cgr *cgr, int congested) |
---|
.. | .. |
---|
718 | 696 | struct device *ctrldev = &caam_pdev->dev, *qidev; |
---|
719 | 697 | struct caam_drv_private *ctrlpriv; |
---|
720 | 698 | const cpumask_t *cpus = qman_affine_cpus(); |
---|
721 | | - struct cpumask old_cpumask = current->cpus_allowed; |
---|
722 | 699 | static struct platform_device_info qi_pdev_info = { |
---|
723 | 700 | .name = "caam_qi", |
---|
724 | 701 | .id = PLATFORM_DEVID_NONE |
---|
725 | 702 | }; |
---|
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)); |
---|
736 | 703 | |
---|
737 | 704 | qi_pdev_info.parent = ctrldev; |
---|
738 | 705 | qi_pdev_info.dma_mask = dma_get_mask(ctrldev); |
---|
.. | .. |
---|
795 | 762 | return -ENOMEM; |
---|
796 | 763 | } |
---|
797 | 764 | |
---|
798 | | - /* Done with the CGRs; restore the cpus allowed mask */ |
---|
799 | | - set_cpus_allowed_ptr(current, &old_cpumask); |
---|
800 | 765 | #ifdef CONFIG_DEBUG_FS |
---|
801 | 766 | debugfs_create_file("qi_congested", 0444, ctrlpriv->ctl, |
---|
802 | 767 | ×_congested, &caam_fops_u64_ro); |
---|