get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218161/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218161,
    "url": "http://patchwork.ozlabs.org/api/patches/2218161/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260331-parse_iommu_cells-v12-3-decfd305eea9@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": "<20260331-parse_iommu_cells-v12-3-decfd305eea9@oss.qualcomm.com>",
    "list_archive_url": null,
    "date": "2026-03-31T14:04:48",
    "name": "[v12,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/20260331-parse_iommu_cells-v12-3-decfd305eea9@oss.qualcomm.com/mbox/",
    "series": [
        {
            "id": 498207,
            "url": "http://patchwork.ozlabs.org/api/series/498207/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=498207",
            "date": "2026-03-31T14:04:46",
            "name": "of: parsing of multi #{iommu,msi}-cells in maps",
            "version": 12,
            "mbox": "http://patchwork.ozlabs.org/series/498207/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218161/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218161/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-51575-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=CmFljeGR;\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=Fe/5CnZC;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-pci+bounces-51575-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=\"CmFljeGR\";\n\tdkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=\"Fe/5CnZC\"",
            "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 sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\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 4flVMm07S9z1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 01:08:36 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 9181C304E23D\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 14:06:35 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 754203FA5E1;\n\tTue, 31 Mar 2026 14:05:50 +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 6B6E63F99F4\n\tfor <linux-pci@vger.kernel.org>; Tue, 31 Mar 2026 14:05:44 +0000 (UTC)",
            "from pps.filterd (m0279868.ppops.net [127.0.0.1])\n\tby mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 62VDcHud058382\n\tfor <linux-pci@vger.kernel.org>; Tue, 31 Mar 2026 14:05:43 GMT",
            "from mail-pg1-f200.google.com (mail-pg1-f200.google.com\n [209.85.215.200])\n\tby mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d8ahksfs1-1\n\t(version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Tue, 31 Mar 2026 14:05:42 +0000 (GMT)",
            "by mail-pg1-f200.google.com with SMTP id\n 41be03b00d2f7-c76b69fb9d6so368926a12.1\n        for <linux-pci@vger.kernel.org>; Tue, 31 Mar 2026 07:05:42 -0700 (PDT)",
            "from hu-vjitta-hyd.qualcomm.com ([202.46.23.25])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b24264292asm118311945ad.4.2026.03.31.07.05.29\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Tue, 31 Mar 2026 07:05:39 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774965950; cv=none;\n b=i6dRs2mX5WeSWRaL4e3YrWa/Euv1VrL/bTJZq90y8edbBil4sUjM1AmUyodhjWSN7gtYWowQZBdMPEpFwCaM7jaOnHVOMN9fvUEpSvUB6m7+PxAI/+tdDkOwC/fcHMqwFpFaQASMPKyVe0Ws+iQnyUS8IMBrLul4MArNXq/R12U=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774965950; 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=V3Df+/j3cGaDSxn8yy10v8rDuubn/tMb1M513Y45wGcdNhFgni/vIg4TOjJ953eyUA7BmSqBtCM9T9moWLzx0JzOQnaVo/iWm9gq9uuxrgsq6Bc9Jna85IIO2Ept8zqTIudaAOvykk5HZkFEnCSHQcBQwuENhdw4iMvadKz91i4=",
        "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=CmFljeGR;\n dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=Fe/5CnZC; 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=CmFljeGRrCbwi0M8\n\tcwhv5/FP5/VOk7MdZs5SNHg6bg6nJEIENpkh1n33d+bp67pXtA6xs5xbL5Dn+lrP\n\tB8rz3bQJ+sEIQUk52lFKoyHwQWchlDI/qG7FbFpjK0Yi2vzkzXZpoQb4bFxRFeXc\n\tnLZ/H5uQhItumLsVUb2ZGZQ/zQTu4IHqQTOT5UK4ROYWC5maANsXvK/gWfLu8Rvg\n\t0z3NmAwyZ7cs4hpZAx38ui3fiNQu5RkomuUFmNfPnflixWjb/t2WidU7GwNAfpw+\n\tUS3E1DT24bQjd/9Qp56LJS4Bi+/XzKYNO7KN2hfha60anYRz/KnJzY8GnEmYwVha\n\tDicf6g==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=oss.qualcomm.com; s=google; t=1774965942; x=1775570742;\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=Fe/5CnZCRUDtDZHRYZMUJkRI3PcPg1vZ8KrYpjUVyiageMNqegD1FBq1t0T0ejZyMG\n         XlxLTCPcWqjJjCuue7EmdMdx7AlNau35mFExRp2TUFpzUoM8gYD4oYnGttdbkj01hqXe\n         z4wztcVbThmoFJDsUpRGak26pOuq/ZHfYRo1inWYxVlcXGl9bRPTWevMSIu3rSlKj/eX\n         hBL8qh0b0CnzWCnAFnx2uYPN7QbPmaw9PDr41m1wUMfxqSFHiRvnWZX1dB3kCRh5CIuT\n         rvHjnmND/CwErOgxl8G5xb3G+eChJa3tcV8Ic2yZz+dlJE0+arAFvzdsuGXRg05Obcex\n         nCQQ=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774965942; x=1775570742;\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=B2amY2y17fKCZEcIVFcENwgyIkLy2ydZCp07oOqvNWYw5lJ3zDOLwie0E8ba+RPebV\n         mpC8jCO0tTqZG9buSkB4/MxB2MG1BV145T/2a6yyGXm+sXbMoG7qcXPqXZQYD3lQhC/v\n         HVQPi+4svlVPKc3nPjadbPxyEqKuy5hpRQtvFLq4ZBrRMYCZZAfrtczniCu66Gloww0o\n         OgRpq5jnpHH4sKDCbBpXKwMqdxwxAW7G7hd68ON7mWATCO3ahDZxNrfB6I5DzO1qZjnP\n         Fs3eb4NK4nUStFRa/HBcvrB/+h1eCLAow2MxL3T876jZLv39UtuARVvvu8hcokJvYQsl\n         FKoA==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCU9UiVyNLWD4Ugfc7tAc++LYMJJqMEky6wwhzzRD3Sh8ZQ8RSuwrERITijm958doW2zStXaB084f2s=@vger.kernel.org",
        "X-Gm-Message-State": "AOJu0YyT095Py85UVZcvCBHcaXnOt95FfZ5KHgVeET4zvpnHh+Z1VMJd\n\tqFAqFC5DDCHkpu/Atf/dVuN9Y0WbA1zm2MYVp3rNBC6IMsJsqbG19HaCePr8ytXpdHmx8xOE+yB\n\t9d6rLrYxygZlvgJhCcphq1wGOoeB85cbQsheRwtQ65xnYCWvbvveykqdJssF1Ua4=",
        "X-Gm-Gg": "ATEYQzysr960X8O9D68m6h8sJ/la+HsN6mCEtKh+X+rgCaTFngrpdVMxXxozFhFpvX2\n\tgtIUgiU90fdmKI9RO8q1r2wdPwsEwi46LCOo/DNJEXVzygbx86ZJ4i4bQ1F850mAOl8GC/G0Uu9\n\tBnVD/1QdVyNcfJcvQOiNXrXCtS6P7XSODfiGtKt8PXtCHE1op78l3I0IL9BxMyfJeGVapNPjoVs\n\tazuaUev6ydqrqbSmvCskrFzUEdDNSTVcI8vOLiydnDRMmvzAZw8p/TBcGVVe47LkhfxaVkPr16j\n\tqCUz892Qbum6pCas5b2LVP5LX/Ie57NnE1OsEfDRQQ0jB6ZGee7cg1KfSG7O8L453aIUjTuDILN\n\t1jXuRx9t5BS9lyaruWPwrRMh2Q7s+vbg/Jy9omMajdxA33YU0GIvf6s2h",
        "X-Received": [
            "by 2002:a17:903:44d2:b0:2b2:4cae:6b2f with SMTP id\n d9443c01a7336-2b25ee9042amr24713195ad.4.1774965941290;\n        Tue, 31 Mar 2026 07:05:41 -0700 (PDT)",
            "by 2002:a17:903:44d2:b0:2b2:4cae:6b2f with SMTP id\n d9443c01a7336-2b25ee9042amr24712315ad.4.1774965940172;\n        Tue, 31 Mar 2026 07:05:40 -0700 (PDT)"
        ],
        "From": "Vijayanand Jitta <vijayanand.jitta@oss.qualcomm.com>",
        "Date": "Tue, 31 Mar 2026 19:34:48 +0530",
        "Subject": "[PATCH v12 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": "<20260331-parse_iommu_cells-v12-3-decfd305eea9@oss.qualcomm.com>",
        "References": "<20260331-parse_iommu_cells-v12-0-decfd305eea9@oss.qualcomm.com>",
        "In-Reply-To": "<20260331-parse_iommu_cells-v12-0-decfd305eea9@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.15.1",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1774965896; l=11993;\n i=vijayanand.jitta@oss.qualcomm.com; s=20260301; h=from:subject:message-id;\n bh=hhxFww84fiqdRnnSRnrS9vJjSjcq+XxylCTlpd3SMkE=;\n b=gRrmchAOmvc8H1+6Ovdtg5xTtZ7ZAOXAB76++3lrhnE23wTQ3dnHyDuB45uAmXrmbCsob3oRc\n a1bj22FGcCOCFRbhZMjrfdmDjDPkJBZ5lVAKxqk0At7lTFuaYmzElPK",
        "X-Developer-Key": "i=vijayanand.jitta@oss.qualcomm.com; a=ed25519;\n pk=Lpi7Cs3wHe8KZtqvyci7FTOLzsKpEHKGCaPNZw+1zRI=",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMzMxMDEzNyBTYWx0ZWRfXw+qdnhMeFVyx\n at2DfpvP/AbOslpVS7Tmu8bsCxHBPHxUqVFBxzkC8OWRGaIY5BDJJffAR5FE54uE/wOYlaU6E67\n Nix96dAaX33nqsJjquNr9jF6rQrn398dPX6SOJHZmc+BtaKtDTVmABjYbQWLb6GbvATatfSe863\n K6JrtID+C6bhCeMbXaSHaF0URFuKjFf1OBu4Wo5OEx5wQ3Me6Sjogmo80pjFyZa/2rz06XpGl2m\n iLSwD+nfqTgDN053EYmZEEkZxDXJA24dVXcJjXwgCEtU6HIPaKhy/eZmdwoGJG4PIj1w2xxksN3\n md2vMGgY8WxAAiAqz+klOrVXGKG2IHcZs8OJlziSQKbDzMKkRztNplOfmHegH0AiG5wHogWbR3d\n kwO2nZiYMDK5Glv8l1kxWPw8Tu/Pzt0us7MUzCMnZnGCkX9PuO3DPxK4T2Jza05FX61jih5X1QB\n yc93RU4N6Cn224kBu4Q==",
        "X-Authority-Analysis": "v=2.4 cv=K4wv3iWI c=1 sm=1 tr=0 ts=69cbd4b6 cx=c_pps\n a=oF/VQ+ItUULfLr/lQ2/icg==: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=ZpdpYltYx_vBUK5n70dp:22\n a=7CQSdrXTAAAA:8 a=EUspDBNiAAAA:8 a=klF1l1D6msg2vEcBgDUA:9 a=QEXdDO2ut3YA:10\n a=3WC7DwWrALyhR5TkjVHa:22 a=a-qgeE7W1pNrGK8U0ZQC:22",
        "X-Proofpoint-ORIG-GUID": "ZDfriyHynzUafZDMAulZ-20D0quKxIH4",
        "X-Proofpoint-GUID": "ZDfriyHynzUafZDMAulZ-20D0quKxIH4",
        "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-31_03,2026-03-31_01,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n lowpriorityscore=0 clxscore=1015 bulkscore=0 priorityscore=1501\n malwarescore=0 spamscore=0 adultscore=0 impostorscore=0 phishscore=0\n suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc=\n route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001\n definitions=main-2603310137"
    },
    "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": [
        "v12",
        "3/3"
    ]
}