Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215823/?format=api
{ "id": 2215823, "url": "http://patchwork.ozlabs.org/api/patches/2215823/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260325-parse_iommu_cells-v11-3-1fefa5c0e82c@oss.qualcomm.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260325-parse_iommu_cells-v11-3-1fefa5c0e82c@oss.qualcomm.com>", "list_archive_url": null, "date": "2026-03-25T11:08:24", "name": "[v11,3/3] of: Respect #{iommu,msi}-cells in maps", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a0cc224df4b8b04b2b69bf9e3baf8ad945d671e6", "submitter": { "id": 92739, "url": "http://patchwork.ozlabs.org/api/people/92739/?format=api", "name": "Vijayanand Jitta", "email": "vijayanand.jitta@oss.qualcomm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260325-parse_iommu_cells-v11-3-1fefa5c0e82c@oss.qualcomm.com/mbox/", "series": [ { "id": 497422, "url": "http://patchwork.ozlabs.org/api/series/497422/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=497422", "date": "2026-03-25T11:08:21", "name": "of: parsing of multi #{iommu,msi}-cells in maps", "version": 11, "mbox": "http://patchwork.ozlabs.org/series/497422/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215823/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215823/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-51053-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=QSLCAAHe;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=KvbMA0pQ;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51053-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com\n header.b=\"QSLCAAHe\";\n\tdkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=\"KvbMA0pQ\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=205.220.180.131", "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=oss.qualcomm.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgkvY5rd1z1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 22:19:37 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 1BBEB31862B7\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 11:10:38 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5B65C3CF681;\n\tWed, 25 Mar 2026 11:09:51 +0000 (UTC)", "from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com\n [205.220.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 167363CF66A\n\tfor <linux-pci@vger.kernel.org>; Wed, 25 Mar 2026 11:09:45 +0000 (UTC)", "from pps.filterd (m0279869.ppops.net [127.0.0.1])\n\tby mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 62PAQNcf1208844\n\tfor <linux-pci@vger.kernel.org>; Wed, 25 Mar 2026 11:09:45 GMT", "from mail-pf1-f198.google.com (mail-pf1-f198.google.com\n [209.85.210.198])\n\tby mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d48599gq5-1\n\t(version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Wed, 25 Mar 2026 11:09:44 +0000 (GMT)", "by mail-pf1-f198.google.com with SMTP id\n d2e1a72fcca58-82c70d1f65aso513784b3a.1\n for <linux-pci@vger.kernel.org>; Wed, 25 Mar 2026 04:09:44 -0700 (PDT)", "from hu-vjitta-hyd.qualcomm.com ([202.46.23.25])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82b040da7besm14615911b3a.49.2026.03.25.04.09.31\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 04:09:42 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774436990; cv=none;\n b=Ud1t6Vk0tWvktePDJwVL0QeP8uAwxabPKGWJqxKxrrFvEXcCHXRjjJcxDzxhIZh96EnwU/4jIhn779DHpFwXbU4hMtQOH9mJ9RzgWc39BvMK7pUOPfCpO+t/W2k6Feea6M3wse8Uq63pVWhdg72AsAQsqvPgNlHu+vj+c6zw/UU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774436990; c=relaxed/simple;\n\tbh=321iTv20Z7OXFtuJcDmECJJpboHYO48kOD5DQXbc3Ao=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=dfMBTnVpa6VM87LqReCq2mB7PIfcThVY4O/GQUZn8CvtDEDcTN48/n2pvWsY/AkWMSnw1aMYbABw2WpBPK8+u9dNEmvKRy3zHnZQ0cJG2S/Jb5SJdMhF0uYaPWRn2HQWHf9TdETDRLzBoJ9Xv2Kzpa6QfxYhYZRNm3Bmi80A964=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com;\n spf=pass smtp.mailfrom=oss.qualcomm.com;\n dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com\n header.b=QSLCAAHe;\n dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=KvbMA0pQ; arc=none smtp.client-ip=205.220.180.131", "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n\tcc:content-transfer-encoding:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to; s=qcppdkim1; bh=\n\tVhGHqC2XDynARGpL/uIgYPGZtNXC+dk0e9MA3p7JUHk=; b=QSLCAAHeqJ/rairq\n\tW2AtAZldN7c3QxFk9yF70tP94pLAUW2pXBnpdsQKVqgKyF8q7kaRIvRgPvd+b/US\n\t3OLsC0pZ66M1zeiyfNbWDIHJDKAhjaSVrRJ5mjDyLYPEPuyc26TebrdxPWlfMQVN\n\tmj7hu+E9Lj6Qg40bB219wN0qc69SKSjLAShY/VoxHO+teX7IS59RzAeDcKgGEpLS\n\t3MObOD6EqSwJlRoC3qexEzo04zPXC5hojgaLj6TOk1zHIyaprP3NACjNwSHx0HXp\n\tjkWv/b0pKp+d/Txcp6HI5W8g2Z6A3N3KrWy1Hcqc3LauI8k2DPKKvEWumiHNj6Zc\n\tIppduA==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1774436984; x=1775041784;\n darn=vger.kernel.org;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to;\n bh=VhGHqC2XDynARGpL/uIgYPGZtNXC+dk0e9MA3p7JUHk=;\n b=KvbMA0pQRS3SJ+arXiETIb4mxWh/fUtIge/sjMejihebgw74iRQwqshLG1Y84oeMXN\n 8n5gAlkr4sFul98AZywm8kKPCiXd3bjhCArlzLxucFKLKlz1VF8DjkgEQY1iocrLfp1i\n ZvRMcWkgR0KQEsbka7KXn4uCZjkOQw7L4qiPpbCOKZ0hVzIWuqAcCpO3fSYb46ASpRs0\n Reg4+G0B8iMSdXDWXb2buEUKP90M+TS8ofboPymaDW8QcGVONU+g393qq9elThxoSowx\n 46gi3SAoqGos5HQ4r3vTSwdVzOPb6mBrZacqeQARNmZN+zl/MaPvi6BtDMRLikB6cMCL\n 2TQw==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774436984; x=1775041784;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=VhGHqC2XDynARGpL/uIgYPGZtNXC+dk0e9MA3p7JUHk=;\n b=bji82TLHNz1Eo0WL/AkZfG5QwlQ3op/9qesIbRIOb1cafy2kQbNzybSL6vXlOx7QCz\n oQDmyrFrLKjHQgjXsA/B7dmC+XyxqdAw/2Xou1M2oZ1Y0DcPAw3XTVJdfFcJMvOFR4wr\n 7vH/MSwa6acZ+Io/CEXNVhcjuqZpEN34sMb9ODCkhn6GQ32qGP6P/hvpynGRMzRV8bra\n fWfrDbgrohYGqdfNJqPdKg7ZZ59HIdkRznHdbOiHmIXHASCVrM6hLZ2fFHtNVbvIrN+F\n E78MfNuwncamQfnbgOkUxCc6QPBk/ufHmOJhLbQ+zyRc1/sW4pEi6GOFIJGmh+BQ27rt\n fd0g==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCX1ZXGGxVnBb9VZtgNp1OEtb1ylrd8IWTq9sIcg7zcK7NCQPAWRXmS3qhUaBWPS2n2gzmNJP+dkR0Q=@vger.kernel.org", "X-Gm-Message-State": "AOJu0Yw2YdWoRi/BxoxzhABQLvKKFQ81kXFY4mtupBH+mbJml2mF6sXZ\n\taQExvy94JwuB1PmZAVSTPM0g8sKtZkHh1yo+IKt+u5ZTP5VFjOF+phoHxfW6qTgzKUInUpcgoqh\n\tWDM/Gonj4h9EzXGVpA8YGFXMc3pIeMsVdK+6cwf3RdH4v8lvg8j8Igh7YoXfpgpA=", "X-Gm-Gg": "ATEYQzxJX7HzwCNGPJDKHHHVk3joru+lWeEp/orCiQj8M6gatNI/qQz51EN7tebeozp\n\tUG0jApUcXPiUodqqWGYX+2qShWqusrj7F4C/V0rQfy4f9ARiJDAwPvmfrvSXLShzyMxkcapuQso\n\tc+P1ezMGUEy+DVKT79rKua3kT37vNPj3FTLkoo2uav4SslnCic7bSe3Ue1EPMgW6tzGIwdpQ26k\n\tOSqzc3MStmHBhomNXHwrLCq1bhhLRtx/E9MSG6CAnMTB5g2QXBsszr2azEvQX8Su3JcDpdcm5v5\n\tcVooS63zvpyJRAMGWeqldi5wRrRS18S4UxGLoW1+LnVFrbcSU3eyCQpgg1IimunuEFHug+ZBCiz\n\tGCOW9mcIlm1OpOgIDwINGVH+ZbaXKEAIGEodzo+8wvZN+r2hB42G3wP2y", "X-Received": [ "by 2002:a05:6a00:4fd4:b0:82c:2180:32e1 with SMTP id\n d2e1a72fcca58-82c6df87d2bmr2941824b3a.30.1774436983602;\n Wed, 25 Mar 2026 04:09:43 -0700 (PDT)", "by 2002:a05:6a00:4fd4:b0:82c:2180:32e1 with SMTP id\n d2e1a72fcca58-82c6df87d2bmr2941761b3a.30.1774436982988;\n Wed, 25 Mar 2026 04:09:42 -0700 (PDT)" ], "From": "Vijayanand Jitta <vijayanand.jitta@oss.qualcomm.com>", "Date": "Wed, 25 Mar 2026 16:38:24 +0530", "Subject": "[PATCH v11 3/3] of: Respect #{iommu,msi}-cells in maps", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260325-parse_iommu_cells-v11-3-1fefa5c0e82c@oss.qualcomm.com>", "References": "<20260325-parse_iommu_cells-v11-0-1fefa5c0e82c@oss.qualcomm.com>", "In-Reply-To": "<20260325-parse_iommu_cells-v11-0-1fefa5c0e82c@oss.qualcomm.com>", "To": "Nipun Gupta <nipun.gupta@amd.com>,\n Nikhil Agarwal <nikhil.agarwal@amd.com>, Joerg Roedel <joro@8bytes.org>,\n Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>,\n Marc Zyngier <maz@kernel.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>,\n Thomas Gleixner <tglx@kernel.org>, Saravana Kannan <saravanak@kernel.org>,\n Richard Zhu <hongxing.zhu@nxp.com>, Lucas Stach <l.stach@pengutronix.de>,\n\t=?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>,\n Manivannan Sadhasivam <mani@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>,\n Frank Li <Frank.Li@nxp.com>, Sascha Hauer <s.hauer@pengutronix.de>,\n Pengutronix Kernel Team <kernel@pengutronix.de>,\n Fabio Estevam <festevam@gmail.com>, Juergen Gross <jgross@suse.com>,\n Stefano Stabellini <sstabellini@kernel.org>,\n Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,\n Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,\n Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,\n Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>,\n Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,\n Krzysztof Kozlowski <krzk+dt@kernel.org>,\n Prakash Gupta <prakash.gupta@oss.qualcomm.com>,\n Vikash Garodia <vikash.garodia@oss.qualcomm.com>", "Cc": "linux-kernel@vger.kernel.org, iommu@lists.linux.dev,\n linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,\n linux-pci@vger.kernel.org, imx@lists.linux.dev,\n xen-devel@lists.xenproject.org, linux-arm-msm@vger.kernel.org,\n Vijayanand Jitta <vijayanand.jitta@oss.qualcomm.com>,\n Charan Teja Kalla <charan.kalla@oss.qualcomm.com>", "X-Mailer": "b4 0.12.3", "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1774436939; l=11993;\n i=vijayanand.jitta@oss.qualcomm.com; s=20260301; h=from:subject:message-id;\n bh=hhxFww84fiqdRnnSRnrS9vJjSjcq+XxylCTlpd3SMkE=;\n b=Us5vY/aPE5SlHmBokg/zubXLlUcnC104O2IL+pQVmfERbJAGAGDMwtGVFIs7pepIAUzGXYtVz\n BTwRA0K6JNYB0x3hR61JI70vT2yYKvdLkJwexsJ8go6z2MWSSMHveGS", "X-Developer-Key": "i=vijayanand.jitta@oss.qualcomm.com; a=ed25519;\n pk=Lpi7Cs3wHe8KZtqvyci7FTOLzsKpEHKGCaPNZw+1zRI=", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMzI1MDA3OSBTYWx0ZWRfX5xXrvPUsIQSi\n 80BP+91WnXtVMjF+0q2V+dIXQEGl4Aow49DSuqxKCP2GH72G9RvbyFSNXOKD/NXXlMIabjikSj7\n KiGRortX1pQu53h8A2wA1qvS3yoUvT1a+vmfTIRqDmeisPjLD43t8JYZ4SwlygBTQNnzSrDQnmo\n 2wc8uhqLHurDlcNVXiTLz/iTKgiwnPM4w1ECbW6PMymg30ztiIhJ84uEPyeotEJ1lat4Rv0pioM\n 9473SZV4070g36wMc5AGCcJYkpiqRuSn4Kvytcofb4iK9t85lgbgX/t0ve+UpdbOBSGmYKXTjZf\n Ityu+ivourO9zA0USlsS3J1E9ZQaCkKz94HLQAMuFONKuJQkJqGvSguYq7/MOmm1Bxc9F9T0V48\n 2dG0UrTwDAmbW33KnXFb+LpXzr+p/q5Q5OqebMJt0mPyskA8Jriee5usnrIFlydBv1rhMit/Q7m\n PjOmfB8k+Kq3uoAB8LA==", "X-Authority-Analysis": "v=2.4 cv=VODQXtPX c=1 sm=1 tr=0 ts=69c3c278 cx=c_pps\n a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17\n a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10\n a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22\n a=7CQSdrXTAAAA:8 a=EUspDBNiAAAA:8 a=klF1l1D6msg2vEcBgDUA:9 a=QEXdDO2ut3YA:10\n a=IoOABgeZipijB_acs4fv:22 a=a-qgeE7W1pNrGK8U0ZQC:22", "X-Proofpoint-GUID": "pLdUM_6jVDt9bLg-MLYRD2DwyCmGRaAX", "X-Proofpoint-ORIG-GUID": "pLdUM_6jVDt9bLg-MLYRD2DwyCmGRaAX", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-03-25_03,2026-03-24_01,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n suspectscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0\n priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0\n bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001\n definitions=main-2603250079" }, "content": "From: Robin Murphy <robin.murphy@arm.com>\n\nSo far our parsing of {iommu,msi}-map properties has always blindly\nassumed that the output specifiers will always have exactly 1 cell.\nThis typically does happen to be the case, but is not actually enforced\n(and the PCI msi-map binding even explicitly states support for 0 or 1\ncells) - as a result we've now ended up with dodgy DTs out in the field\nwhich depend on this behaviour to map a 1-cell specifier for a 2-cell\nprovider, despite that being bogus per the bindings themselves.\n\nSince there is some potential use in being able to map at least single\ninput IDs to multi-cell output specifiers (and properly support 0-cell\noutputs as well), add support for properly parsing and using the target\nnodes' #cells values, albeit with the unfortunate complication of still\nhaving to work around expectations of the old behaviour too.\n\nSince there are multi-cell output specifiers, the callers of of_map_id()\nmay need to get the exact cell output value for further processing.\nUpdate of_map_id() to set args_count in the output to reflect the actual\nnumber of output specifier cells.\n\nSigned-off-by: Robin Murphy <robin.murphy@arm.com>\nSigned-off-by: Charan Teja Kalla <charan.kalla@oss.qualcomm.com>\nSigned-off-by: Vijayanand Jitta <vijayanand.jitta@oss.qualcomm.com>\n---\n drivers/of/base.c | 155 ++++++++++++++++++++++++++++++++++++++++-------------\n include/linux/of.h | 6 ++-\n 2 files changed, 123 insertions(+), 38 deletions(-)", "diff": "diff --git a/drivers/of/base.c b/drivers/of/base.c\nindex b3d002015192..7b22e2484e1c 100644\n--- a/drivers/of/base.c\n+++ b/drivers/of/base.c\n@@ -2096,18 +2096,48 @@ int of_find_last_cache_level(unsigned int cpu)\n \treturn cache_level;\n }\n \n+/*\n+ * Some DTs have an iommu-map targeting a 2-cell IOMMU node while\n+ * specifying only 1 cell. Fortunately they all consist of value '1'\n+ * as the 2nd cell entry with the same target, so check for that pattern.\n+ *\n+ * Example:\n+ *\tIOMMU node:\n+ *\t\t#iommu-cells = <2>;\n+ *\n+ *\tDevice node:\n+ *\t\tiommu-map = <0x0000 &smmu 0x0000 0x1>,\n+ *\t\t\t <0x0100 &smmu 0x0100 0x1>;\n+ */\n+static bool of_check_bad_map(const __be32 *map, int len)\n+{\n+\t__be32 phandle = map[1];\n+\n+\tif (len % 4)\n+\t\treturn false;\n+\tfor (int i = 0; i < len; i += 4) {\n+\t\tif (map[i + 1] != phandle || map[i + 3] != cpu_to_be32(1))\n+\t\t\treturn false;\n+\t}\n+\treturn true;\n+}\n+\n /**\n * of_map_id - Translate an ID through a downstream mapping.\n * @np: root complex device node.\n * @id: device ID to map.\n * @map_name: property name of the map to use.\n+ * @cells_name: property name of target specifier cells.\n * @map_mask_name: optional property name of the mask to use.\n * @filter_np: optional device node to filter matches by, or NULL to match any.\n *\tIf non-NULL, only map entries targeting this node will be matched.\n * @arg: pointer to a &struct of_phandle_args for the result. On success,\n- *\t@arg->args[0] will contain the translated ID. If a map entry was\n- *\tmatched, @arg->np will be set to the target node with a reference\n- *\theld that the caller must release with of_node_put().\n+ *\t@arg->args_count will be set to the number of output specifier cells\n+ *\tas defined by @cells_name in the target node, and\n+ *\t@arg->args[0..args_count-1] will contain the translated output\n+ *\tspecifier values. If a map entry was matched, @arg->np will be set\n+ *\tto the target node with a reference held that the caller must release\n+ *\twith of_node_put().\n *\n * Given a device ID, look up the appropriate implementation-defined\n * platform ID and/or the target device which receives transactions on that\n@@ -2116,17 +2146,19 @@ int of_find_last_cache_level(unsigned int cpu)\n * Return: 0 on success or a standard error code on failure.\n */\n int of_map_id(const struct device_node *np, u32 id,\n-\t const char *map_name, const char *map_mask_name,\n+\t const char *map_name, const char *cells_name,\n+\t const char *map_mask_name,\n \t const struct device_node *filter_np, struct of_phandle_args *arg)\n {\n \tu32 map_mask, masked_id;\n-\tint map_len;\n+\tint map_bytes, map_len, offset = 0;\n+\tbool bad_map = false;\n \tconst __be32 *map = NULL;\n \n \tif (!np || !map_name || !arg)\n \t\treturn -EINVAL;\n \n-\tmap = of_get_property(np, map_name, &map_len);\n+\tmap = of_get_property(np, map_name, &map_bytes);\n \tif (!map) {\n \t\tif (filter_np)\n \t\t\treturn -ENODEV;\n@@ -2136,11 +2168,9 @@ int of_map_id(const struct device_node *np, u32 id,\n \t\treturn 0;\n \t}\n \n-\tif (!map_len || map_len % (4 * sizeof(*map))) {\n-\t\tpr_err(\"%pOF: Error: Bad %s length: %d\\n\", np,\n-\t\t\tmap_name, map_len);\n-\t\treturn -EINVAL;\n-\t}\n+\tif (map_bytes % sizeof(*map))\n+\t\tgoto err_map_len;\n+\tmap_len = map_bytes / sizeof(*map);\n \n \t/* The default is to select all bits. */\n \tmap_mask = 0xffffffff;\n@@ -2153,39 +2183,82 @@ int of_map_id(const struct device_node *np, u32 id,\n \t\tof_property_read_u32(np, map_mask_name, &map_mask);\n \n \tmasked_id = map_mask & id;\n-\tfor ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {\n+\n+\twhile (offset < map_len) {\n \t\tstruct device_node *phandle_node;\n-\t\tu32 id_base = be32_to_cpup(map + 0);\n-\t\tu32 phandle = be32_to_cpup(map + 1);\n-\t\tu32 out_base = be32_to_cpup(map + 2);\n-\t\tu32 id_len = be32_to_cpup(map + 3);\n+\t\tu32 id_base, phandle, id_len, id_off, cells = 0;\n+\t\tconst __be32 *out_base;\n+\n+\t\tif (map_len - offset < 2)\n+\t\t\tgoto err_map_len;\n+\n+\t\tid_base = be32_to_cpup(map + offset);\n \n \t\tif (id_base & ~map_mask) {\n-\t\t\tpr_err(\"%pOF: Invalid %s translation - %s-mask (0x%x) ignores id-base (0x%x)\\n\",\n-\t\t\t\tnp, map_name, map_name,\n-\t\t\t\tmap_mask, id_base);\n+\t\t\tpr_err(\"%pOF: Invalid %s translation - %s (0x%x) ignores id-base (0x%x)\\n\",\n+\t\t\t np, map_name, map_mask_name, map_mask, id_base);\n \t\t\treturn -EFAULT;\n \t\t}\n \n-\t\tif (masked_id < id_base || masked_id >= id_base + id_len)\n-\t\t\tcontinue;\n-\n+\t\tphandle = be32_to_cpup(map + offset + 1);\n \t\tphandle_node = of_find_node_by_phandle(phandle);\n \t\tif (!phandle_node)\n \t\t\treturn -ENODEV;\n \n+\t\tif (!bad_map && of_property_read_u32(phandle_node, cells_name, &cells)) {\n+\t\t\tpr_err(\"%pOF: missing %s property\\n\", phandle_node, cells_name);\n+\t\t\tof_node_put(phandle_node);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (map_len - offset < 3 + cells) {\n+\t\t\tof_node_put(phandle_node);\n+\t\t\tgoto err_map_len;\n+\t\t}\n+\n+\t\tif (offset == 0 && cells == 2) {\n+\t\t\tbad_map = of_check_bad_map(map, map_len);\n+\t\t\tif (bad_map) {\n+\t\t\t\tpr_warn_once(\"%pOF: %s mismatches target %s, assuming extra cell of 0\\n\",\n+\t\t\t\t\t np, map_name, cells_name);\n+\t\t\t\tcells = 1;\n+\t\t\t}\n+\t\t}\n+\n+\t\tout_base = map + offset + 2;\n+\t\toffset += 3 + cells;\n+\n+\t\tid_len = be32_to_cpup(map + offset - 1);\n+\t\tif (id_len > 1 && cells > 1) {\n+\t\t\t/*\n+\t\t\t * With 1 output cell we reasonably assume its value\n+\t\t\t * has a linear relationship to the input; with more,\n+\t\t\t * we'd need help from the provider to know what to do.\n+\t\t\t */\n+\t\t\tpr_err(\"%pOF: Unsupported %s - cannot handle %d-ID range with %d-cell output specifier\\n\",\n+\t\t\t np, map_name, id_len, cells);\n+\t\t\tof_node_put(phandle_node);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tid_off = masked_id - id_base;\n+\t\tif (masked_id < id_base || id_off >= id_len) {\n+\t\t\tof_node_put(phandle_node);\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tif (filter_np && filter_np != phandle_node) {\n \t\t\tof_node_put(phandle_node);\n \t\t\tcontinue;\n \t\t}\n \n \t\targ->np = phandle_node;\n-\t\targ->args[0] = masked_id - id_base + out_base;\n-\t\targ->args_count = 1;\n+\t\tfor (int i = 0; i < cells; i++)\n+\t\t\targ->args[i] = id_off + be32_to_cpu(out_base[i]);\n+\t\targ->args_count = cells;\n \n \t\tpr_debug(\"%pOF: %s, using mask %08x, id-base: %08x, out-base: %08x, length: %08x, id: %08x -> %08x\\n\",\n-\t\t\tnp, map_name, map_mask, id_base, out_base,\n-\t\t\tid_len, id, masked_id - id_base + out_base);\n+\t\t\tnp, map_name, map_mask, id_base, be32_to_cpup(out_base),\n+\t\t\tid_len, id, id_off + be32_to_cpup(out_base));\n \t\treturn 0;\n \t}\n \n@@ -2196,6 +2269,10 @@ int of_map_id(const struct device_node *np, u32 id,\n \targ->args[0] = id;\n \targ->args_count = 1;\n \treturn 0;\n+\n+err_map_len:\n+\tpr_err(\"%pOF: Error: Bad %s length: %d\\n\", np, map_name, map_bytes);\n+\treturn -EINVAL;\n }\n EXPORT_SYMBOL_GPL(of_map_id);\n \n@@ -2205,18 +2282,21 @@ EXPORT_SYMBOL_GPL(of_map_id);\n * @id: Requester ID of the device (e.g. PCI RID/BDF or a platform\n * stream/device ID) used as the lookup key in the iommu-map table.\n * @arg: pointer to a &struct of_phandle_args for the result. On success,\n- *\t@arg->args[0] contains the translated ID. If a map entry was matched,\n- *\t@arg->np holds a reference to the target node that the caller must\n- *\trelease with of_node_put().\n+ *\t@arg->args_count will be set to the number of output specifier cells\n+ *\tand @arg->args[0..args_count-1] will contain the translated output\n+ *\tspecifier values. If a map entry was matched, @arg->np holds a\n+ *\treference to the target node that the caller must release with\n+ *\tof_node_put().\n *\n- * Convenience wrapper around of_map_id() using \"iommu-map\" and \"iommu-map-mask\".\n+ * Convenience wrapper around of_map_id() using \"iommu-map\", \"#iommu-cells\",\n+ * and \"iommu-map-mask\".\n *\n * Return: 0 on success or a standard error code on failure.\n */\n int of_map_iommu_id(const struct device_node *np, u32 id,\n \t\t struct of_phandle_args *arg)\n {\n-\treturn of_map_id(np, id, \"iommu-map\", \"iommu-map-mask\", NULL, arg);\n+\treturn of_map_id(np, id, \"iommu-map\", \"#iommu-cells\", \"iommu-map-mask\", NULL, arg);\n }\n EXPORT_SYMBOL_GPL(of_map_iommu_id);\n \n@@ -2229,17 +2309,20 @@ EXPORT_SYMBOL_GPL(of_map_iommu_id);\n *\tto match any. If non-NULL, only map entries targeting this node will\n *\tbe matched.\n * @arg: pointer to a &struct of_phandle_args for the result. On success,\n- *\t@arg->args[0] contains the translated ID. If a map entry was matched,\n- *\t@arg->np holds a reference to the target node that the caller must\n- *\trelease with of_node_put().\n+ *\t@arg->args_count will be set to the number of output specifier cells\n+ *\tand @arg->args[0..args_count-1] will contain the translated output\n+ *\tspecifier values. If a map entry was matched, @arg->np holds a\n+ *\treference to the target node that the caller must release with\n+ *\tof_node_put().\n *\n- * Convenience wrapper around of_map_id() using \"msi-map\" and \"msi-map-mask\".\n+ * Convenience wrapper around of_map_id() using \"msi-map\", \"#msi-cells\",\n+ * and \"msi-map-mask\".\n *\n * Return: 0 on success or a standard error code on failure.\n */\n int of_map_msi_id(const struct device_node *np, u32 id,\n \t\t const struct device_node *filter_np, struct of_phandle_args *arg)\n {\n-\treturn of_map_id(np, id, \"msi-map\", \"msi-map-mask\", filter_np, arg);\n+\treturn of_map_id(np, id, \"msi-map\", \"#msi-cells\", \"msi-map-mask\", filter_np, arg);\n }\n EXPORT_SYMBOL_GPL(of_map_msi_id);\ndiff --git a/include/linux/of.h b/include/linux/of.h\nindex 8548cd9eb4f1..51ac8539f2c3 100644\n--- a/include/linux/of.h\n+++ b/include/linux/of.h\n@@ -462,7 +462,8 @@ const char *of_prop_next_string(const struct property *prop, const char *cur);\n bool of_console_check(const struct device_node *dn, char *name, int index);\n \n int of_map_id(const struct device_node *np, u32 id,\n-\t const char *map_name, const char *map_mask_name,\n+\t const char *map_name, const char *cells_name,\n+\t const char *map_mask_name,\n \t const struct device_node *filter_np, struct of_phandle_args *arg);\n \n int of_map_iommu_id(const struct device_node *np, u32 id,\n@@ -934,7 +935,8 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag\n }\n \n static inline int of_map_id(const struct device_node *np, u32 id,\n-\t\t\t const char *map_name, const char *map_mask_name,\n+\t\t\t const char *map_name, const char *cells_name,\n+\t\t\t const char *map_mask_name,\n \t\t\t const struct device_node *filter_np,\n \t\t\t struct of_phandle_args *arg)\n {\n", "prefixes": [ "v11", "3/3" ] }