Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbbGIUW1 (ORCPT ); Thu, 9 Jul 2015 16:22:27 -0400 Received: from mail-bn1on0111.outbound.protection.outlook.com ([157.56.110.111]:57959 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753889AbbGIUWM (ORCPT ); Thu, 9 Jul 2015 16:22:12 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Roy Pledge To: , CC: , Subject: [PATCH 11/11] soc/qman: add qman_delete_cgr_safe() Date: Thu, 9 Jul 2015 16:22:02 -0400 Message-ID: <1436473322-21247-12-git-send-email-Roy.Pledge@freescale.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1436473322-21247-1-git-send-email-Roy.Pledge@freescale.com> References: <1436473322-21247-1-git-send-email-Roy.Pledge@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD038;1:fENSIPS6vrHBOiMoeFhJcJEO1TGPLai5qmN0NzEBMJHuSHZpt9Sr2OtabknG5kUcMQQW716HyIkGODQlvRcE5wxdMduHuMKFI37qSLaKfYNtaPdtRWUrwaoB5NzCkldUbXN6AZHwKri5nLAXXIFqC3NmbgQDBODm9QbeYzzeSKYT5pE9MQo0r48L/vMRpiTVqnNJd7+bUjKDLXKAm6kndJ2lI8zcAqdCSYh6i8ACO3NNFtem17nCkG93PBaqWYB6UzVhrOIZm2O7JmKBb53WNLLfkMlTlnXPEMO9u2rrpCzFFgpRLKIi9J3fAaJkl13PtXnTUZQjwNSC6UZpyDOnjg== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(189998001)(92566002)(19580405001)(47776003)(50226001)(5001960100002)(104016003)(105606002)(19580395003)(2950100001)(87936001)(77096005)(62966003)(77156002)(6806004)(229853001)(106466001)(86362001)(36756003)(5003940100001)(48376002)(46102003)(85426001)(5001920100001)(50466002)(76176999)(50986999)(5001770100001)(4001450100001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR03MB1487;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB1487;2:Qb7YI3n9mEt6xSmgPi0ZsYTyxKpfrZptO86ROtG4GYSawt3Z7zEoCpjMSH88h9/w;3:8hx+DKY3T1591jLp0W9xU+9z3dwdGvpqL9Vx74b2QWQy7wrIEv0Rzb7hAsQp6744HslC3DFxUthosQyGaxmQGBXQIB6plHh4yqCm5Ud3MXiInsrSoQT7eaK0fUO6cklnMsavTlX5MlFUh1opn+XXDdqiPUIu8R1wtJ28H6AzmgE1I1xf1X9rhBCFJ6//jT4HbwXXSWsaXoq649ZmY13niPMP8bAeK205csJ8bQOngNI=;25:6Z2tfxVPJpq1NGUsDZ4pyycEjTLXmAPS5sYp/02e5frmZclK/S50jrFmkDOChXtfUqMkZDOG1Omdn4n10jXKYIhkT3zCrtKu+2wLOXoiALU7eRJxcXmqf9J14YTDCYhNaXOeWqg1UJzwtmCmTvVrMZovYMZV9lbyMoJ1FASpcmznm5VcMwOmJDaGQJIu653a76B+1fZvM9R5L3alU+rQ4gHjwknCaivNsPeT6id4uHi40wff7rjP5zCqKm6R5aRQR3gvi6rKgBNDsJv8MnVzrA==;20:t7DPrkdd5UsV9GSGRquKPrbpOb0nh11jXEGIfHtgJXYoH13/FrKcHTc34SKHCQPAkcsfN+WDDxzC1V2L+1Ny8XC9KMaLxBjI2Kk5NKSCry+RyB6J2haWCdJF2flhCjWIE0JQKpCG6Zgsv9q9QJk5HrkC4Wb+BMZZ8vC69DeYiGZMMNX4TTT0ea/YpH8L1v82VCtEbPqAMG/lS20vW+B64cKKvzrUCx2SHN8Zt925KtKK93Wog+47lqLGCCh27KdRcR7bI7cev5ZbITx5nmZufs2gIfc3lU6RJ6n7rqoP1fyOOCtuoFwJ+TJQ6NkLqiJySOeIMm2iXNxDDlamaOfMHTuBLMh2kOfd9eExSnefI8k= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1487; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:CY1PR03MB1487;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1487; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB1487;4:jIwJlEJSA4N0fJi9v3D96ryOUt+PSxy8bTV7vGn5j2Aquw8Ztz4+Yph/NkhwTOaNnNu/bBS0fq1otJBniWGOcxJGIDiLF/6ZiKVHN5cfkd41iihHhB7KAIgAxMFJBzGzDe9duIVVA1SSSxp22K2FdRWg7SZZ0sO/sERh42JV2AEeB2xJW6i1fvOKmmBLBmEUETGV5nt8cGBkSAg5OR7/jFD2xT0sVZpWU2Dbz1sXM2IZo/WWo7zJAr0rdBUUcmoK1nM+8YDoGdjpHQaGPNHpAd6Gbeo/Gu2H8gZecig8jMc= X-Forefront-PRVS: 0632519F33 X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB1487;23:Xxg8YXapqB1LyQmpSHHqzoXWGesWRzIKEGQHPhluREIl8cZPaJwPdXdAtlbS8ZTp7vu9uGbzjFiHXYk0Wm6ihJYpJK6/kRsJIP298R8SUKNr2RdNYAfCnI/+2x6tQJIBla6yHk6oTNesuZHReNzy8TW6vnF4T10zcOkM19/JjFhsAaU3skIzwDmgw2HGc3/vqZWtyxTpUptwLlwVTjHAwdvZYTnqtfew/TEgb49qDLX3QxvgqP2ohy+cMLRmnHI0gYfufiAPPcTqbIN65OXtoyhz/Oc8E/77nujarADfpTKgW4g/keko6Uonffv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CrossTenant-OriginalArrivalTime: 09 Jul 2015 20:22:09.2377 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1487 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2573 Lines: 91 From: Madalin Bucur Add qman_delete_cgr_safe() that can be called from any CPU. This in turn schedules qman_delete_cgr() on the proper CPU. Signed-off-by: Madalin Bucur Signed-off-by: Roy Pledge --- drivers/soc/fsl/qbman/qman_api.c | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman_api.c b/drivers/soc/fsl/qbman/qman_api.c index 93f43dd..5dbcd94 100644 --- a/drivers/soc/fsl/qbman/qman_api.c +++ b/drivers/soc/fsl/qbman/qman_api.c @@ -2459,6 +2459,8 @@ EXPORT_SYMBOL(qman_modify_cgr); QM_CHANNEL_SWPORTAL0)) #define PORTAL_IDX(n) (n->config->public_cfg.channel - QM_CHANNEL_SWPORTAL0) +static u8 qman_cgr_cpus[__CGR_NUM]; + int qman_create_cgr(struct qman_cgr *cgr, u32 flags, struct qm_mcc_initcgr *opts) { @@ -2475,7 +2477,10 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, if (cgr->cgrid >= __CGR_NUM) return -EINVAL; + preempt_disable(); p = get_affine_portal(); + qman_cgr_cpus[cgr->cgrid] = smp_processor_id(); + preempt_enable(); memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); cgr->chan = p->config->public_cfg.channel; @@ -2617,6 +2622,47 @@ put_portal: } EXPORT_SYMBOL(qman_delete_cgr); +struct cgr_comp { + struct qman_cgr *cgr; + struct completion completion; +}; + +static int qman_delete_cgr_thread(void *p) +{ + struct cgr_comp *cgr_comp = (struct cgr_comp *)p; + int res; + + res = qman_delete_cgr((struct qman_cgr *)cgr_comp->cgr); + complete(&cgr_comp->completion); + + return res; +} + +void qman_delete_cgr_safe(struct qman_cgr *cgr) +{ + struct task_struct *thread; + struct cgr_comp cgr_comp; + + preempt_disable(); + if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) { + init_completion(&cgr_comp.completion); + cgr_comp.cgr = cgr; + thread = kthread_create(qman_delete_cgr_thread, &cgr_comp, + "cgr_del"); + + if (likely(!IS_ERR(thread))) { + kthread_bind(thread, qman_cgr_cpus[cgr->cgrid]); + wake_up_process(thread); + wait_for_completion(&cgr_comp.completion); + preempt_enable(); + return; + } + } + qman_delete_cgr(cgr); + preempt_enable(); +} +EXPORT_SYMBOL(qman_delete_cgr_safe); + int qman_set_wpm(int wpm_enable) { return qm_set_wpm(wpm_enable); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/