From patchwork Fri Jul 15 21:59:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4952DC433EF for ; Fri, 15 Jul 2022 22:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jTlIz63a4l9+0dFavywjEFA5upPmxNghEC4rK0o1Tvo=; b=PtTWPj9R172XXQ n3bwJy4UkH9jqrKXnfXnieb4uEvN3U4f+JiwLE1sf4lxkBQcV40quL8ySa16NaH4Z2SfSqG5oilsK QacyWpnwSCejKLkIS/VHxWoENgplgSPy7PN7mqBxNlTYiTzpgSeLxBnrDmKX0fo8KP2/ftPkSoguW cSZ4s1lJs+zZm2t6IShVxzDaNF1vd2bY9NLuGl+1YkBteexQH2+zWDIYyJwc7q4uOAn8G8Bunx+Ll /KOUerVl+7AxFGmZIzMmdK3GQn7cgjMZ2i4WUW+9FR3iqSSkZ9fNcW96c/GuTTSaDVX/DNtzI45eZ ltOs08OantT4m5+70bEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU21-00Aquv-0v; Fri, 15 Jul 2022 22:43:36 +0000 Received: from mail-eopbgr00076.outbound.protection.outlook.com ([40.107.0.76] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNb-00AbbJ-72 for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iAjdUvxFsMirX1shYx6W1B5wWZgDM/RTHfNraPVjRbK0D3cntIQyM4yjYY2TRjfD/X9qZucyWjzZkAMu+llGaFZzOXV/jfvoqnjpySOQIlQbuAexki88lc/KvCqmDXgG2Q0B/P4CifWB0+yOoMA4KpstmjpCu/vN94FeOEU6crSCeM9AEyTuzF4SXt+RDRlwuCIcE9FMCIAFuFTDXkiUx0mqfUTpzdXEq41cun0w5CPB9I+n2Zn+fzEI9iFFVsa3ig9UkSShgiGCM56CfbHOlWquORVQ1HT8dL7yy1bHgJIrYIPKpHodXDgryi8CjsabaLP2dM1o18njZnuh/65j6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hasT6hbSKpYPEJ2OuGoSIn5aDqRn8ixuLqCWErCLeDo=; b=g61V41b5o8j7N0u1e439VYWMOV5YroSwsu82cFCnA5+rhcX+csxJKK0/QEKjkG6rGiWsAOdGFSvSx9S6cCBAOAF8IqPuBoab0xutscY9GDpjsNnR8OQaf++IMDlb3SErFS9fpQC/9gfao1vakfmbCNB+ZLU6J6T5qKTQIFsYHiFbRlrsH58bCUW4NttTYRyVVCZk3rcnoa3pb9ft3tGykFSXJaJFUThL5k8LI4M8xon5oxFl19N8iiIG+w9+rRmKa4vzx/ksSTG+xLmdIdqZQi5myoAWFHcAt/slziB4vBHHqhxysxYW4SZW4hJLbKty/JxgKrMt3UfqLCXfRYZTow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hasT6hbSKpYPEJ2OuGoSIn5aDqRn8ixuLqCWErCLeDo=; b=yRAZSwXrj+hu1fyu67UtunOwRhTPeiNSxRB2siz/DXKyp3mokQsMQma25pnbBApWCI7dbQpS1xKdeCftObvdBjoVJ14j6YYkI06JtYMRxMTs6S9kC4hingCIlUI82lYclSrwu8HNFWNQuEI2KFe0F3S8g5HwgVsV3QYijhmkB+pNFV6yWKWdEeAEtRvqsan0UxzHBhUj+/KYWplgkzRK/yUrkWpvQpEG3RgbFEuRTBFf8j9TuiY0XMssYWaCOYI8ujzZVt9EAB1XgiBpuc3ngEd+KCwr3tyhNVGvhkJJ1y63dTqFH9TeCKu6jbkWuhLuNhAbYNvrpG1I1OHQ8NEnmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS4PR03MB8433.eurprd03.prod.outlook.com (2603:10a6:20b:518::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.19; Fri, 15 Jul 2022 22:01:34 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:34 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v3 36/47] soc: fsl: qbman: Add helper for sanity checking cgr ops Date: Fri, 15 Jul 2022 17:59:43 -0400 Message-Id: <20220715215954.1449214-37-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db3bb590-b0e3-45c1-5fe8-08da66ad94d8 X-MS-TrafficTypeDiagnostic: AS4PR03MB8433:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PkajheBA/FAfx1ROI5aT5JdX4ta1f518g8x/EBx0Bt/JTFE3A6Vymb43slhJkmKuHgEeXz8TiaXHYgwHVuuLv6PspWZF/bt9omMYOSSLGbFKp6K6/DakxjwYQ+5HOlHd2RJvczmEVAApqMzApISgPSj7Gjff1vz2m6uvr1/JxUAIJnNZ7HsVw5Tyz9oFZilgaP6Ip5ZZ60sskgOez+ruhhf+9kBPYP7/PPorLsWkl+YzdcecCy/Wbs3fOSavTzyzX0vDM9ZYuo16v5kC9QbbwIj1baeQe8kmlpMG8jWaCaa237Fr1wXI2YAITqY+b4qynuTb6nGiyrioxWlIc+DmWKdkT9K7wG3KMh8FL8NVzsQR7a6YAUWDahafRCu0iJLABy/hXBayTCWJWlofsw5L5L99R1F2MuxD+xIbOfr9djKcA7+UeUE2h2VVFH572lfE7EY7pfxQxf2Nw97vJz+pFWithLSiknXGRuttHOTSUOwiQrYBNMoHhlAN+kO3aamRXR7IpbgKMmt1qGa5r92KgRWn8ofl/oYj4pyrXIH4OqrcuO4v5P9RGQrcSh703yHMyMeDGQekEl28/2DQcvGY2DJPZuZa1oLXtkmuxXYuLpjcpHT/Shz5e4NlsoZKpFpgNN8jSD+j9sxFHuNPj1TMqlirTIZaDq0S6xUt1yLzbLWo6Qk0SElZbv0NhuvukilzN6Z1Z6i1OjKD0qev4sAFeLtvBom/AYMj4R3TphH8PKZUeorx6zjSYku4haHCIMLj3YlZ24/F3iTrMwLcJm6wlVSwcoMFuJcqDpTiMg7RrH1YJhTG1QwZKhtVR+q5c4Yr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(346002)(39850400004)(396003)(366004)(136003)(6486002)(478600001)(86362001)(6506007)(41300700001)(6666004)(52116002)(6512007)(26005)(83380400001)(2616005)(54906003)(1076003)(316002)(186003)(110136005)(66946007)(2906002)(7416002)(66476007)(4326008)(66556008)(44832011)(8676002)(5660300002)(8936002)(38350700002)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ldXyVvx9BMmKoG3jpYddFHeF9uJEAw1Mrhnz0fdcEuLXFYJ0ALYczouA1WUqUSWiy+ixWYaBn47qud03UCUFmdEuM5yfQqpamSSLGT7qWcYn5hsHhMmtOIrra7h77gErB8xvszlGPtHze3mFiBS0ibwcqaS9i7leBvxLdtb8yfHv8NAdAEsJcVY8hXxCtfXPjXQchWcsA+ZQ8GhLrzV3y/XMf6Fzd0SwuMOiqLWQSkyHq7MFqYFd9stPMTQitB1vRbXB08K43zRyjeeMcBLfoBhAmjSUZ0NBInoQ/aPKMsCUO/sd1H/qfgOOjluRn9pF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5tL0hVsOhRTEB2OSqoHc9yYy3jAPRnquzMgUGmYP76psavt2TlqHmwujnadsoPQig42ECVSIwdu8854tGVy5uV8Jm/FV7v96TFGCj/2iDA9RG6v/t/m8gLmhLF/5jEJhm+l3JBfEbmg1EQZZhM7Qpfc4gs/UjjUinsolJ/6qb7P8V+9uHRzfSycVkCIV+W2NNdYB5j2h26Sg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: db3bb590-b0e3-45c1-5fe8-08da66ad94d8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:34.0023 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7mIyAnRXk7Zbtp4/R6+c63KJj99jXsoWc2ZXg23Ecn+KLvoOsW9tSwpcxKeu1YzPyZe00QUy+abzVhCAU1Wxjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150147_348254_C0F3C1E6 X-CRM114-Status: GOOD ( 11.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This breaks out/combines get_affine_portal and the cgr sanity check in preparation for the next commit. No functional change intended. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v2) Changes in v2: - New drivers/soc/fsl/qbman/qman.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index fde4edd83c14..eb6600aab09b 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -2483,13 +2483,8 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, } EXPORT_SYMBOL(qman_create_cgr); -int qman_delete_cgr(struct qman_cgr *cgr) +static struct qman_portal *qman_cgr_get_affine_portal(struct qman_cgr *cgr) { - unsigned long irqflags; - struct qm_mcr_querycgr cgr_state; - struct qm_mcc_initcgr local_opts; - int ret = 0; - struct qman_cgr *i; struct qman_portal *p = get_affine_portal(); if (cgr->chan != p->config->channel) { @@ -2497,10 +2492,25 @@ int qman_delete_cgr(struct qman_cgr *cgr) dev_err(p->config->dev, "CGR not owned by current portal"); dev_dbg(p->config->dev, " create 0x%x, delete 0x%x\n", cgr->chan, p->config->channel); - - ret = -EINVAL; - goto put_portal; + put_affine_portal(); + return NULL; } + + return p; +} + +int qman_delete_cgr(struct qman_cgr *cgr) +{ + unsigned long irqflags; + struct qm_mcr_querycgr cgr_state; + struct qm_mcc_initcgr local_opts; + int ret = 0; + struct qman_cgr *i; + struct qman_portal *p = qman_cgr_get_affine_portal(cgr); + + if (!p) + return -EINVAL; + memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); spin_lock_irqsave(&p->cgr_lock, irqflags); list_del(&cgr->node); @@ -2528,7 +2538,6 @@ int qman_delete_cgr(struct qman_cgr *cgr) list_add(&cgr->node, &p->cgr_cbs); release_lock: spin_unlock_irqrestore(&p->cgr_lock, irqflags); -put_portal: put_affine_portal(); return ret; }