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 B0850379EE2 for ; Tue, 17 Mar 2026 17:36:36 +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=1773768998; cv=none; b=GbTIPFLLc6nrpKZ2zHFrd6WbsvfHL0niERbjpv+XcQCAWczCdXHgT81hj26ufr0C1n/DZ+i7MjFerFlPQhq2aNk/xJDNJPnFaDhlR2Rp1HQCtkW+nhea9O8v2ElIIlQwBmaU+WspbEMsUpTKgRgfAH8dBzQl4JavgnWCy1XuBks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773768998; c=relaxed/simple; bh=3rwjPmHOSwY4XTSgIu6O+LE+Rr7mCg58/5IvLB1zFOM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Gaz+jXVjOOGDXMmki8sWgua9LceYKeA4lj8q/yod2Buzq23L1J14AwJ74FoFCTFgjhCdB4QdML4X4YeUzsV+Bce6NYu3cJytPTVYBRTvSiAtpA1AVQOTrAcV+sxPcmDnhKegqfCsBivwXrirJC6iWHVAFdKF+B0s2iP+qWhVsQI= 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=DDNrKG6T; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CJLYfxUY; 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="DDNrKG6T"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CJLYfxUY" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62HFOKwi536902 for ; Tue, 17 Mar 2026 17:36:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= zytiUP8Xce3T94fCwbA24WE4ff9eD1E8/ytUb5yxkwI=; b=DDNrKG6TBGPThpBu Qyx6FFRxPlo9Lsw9cg7D1U2tm8zxL8j42xvmYJAy8i0iWCAzgnYY0vH7Ul9raj6Z HwxUqbkaynZU+WVWdLr+MRDq4tz5iJzOfAFFTHtkdpJPhbSqh1/UMsdv4OMIufdB CvX5TsvYNSq4goCEBNHBJRVHgWt74xDg8XJsMHx9HGYEGWXYd4gS/ozpnjbkVYGC QnHJ/bTannKFVM7Z/DLt8BomcdqaqKYgFGrYJkse2i7sHtxmK6ZTs/FbkI1hFi3T brQEIdXMSyoL7duC5cni/eKj+yoGMQCFnf5reegtKcrLp16GOY3KvF58shbTVtD+ sTIEqA== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cy9jr0j2e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 17 Mar 2026 17:36:35 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ae3badc00dso87928535ad.3 for ; Tue, 17 Mar 2026 10:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773768995; x=1774373795; darn=lists.linux.dev; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zytiUP8Xce3T94fCwbA24WE4ff9eD1E8/ytUb5yxkwI=; b=CJLYfxUYe3yfSlu9sC+HU9RBubqRbOx91eFS5YYeILDriSFkA9s1LAzpcOS6luNsT7 t2QSDMGkP6kjadRCBVmlVL3fZrM3Xo0YjNNb4q96dtNt+TiP+/rMC0BOqdlVQbQF0VqK mPyno/dRtQVQ98kHdf5idSg4LWHNjWRDLYHBREQ3/Kl1djWBR14O0bOe9oX16FQ1GfFh mL20JhlwZSCuj5cbBy1uIFHEFXaXSjXQ3CQLEQK6I+dt6F72mgn53sbV1Q/KVpATeqEU jPx75FuaqvWMwI2pcAbahILF/6GjrFZXBkE1wZYrbqq5dFPo57LvF8oN/OABPMpGYYiG 8TOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773768995; x=1774373795; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zytiUP8Xce3T94fCwbA24WE4ff9eD1E8/ytUb5yxkwI=; b=mbORNHRsStEGVnahL2L0yGor6hOPgMPZ5jB3gUAzSoJTgu8QFWiRJbl0qX+dUsoBSt 5g8jzM2QTc7sYkgeWNNMo0mzSVCd1vCYYPUok0zQOiJrKF04Y7Cq/m59+ChmW8g2TN6s v7ZA0nFCb4n98LJD3Jnw+JRItTo1Vh0/uDuKD4w2BjBK7+RCIjOrAZWvFvNzIWO+UVPI PD54y2NukhXBqvv+bV+HOyz2uGsK1SNL9A1WShAy9HkrwFyHEs5PX6GisVjvGXwc/vkA a0ZxrNRnPecWA/MKpxObsBJDt/vr16LPfSViaIlxOpN6IaLvWPdw+fMHWIdFlpoP0kL5 kzBg== X-Forwarded-Encrypted: i=1; AJvYcCVn5d+lymPYh/dVPP/uv9O1MRLiFlcVtosDxppc3ZoFufPrLMtx8tuWgXE5B1gCd6ec8IU=@lists.linux.dev X-Gm-Message-State: AOJu0Yxdl6LhEicv3rLZD0JLFt8K55CvhO3JmDufF9bEGDB9i1bV5ut1 sm6FbaFNfn4Mewsff3I97wB0HrucyTU74cOI/+J5sh1Kbxzx533mVz12Y/UEmLYCcze1+NwGSCJ 679aZKQLBQ22qaGXub/HFn2d9cbf5L6N3suqGRo/GnvOcWeHflKM143Y= X-Gm-Gg: ATEYQzwegPP2rfdbho48hD8meOTaePOn6jfDsW7WNdnuZkDDkWDgpFRaZx4wYfoutSJ fnHWO7nEICo/qYakkD9PyFW6te+BU9UJPlu+yuWIhXKuz7sJbejkaikB3YynBuV8r4qzIkk+iiK VU6XEtDXhOJfwRPKTxFHJ7bFAY/M09ehrRNPVTzwM6iV9DNw6l+BLGyBUqHQt0FGhxW5As+UxFO NxOZTs7ku72bCIQIzekLuwPxtuvMd8C08CLleOpc2YK0B6wER0JNrK6Znf+kINdyXKC3NEnO3xJ ee+RZlEdQdHADkTDKNlpsTUAlEzdiUYYn1kEGWusBaXlIPPJJLI/JxTqHZ1GogI5yj5JgGJC28n pA2xPQ+Z8IOqxCNCjU9y+fTF7/IyG4Y7Y6TThZ7fMfCLDkXIQq2XSwQfs X-Received: by 2002:a17:903:1a67:b0:2b0:5a4c:726a with SMTP id d9443c01a7336-2b06e41afc9mr2520665ad.43.1773768994509; Tue, 17 Mar 2026 10:36:34 -0700 (PDT) X-Received: by 2002:a17:903:1a67:b0:2b0:5a4c:726a with SMTP id d9443c01a7336-2b06e41afc9mr2520265ad.43.1773768993782; Tue, 17 Mar 2026 10:36:33 -0700 (PDT) Received: from [192.168.0.172] ([49.205.248.224]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e603937sm1236095ad.57.2026.03.17.10.36.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Mar 2026 10:36:33 -0700 (PDT) Message-ID: Date: Tue, 17 Mar 2026 23:06:21 +0530 Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] of/iommu: support multiple iommu-map entries per input ID To: Robin Murphy , Vijayanand Jitta , Joerg Roedel , Will Deacon , Rob Herring , Saravana Kannan , Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Marc Zyngier , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Dmitry Baryshkov , Konrad Dybcio , Bjorn Andersson , Conor Dooley , Krzysztof Kozlowski , Prakash Gupta Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, xen-devel@lists.xenproject.org References: <20260315-iommu_multi_map-v2-1-51b98cb79331@oss.qualcomm.com> Content-Language: en-US From: Vikash Garodia In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: Cqkl4Cca-E2cnZfjP597OZD8i53JmFjh X-Proofpoint-ORIG-GUID: Cqkl4Cca-E2cnZfjP597OZD8i53JmFjh X-Authority-Analysis: v=2.4 cv=NdjrFmD4 c=1 sm=1 tr=0 ts=69b99123 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=L0D9IIo8dDxUtxRzEGqq2w==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=dbrUTAiK8tO8QfTRFOUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE3MDE1NCBTYWx0ZWRfX8nwubca5/Kov J2wpk+VgVw5CXn5S/+RV305/XjGoJLo//WlbfyA0keJ2IAmNok4kEbso4CLr8HBPZN6EIo5ilYM DY7TRgKEcSs8mpTzKfWmZD1HmIKEz61A8rby317ItIu++WpErNy76jpxnVhArGhL5qk7VOgfkrr zfm4U/8cZCBAWyuIrtAJcNn/xQ29zwbHu9IT2PNO/3FsnE4buSsj0dn/MWczQTMlxbz0IzXtuKG lsqIcglYDtbqDpXRb0eGjFog/bAK00+Pz3O04RJGCCkWnZxKB7dBrw/YwyTYBmDlHPLT72QFZk2 9JluqZZv4bYfxODBg2LIADCNg8IpxtkS3qHUUeGk9DF0dFoq3Qek6UPuFk1VqOO+Qxaxb3aykMi 7BF2un5R2AspsQqCzkdlNnMZ1zDyJBd9JzKx+ogDPewN+Yxh8gIuVHfR3RO1rZ9g1d2fFXSz3HD McL3jD/jH/MJ7L9D4zA== 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-03-17_03,2026-03-17_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 adultscore=0 impostorscore=0 malwarescore=0 suspectscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603170154 Hello Robin, On 3/16/2026 5:18 PM, Robin Murphy wrote: > On 2026-03-15 5:07 pm, Vijayanand Jitta wrote: >> When multiple mappings are present for an input ID, linux matches >> just the first one. There is a usecase [1] where all the mappings >> are to be maintained in parallel for an iommu-map entry of a same >> input id. >> >> Add a next_offset iterator parameter to of_map_iommu_id() and >> refactor of_map_id() internals into a static helper to carry it. >> Update of_iommu_configure_dev_id() to loop over all matching >> entries to support this case. All other callers pass NULL and >> are unaffected. >> >> [1] https://lore.kernel.org/all/20250627-video_cb- >> v3-0-51e18c0ffbce@quicinc.com/ > > That series doesn't even reference "iommu-map" though? > > Once again, NAK to this - the purpose of "iommu-map"/"msi-map" is to > describe a translation from one hardware ID space to another, where a > one-to-many mapping of IDs to a single target would never make sense. > While it is in principle possible for a single device to map to multiple > different *targets*, that is ambiguous as to what it means - is it > giving the OS a choice to use whichever one it prefers, or implying they > must all be configured identically at all times? - so depending on how > you prefer to look at it, we either do not support that, or we have > chosen the first option. > Ideally that should be the way to have unique hardware ID should be mapped to unique single target. In case of VPU hardware, there are few sub hardwares blocks, 2 of them would be bitstream engine (BE) and tensilica (XS). They generates unique ID as 0x1940 and 0x1a20 respectively. There is a *single register interface* to program a mapped device address which both these hardware would access and processes on the data. To accomplish this, these unique stream-ids are being mapped to single target so as to generate single device address. We can call this out as VPU hardware limitation, but thats how it is currently designed. If you could please suggest any alternate way to acheive this, it would help us conclude. Regards, Vikash >> Signed-off-by: Vijayanand Jitta >> --- >> On Qualcomm kaanapali, the VPU hardware has multiple internal blocks >> that generate different stream IDs for the same input ID. The device >> tree encodes them as separate iommu-map entries sharing the same input >> ID: > > And all that means is that your invented notion of "input IDs" is > clearly wrong. Please stop this abuse of common bindings and just come > up with a proper way to describe your hardware appropriately for what it > actually is and does. > > Thanks, > Robin. > >>    iommu-map = <0x100 &apps_smmu 0x1940 0x1>, >>                <0x100 &apps_smmu 0x1a20 0x1>, ... >> >> This requires multiple iommu-map entries per device. >> of_iommu_configure_dev_id() currently stops at the first match, >> so only one stream ID gets registered with the IOMMU. >> >> The v1 series [1] addressed this with a callback threaded through >> of_map_id(). >> >> This patch uses a next_offset iterator on of_map_iommu_id() instead, >> keeping of_map_id() unchanged, and updates of_iommu_configure_dev_id() >> to loop over all matching entries. >> >> This patch also depends on iommu-cells series [4]. >> >> Changes since v1: >>        - Split patches 2/7 [2] and 3/7 [3] out into this standalone >> series. >>        - Dropped the callback (of_map_id_cb / of_map_id_arg) entirely. >>        - Replaced with a next_offset iterator on of_map_iommu_id() >>          only; of_map_id() public API is unchanged. >>        - of_iommu_configure_dev_id() now loops explicitly; no >>          bus-type heuristic (dev_is_platform()) needed. >> >> [1] https://lore.kernel.org/all/20260126-kaanapali-iris-v1-0- >> e2646246bfc1@oss.qualcomm.com/ >> [2] https://lore.kernel.org/all/20260126-kaanapali-iris-v1-2- >> e2646246bfc1@oss.qualcomm.com/ >> [3] https://lore.kernel.org/all/20260126-kaanapali-iris-v1-3- >> e2646246bfc1@oss.qualcomm.com/ >> [4] https://lore.kernel.org/all/ce25b963-0e8e-4411- >> a406-7b466eadb1f9@oss.qualcomm.com/ >> >> Signed-off-by: Vijayanand Jitta >> --- >>   drivers/iommu/of_iommu.c              | 20 +++++++---- >>   drivers/of/base.c                     | 65 +++++++++++++++++++++++++ >> +++++----- >>   drivers/pci/controller/dwc/pci-imx6.c |  2 +- >>   drivers/pci/controller/pcie-apple.c   |  2 +- >>   drivers/xen/grant-dma-ops.c           |  2 +- >>   include/linux/of.h                    |  4 +-- >>   6 files changed, 75 insertions(+), 20 deletions(-) >> >> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c >> index a18bb60f6f3d..947eedd9a88b 100644 >> --- a/drivers/iommu/of_iommu.c >> +++ b/drivers/iommu/of_iommu.c >> @@ -46,14 +46,22 @@ static int of_iommu_configure_dev_id(struct >> device_node *master_np, >>                        const u32 *id) >>   { >>       struct of_phandle_args iommu_spec = {}; >> -    int err; >> +    int offset = 0, err; >> +    bool found = false; >> -    err = of_map_iommu_id(master_np, *id, &iommu_spec); >> -    if (err) >> -        return err; >> +    while (!(err = of_map_iommu_id(master_np, *id, &iommu_spec, >> &offset))) { >> +        err = of_iommu_xlate(dev, &iommu_spec); >> +        of_node_put(iommu_spec.np); >> +        iommu_spec.np = NULL; >> +        if (err) >> +            return err; >> +        found = true; >> +    } >> + >> +    /* -ENODEV means all entries exhausted; success if at least one >> was processed */ >> +    if (err == -ENODEV && found) >> +        return 0; >> -    err = of_iommu_xlate(dev, &iommu_spec); >> -    of_node_put(iommu_spec.np); >>       return err; >>   } >> diff --git a/drivers/of/base.c b/drivers/of/base.c >> index 9c44eb6d445d..71175e670757 100644 >> --- a/drivers/of/base.c >> +++ b/drivers/of/base.c >> @@ -2146,13 +2146,13 @@ static bool of_check_bad_map(const __be32 >> *map, int len) >>    * >>    * Return: 0 on success or a standard error code on failure. >>    */ >> -int of_map_id(const struct device_node *np, u32 id, >> -           const char *map_name, const char *cells_name, >> -           const char *map_mask_name, >> -           struct of_phandle_args *arg) >> +static int of_map_id_next(const struct device_node *np, u32 id, >> +              const char *map_name, const char *cells_name, >> +              const char *map_mask_name, >> +              struct of_phandle_args *arg, int *next_offset) >>   { >>       u32 map_mask, masked_id; >> -    int map_bytes, map_len, offset = 0; >> +    int map_bytes, map_len, offset = next_offset ? *next_offset : 0; >>       bool bad_map = false; >>       const __be32 *map = NULL; >> @@ -2161,7 +2161,7 @@ int of_map_id(const struct device_node *np, u32 id, >>       map = of_get_property(np, map_name, &map_bytes); >>       if (!map) { >> -        if (arg->np) >> +        if (arg->np || next_offset) >>               return -ENODEV; >>           /* Otherwise, no map implies no translation */ >>           arg->args[0] = id; >> @@ -2262,9 +2262,16 @@ int of_map_id(const struct device_node *np, u32 >> id, >>           pr_debug("%pOF: %s, using mask %08x, id-base: %08x, out- >> base: %08x, length: %08x, id: %08x -> %08x\n", >>               np, map_name, map_mask, id_base, be32_to_cpup(out_base), >>               id_len, id, id_off + be32_to_cpup(out_base)); >> + >> +        if (next_offset) >> +            *next_offset = offset;    /* caller resumes from here */ >>           return 0; >>       } >> +    /* no (more) matches found in the map */ >> +    if (next_offset) >> +        return -ENODEV; >> + >>       pr_info("%pOF: no %s translation for id 0x%x on %pOF\n", np, >> map_name, >>           id, arg->np); >> @@ -2276,6 +2283,38 @@ int of_map_id(const struct device_node *np, u32 >> id, >>       pr_err("%pOF: Error: Bad %s length: %d\n", np, map_name, >> map_bytes); >>       return -EINVAL; >>   } >> + >> +/** >> + * of_map_id - Translate an ID through a downstream mapping. >> + * @np: root complex device node. >> + * @id: device ID to map. >> + * @map_name: property name of the map to use. >> + * @cells_name: property name of target specifier cells. >> + * @map_mask_name: optional property name of the mask to use. >> + * @arg: pointer to a &struct of_phandle_args. On input, @arg->np may be >> + *    set to a target device node to match, or NULL to match any. On >> + *    success, @arg->np will be set to the matched target node (with a >> + *    reference held), @arg->args_count will be set to the number of >> + *    output specifier cells as defined by @cells_name in the target >> node, >> + *    and @arg->args[0..args_count-1] will contain the translated output >> + *    specifier values. >> + * >> + * Given a device ID, look up the appropriate implementation-defined >> + * platform ID and/or the target device which receives transactions >> on that >> + * ID, as per the "iommu-map" and "msi-map" bindings. If @arg->np >> points to >> + * a non-NULL device node, only entries targeting that node will be >> matched; >> + * if it is NULL, it will receive the device node of the first matching >> + * target phandle, with a reference held. >> + * >> + * Return: 0 on success or a standard error code on failure. >> + */ >> +int of_map_id(const struct device_node *np, u32 id, >> +          const char *map_name, const char *cells_name, >> +          const char *map_mask_name, >> +          struct of_phandle_args *arg) >> +{ >> +    return of_map_id_next(np, id, map_name, cells_name, >> map_mask_name, arg, NULL); >> +} >>   EXPORT_SYMBOL_GPL(of_map_id); >>   /** >> @@ -2285,15 +2324,23 @@ EXPORT_SYMBOL_GPL(of_map_id); >>    * @arg: pointer to a &struct of_phandle_args for the result. On >> success, >>    *    @arg->np holds a reference to the target node that the caller >> must >>    *    release with of_node_put(). >> + * @next_offset: if non-NULL, on success it is set to the map offset >> just >> + *    past the matched entry. Pass this value back on the next call to >> + *    resume scanning from where the previous call left off, allowing >> all >> + *    matching entries for the same @id to be iterated. Pass NULL (or a >> + *    pointer to 0) to find only the first match. >>    * >> - * Convenience wrapper around of_map_id() using "iommu-map" and >> "iommu-map-mask". >> + * Wrapper around the internal iommu-map scanner using "iommu-map" and >> + * "iommu-map-mask". When @next_offset is non-NULL, returns -ENODEV once >> + * all matching entries have been exhausted. >>    * >>    * Return: 0 on success or a standard error code on failure. >>    */ >>   int of_map_iommu_id(const struct device_node *np, u32 id, >> -            struct of_phandle_args *arg) >> +            struct of_phandle_args *arg, int *next_offset) >>   { >> -    return of_map_id(np, id, "iommu-map", "#iommu-cells", "iommu-map- >> mask", arg); >> +    return of_map_id_next(np, id, "iommu-map", "#iommu-cells", >> +                  "iommu-map-mask", arg, next_offset); >>   } >>   EXPORT_SYMBOL_GPL(of_map_iommu_id); >> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/ >> controller/dwc/pci-imx6.c >> index 5f8a11774eb5..0d7f5e6d037a 100644 >> --- a/drivers/pci/controller/dwc/pci-imx6.c >> +++ b/drivers/pci/controller/dwc/pci-imx6.c >> @@ -1146,7 +1146,7 @@ static int imx_pcie_add_lut_by_rid(struct >> imx_pcie *imx_pcie, u32 rid) >>       u32 sid = 0; >>       target = NULL; >> -    err_i = of_map_iommu_id(dev->of_node, rid, &iommu_spec); >> +    err_i = of_map_iommu_id(dev->of_node, rid, &iommu_spec, NULL); >>       if (!err_i) { >>           target = iommu_spec.np; >>           sid_i = iommu_spec.args[0]; >> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/ >> controller/pcie-apple.c >> index 2e86f8fd300b..c780e3f9d14d 100644 >> --- a/drivers/pci/controller/pcie-apple.c >> +++ b/drivers/pci/controller/pcie-apple.c >> @@ -765,7 +765,7 @@ static int apple_pcie_enable_device(struct >> pci_host_bridge *bridge, struct pci_d >>       dev_dbg(&pdev->dev, "added to bus %s, index %d\n", >>           pci_name(pdev->bus->self), port->idx); >> -    err = of_map_iommu_id(port->pcie->dev->of_node, rid, &iommu_spec); >> +    err = of_map_iommu_id(port->pcie->dev->of_node, rid, &iommu_spec, >> NULL); >>       if (err) >>           return err; >> diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c >> index 36547d7cf1d6..062beb5825f5 100644 >> --- a/drivers/xen/grant-dma-ops.c >> +++ b/drivers/xen/grant-dma-ops.c >> @@ -325,7 +325,7 @@ static int xen_dt_grant_init_backend_domid(struct >> device *dev, >>           struct pci_dev *pdev = to_pci_dev(dev); >>           u32 rid = PCI_DEVID(pdev->bus->number, pdev->devfn); >> -        if (of_map_iommu_id(np, rid, &iommu_spec)) { >> +        if (of_map_iommu_id(np, rid, &iommu_spec, NULL)) { >>               dev_dbg(dev, "Cannot translate ID\n"); >>               return -ESRCH; >>           } >> diff --git a/include/linux/of.h b/include/linux/of.h >> index 953f2dbe0e86..990849f00e74 100644 >> --- a/include/linux/of.h >> +++ b/include/linux/of.h >> @@ -467,7 +467,7 @@ int of_map_id(const struct device_node *np, u32 id, >>              struct of_phandle_args *arg); >>   int of_map_iommu_id(const struct device_node *np, u32 id, >> -            struct of_phandle_args *arg); >> +            struct of_phandle_args *arg, int *next_offset); >>   int of_map_msi_id(const struct device_node *np, u32 id, >>             struct of_phandle_args *arg); >> @@ -943,7 +943,7 @@ static inline int of_map_id(const struct >> device_node *np, u32 id, >>   } >>   static inline int of_map_iommu_id(const struct device_node *np, u32 id, >> -                  struct of_phandle_args *arg) >> +                  struct of_phandle_args *arg, int *next_offset) >>   { >>       return -EINVAL; >>   } >> >> --- >> base-commit: 9e94742cffb7541f55fa904a40c1ca9d836d303d >> change-id: 20260315-iommu_multi_map-8c9b78490ace >> >> Best regards, >