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 6EA3E2C026F for ; Thu, 4 Dec 2025 09:55:43 +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=1764842144; cv=none; b=Fbzp5JYVps3zQVZg8X35Tqt/JtUUbVu0yO1z3RNBhyocbS91Pe5mxiHOdncozaifeFjSLVXzKa6Vzshh7pRpMp//EC351DrDxkqry5oHDM2rbPgxR8nnct0OwnrNovYBh2pAgnqTEmx6K2IVBcSMWX6QRrHa7/IYiCmyAEsDVl4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764842144; c=relaxed/simple; bh=dYNYUjY6ikxZh56WSHbxDgmXCaZcm2S1pqIcbri6RjE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=N8rYQ2Po3Dd2G+R26ONag3YmbLO7cXZu9sGnKZi30Ybb6zXdgTTQSMNwnT/AjxAkkY6OwSiiQ6pL6hQvBimMppDq4aKZyYJ2bictcpBk5ZXud+kyJFz9TluWPXC9rPOyFQtDmGA4gS/yZcCWGxbL4F8x4NqUOXoghWrxsMkG3pI= 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=YUwsmk0g; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=H1cwkRqT; 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="YUwsmk0g"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="H1cwkRqT" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B47TvIW996504 for ; Thu, 4 Dec 2025 09:55:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=0CBS82JE97HEdddV9MujHpiyCYF+cW+4cfC P0rgquHo=; b=YUwsmk0gWpQr+TJQl2/ZVERUCk6QvjLsFnEx3aLHrg36h1gvhDW MKamww0EP/5CgwaH9KR+UgUkSBLBMR/rPCl7PeGJ4AXfDHdzJ0JAWrLzjR9APvUt dlZdy5UCYRtCp9Bf7Mtd/J64k9k7TM4WsmbFkHuuGAqGBc596c3/V3xCfoc0Ajyj 7aVS5LTe5aMktgx2mZFYv3ez8bYvbmZMWVJjysOo9WHChveiAsjry2K0lzDTlBMo m2ZMgt++Uq/nN21kIVYFOcGrqyupsI3xXWkMxg5UulEGq8DWj0lYiGq4A572pkTS 6vUhkWy0sWGbc/ybbt03nBsSN8ZmKffz/RA== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4au5yc0guy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 04 Dec 2025 09:55:41 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-297e5a18652so9988515ad.1 for ; Thu, 04 Dec 2025 01:55:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764842140; x=1765446940; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0CBS82JE97HEdddV9MujHpiyCYF+cW+4cfCP0rgquHo=; b=H1cwkRqTlccEvQgy07TIAE2jXjokF+1OKywZKxP/XwOp1WgKS++VoD4rYlmmOhjxDu 8yOyW9xLciTWWZisS58Ys93E0ZHjyWwBUM1HsxthcIEkVHBYdnSAKfG8wWsm60VOZhha ukBfMcD5abtM/73RmO1Ln4sqyOnzb8N2mmAW8T57FftAQsfQ6PqSJiiWoGXxEUJQfu4F 0RcBYBtzhlohgadmJvZ25MsKbqU/0HcBJ2izfBAVBbL3kTLveTSD7+3DtAr1774FsCKC ijIc9DnTCujmfk/ZSz7zyuxUO1FrXUzNxvVrKc3GmmeII2I0bsyT1+/GAuR5JibWW9ar eNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764842140; x=1765446940; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0CBS82JE97HEdddV9MujHpiyCYF+cW+4cfCP0rgquHo=; b=Fbn1C9bSoYpSMYeb/S6MVr+I5cLvYLo7ATxeOapCR9u2NLyuw+lsbPxsXU41cK8Nq9 nkaJj9UxHoMJ5mJqeHqgXHnWB5rgsQz42m9BKeTLAi3ALQrxL6TzfFhFSCG3mfuxzgk2 dkKf3vZ5RJbIcelYrkvJMV0P1X6VN8+zJSO/yOIqXkV1AJ9hh+On60zQX27sq/+Nh3/7 kUrPJYihVt1ZL56aXRKDCrUuX2j27nljsEzp30VygMlWyhZSCHoBQ/WC8jpoGHeiLmJe Xft0SHYhEzXL0qFMP+eLxuQMYnPeiUtRQCOEolaqYl/RlS5BFd3ZMpuG9NZbf7B8n4Jm 34Kw== X-Forwarded-Encrypted: i=1; AJvYcCUQAVnTklxgNV5d0RYDzQUR/KVT9mAF00mIv7DKSNBQG101KfnNP8YelCONXJcEvrPqgZRtRHOzd8CUb04=@vger.kernel.org X-Gm-Message-State: AOJu0YwNScMZqzp0Y2LeWZ95LxtP4aAI+dIt89CzbjaiZrdIlaMKdgOY A0h9tg2o+MXjYhvUPhjInLG3321Fl1QbgZGJihj4sCbnjw9XVrWmZ3OuuAg54j8dceE4ZaYp/mr I/taAMYsCvsYvVGIhC+V4bwfV3EKsfYInRHGVl6t7UbJmuomM1phxlPtHQVVEBks66vU= X-Gm-Gg: ASbGncu5aSnMjsXfZ55hEe1cI53BhAC4sYPJBk6g2iQd1UWyk9A7Kid/2aIR8394jHL NxOthC4pQv5dFirJ7h3CzJ7SrMhE8HSPbFmdmZw/1qemEJs5Bzjw6o37oZ/6eq7shzpLQeM1YO6 NUWfVlZqp+Cq/c5FUHgk5JmWzwhKBc7Lnx/LtR9os3eG6+ai+CzzguK804UH4rQvoNdyDhh+xOE w9c1wR9f3Tw3zM7Y7y2+x/725IH9s9uFR3rW6yQI0ACLnN9Gkv4/pjeMhiX4ezbsIwJm7HVS2i6 W2xXDcwljUhZHPx5ALtg3WfSBPdzlOKSmvM3sHE0wDOMLrXHezqUKMw5tco7YxrjTygS+CBJhnk 7Zp2G+hZUaQnafMeoV3tYFwrXV4f8OkyS8gw4gRiLxM7c X-Received: by 2002:a17:903:3c2b:b0:29d:9f5a:e0d1 with SMTP id d9443c01a7336-29d9f5ae5b9mr29352215ad.27.1764842140528; Thu, 04 Dec 2025 01:55:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLmJJ1IqVAbpRWJYWX68AfdveHt+0MbsRDYek5+9K27SHrhh0a6ba8/TJ2nGMVM8HpcloKvQ== X-Received: by 2002:a17:903:3c2b:b0:29d:9f5a:e0d1 with SMTP id d9443c01a7336-29d9f5ae5b9mr29351895ad.27.1764842140016; Thu, 04 Dec 2025 01:55:40 -0800 (PST) Received: from hu-vjitta-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-bf6817389fdsm1380436a12.1.2025.12.04.01.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Dec 2025 01:55:39 -0800 (PST) From: Vijayanand Jitta To: robin.murphy@arm.com, will@kernel.org, joro@8bytes.org, robh@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, bjorn.andersson@oss.qualcomm.com, bod@kernel.org, conor+dt@kernel.org, krzk+dt@kernel.org, charan.kalla@oss.qualcomm.com, prakash.gupta@oss.qualcomm.com, vikash.garodia@oss.qualcomm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, vijayanand.jitta@oss.qualcomm.com Subject: [PATCH v2 0/3] of: parsing of multi #{iommu,msi}-cells in maps Date: Thu, 4 Dec 2025 15:25:27 +0530 Message-Id: <20251204095530.8627-1-vijayanand.jitta@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=QstTHFyd c=1 sm=1 tr=0 ts=69315a9e cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=eQMVBvNRXY1Htgy04vAA:9 a=GvdueXVYPmCkWapjIL-Q:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: eG4c9q2bVR-v_4uqX3lkNXyOWEMIV-FI X-Proofpoint-GUID: eG4c9q2bVR-v_4uqX3lkNXyOWEMIV-FI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjA0MDA4MSBTYWx0ZWRfXwKJCSvVlEERX +4c0waWAHHdgOGy31Rty86nOD/qKsH367TyVnyBkIXOxSajCi0++v7Dnw72tIQ0fxvLtoYdn7yu Hdil+9pZCUAV/XAF+MAf7DSKOiBK37oR12qkz4+gX//OkhxiecXRdM7PlQgCTSe3fOeYr91YbzC twembDPCXBNEWQt3Nmy1XLg/jORWepCGMegE/kPP25WToOhAiZnvYPIuJbFrG/Hr9mScg/ccJ6J r089LE5KoOev/IVwdu/sWHu++8IckXGY1YcT2Zyb1nCUx6sVFfOBptkcxjlfRldot+OeIB3TfSc ngQwVZ71Q0g3eyJtZhzidCCl/bq9clM6FCviSvLIJuw5p1fzxJgt3SwJwXIMDsypiq1DHuVz6b/ WZfeveb8osa8eHpGQj13Rn07VAFgnw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-04_02,2025-12-03_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 priorityscore=1501 adultscore=0 bulkscore=0 clxscore=1011 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512040081 So far our parsing of {iommu,msi}-map properites 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. The motivation for this patchset originates from the multi-map use case described in V1, which will be addressed in a subsequent series once the current fixes for iommu-cell handling are concluded. These changes have been tested on QEMU for the arm64 architecture. We plan to perform more extensive testing based on community feedback and are sending this series out early to gather review comments. [1] https://lore.kernel.org/all/20250627-video_cb-v3-0-51e18c0ffbce@quicinc.com/ V2: 1) Incorporated the patches from Robin that does the clean implementation. 2) 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 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 | 3 +- drivers/iommu/of_iommu.c | 11 +- drivers/irqchip/irq-gic-its-msi-parent.c | 4 +- drivers/of/base.c | 132 ++++++++++++++++------- drivers/of/irq.c | 3 +- drivers/pci/controller/dwc/pci-imx6.c | 10 +- drivers/pci/controller/pcie-apple.c | 6 +- drivers/xen/grant-dma-ops.c | 6 +- include/linux/of.h | 36 +++++-- 9 files changed, 151 insertions(+), 60 deletions(-) -- 2.34.1