[v2,1/1] dmaengine: fsl-qdma: add __iomem and struct in union to fix sparse warning
Message ID | 20240219155939.611237-1-Frank.Li@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-71629-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1374807dyc; Mon, 19 Feb 2024 08:01:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3b0n64JcJhzkyZ/cnVDc/pw8GfwS9Z8sJDQNSLR4Ess0Xd551WJ2bdU//qkROLOcNGLkHQsL/FoFZrH/hoIkdrmXn4w== X-Google-Smtp-Source: AGHT+IG7A6TMB+ZfngWzPrimh/auK6PG2w9+gEU0KTPTaxqgTDQVmvWFJOHnYWf8nn2ICkhEtLhw X-Received: by 2002:a92:cbc6:0:b0:363:a992:2ec9 with SMTP id s6-20020a92cbc6000000b00363a9922ec9mr10727936ilq.21.1708358484638; Mon, 19 Feb 2024 08:01:24 -0800 (PST) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j9-20020a92ca09000000b003653db8554asi166776ils.19.2024.02.19.08.01.21 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:01:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="JyukACi/"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-71629-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71629-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A67E31C223B3 for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 16:00:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80E583BB48; Mon, 19 Feb 2024 16:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="JyukACi/" Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2074.outbound.protection.outlook.com [40.107.241.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8915838DF2; Mon, 19 Feb 2024 15:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708358395; cv=fail; b=mKA/Inz80tClZi1suDCC/q+4m0eaGL7paaNQIPxLYExOLEo9aOmWe5g6ipGJSVcHMBdq7K2DYfhP2x9BgCuyrSXfYM93kxVzv9TeCTNV3fM/oeGSdWrC3+oB3B6THPJg3aId2h7JzJ5iq0u9fTlFG/RnEkgoQ/BIeJS2JRlhBK8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708358395; c=relaxed/simple; bh=PbebcNxPPqgmQwzviQuB7uu2/erkbS8O0hptgyXd1J8=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=IcRT+C6Nf1xi6mxg92LqOpBCYJE0ibFFEcDM4V0i8qQCtxsPMM8kPFe1lj4IOk83ezWQ57NIgr6FWa6WsqR13UKzIpryyQmx0al5ct1he5aixzmojfsSev1cowwdNXpovTLy2sM8wvaABw+Ru5WYzJaUKxyDczKdBIK9t3o5km0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=JyukACi/; arc=fail smtp.client-ip=40.107.241.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNaOtdOovodA9mO0IhHA9A6rGJELW9kzx5Li1p2XltDdTyTzcCWVZzssXHH5qH/hdF7+unDcCJ6JbtSSlBlsdAzRP/ybVDolB6oaQllNRB7LpY6JnXDAK1ViaBz+Zn+cgEU99aMD+bwguhtDmMeIUnbj2WEe1MHcnqp/dUNaxrWLWd72pw0vHfVCUK71YCIDq0YTc9hIs1tn6vTa/TfsXVbcmbofGkMvLcxzln7/HGh0+RF8KaWR1Lr4ZMzMz7nqxItbENVYr7Sfc6tjYVXSHYJt0+UeOHhTKAs3BM51xLSGjFekpTlcofyPUI29895TheyT7X6ULvDZQucF/LHlHA== 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=0a/URzydOecL9yZy0YkXo2W/IfmwvDzcgc8qqKA0Tss=; b=YiuMZhcxws+ghsTXAmQuTtNVifTQDuHZGKWE7jwSfPmCYFAfNaVd2JwQ3AN1o18+2jZ+uRu1CVoCz2Py94ud2oGwL/t4LpjQu2bgMq8VuW7SUmqqW+pc1A9Ba1gF6mjWfgOxZonrnMbKZdVR7o+52nEeXCMc61zb7kSnP38bmJtyRukh+QUWEU+dMc04FUpxdIUD7XI0mynjjhfY10iJ4wrpVycYMdbiH7v/pzmscjUv5d5l0n67SyY6xYyAwT4Eqs02UblTMvdsOwE/SA2ptR3shYficvPF5UinbRGYf8wD/I9RFhfzc1U3w4aBm+XyVvk9iaHn5HUkTekY4PVcQw== 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=0a/URzydOecL9yZy0YkXo2W/IfmwvDzcgc8qqKA0Tss=; b=JyukACi/74BxsAyvcbAA2hond08Bj/RlcubcXqfAXDBNS1ZuLAcrUzueXDj6rnG660AwQ+oLOJ1r9VsGlYycnnvvKf2T8u4Lqhy+3rVDagkQFymf2OANt9qXl9CNbfHOuL2dsEi0vhhzZT/aaJoODGMTy0VBGIhTtJTDNI4brLQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.27; Mon, 19 Feb 2024 15:59:50 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Mon, 19 Feb 2024 15:59:50 +0000 From: Frank Li <Frank.Li@nxp.com> To: Vinod Koul <vkoul@kernel.org>, dmaengine@vger.kernel.org (open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: imx@lists.linux.dev Subject: [PATCH v2 1/1] dmaengine: fsl-qdma: add __iomem and struct in union to fix sparse warning Date: Mon, 19 Feb 2024 10:59:39 -0500 Message-Id: <20240219155939.611237-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR01CA0051.prod.exchangelabs.com (2603:10b6:a03:94::28) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: 55080c36-cc7a-4038-c3fc-08dc3163cdd2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +8LuqDWaaHys4k1Ljq7OPAWe2XtgASEhQq9MDX239sSdxaAbPFT3CQtlK0fSGKCb5zaOahUUXih7FMU0/VdHfo6qifU1NIyge/m/uKrUgSnlKBE9Ovc39Zjx+jFatWSoBSqX4W+vGgt7xPjsmeing5ZppDpBusdDOuPQnxrZTUcjvnhsJOy/3qoxruVwBbZH6S4GyuRZXQK4zgD8CKLeXIcCxtjprqUKSjBWMQHDG/Ug8y+Ue1/R8flB8NIa0iZj9huuRh44Mrfg3XcgVoTfab1w0ArW7YZkEBHIzwy6LVqSceVG0HbVnz/koB/4eNjLPxg+gt2BztSGt+0lUknox5EXIxdOaEzdlf/CHHmJE8pklMqTdbloHQu0+SjW99jbkBpekCGmrM7qt2fm1MXGy65naArVNWKv7zemeOeBHUtc2unjS7527wYvAdCs/B1f1JUqLtVXXzpVSC2uQ7la051178paKdAjUcXNhvXu94SIURjH/9H4uM8HvZPROcz4A+p3vNcooaxYIPbv0HOJymSQjswIvDquPSu00fn1JgbVSYyPSxOR/x2PW4mwqjhA/B9LDO6SPRz80KWbFPAvbuAIt1XEaw3YThqxbUV6HLk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(230273577357003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?G0T9PmNR8FYbRE8p4DkkkpMXNCR2?= =?utf-8?q?hV+z2mshXFshLR0W+B9oqbA1czoxXnCYaMmmP3RPWrEXOw25SjS55Vd++5433MBPF?= =?utf-8?q?bNOY1rEKLZrnYQasB4d8PQuPpTt5dW+nS8uZ0GMpWfthqbFq8OapFHPX/gu8BgfBg?= =?utf-8?q?FTxWeMktjscmfR716we/gvEF7sCd5QyU+NbLEk8wzhZq7D7zhwqitSx3fQQessg+C?= =?utf-8?q?ko6IZz9HLPO92mwGd8fFtVHLpl/A9UzZV2dWQWvAFhT1V7mwO6SOthTSjLtPP4ie1?= =?utf-8?q?2tw1R0QRN1zBSl4ucHefOtAOt/TKYUsq8hCPyB2V86apL3BRzDTtxzl3HmLbct9ko?= =?utf-8?q?yZvkJ+XATVB83BCcOgtKiZtFa9LSh2bpH8dg12F2Mkte5DCetMd6vGrKIoa9feeCE?= =?utf-8?q?lKPbYKQbhLLhTZxpHZlGA618pa+m+jMlAaSZKR/FehQilRdV7smJKX9lXbgi6huvn?= =?utf-8?q?u3EjqlKCXFDNfGrZmGr5yKxqPu12Yar3lKafYpNTFZUMo8XCcoJ8R4ErtsDTFAUUc?= =?utf-8?q?15USJLH4AipRJ7d26PL8hjTc83hCoi+Y7sumUUY2C2yJ0iwMPfiavyM5N9fS8ZVb6?= =?utf-8?q?MdrhP8jedUJxW/Vpim5eqGiJrtzhZVG147sx5gmCqHo5R39X+Xz/S/lFgtcjaRGEH?= =?utf-8?q?EDCgIwKgWeRfVOuGusJNXhVknMelUcbRhokiOH3J1o3dgUwR4vHtGIsnmTM5cFeM0?= =?utf-8?q?VLO+o0pROPmaC6gsRIJH+Zns2tiegJUu0LdPsXzWsiwRi/dM/wM0wzL+2Mcnymzwf?= =?utf-8?q?Ih1ZwHtnnsPJrSpzV3XGJH5lJQEm8+mEGMDFzT8Cb50vHjbgVSKS9b23VIUuyshZo?= =?utf-8?q?r3AnbMwHJjlgchesv//BGcv8KYCixFdEJA6QAEnQ3t0dxpLiuv0ZOGvvOeAyLy9kU?= =?utf-8?q?Jxr8Jz/xbTz82Sn42qDRoSL+iYBhsS0o5yHilxCZnsSuB+CqcJFiaa1tYAjk3YbaY?= =?utf-8?q?vVx8av+G3Pw9rv/L2DK93JKqVatXu5wZ4wa67gE4lQQ36GwdGN8iPtS28ph707XsB?= =?utf-8?q?3f23fNTWjbYxVQToL4sc/B6F8+9cMCbI+P0iiD0MZrdFETtZyQvBjducTrBK6N0Pf?= =?utf-8?q?h7YF/N33H4L62DSlKjNcluPJNCllgJ1wNvFVN8KjjG0IhGHl2wYlAKJDV+OkzTY+o?= =?utf-8?q?MFTUjjVM6rySKIv3F9NVoLZWrd0Zz5D6kPkmW30WfxDQ0pk4ep7o6vXi2rMaPgykp?= =?utf-8?q?dUfqHHD8ZKRwBaUKbHjj2y2Kheo/mE+uFBOxztLm1n+ruGee/FnCdvzobk7lM7AHx?= =?utf-8?q?zkdotq8voSwc+kdj945MMIlYIOtCc9f6XwvrdeKPriMG3OI7KEZo9KR+kOOJmXP9y?= =?utf-8?q?vYhGJUtO7BUUb29Vbb3j4xqjRTa156yjaDRvlIKCoqMxjqWe5VjPLv9F5xC0yXlxd?= =?utf-8?q?Tex3XT6uyaeUKwoXlxmyaX1xYmK9x87NDNRuMWcnCnE2XLuiBklfKYj6KvR1sJMa3?= =?utf-8?q?atmUaGVwxlI0zDFBFcKUTi1v3UHdf2iczUU4K5ka2fbjsRr0bmkg0+sJFFvizIvFw?= =?utf-8?q?564+4BJD9P4K?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55080c36-cc7a-4038-c3fc-08dc3163cdd2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 15:59:50.5545 (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: v196wIL0kct3kdHDxeRsSgysEsEwXVw3I/HajQN2fKOPPbyzHengqvckbJVGQ5kQA7i0LeTvxAlbQKttFw4fIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791343706681993034 X-GMAIL-MSGID: 1791343706681993034 |
Series |
[v2,1/1] dmaengine: fsl-qdma: add __iomem and struct in union to fix sparse warning
|
|
Commit Message
Frank Li
Feb. 19, 2024, 3:59 p.m. UTC
Fix below sparse warnings.
drivers/dma/fsl-qdma.c:645:50: sparse: warning: incorrect type in argument 2 (different address spaces)
drivers/dma/fsl-qdma.c:645:50: sparse: expected void [noderef] __iomem *addr
drivers/dma/fsl-qdma.c:645:50: sparse: got void
drivers/dma/fsl-qdma.c:387:15: sparse: sparse: restricted __le32 degrades to integer
drivers/dma/fsl-qdma.c:390:19: sparse: expected restricted __le64 [usertype] data
drivers/dma/fsl-qdma.c:392:13: sparse: expected unsigned int [assigned] [usertype] cmd
QDMA decriptor have below 3 kind formats. (little endian)
Compound Command Descriptor Format
┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │
│ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│
├──────┼─┴─┼─┴─┴─┼─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┤
│ 0x0C │DD │ - │QUEUE│ - │ ADDR │
├──────┼───┴─────┴─────┴───────────────────────────────┴───────────────┤
│ 0x08 │ ADDR │
├──────┼─────┬─────────────────┬───────────────────────────────────────┤
│ 0x04 │ FMT │ OFFSET │ - │
├──────┼─┬─┬─┴─────────────────┴───────────────────────┬───────────────┤
│ │ │S│ │ │
│ 0x00 │-│E│ - │ STATUS │
│ │ │R│ │ │
└──────┴─┴─┴───────────────────────────────────────────┴───────────────┘
Compound S/G Table Entry Format
┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │
│ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│
├──────┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┤
│ 0x0C │ - │ ADDR │
├──────┼───────────────────────────────────────────────┴───────────────┤
│ 0x08 │ ADDR │
├──────┼─┬─┬───────────────────────────────────────────────────────────┤
│ 0x04 │E│F│ LENGTH │
├──────┼─┴─┴─────────────────────────────────┬─────────────────────────┤
│ 0x00 │ - │ OFFSET │
└──────┴─────────────────────────────────────┴─────────────────────────┘
Source/Destination Descriptor Format
┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │
│ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│
├──────┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤
│ 0x0C │ CMD │
├──────┼───────────────────────────────────────────────────────────────┤
│ 0x08 │ - │
├──────┼───────────────┬───────────────────────┬───────────────────────┤
│ 0x04 │ - │ S[D]SS │ S[D]SD │
├──────┼───────────────┴───────────────────────┴───────────────────────┤
│ 0x00 │ - │
└──────┴───────────────────────────────────────────────────────────────┘
Previous code use 64bit 'data' map to 0x8 and 0xC. In little endian system
CMD is high part of 64bit 'data'. It is correct by left shift 32. But in
big endian system, shift left 32 will write to 0x8 position. Sparse detect
this problem.
Add below field ot match 'Source/Destination Descriptor Format'.
struct {
__le32 __reserved2;
__le32 cmd;
} __packed;
Using ddf(sdf)->cmd save to correct posistion regardless endian.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402081929.mggOTHaZ-lkp@intel.com/
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Notes:
Change from v1 to v2
- update commit message to show why add 'cmd'
fsl-edma-common.c's build warning should not cause by this driver. which is
difference drivers. This driver will not use any code related with
fsl-edma-common.c.
drivers/dma/fsl-qdma.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
Comments
On 19-02-24, 10:59, Frank Li wrote: > Fix below sparse warnings. This does not apply for me, can you rebase > > drivers/dma/fsl-qdma.c:645:50: sparse: warning: incorrect type in argument 2 (different address spaces) > drivers/dma/fsl-qdma.c:645:50: sparse: expected void [noderef] __iomem *addr > drivers/dma/fsl-qdma.c:645:50: sparse: got void > > drivers/dma/fsl-qdma.c:387:15: sparse: sparse: restricted __le32 degrades to integer > drivers/dma/fsl-qdma.c:390:19: sparse: expected restricted __le64 [usertype] data > drivers/dma/fsl-qdma.c:392:13: sparse: expected unsigned int [assigned] [usertype] cmd > > QDMA decriptor have below 3 kind formats. (little endian) > > Compound Command Descriptor Format > ┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > │Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │ > │ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│ > ├──────┼─┴─┼─┴─┴─┼─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┤ > │ 0x0C │DD │ - │QUEUE│ - │ ADDR │ > ├──────┼───┴─────┴─────┴───────────────────────────────┴───────────────┤ > │ 0x08 │ ADDR │ > ├──────┼─────┬─────────────────┬───────────────────────────────────────┤ > │ 0x04 │ FMT │ OFFSET │ - │ > ├──────┼─┬─┬─┴─────────────────┴───────────────────────┬───────────────┤ > │ │ │S│ │ │ > │ 0x00 │-│E│ - │ STATUS │ > │ │ │R│ │ │ > └──────┴─┴─┴───────────────────────────────────────────┴───────────────┘ > > Compound S/G Table Entry Format > ┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > │Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │ > │ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│ > ├──────┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┤ > │ 0x0C │ - │ ADDR │ > ├──────┼───────────────────────────────────────────────┴───────────────┤ > │ 0x08 │ ADDR │ > ├──────┼─┬─┬───────────────────────────────────────────────────────────┤ > │ 0x04 │E│F│ LENGTH │ > ├──────┼─┴─┴─────────────────────────────────┬─────────────────────────┤ > │ 0x00 │ - │ OFFSET │ > └──────┴─────────────────────────────────────┴─────────────────────────┘ > > Source/Destination Descriptor Format > ┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > │Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │ > │ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│ > ├──────┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ > │ 0x0C │ CMD │ > ├──────┼───────────────────────────────────────────────────────────────┤ > │ 0x08 │ - │ > ├──────┼───────────────┬───────────────────────┬───────────────────────┤ > │ 0x04 │ - │ S[D]SS │ S[D]SD │ > ├──────┼───────────────┴───────────────────────┴───────────────────────┤ > │ 0x00 │ - │ > └──────┴───────────────────────────────────────────────────────────────┘ > > Previous code use 64bit 'data' map to 0x8 and 0xC. In little endian system > CMD is high part of 64bit 'data'. It is correct by left shift 32. But in > big endian system, shift left 32 will write to 0x8 position. Sparse detect > this problem. > > Add below field ot match 'Source/Destination Descriptor Format'. > struct { > __le32 __reserved2; > __le32 cmd; > } __packed; > > Using ddf(sdf)->cmd save to correct posistion regardless endian. > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202402081929.mggOTHaZ-lkp@intel.com/ > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > > Notes: > Change from v1 to v2 > - update commit message to show why add 'cmd' > > fsl-edma-common.c's build warning should not cause by this driver. which is > difference drivers. This driver will not use any code related with > fsl-edma-common.c. > > drivers/dma/fsl-qdma.c | 21 ++++++++++----------- > 1 file changed, 10 insertions(+), 11 deletions(-) > > diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c > index 1e3bf6f30f784..5005e138fc239 100644 > --- a/drivers/dma/fsl-qdma.c > +++ b/drivers/dma/fsl-qdma.c > @@ -161,6 +161,10 @@ struct fsl_qdma_format { > u8 __reserved1[2]; > u8 cfg8b_w1; > } __packed; > + struct { > + __le32 __reserved2; > + __le32 cmd; > + } __packed; > __le64 data; > }; > } __packed; > @@ -355,7 +359,6 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan) > static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, > dma_addr_t dst, dma_addr_t src, u32 len) > { > - u32 cmd; > struct fsl_qdma_format *sdf, *ddf; > struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest; > > @@ -384,15 +387,11 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, > /* This entry is the last entry. */ > qdma_csgf_set_f(csgf_dest, len); > /* Descriptor Buffer */ > - cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << > - FSL_QDMA_CMD_RWTTYPE_OFFSET) | > - FSL_QDMA_CMD_PF; > - sdf->data = QDMA_SDDF_CMD(cmd); > - > - cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << > - FSL_QDMA_CMD_RWTTYPE_OFFSET); > - cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); > - ddf->data = QDMA_SDDF_CMD(cmd); > + sdf->cmd = cpu_to_le32((FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET) | > + FSL_QDMA_CMD_PF); > + > + ddf->cmd = cpu_to_le32((FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET) | > + (FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET)); > } > > /* > @@ -626,7 +625,7 @@ static int fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) > > static int > fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, > - void *block, > + __iomem void *block, > int id) > { > bool duplicate; > -- > 2.34.1
On Thu, Feb 22, 2024 at 07:30:59PM +0530, Vinod Koul wrote: > On 19-02-24, 10:59, Frank Li wrote: > > Fix below sparse warnings. > > This does not apply for me, can you rebase Which branch do you try to apply? This one is fix warnings in "fixes" branch, commit https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/commit/?h=fixes&id=9d739bccf261dd93ec1babf82f5c5d71dd4caa3e Frank > > > > > drivers/dma/fsl-qdma.c:645:50: sparse: warning: incorrect type in argument 2 (different address spaces) > > drivers/dma/fsl-qdma.c:645:50: sparse: expected void [noderef] __iomem *addr > > drivers/dma/fsl-qdma.c:645:50: sparse: got void > > > > drivers/dma/fsl-qdma.c:387:15: sparse: sparse: restricted __le32 degrades to integer > > drivers/dma/fsl-qdma.c:390:19: sparse: expected restricted __le64 [usertype] data > > drivers/dma/fsl-qdma.c:392:13: sparse: expected unsigned int [assigned] [usertype] cmd > > > > QDMA decriptor have below 3 kind formats. (little endian) > > > > Compound Command Descriptor Format > > ┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > > │Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │ > > │ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│ > > ├──────┼─┴─┼─┴─┴─┼─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┤ > > │ 0x0C │DD │ - │QUEUE│ - │ ADDR │ > > ├──────┼───┴─────┴─────┴───────────────────────────────┴───────────────┤ > > │ 0x08 │ ADDR │ > > ├──────┼─────┬─────────────────┬───────────────────────────────────────┤ > > │ 0x04 │ FMT │ OFFSET │ - │ > > ├──────┼─┬─┬─┴─────────────────┴───────────────────────┬───────────────┤ > > │ │ │S│ │ │ > > │ 0x00 │-│E│ - │ STATUS │ > > │ │ │R│ │ │ > > └──────┴─┴─┴───────────────────────────────────────────┴───────────────┘ > > > > Compound S/G Table Entry Format > > ┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > > │Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │ > > │ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│ > > ├──────┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┴─┴─┴─┴─┴─┤ > > │ 0x0C │ - │ ADDR │ > > ├──────┼───────────────────────────────────────────────┴───────────────┤ > > │ 0x08 │ ADDR │ > > ├──────┼─┬─┬───────────────────────────────────────────────────────────┤ > > │ 0x04 │E│F│ LENGTH │ > > ├──────┼─┴─┴─────────────────────────────────┬─────────────────────────┤ > > │ 0x00 │ - │ OFFSET │ > > └──────┴─────────────────────────────────────┴─────────────────────────┘ > > > > Source/Destination Descriptor Format > > ┌──────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ > > │Offset│3│3│2│2│2│2│2│2│2│2│2│2│1│1│1│1│1│1│1│1│1│1│ │ │ │ │ │ │ │ │ │ │ > > │ │1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│9│8│7│6│5│4│3│2│1│0│ > > ├──────┼─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ > > │ 0x0C │ CMD │ > > ├──────┼───────────────────────────────────────────────────────────────┤ > > │ 0x08 │ - │ > > ├──────┼───────────────┬───────────────────────┬───────────────────────┤ > > │ 0x04 │ - │ S[D]SS │ S[D]SD │ > > ├──────┼───────────────┴───────────────────────┴───────────────────────┤ > > │ 0x00 │ - │ > > └──────┴───────────────────────────────────────────────────────────────┘ > > > > Previous code use 64bit 'data' map to 0x8 and 0xC. In little endian system > > CMD is high part of 64bit 'data'. It is correct by left shift 32. But in > > big endian system, shift left 32 will write to 0x8 position. Sparse detect > > this problem. > > > > Add below field ot match 'Source/Destination Descriptor Format'. > > struct { > > __le32 __reserved2; > > __le32 cmd; > > } __packed; > > > > Using ddf(sdf)->cmd save to correct posistion regardless endian. > > > > Reported-by: kernel test robot <lkp@intel.com> > > Closes: https://lore.kernel.org/oe-kbuild-all/202402081929.mggOTHaZ-lkp@intel.com/ > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > --- > > > > Notes: > > Change from v1 to v2 > > - update commit message to show why add 'cmd' > > > > fsl-edma-common.c's build warning should not cause by this driver. which is > > difference drivers. This driver will not use any code related with > > fsl-edma-common.c. > > > > drivers/dma/fsl-qdma.c | 21 ++++++++++----------- > > 1 file changed, 10 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c > > index 1e3bf6f30f784..5005e138fc239 100644 > > --- a/drivers/dma/fsl-qdma.c > > +++ b/drivers/dma/fsl-qdma.c > > @@ -161,6 +161,10 @@ struct fsl_qdma_format { > > u8 __reserved1[2]; > > u8 cfg8b_w1; > > } __packed; > > + struct { > > + __le32 __reserved2; > > + __le32 cmd; > > + } __packed; > > __le64 data; > > }; > > } __packed; > > @@ -355,7 +359,6 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan) > > static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, > > dma_addr_t dst, dma_addr_t src, u32 len) > > { > > - u32 cmd; > > struct fsl_qdma_format *sdf, *ddf; > > struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest; > > > > @@ -384,15 +387,11 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, > > /* This entry is the last entry. */ > > qdma_csgf_set_f(csgf_dest, len); > > /* Descriptor Buffer */ > > - cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << > > - FSL_QDMA_CMD_RWTTYPE_OFFSET) | > > - FSL_QDMA_CMD_PF; > > - sdf->data = QDMA_SDDF_CMD(cmd); > > - > > - cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << > > - FSL_QDMA_CMD_RWTTYPE_OFFSET); > > - cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); > > - ddf->data = QDMA_SDDF_CMD(cmd); > > + sdf->cmd = cpu_to_le32((FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET) | > > + FSL_QDMA_CMD_PF); > > + > > + ddf->cmd = cpu_to_le32((FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET) | > > + (FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET)); > > } > > > > /* > > @@ -626,7 +625,7 @@ static int fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) > > > > static int > > fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, > > - void *block, > > + __iomem void *block, > > int id) > > { > > bool duplicate; > > -- > > 2.34.1 > > -- > ~Vinod
On 22-02-24, 19:30, Vinod Koul wrote: > On 19-02-24, 10:59, Frank Li wrote: > > Fix below sparse warnings. > > This does not apply for me, can you rebase Nevermind I had issues in my local branch, this works
On Mon, 19 Feb 2024 10:59:39 -0500, Frank Li wrote: > Fix below sparse warnings. > > drivers/dma/fsl-qdma.c:645:50: sparse: warning: incorrect type in argument 2 (different address spaces) > drivers/dma/fsl-qdma.c:645:50: sparse: expected void [noderef] __iomem *addr > drivers/dma/fsl-qdma.c:645:50: sparse: got void > > drivers/dma/fsl-qdma.c:387:15: sparse: sparse: restricted __le32 degrades to integer > drivers/dma/fsl-qdma.c:390:19: sparse: expected restricted __le64 [usertype] data > drivers/dma/fsl-qdma.c:392:13: sparse: expected unsigned int [assigned] [usertype] cmd > > [...] Applied, thanks! [1/1] dmaengine: fsl-qdma: add __iomem and struct in union to fix sparse warning commit: 1878840a0328dac1c85d29fee31456ec26fcc01c Best regards,
diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index 1e3bf6f30f784..5005e138fc239 100644 --- a/drivers/dma/fsl-qdma.c +++ b/drivers/dma/fsl-qdma.c @@ -161,6 +161,10 @@ struct fsl_qdma_format { u8 __reserved1[2]; u8 cfg8b_w1; } __packed; + struct { + __le32 __reserved2; + __le32 cmd; + } __packed; __le64 data; }; } __packed; @@ -355,7 +359,6 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan) static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, dma_addr_t dst, dma_addr_t src, u32 len) { - u32 cmd; struct fsl_qdma_format *sdf, *ddf; struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest; @@ -384,15 +387,11 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp, /* This entry is the last entry. */ qdma_csgf_set_f(csgf_dest, len); /* Descriptor Buffer */ - cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET) | - FSL_QDMA_CMD_PF; - sdf->data = QDMA_SDDF_CMD(cmd); - - cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE << - FSL_QDMA_CMD_RWTTYPE_OFFSET); - cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET); - ddf->data = QDMA_SDDF_CMD(cmd); + sdf->cmd = cpu_to_le32((FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET) | + FSL_QDMA_CMD_PF); + + ddf->cmd = cpu_to_le32((FSL_QDMA_CMD_RWTTYPE << FSL_QDMA_CMD_RWTTYPE_OFFSET) | + (FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET)); } /* @@ -626,7 +625,7 @@ static int fsl_qdma_halt(struct fsl_qdma_engine *fsl_qdma) static int fsl_qdma_queue_transfer_complete(struct fsl_qdma_engine *fsl_qdma, - void *block, + __iomem void *block, int id) { bool duplicate;