From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 7566E3B636C for ; Wed, 8 Apr 2026 10:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775642637; cv=none; b=evQPFeu1jK4EKlyS41Wmunl8avqp+HhydMq+JzTQTUpOS1j/7koaomWCODt/AE0m/8LM+imdFvWr/33pYTK0cSJV1xswR5czgnqRC6v5ZlhUhFtTL4QIeW48+l0UZIt8d4PFY+WBW1vwjKQId01IBGIEQXCFYNHeWAZmp7X+yzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775642637; c=relaxed/simple; bh=k94qEoqP6LeaqMjZ56JkwcDL9Caxb++/1ywGR2aNrcE=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=qkbIqBmczVJeBj6ijpN+epHMfn1y73RpMDjdYKQu9zJGTfYywHByzUY3uDnuJSiJb2WnOcZN+DgTMgYZoACtc1SjeST+OHw1cFiSwVw3I+C/sP9L7vjezL2sRgABTv4jm9wdlRf1i/nL2l5/rB6CdLgmE+VU0JGjrx3Haw4A8yU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=E5a+CiVG; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=WsAW3peb; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="E5a+CiVG"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WsAW3peb" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6387K0Ob2451717 for ; Wed, 8 Apr 2026 10:03:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=7S+jIsI8IolI8S/0NzS+SU gTDKQIENCfMEWeyQ17RZs=; b=E5a+CiVGxDzyfBjpQZeW+h8coO6mDpkw3C4VLr Il7IruwRRyGVifBF2tWEIh0RITVBUh7wynkqqBDiu0qvVthDXizphb40Z0fXg7l1 4ePD+LWpuMLVmio17YTK1QVRNMPOyHYbMWFwoed9dZ4dSV6Mg9UfbYAstBHh0LrC ZcRfFoLo3Ctd4aDMK0HXfG7wz4TO1bUEzKb0WISeGCY/qyVcs8KZiv5bhjTW+QUi MjqFoHQ/Aq+Lu9LM0xUn0dFnnR/PTKUZzQwF1+yIbkQFbo36+N0foO3Q1elT13BM ppen4soBoDXUil18hOzE/8lDj63ocv022uBlYiZUp66jejBA== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ddae6a6gf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 08 Apr 2026 10:03:44 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-c70dd30025fso9966559a12.2 for ; Wed, 08 Apr 2026 03:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1775642623; x=1776247423; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=7S+jIsI8IolI8S/0NzS+SUgTDKQIENCfMEWeyQ17RZs=; b=WsAW3pebq2PHl8lUA6Rep2AMMJvNex+3AhplJiFVEOWNTE518MRge/hAYnS0kzzpHw 4/L98bJ1SlkJaxmoY9SRyNY56161x1feGBIK62eXzHepN09ivBZAeVUzO26vvCuDOv2/ tW6m2ImbtU+mp9x3FGqDUXMfRw9rmBsiICHlr2NmNyhhwD3nPpsPEr4SJ8uTlT1PsgGe 5dOYB7N3Xy9XiUaZWjfPb0Zau+76i29KerJ9+hCorJaJTnxJKkHw+dlfZZ24skXyR0aE 820mGIp4oKs8By7Qs7JeNxFEy3gAYLPxzAe0jH8JR3y7utLOpyzPqQXlZB2Q3fgmgrEN Y+ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775642623; x=1776247423; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7S+jIsI8IolI8S/0NzS+SUgTDKQIENCfMEWeyQ17RZs=; b=qyiNZHfM0w/DItTTCpMrcFWcInUjFYfK5IAuzfsko2aQVsUqfW83w4engziGK1G4ZN uiNmlE6snFHjCa2/S9dF6KbzqUoXPnSTnh1k4GuoGOH44Fx4Ji1lBkCXD5e5xBx9eneq AlWJsMVO9lU/4i9bt27+hbGseGZlChw8mqad5dSWXkJra9JsC206yU3DNZPcnvA8mSa2 /9UD9L0kPjnGy3tfCJE9mGUekti0OqWE7RaecBrZ8xgdAjoQSPrUsJii4mKMtYqAHXdb +zKhSQ2nPrLsBCuaJ3j20G3k0gA9sSaZwTDm9HKKM/LsSPVQCzm2iPSESobqLAGHta95 e2Ww== X-Gm-Message-State: AOJu0Yxl+fWu4PupZo66rFjqeRegGnukGldnvs1BDki2CA2Tz+7qMxWq H/W+XmbPaDb1D6og7te501LNnYQYmaV5+f4TkfsAb1Fe85NGUlZ2WbN4PHSLU072+e9K8QyqslX slR1chp/eNVO85XXohY2skEDutjfLIQDOEoNXJ0fS3bG/+q5JVODdbBwtla9mhmBi16o= X-Gm-Gg: AeBDiesiLXKBtTec/8TIuduy0Q5noIzyqh2ozZTZuvUJaPMfJu/JCsvBG3OQ7eynSjJ QwAdCZYmjVYTZaTcpeNKxszUOCze9V6y7/9u/knJRcFFLBwUBZ2e8+AeHHT1k784sKP1boJDIRQ RwGg9NQSAZLiQ2Bdp0oz/wIbVHJ8pqVFWqfx4ID2BjjL3hkf0acn+rTSx+eR3QkZzz07f1lk6/D ebfqjmsWCwwbhX6TOmNqj/JDGei8NJWY/OByf4CLHLOI0sjY1kK7Us9uO29ASUW35mODgmn9zgk UDLv+LObedPokFcpdS04LBbMrAskbGuqpnH/fikDgn3tDoyZbg8tU0F04H0ju6TzXYSc8blCX13 7STxiUgW/oA6xcg/yRiUs2yo06OoucahQ1oqyfYd/JtoEuAdkTJBYCqJZ X-Received: by 2002:a05:6a00:3696:b0:827:2a07:231d with SMTP id d2e1a72fcca58-82d0da77231mr19594618b3a.17.1775642623077; Wed, 08 Apr 2026 03:03:43 -0700 (PDT) X-Received: by 2002:a05:6a00:3696:b0:827:2a07:231d with SMTP id d2e1a72fcca58-82d0da77231mr19594542b3a.17.1775642622439; Wed, 08 Apr 2026 03:03:42 -0700 (PDT) Received: from hu-vjitta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82cf9b5fb22sm25805584b3a.26.2026.04.08.03.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 03:03:42 -0700 (PDT) From: Vijayanand Jitta Subject: [PATCH v13 0/3] of: parsing of multi #{iommu,msi}-cells in maps Date: Wed, 08 Apr 2026 15:33:24 +0530 Message-Id: <20260408-parse_iommu_cells-v13-0-fa921e92661b@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAOwn1mkC/33PQY7CMAwF0KugrCcoTkinnRX3QAi5jgORCmUSq ECod8ew6qKwsfQt+1l+qMI5cVF/i4fKPKSS+pMEcD8LRQc87VmnIA1lja2MM6DPmAvvUn88Xnf EXVc0kHO/VY3ctqhk75w5ptsb3WwlH1K59Pn+vjE0r+43bWi00asALTETeYZ1X8ry/4odydRSi nqhA5ip1MxJYISiykZC9Aih/kTBhLJ+lgKhIHJET4ZrS58oO6Hc7H9ghQpMMTjjmbGZocZxfAK rbA/VmwEAAA== X-Change-ID: 20260301-parse_iommu_cells-1c33768aebba To: Nipun Gupta , Nikhil Agarwal , Joerg Roedel , Will Deacon , Robin Murphy , Marc Zyngier , Lorenzo Pieralisi , Thomas Gleixner , Saravana Kannan , Richard Zhu , Lucas Stach , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Dmitry Baryshkov , Konrad Dybcio , Bjorn Andersson , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Prakash Gupta , Vikash Garodia Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, xen-devel@lists.xenproject.org, linux-arm-msm@vger.kernel.org, Vijayanand Jitta , Charan Teja Kalla X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775642611; l=6465; i=vijayanand.jitta@oss.qualcomm.com; s=20260301; h=from:subject:message-id; bh=k94qEoqP6LeaqMjZ56JkwcDL9Caxb++/1ywGR2aNrcE=; b=Fa93m6jMAv59XO0RGhV08H7u/lbeMgEu+VO89mYeYe9+udo03+OfW5l6aRjt+/+cujOgn9u6U /txq4POfFP1D4nQK6IieIAafLv29dRyBbPOkaAXwmZAh5zFPlwXVp/j X-Developer-Key: i=vijayanand.jitta@oss.qualcomm.com; a=ed25519; pk=Lpi7Cs3wHe8KZtqvyci7FTOLzsKpEHKGCaPNZw+1zRI= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDA4MDA5MSBTYWx0ZWRfX1Oxshg7kd7jc hWZMCQpl+tVixGh6WdbZnXzo98u0BA4kZcW9g4BhAlmV1df1WxjwYonrswdqsOYDjE192YFThjO 9B6ClLDrhCf78WYYvI8F2KZSViJb+TNkFjA8I8roEwUHtRH396lpIAct2Nxv+jrY1coRstQdqFS fsD6ZDUNnv2c/xaAjI5JNXggU+jUo+bejb5N4LTvlij/iphLEuuq9fI8dPob4m1ipCgFaEVX0OK Zyr/qlsdClhQuUPq18Aj5B8iJPJYjutiR04N7SxLSU+iHL3iDU0Ca79cPv9v0AXkenZcgAhmq9B 2gvZuXYwlz0NM1j1ZykIFGkzIu+sdNXH5Y9yACbPmZcfrYjVSr1pZgPgh5sbd/xn9EJc48OGlKk pau4sehF/ffmBnZsw8vwKeqejBtlr76nwuCJaT1r6fvgMzYxGRoNLiCWrqQUymw1B6ufbZlP0cG xcIuPHQwOHsXk5atoXA== X-Proofpoint-GUID: e_dzX1fz1vGpmM3OfDpMRgptHJzejEjQ X-Proofpoint-ORIG-GUID: e_dzX1fz1vGpmM3OfDpMRgptHJzejEjQ X-Authority-Analysis: v=2.4 cv=K4AS2SWI c=1 sm=1 tr=0 ts=69d62800 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8 a=NEAV23lmAAAA:8 a=bC-a23v3AAAA:8 a=EUspDBNiAAAA:8 a=qMDWySynzQg1s02BiloA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=TjNXssC_j7lpFel5tvFf:22 a=FO4_E8m0qiDe52t0p3_H:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-08_03,2026-04-08_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604080091 So far our parsing of {iommu,msi}-map properties has always blindly assumed that the output specifiers will always have exactly 1 cell. This typically does happen to be the case, but is not actually enforced (and the PCI msi-map binding even explicitly states support for 0 or 1 cells) - as a result we've now ended up with dodgy DTs out in the field which depend on this behaviour to map a 1-cell specifier for a 2-cell provider, despite that being bogus per the bindings themselves. Since there is some potential use[1] in being able to map at least single input IDs to multi-cell output specifiers (and properly support 0-cell outputs as well), add support for properly parsing and using the target nodes' #cells values, albeit with the unfortunate complication of still having to work around expectations of the old behaviour too. -- Robin. Unlike single #{}-cell, it is complex to establish a linear relation between input 'id' and output specifier for multi-cell properties, thus it is always expected that len never going to be > 1. These changes have been tested on QEMU for the arm64 architecture. Since, this would also need update in dt-schema, raised PR[2] for the same. [1] https://lore.kernel.org/all/20250627-video_cb-v3-0-51e18c0ffbce@quicinc.com/ [2] PR for iommu-map dtschema: https://github.com/devicetree-org/dt-schema/pull/184 Robin, Could this series be pulled into an immutable branch/tag, if it doesn't make it into the v7.1 merge window? There are client changes dependent on it, So it would help to get them moving forward rather than waiting another cycle. Thanks, Vijay V13: - Fix bad_map handling in of_map_id(): 'cells' is re-initialized to 0 on each loop iteration, so the !bad_map guard was insufficient, cells stayed 0 for all entries after the first. Fix by explicitly setting cells=1 when bad_map is true on every iteration. - Collected Acked-by from Frank Li. Link to v12: https://patch.msgid.link/20260331-parse_iommu_cells-v12-0-decfd305eea9@oss.qualcomm.com V12: - Call of_node_put() unconditionally in imx_pcie_add_lut_by_rid() thereby addressing comments from Bjorn Helgaas. Link to v11: https://lore.kernel.org/r/20260325-parse_iommu_cells-v11-0-1fefa5c0e82c@oss.qualcomm.com V11: - Added explicit filter_np parameter to of_map_id() and of_map_msi_id() per Dmitry Baryshkov's review feedback, making the filter explicit instead of overloading arg->np as both input filter and output parameter. - Removed of_node_put() from inside of_map_id(), making the caller responsible for reference management. Updated of_msi_xlate() to properly handle reference counting. - Collected ACKed by tags, and fixed minor typos. Link to v10: https://lore.kernel.org/r/20260309-parse_iommu_cells-v10-0-c62fcaa5a1d8@oss.qualcomm.com V10: - Move of_map_iommu_id()/of_map_msi_id() from include/linux/of.h to drivers/of/base.c as out-of-line helpers per feedback from Marc Zyngier and Rob Herring. - Add kernel-doc to document both helpers for discoverability and usage clarity. - Fix of_map_msi_id() wrapper and all its callers (cdx_msi.c, irq-gic-its-msi-parent.c, drivers/of/irq.c) to correctly use the new struct of_phandle_args-based API with proper of_node_put() handling as per feeback from Dmitry. Link to v9: https://lore.kernel.org/r/20260301-parse_iommu_cells-v9-0-4d1bceecc5e1@oss.qualcomm.com V9: - Updated TO/CC list based on feedback to include all relevant maintainers. - No functional changes to the patches themselves. Link to V8: https://lore.kernel.org/all/20260226074245.3098486-1-vijayanand.jitta@oss.qualcomm.com/ V8: - Removed mentions of of_map_args from commit message to match code. Link to V7: https://lore.kernel.org/all/20260210101157.2145113-1-vijayanand.jitta@oss.qualcomm.com/ V7: - Removed of_map_id_args structure and replaced it with of_phandle_args as suggested by Dmitry. Link to V6: https://lore.kernel.org/all/20260121055400.937856-1-vijayanand.jitta@oss.qualcomm.com/ V6: - Fixed build error reported by kernel test bot. Link to V5: https://lore.kernel.org/all/20260118181125.1436036-1-vijayanand.jitta@oss.qualcomm.com/ V5: - Fixed Build Warnings. - Raised PR for iommu-map dtschema: https://github.com/devicetree-org/dt-schema/pull/184 Link to V4: https://lore.kernel.org/all/20251231114257.2382820-1-vijayanand.jitta@oss.qualcomm.com/ V4: - Added Reviewed-by tag. - Resolved warnings reported by kernel test bot, minor code reorganization. Link to V3: https://lore.kernel.org/all/20251221213602.2413124-1-vijayanand.jitta@oss.qualcomm.com/ V3: - Added Reviewed-by tag. - Updated of_map_id_args struct as a wrapper to of_phandle_args and added comment description as suggested by Rob Herring. Link to V2: https://lore.kernel.org/all/20251204095530.8627-1-vijayanand.jitta@oss.qualcomm.com/ V2: - Incorporated the patches from Robin that does the clean implementation. - Dropped the patches the were adding multi-map support from this series as suggested. V1: https://lore.kernel.org/all/cover.1762235099.git.charan.kalla@oss.qualcomm.com/ RFC: https://lore.kernel.org/all/20250928171718.436440-1-charan.kalla@oss.qualcomm.com/#r Signed-off-by: Vijayanand Jitta --- --- Charan Teja Kalla (1): of: Factor arguments passed to of_map_id() into a struct Robin Murphy (2): of: Add convenience wrappers for of_map_id() of: Respect #{iommu,msi}-cells in maps drivers/cdx/cdx_msi.c | 8 +- drivers/iommu/of_iommu.c | 6 +- drivers/irqchip/irq-gic-its-msi-parent.c | 11 +- drivers/of/base.c | 215 ++++++++++++++++++++++++------- drivers/of/irq.c | 11 +- drivers/pci/controller/dwc/pci-imx6.c | 34 +++-- drivers/pci/controller/pcie-apple.c | 6 +- drivers/xen/grant-dma-ops.c | 5 +- include/linux/of.h | 30 ++++- 9 files changed, 242 insertions(+), 84 deletions(-) --- base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31 change-id: 20260301-parse_iommu_cells-1c33768aebba Best regards, -- Vijayanand Jitta