From patchwork Fri Jul 12 09:56:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13731558 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 BE77FC2BD09 for ; Fri, 12 Jul 2024 09:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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:In-Reply-To:References:List-Owner; bh=D/bIWHweZseYmKh11oTyydP08zCUd2gjebeBMQ6AUW8=; b=1KdJPuvjiqiBhhf4J7SF8e1PF4 3zDD3YCVX1GiDo7zcBrPL0Acad0ccT+kt3h7c5Mm4BDxgBQ2wnQ2tc2/2/hvSJ2AvKxAkgY7lUQqa pNvKjrLk/K2hMC2z2P33TZIo2sIQ25KwCyIgKo6EB+l7gFw11LuR6eejngcJJwnKDx3YwvDizPTmE +sm0AtfZ1bN9KpIgk3TgWMHrvpMWIs2ZAOsBOlRXIFt+2px0mcyI32WT0CtG9N1O4c66uRxAhgXfS UtHneXSxb4vcRMVII7vy/gSGK2sOoGmO+FgKK4KxShZlwD9iZaeFD6W/RzK7MnnEc+nXSYst314N2 BCAACZ4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSD27-0000000HCxy-2gs3; Fri, 12 Jul 2024 09:57:43 +0000 Received: from mail-northeuropeazlp170130004.outbound.protection.outlook.com ([2a01:111:f403:c200::4] helo=DUZPR83CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSD1p-0000000HCrp-3Aae for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 09:57:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jwm4XMe5WiZ7xl4FV5oWdNFSEHIOEzrg3mZC9RQxXq6hYcPcVxXbZFzGJBeqTweCo9QCOJkke/eYQa+F5+0TajvNwAafClVirzdxVOVTYyxuugUmxF+n7Bnglk6SeEMkb0OAtsUKEs/+MBKPos5DUtGBpoLdToc+K65CbMaAM1uGr3kuHji3+QPpdejKZloV5iCApPzev5WPPecAlXHcVJLMaVC7qy9T3VXyegezQzsth22Fs2dD3CCYUpDyleyPfr/yaQr8szGvE3B8BwoAEEa5a4Vnr0XtNrvH30UoEYRfj3qQ8GXFFpFju6PY+4yGApkGbuUMhdsAdUuHLSMPyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=D/bIWHweZseYmKh11oTyydP08zCUd2gjebeBMQ6AUW8=; b=CoFJUlfo5fjuvem1lDcLgz0sq6c4Cpy9euYlAXFqCobx/uiatFE6dJMdPQlMZNWFdUQ+VdSadvVLV2M3ecOygw+nf4fIVGgZogv7G9Psn7QzRCBHxZZeSnlXgpkErbjCvaMy3ab9/vB2HLl2NGHOQyRkZGtXhPa9kpvxe3cICBWJ8USYQsEfB2M53NRDtBbNnTxs0A3j1p2588vxsVk5yiwP+8+08ES8i0KsCInvF3UooOBIj4IQ+9/HNFW1N0HXJJVGe5dn8zhR+h9QiwsNuhYjhKJatcLson3oY4lF8/EHjWsj+Xy1OsRhccUlZoduZEObscTM0aVhW9fwrUBc3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D/bIWHweZseYmKh11oTyydP08zCUd2gjebeBMQ6AUW8=; b=XHI3vHKq6W9Zsr7TT8GaCAtjwSSF+8JWO7ukjswd1sZAfhc8TGM+AYuLLp/ngkvcn1RIklreITCB8gKShSuq0ZU48EkwGTaRuiDn7YDqu+FDFOxQQi0il/8UgyEUH7z1Y8V4sG3Uphwgq6FQYL2bpoRHcKW30StCaN9/sh+QGCU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) by AM9PR04MB8340.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Fri, 12 Jul 2024 09:57:13 +0000 Received: from DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a]) by DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a%4]) with mapi id 15.20.7741.017; Fri, 12 Jul 2024 09:57:12 +0000 From: Vladimir Oltean To: linux-arm-kernel@lists.infradead.org Cc: Rob Herring , Herbert Xu , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/2] soc: fsl: qbman: delete bogus device tree fixup in qbman_init_private_mem() Date: Fri, 12 Jul 2024 12:56:57 +0300 Message-Id: <20240712095658.577186-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: VI1P195CA0050.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::39) To DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4555:EE_|AM9PR04MB8340:EE_ X-MS-Office365-Filtering-Correlation-Id: 081dc07b-45e5-46c9-80d6-08dca25900be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: isW492uIfzAXF4VpacXsTEy07KafXD2E+9qFZ8eytrzCQEPQ+jQy8b/jRioZ7pzowf/7EDpFyOJ6WxCF8bWCfZ5Q0ji4kf5YeL2okzOLOL7yvYA7vuDjUAk2jRPeLBi4pVI1qOS3MTtc7L0eK0uMbby21S7UUdeSOvpTE3WVrEXITeZolbEqM8WOk2biDfBdX5dUUlk9QK4x0Raju/XXQvd+O9/BdspQKPdi35l1s8FZcLfHFh40uVD8HXnVXf7W73/wOOJixmTbcA1XulB4nNsBo0woW71aiom3akO6Uw63eMIZHhBsG+zPvV+NoZFuTNRYEfCYXY7fIKHBrACST5SaN8nlZ00VZYExDfSvNd1Lxer8luNKrD52vxRcIZH2ygvEKT0MbLOU37OitLMTDzKQ2uHTMHi5VD6lwL5epDswQ9jo04bJc7pE+6MPtaiV5HT6/qOecBeV4KwJk6/ppi3PrPtUzyYIjFLCiW6HAll+6yyAdS3VSYY133+2E7OAuPohh3860dpQaCztTuTrDPzEL2ITfDyQgvFOSZb0w5kO3JeAUTu6Tx4WUF7gUabxMOFXHft8MN0I6COK7pb+d/uYYqBrgRR+hyoxLdRdC79l6eb6+ZVZ6naR9vdQcvcPk3VLHpK2aW52LOQmozwzrqKYav++PA1BgdPTjnwjKC1KpSYeuIHO3PyXl0Sh7Ua0UrDuOXuONuqEYaPLCcG2RMHTvNJT2WX7hUshVOu5arIPyHJf0+sWYL6DklsE4GDCX8dlLmmjtxZDDnwn3EXkgicrY+lQ2E/kumAw8mh2BDAqX2Nu/ssdCsaBLh44f/nCQeLgLvFjiFZCiTmkwDPPS9lXFrW3l6Iw+gnIOWvzYC0FdiBIdqi7qt91LTy4AXs1vWvEULoCbjnjTuV3d907mrCjTt6ZpZcYuXupJFCYLYIjgwAzfyED9OX5cX0NGzOlnBCX8ljOpqz2YInsGUYNVIPFx6qQE7kB9gTi8401EkQFs8Xc7bhIjL2t/9/yu60fiAuVZoPjFyYec5fazvH+waRuoSFf/ACWXOFEZzjB0H7hPy3nuYi3cXxzcRtz5TkaTvxKryQ2AHGrOO8tEUWAnTMtxNXba7aLWzivy8yanvygkGMuMK3cCvP6hwOPQy78RMhRh2bFXhkWP6HtkPx7x1sMBNKLo4ty9akrxxIC9lh5wyrg1ujZxrDjrhCNcQpQCSdcXG2xZXOtQMFR89LNmX5f2JNd93qYgUqODGcA4TcS6I0EErfTlTxllNzATtvct63TRLdw/zh6IrzFTQCx3U4J5AKoITSyTqOHXYTJtERGxrax35UIjaHRJkpACNlaarHWwJbGYBI3ykhD7yvm4k6/RjtGr2Qz6t1EAA0JKuS0Ne/1jL/nJIURRP0X9ntpoaP2eUByTkwZdt5bYJqTVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J2BNNdDdDV/a5w+b0JDHFpfsj3Ss/AL56lQaUB0HJqOiiKIjgwjnthGKuEDRBKFJRvIG+eBiBd4GY+twjQd5VLSLjn0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8YcECSz+u6f60co4uqE01PaFgT7068RPTyyeqxobrX+BtpvBxkea8oK043gL4G7wwa4C1bpHHVqgNYxBAm4n7GZWC2s6BwNdKJlZtCWf7XsceIMGddE9osvst61wzokruUtiLg4rT8qPvYWnlqNLCtvwk9Zad+robx3VkSsP5cJrKx/OztI5VeQMQj0He26AgoXZT0Ms+2HC+omrrBkyNtZAgw3Rbb23GagZdYR5a/+5N40ogd+8SQhmjlI2b2dAjpggEcMiGbYHBaskWA03YTPXN9I2tiQx9fr7CoNoFI+K/sQNdtyi5xTvg9I1Z6FNW0IJvS/2C09G2D6gKiBKH33gkxJG1ORCMK3Z74yrNAJVnq3N/Zo8t6tTvzwu4r2qF0DWDprfpmQorUwFzCH4j/F3+mL11EB8ZqZRWS0zrAD9HA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 081dc07b-45e5-46c9-80d6-08dca25900be X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 09:57:12.9473 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eJq0T69ZqtLe8AhrvWEcYezkZvgKOpfEgaNEo2tBd69fNox5ZwTYlAY/uuIn94FoZGY+bP3eMXSFq4pWzs7tkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8340 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_025725_821010_49B4420F X-CRM114-Status: GOOD ( 15.11 ) 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 is effectively a revert of commit 6ea4c0fe4570 ("soc/fsl/qbman: Update device tree with reserved memory"). What that commit intended to do: Fix up the device tree that is passed to a subsequent kexec-loaded kernel, so that the reserved-memory nodes have the same base addresses as the currently running kernel. What that commit actually does: Fix up the running device tree, which has no effect whatsoever upon the device tree passed to the next kernel. I would have refrained from making this kind of non-bugfix change in stable kernels, but qbman_init_private_mem() grossly misrepresents what this function does, and for an actual upcoming bug fix, it needs to be refactored. There is no place for the bogus code afterwards, so it needs to go as part of that, sadly. Cc: Signed-off-by: Vladimir Oltean --- drivers/soc/fsl/qbman/dpaa_sys.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/drivers/soc/fsl/qbman/dpaa_sys.c b/drivers/soc/fsl/qbman/dpaa_sys.c index e1d7b79cc450..b1cee145cbd7 100644 --- a/drivers/soc/fsl/qbman/dpaa_sys.c +++ b/drivers/soc/fsl/qbman/dpaa_sys.c @@ -39,8 +39,6 @@ int qbman_init_private_mem(struct device *dev, int idx, const char *compat, { struct device_node *mem_node; struct reserved_mem *rmem; - int err; - __be32 *res_array; mem_node = of_parse_phandle(dev->of_node, "memory-region", idx); if (!mem_node) { @@ -60,34 +58,5 @@ int qbman_init_private_mem(struct device *dev, int idx, const char *compat, *addr = rmem->base; *size = rmem->size; - /* - * Check if the reg property exists - if not insert the node - * so upon kexec() the same memory region address will be preserved. - * This is needed because QBMan HW does not allow the base address/ - * size to be modified once set. - */ - if (!of_property_present(mem_node, "reg")) { - struct property *prop; - - prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL); - if (!prop) - return -ENOMEM; - prop->value = res_array = devm_kzalloc(dev, sizeof(__be32) * 4, - GFP_KERNEL); - if (!prop->value) - return -ENOMEM; - res_array[0] = cpu_to_be32(upper_32_bits(*addr)); - res_array[1] = cpu_to_be32(lower_32_bits(*addr)); - res_array[2] = cpu_to_be32(upper_32_bits(*size)); - res_array[3] = cpu_to_be32(lower_32_bits(*size)); - prop->length = sizeof(__be32) * 4; - prop->name = devm_kstrdup(dev, "reg", GFP_KERNEL); - if (!prop->name) - return -ENOMEM; - err = of_add_property(mem_node, prop); - if (err) - return err; - } - return 0; } From patchwork Fri Jul 12 09:56:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13731559 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 87B00C2BD09 for ; Fri, 12 Jul 2024 09:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=C+IUua9VXwUehUpKMbwuGTuNg1MRc5BSAaD7Lih6WeM=; b=tH49XXVbO8wsFpHwycORP26gvl 5HTflVLH+qMkicvNQkEidJ8VjYPDrb1ponwr/KNWCpKJKJODjIG6Hl8xoEHAq63dg73klJgY4kVAX iz0v3yhASXBq2GQ2VgL7o42JfI0m1VmJta58hhXoQnMS8qeD158ZFhCmm2rklsnxSze+9MlDwe8bO Rxz7fvfq5VQVih7KzoPB02ZQw6JO/YZYAxIDSqSX+pYpQEujlz4UD7D+K28gPr7gRLdFtCMICOgkH 05fnP5wGuuSPIJtxLu7tiJdTkMLCWgyET0Knq7x09KAU+GUl2Cfco8SlBvW4u53Xrv7TZ7vG7nRdF tDpdEkDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSD2P-0000000HD4v-1aVa; Fri, 12 Jul 2024 09:58:01 +0000 Received: from mail-northeuropeazlp170130004.outbound.protection.outlook.com ([2a01:111:f403:c200::4] helo=DUZPR83CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSD1r-0000000HCrp-31Ur for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 09:57:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NSflWVzChaJIrzMSj75h30sth9WsSZsss88ah1mMUus9KQeScJq6Yg7uluTNNTXmX62Jmm4KC40LNkFc1d3dYK/FZ0TRLJI0isfXfCrpe34GeWkyjwwO3cAZOmqTZXKcl2TEbUyMjpO7QTWNjoZIUWppWk+GgGaeunPdnKCeoANrjt33WcyF/klIiKEd+Rb9lrZHHKq45xS5yn28feZ5VikjYlpOTTZ9egeGZz026Xy492TEluDFhlUSKAij0I48MCqdLhFj63hht9M1omdFBDWUXFjcOwlo4OB4TMTHJnhWLTO4PdqZpND2Y7mx9XsN/hy2r7EzhLv9/6L9rRobow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=C+IUua9VXwUehUpKMbwuGTuNg1MRc5BSAaD7Lih6WeM=; b=Y4XiFiPr5cRzB8JzRfzFp22m4ZAGFsvvJOHbRkw05GcmNuruWQb2daMKRmIyYGqqCGSvyJ0sAeitq3USUuvDRvxJ+QjHcyUpaHkfl0+7SMBvkFWgX+tBhKrS462tsQmgzXK2CMjnupL7pqpU6TvYH0h1hfxBBstKug06+ZWisawdYJ9OYMEDVUuTgWEyD2ujXEnIV+isfok1DOY5CvGmQLwktuCVZnNCPm0YoPwZyn+NKYfkEQzSIgbcaP9i6eJsePBEjJ4wrTY9cU2Chlulns5pnJvc1CVJ/0OE5ys/MJfd6+dLWQBzfYpE1XK3AaW2l+pPwkBqzg6nzJL7IWREjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C+IUua9VXwUehUpKMbwuGTuNg1MRc5BSAaD7Lih6WeM=; b=LQmvcmb4xhmCb9XkHNwlqvw7969EY8igw7pSwXFpyHS/fIbuIbmNncbvcg0vCaXvEJ64QIhugykseYChH+TTiP7nRc4MpNczxjppYi5txj1ljwN+BaUqaH5X4IE955KJTc4tkvODiu+666qBk1YUgv7vpDViMv+yp6YK2CGTmjo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) by AM9PR04MB8340.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Fri, 12 Jul 2024 09:57:13 +0000 Received: from DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a]) by DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a%4]) with mapi id 15.20.7741.017; Fri, 12 Jul 2024 09:57:13 +0000 From: Vladimir Oltean To: linux-arm-kernel@lists.infradead.org Cc: Rob Herring , Herbert Xu , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/2] soc: fsl: qbman: fix unconditional WARN_ON() on Arm during fsl_qman_probe() Date: Fri, 12 Jul 2024 12:56:58 +0300 Message-Id: <20240712095658.577186-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240712095658.577186-1-vladimir.oltean@nxp.com> References: <20240712095658.577186-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1P195CA0050.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::39) To DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4555:EE_|AM9PR04MB8340:EE_ X-MS-Office365-Filtering-Correlation-Id: be498fc7-7886-4726-8cfa-08dca2590142 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: QOi7P/W2TZjLrsL7GNL1yjpTDfLX0+p1B//mHTvZNiFP7QpgxvZMokxIxCfGc7eMmioNq2dVp5+2VJMykLLKoLgAIF0DkuQnXnjtCrUvyGJsmpN1XVdRmvUpkAV0Eq5CCgN2TATEkEPmaAUKZSszAlrT5ZUDl1xo9X32SQvLFvcEtm9eRMKTMY0feDytTx9iHdFa/dy6b+NhVrQaN/j2ESI+gXQxl385+V6z4tFyN0qPvyvtcU3jNa88uyl6ClH+ist5pCiVof1HnTZwGIDQtApq7GtVnF4iGt9ArnSjDSvjCkeuw6XH751EPTuzsU3pCYXj7TTs7cKwW+UxjB8qrvQ9W6buwWr2ervSydilqosMDyFNyc84hpriQzpsb52Livf/Irxlc6fmAJ4he2fwxv7xey5iZh5WE1scuWv7L6bl9yShPtc/rfNu8ju0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eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DlcoK6RZGwm6r68etzJ9QamzuTHV/WbRLLoeVM3NoMJHgFxa0XyED+XilQaQX4T/buWo5KW/q4NGfdPWlXm19zS55IhXKLfk55esRbCkz9LODJDNSSrYvFZ81Ulmqx8Id9//hOOs1Pikzho8elXzRfDCivhx6SgxauJnfHvYGF1+VmyjfPAeztsvRGLKCLOwjVoDHeoqUmqL5wBBo+sjSBPudaJ6+AZTJQLRkp3LQiGvwNLvD66MS4EspEF85bJl68tFoJnK45EIBV8Eow05+10GOWUCdcySgt2UrJNfXAH1yQ5wAYmLV4vD3gWBZ0ozefXdWpt6aunivr0pohWPYadNOJLtlH6gysSZDtqGY6RGuEKtwvS1lgaGebB+vj0GJj9Y89coANz0B3rf8z41XIDfTXigLbGtmbzKT84+tvYKidraD6gPww3xuD7TTIyMxS9FSjay+A7debPuB8DKcZ9n2fW5iCktPNbUfhvvmlkwjteINs3bKflDkLIL6BDblQT86w8kai63VskqqLqeULLFyyJT6znZYluDYuNBAqg5dH2UlXVyGmHnKMnmNUWx7bb71WW8NP5AvQ4AJpIulFIQaU8fs3SczfWeuRL09RaL0N9I7bmDucrkMqNHPP2VX9ZG1lhMFln74dtnDZV2LQUJeaqZOefFvN4p0jDiI3r91Zp7vrcI05CArnfTMeljVfHIyPnop4Nml4vlNd+cQzjWQu/dsqVPtkXqA9p8Pk0D4iWrMeO7rYw2PpfeUwNbAc/AXs+wGQYQxINfc6kPgM2Ga2/EE7YT7gXRgOhPnB0JuautZr8rRz9lzwK/Q+0sTDnpR5I0CNtBQqtpEdo6mA3z3j5aTM8md9W8ryvxLSSqYeRsTKHt56vPuMsGwbs+FakygK6+iGTenYqyUwYQ4+7ssYURkAMMAginLODr7C3fZAUpWqyClbI0Bq396cbuy4yez4dsnbGDAbtNHfoIjuRk8AC9qEBiBiUN46ME+r+ZDIMtFXio6+MuEX0Aqy50twGoZ4oWVh2DfzPXW+JwqYq1kbE6Sjb66XnxAXyxlMLw2NCzD1pxgqnGlRfPdbmIcA0YV3YeCUyZWbsGda/qNsefaULUjg9pTOMNc6N2BdZBahSlwRVaZ7vfGlyUN7HIVQuPTY0cVTe7Cz7kVp+V8MReKneU3+dKxdWQlUxDAf8jKjewsyUA11usK5gBNgZfA8hSP3DNqLnmxEWAmUqqTbR+r5hduzr3TJjRHVZd872ykbJr6olnnTvQx9PRgBl2Iwa0ICIoBfiRDqWzYkYWJMjaqQj9sZzGb6KEhMG0/6mM2Dg//WSleVOgZE+gxatJek6XGxNutcrW8GanNB9Y03XmWSa17aW9aNIvq+eClvI3U9zPhSqnzMmX1iSpjOCOm9A3JdBrSjDIWHKpy3aMrHQ3NX7It7+QeNpLKPgm1Qrj3czkME0S3KBqrTYtqv51boZ1kAjLnq9BX0HK5zE4C1J5MFV+e45kAn+igBOYhqnn+RobdPCXVyiy7nWUKi0zcxXIEdV/NlM/AgHLiXzNEwslFKZZbrMZxEx8D6a+VGGPkLFE0Dj7YukePA1cu/flram9TAE6DQ4G8shcT/trzQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: be498fc7-7886-4726-8cfa-08dca2590142 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 09:57:13.8731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hyUYbxyv4e8vHF9nlUyo1iDsJpO1BeNP//GEWEN7wpAmPfI+GEqnPWBwYEcvEAl1NpHzDG7Lpqd9f0UQwr88sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8340 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_025727_799105_EFF50FB9 X-CRM114-Status: GOOD ( 19.80 ) 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 The blamed commit performed a lossy transformation of the original logic. Due to it, on Arm DPAA1 platforms, we are now faced with this WARN on each boot: ------------[ cut here ]------------ Unexpected architecture using non shared-dma-mem reservations WARNING: CPU: 0 PID: 1 at drivers/soc/fsl/qbman/qman_ccsr.c:795 fsl_qman_probe+0x1d0/0x768 pc : fsl_qman_probe+0x1d0/0x768 lr : fsl_qman_probe+0x1b0/0x768 Call trace: fsl_qman_probe+0x1d0/0x768 platform_probe+0xa8/0xd0 really_probe+0x128/0x2c8 Prior to the refactoring, the logic in fsl_qman_probe() was as follows: if (fqd_a) { // previously found using RESERVEDMEM_OF_DECLARE("fsl,qman-fqd") [0] #ifdef CONFIG_PPC /* * For PPC backward DT compatibility * FQD memory MUST be zero'd by software */ zero_priv_mem(fqd_a, fqd_sz); #else WARN(1, "Unexpected architecture using non shared-dma-mem reservations"); #endif } else { // Find FQD using new-style device tree bindings [1] ret = qbman_init_private_mem(dev, 0, &fqd_a, &fqd_sz); } After the refactoring, the search for the new-style and the old-style got flipped, and both got absorbed into qbman_init_private_mem(). This creates a problem, because there is no longer a place to put the "fqd_a != 0" branch within fsl_qman_probe(). The callee, qbman_init_private_mem(), does not distinguish between FQD, PFDR and FBPR, and zero_priv_mem() must execute only for FQD. Split qbman_init_private_mem() into two different functions: qbman_find_reserved_mem_by_idx() for new-style bindings, and qbman_find_reserved_mem_by_compatible() for old-style. Let callers explicitly call both, which permits fsl_qman_probe() to zero-initialize the FQD memory on PowerPC if it matched on a compatible string. [0] Legacy bindings used by PowerPC: / { reserved-memory { qman_fqd: qman-fqd { compatible = "fsl,qman-fqd"; alloc-ranges = <0 0 0x10000 0>; size = <0 0x400000>; alignment = <0 0x400000>; }; }; }; [1] New bindings: / { reserved-memory { qman_fqd: qman-fqd { compatible = "shared-dma-pool"; size = <0 0x800000>; alignment = <0 0x800000>; no-map; }; qman_pfdr: qman-pfdr { compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; no-map; }; }; soc { qman: qman@1880000 { compatible = "fsl,qman"; reg = <0x0 0x1880000 0x0 0x10000>; memory-region = <&qman_fqd &qman_pfdr>; }; }; }; Fixes: 3e62273ac63a ("soc: fsl: qbman: Remove RESERVEDMEM_OF_DECLARE usage") Cc: Signed-off-by: Vladimir Oltean --- drivers/soc/fsl/qbman/bman_ccsr.c | 11 ++++-- drivers/soc/fsl/qbman/dpaa_sys.c | 62 ++++++++++++++++++++++--------- drivers/soc/fsl/qbman/dpaa_sys.h | 7 ++-- drivers/soc/fsl/qbman/qman_ccsr.c | 40 +++++++++++++------- 4 files changed, 82 insertions(+), 38 deletions(-) diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c b/drivers/soc/fsl/qbman/bman_ccsr.c index b0f26f6f731e..d8a440a265c5 100644 --- a/drivers/soc/fsl/qbman/bman_ccsr.c +++ b/drivers/soc/fsl/qbman/bman_ccsr.c @@ -231,11 +231,14 @@ static int fsl_bman_probe(struct platform_device *pdev) return -ENODEV; } - ret = qbman_init_private_mem(dev, 0, "fsl,bman-fbpr", &fbpr_a, &fbpr_sz); + ret = qbman_find_reserved_mem_by_idx(dev, 0, &fbpr_a, &fbpr_sz); + if (ret) + ret = qbman_find_reserved_mem_by_compatible(dev, "fsl,bman-fbpr", + &fbpr_a, &fbpr_sz); if (ret) { - dev_err(dev, "qbman_init_private_mem() failed 0x%x\n", - ret); - return -ENODEV; + dev_err(dev, "Failed to find FBPR reserved-memory region: %pe\n", + ERR_PTR(ret)); + return ret; } dev_dbg(dev, "Allocated FBPR 0x%llx 0x%zx\n", fbpr_a, fbpr_sz); diff --git a/drivers/soc/fsl/qbman/dpaa_sys.c b/drivers/soc/fsl/qbman/dpaa_sys.c index b1cee145cbd7..7c775c4c8a21 100644 --- a/drivers/soc/fsl/qbman/dpaa_sys.c +++ b/drivers/soc/fsl/qbman/dpaa_sys.c @@ -31,28 +31,14 @@ #include #include "dpaa_sys.h" -/* - * Initialize a devices private memory region - */ -int qbman_init_private_mem(struct device *dev, int idx, const char *compat, - dma_addr_t *addr, size_t *size) +static int qbman_reserved_mem_lookup(struct device_node *mem_node, + dma_addr_t *addr, size_t *size) { - struct device_node *mem_node; struct reserved_mem *rmem; - mem_node = of_parse_phandle(dev->of_node, "memory-region", idx); - if (!mem_node) { - mem_node = of_find_compatible_node(NULL, NULL, compat); - if (!mem_node) { - dev_err(dev, "No memory-region found for index %d or compatible '%s'\n", - idx, compat); - return -ENODEV; - } - } - rmem = of_reserved_mem_lookup(mem_node); if (!rmem) { - dev_err(dev, "of_reserved_mem_lookup() returned NULL\n"); + pr_err("of_reserved_mem_lookup(%pOF) returned NULL\n", mem_node); return -ENODEV; } *addr = rmem->base; @@ -60,3 +46,45 @@ int qbman_init_private_mem(struct device *dev, int idx, const char *compat, return 0; } + +/** + * qbman_find_reserved_mem_by_idx() - Find QBMan reserved-memory node + * @dev: Pointer to QMan or BMan device structure + * @idx: for BMan, pass 0 for the FBPR region. + * for QMan, pass 0 for the FQD region and 1 for the PFDR region. + * @addr: Pointer to storage for the region's base address. + * @size: Pointer to storage for the region's size. + */ +int qbman_find_reserved_mem_by_idx(struct device *dev, int idx, + dma_addr_t *addr, size_t *size) +{ + struct device_node *mem_node; + + mem_node = of_parse_phandle(dev->of_node, "memory-region", idx); + if (!mem_node) + return -ENODEV; + + return qbman_reserved_mem_lookup(mem_node, addr, size); +} + +/** + * qbman_find_reserved_mem_by_compatible() - Find QBMan reserved-memory node (PowerPC) + * @dev: Pointer to QMan or BMan device structure + * @compat: one of "fsl,bman-fbpr", "fsl,qman-fqd" or "fsl,qman-pfdr" + * @addr: Pointer to storage for the region's base address. + * @size: Pointer to storage for the region's size. + * + * This is a legacy variant of qbman_find_reserved_mem_by_idx(), which should + * only be used for backwards compatibility with certain PowerPC device trees. + */ +int qbman_find_reserved_mem_by_compatible(struct device *dev, const char *compat, + dma_addr_t *addr, size_t *size) +{ + struct device_node *mem_node; + + mem_node = of_find_compatible_node(NULL, NULL, compat); + if (!mem_node) + return -ENODEV; + + return qbman_reserved_mem_lookup(mem_node, addr, size); +} diff --git a/drivers/soc/fsl/qbman/dpaa_sys.h b/drivers/soc/fsl/qbman/dpaa_sys.h index 16485bde9636..1c80244b34d1 100644 --- a/drivers/soc/fsl/qbman/dpaa_sys.h +++ b/drivers/soc/fsl/qbman/dpaa_sys.h @@ -100,9 +100,10 @@ static inline u8 dpaa_cyc_diff(u8 ringsize, u8 first, u8 last) /* Offset applied to genalloc pools due to zero being an error return */ #define DPAA_GENALLOC_OFF 0x80000000 -/* Initialize the devices private memory region */ -int qbman_init_private_mem(struct device *dev, int idx, const char *compat, - dma_addr_t *addr, size_t *size); +int qbman_find_reserved_mem_by_idx(struct device *dev, int idx, + dma_addr_t *addr, size_t *size); +int qbman_find_reserved_mem_by_compatible(struct device *dev, const char *compat, + dma_addr_t *addr, size_t *size); /* memremap() attributes for different platforms */ #ifdef CONFIG_PPC diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c index 392e54f14dbe..4735b450d97e 100644 --- a/drivers/soc/fsl/qbman/qman_ccsr.c +++ b/drivers/soc/fsl/qbman/qman_ccsr.c @@ -731,6 +731,7 @@ static int fsl_qman_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; + bool fqd_found_by_compatible = false; struct resource *res; int ret, err_irq; u16 id; @@ -779,29 +780,40 @@ static int fsl_qman_probe(struct platform_device *pdev) * in order to ensure allocations from the correct regions the * driver initializes then allocates each piece in order */ - ret = qbman_init_private_mem(dev, 0, "fsl,qman-fqd", &fqd_a, &fqd_sz); + ret = qbman_find_reserved_mem_by_idx(dev, 0, &fqd_a, &fqd_sz); if (ret) { - dev_err(dev, "qbman_init_private_mem() for FQD failed 0x%x\n", - ret); - return -ENODEV; + ret = qbman_find_reserved_mem_by_compatible(dev, "fsl,qman-fqd", + &fqd_a, &fqd_sz); + if (ret == 0) + fqd_found_by_compatible = true; } + if (ret) { + dev_err(dev, "Failed to find FQD reserved-memory region: %pe\n", + ERR_PTR(ret)); + return ret; + } + if (fqd_found_by_compatible) { #ifdef CONFIG_PPC - /* - * For PPC backward DT compatibility - * FQD memory MUST be zero'd by software - */ - zero_priv_mem(fqd_a, fqd_sz); + /* + * For PPC backward DT compatibility + * FQD memory MUST be zero'd by software + */ + zero_priv_mem(fqd_a, fqd_sz); #else - WARN(1, "Unexpected architecture using non shared-dma-mem reservations"); + WARN(1, "Unexpected architecture using non shared-dma-mem reservations"); #endif + } dev_dbg(dev, "Allocated FQD 0x%llx 0x%zx\n", fqd_a, fqd_sz); /* Setup PFDR memory */ - ret = qbman_init_private_mem(dev, 1, "fsl,qman-pfdr", &pfdr_a, &pfdr_sz); + ret = qbman_find_reserved_mem_by_idx(dev, 1, &pfdr_a, &pfdr_sz); + if (ret) + ret = qbman_find_reserved_mem_by_compatible(dev, "fsl,qman-pfdr", + &pfdr_a, &pfdr_sz); if (ret) { - dev_err(dev, "qbman_init_private_mem() for PFDR failed 0x%x\n", - ret); - return -ENODEV; + dev_err(dev, "Failed to find PFDR reserved-memory region: %pe\n", + ERR_PTR(ret)); + return ret; } dev_dbg(dev, "Allocated PFDR 0x%llx 0x%zx\n", pfdr_a, pfdr_sz);