Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229AbbHLUPe (ORCPT ); Wed, 12 Aug 2015 16:15:34 -0400 Received: from mail-by2on0112.outbound.protection.outlook.com ([207.46.100.112]:40864 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752082AbbHLUPL (ORCPT ); Wed, 12 Aug 2015 16:15:11 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Roy Pledge To: , CC: , Subject: [v2 11/11] soc/qman: add qman_delete_cgr_safe() Date: Wed, 12 Aug 2015 16:14:57 -0400 Message-ID: <1439410497-19039-12-git-send-email-Roy.Pledge@freescale.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1439410497-19039-1-git-send-email-Roy.Pledge@freescale.com> References: <1439410497-19039-1-git-send-email-Roy.Pledge@freescale.com> Reply-To: X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD010;1:RDhP0zMJCtPrzvT9i+HVEtQ974047Fph4TEYJc9rOyE2uU6mOKcOQ+IG7cUGUS/Msp5sSVHazc/K9hzibAtlT7p1SNLrgdSnVM6tLoZPkXDSnPpzVbRU8DkP/OuMaVhWMrOeTTctMuySR8BH1QtNOjn0e8QpwQzUWgBPKXFiWEzY3mAqFaf3bbJFPz3yPERh6jppC/pOzTf47BuXMB3p4OUnCDM0Tr5N0hmaSPlims3hjIkYauF05oURuIRjDO/T7OyKuhNMB1Vcv6RYswbGTFrr+19orRS2wsKm8UDcsqK1bCGSrWKDPrpuNzgoxwZxBIngyFhYH/AVxfDDjAzQFeAGTLcWb5xhXZr9v54Hb2KR7kFemaWO3AtPxXiTBdERpkUxg14a3kMQXEWsBwllKA== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(3050300001)(189002)(199003)(189998001)(64706001)(47776003)(5001960100002)(77156002)(19580395003)(19580405001)(85426001)(62966003)(4001450100002)(48376002)(6806004)(46102003)(106466001)(53806999)(2950100001)(105606002)(77096005)(50226001)(36756003)(229853001)(68736005)(87936001)(4001540100001)(97736004)(5003940100001)(5001770100001)(81156007)(86362001)(5001830100001)(5001860100001)(104016003)(43066003)(76176999)(50466002)(50986999)(69596002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1475;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;2:RkrF7URfEYmLc4WxDRQ0cpa+cFGMmj+30lWq+b0xJNixO9vvn2WmnKHkeOrIPS+VYPAaw94tyz++J30nstD9bmxCHEapXtbWPOgu1JAzB8KKPzYllkm4Qsvk4YQSeoHHZIm+PRkJ/nmGXkuoNPktTTyOTKYV9hBqCUvc1icWWvQ=;3:IQNameNl+1Vf8PTH3WcWcUdpFd9r3f0/K1+HG/QK6QSjTSpX0vdxj7rkfCeQu68DVXAQmo/nLu0P/swUu+FfmqEO+1y6F0RbjiVxkyMJT29BFsiEekpe8YWu/XNlXdMDk9TY3Zl44ga574hMxfKG8+9SjrfF8BmjPb6/mfmXv3V1RlBqiI6xQsnqXzEzOdPAWJSER6gqWSKToYYjt7ezs6BWal+Jwe8ywsZ6BmpXxVc=;25:Y4QE+6jFjkfbJsL0qft0f1r2VU80s0oWU0JODzPSYWjr8B6/qWha4doR/Ch9cUEruGwI2iYJaW4auabiCJ7Bf+E/5+OdkpYK+HgUixmv7RipDWcpC5aWpdDNrFNUFERAAr5Hl0t116Ar6FeBmeyyHpdXdMLvr0fXwCv4JsERPx2rfncA7d6r+u2MbaFZaDyntOm23TiLTaj7mRkIWihKC92bzHYBmDpNz0GCGK2jh/+3LFEDJ3fxlQp3E2Kc8LJpSZiqEO4wyj3GTxHjfSGxDQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1475; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;20:J6eG7TrclQ4iS3c8htj/biTwsdOhrelZlKiCZbXidlYv3JHqlblVU1syUVuLUYuFRoIpzbV4dlCf5QAYZKBoywfvo0WQJTzhrJddl9I/Z2g8nNhM4ag8evFzpC4kEfxLz5qypVgyjsSGiyrh4faenikiLKTdPKA9NpPXGVBEkvg2f9OBZB9B3Pm12oNTKrMKeJ5cgpUucBGJGBsgNgPYS5VdrzGPzR32jZN1sRRBQwoOSYGt9xnekTf+25i8s18VbqQZ+hYPrPY68S/cW74NBk1xh8Df4GeC4uTq2YYgPMSKBxefW2xWR33IWME6Xe/OoGrJE4ORY9crHSnJsUtoMU4lv35XxDXfPwouKZL5cEc=;4:dSwRnUc6hUoZcZ8ejsL7PIQEk0rq3lzlr3QEV2NCe+sV8NYkDfyKMPVl5Iax6VmoPW5HrTPvNjsVGAjBah6Y30+Swmap/LB/mwA7bXeJtK10t8bUyC7kLmHBcQprr4YNFfUCnxbgka28Q0+uDgi7+ZinI7g4rJ/K4KG2lgwAneEcHbzZoS8ZafJVoeYc85pX33x1X6x2M8M1czHKRq1Y5o3AjiN1bRKaORC21HD0GSa64uppSrKovDY0xvVAoLmAzj1zedSOc0vwdCTfWtiCR9/VrrEvjTvQI9NN2/Ojw5I= 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:BLUPR03MB1475;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1475; X-Forefront-PRVS: 0666E15D35 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR03MB1475;23:wprbDLca1TOFg5r7/lRxSJizUItHW61XAwWRV/2bC?= =?us-ascii?Q?BLardJNNJ3/obAh8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?fgXo/SSk4QoCWEbK9kqnKp6Su7HBedi/rQHEAv5zCNItxws6gd9yAR1JtRMD?= =?us-ascii?Q?d+siApiEPrDjR2yLfmf8bpMcjv6xskJn2vxfTrdABsvlx5knnCV45QIuIuEI?= =?us-ascii?Q?Z/cJXS9Gs8hLFyq3KJoJeaLdcbmZWyGve5H3JGrCtR5SPM0XGJnoLshIr/vB?= =?us-ascii?Q?mA2xaSOLRC/oCXFrxrjPjYZuODZz7MccrSml6gOGfAoY2Fk+eTFVQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;5:iZ674xCLg42lGlD3lVNktfoi77H7mRTf2kNGUODA72woOVpBGJpYaWf6Y8xzFwzOvEteiByCjDn13o3T1e0AG6gNiZhKMDws94Is4gNkjFgCNKP7TC8HmfMWCpxhLgkzf58pzFiR+vITwG/mMFr+NQ==;24:rUr+6PhnhAQI6HbQjSBMzdCtkJD172lKOwzZggrilgcs1wdzfc8ZipUbubVAiKbeibP8XUELc3kOydn81f6d/qT7GGIWSt8bgpXVRzCTB0o=;20:k6/XodSfqJMizfF97PVMDHNK2LwbF+lIiadC2+mNXPtSEZhfD4DzKVxnLtJfzW9MJUjdB8bUs6DBDTkuBKhrbw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2015 20:15:07.1582 (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.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1475 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 d4f9be0..1dd60f2 100644 --- a/drivers/soc/fsl/qbman/qman_api.c +++ b/drivers/soc/fsl/qbman/qman_api.c @@ -2463,6 +2463,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) { @@ -2479,7 +2481,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; @@ -2621,6 +2626,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/