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 3F7B32EA171 for ; Mon, 15 Jun 2026 17:51:57 +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=1781545918; cv=none; b=bPLnnwi7IBYSHc6X/ie1t6zNC+PjJsPOLgN1IDq5rJTenVzFUz5jxuMq+98i5NosqQLYi0wJTel6w5ARDcvKApa8LndpWRcmvGIldqlBThqlYqSm+4oNpOQUB/ekZSXDN1yAtpCqFOt2WVxQ3gA9XmGvia2SpqvdbMTW7FA8gp0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781545918; c=relaxed/simple; bh=jRBOymtAD5Zax1YDEFOJtJc65qKSsvi6ja5n8PcXrVw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=McmTB+XQhyLMWAgneXXLDz3cKihJY0fbpzzvnbXAsvRz4CVsd4/uJYtI101sWmFKI+qlnvvi8Zu32e0KpHXgbvVv8EyawRQbNK1Fl4/5h8WskzH8Jae1Um0AlGHDW3529GB9paDGVzJ3+AsK2E700Zemp5giuoBc58ELne20Ll8= 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=FCu358r/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Y4W7wVVU; 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="FCu358r/"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Y4W7wVVU" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65FFiNBg927141 for ; Mon, 15 Jun 2026 17:51:56 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= qZK8gIrw4sJMg/RWkW+3S8oTqB2g5fpkwTdzQW5NIdU=; b=FCu358r/FhlaTP/4 EccVyTT3a7iO4ApIbAMOZTtgMr0frC6jDMn/q9I9ciwAPlwsMiiAqn3KrK8rANW2 9DYhyonELhphHchHBQi7m7a6v9iaMMD8zYGr6sa9c+8LSKtRrThdimDa5k9SHgH3 Ubvi1wWUdyn2LnDieDXZX7nw+Tx5hGylzcP8rxfKGntBExIjcbevQhIy5N1hYlIz X4D4LVNTIDtukzSM3oIyGM2q9loEIcjnetdkBy0kaNsUq4vsr5CdS1HEyqBlPQkw 6Q1R7/4xcVD9kViNdIvLm8XfD0j0d9ZrMTVHD8fa5w+sWoZC0Gs9DvH0mR8rVkaP C/taZQ== 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 4etegut6ne-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 15 Jun 2026 17:51:56 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2c2b64850easo21778545ad.1 for ; Mon, 15 Jun 2026 10:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781545915; x=1782150715; darn=vger.kernel.org; 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=qZK8gIrw4sJMg/RWkW+3S8oTqB2g5fpkwTdzQW5NIdU=; b=Y4W7wVVUD8NPMDI0Pl+r9HnVec1WLj5XsA2E+ZyQjU7tviNCCkxIz1XkZ0m++Kb/ut 7fmp9qprLpuTIzgi6LVRUkOz06w/4m7aKg3uLoWTGPc5nl+e/ZPoCDLsQxBOXWGoZxjl W1OelDKDRs1QjKVGbS8tXBHL5BioDb2uG34B4JCHfeQpGcZozsM++nMFiKYKvQRWYH2G ka1T0V7oXgTjFCH00zkxx0rHJHGFRNV3zSnl8K6FNXsMmKr58RwozD+ZhbobiqamJ7YO PgTMHKTdI2Lo3GLrN+Clks50tDu/ghRUMX+NcKJzuM+Q4qX57H44gPIjska73aQuRYWP 5TDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781545915; x=1782150715; 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=qZK8gIrw4sJMg/RWkW+3S8oTqB2g5fpkwTdzQW5NIdU=; b=DqfPSl1c+4We8F9HGJBimVFgdSdLB1Xq0fz6F3jj/wS9KKK2doH7x1Ot+S7w3JxxEj s0xeaKsfoa7XvDVIDhk4aOgSCotQp0MX6xF9MzeqcY7QLZ2jGvayaHPd5eIXQqegi6/R mTKbr7Lq1ZNbvneBF9LCt1QV4wqKOswlecDgQA2SO3sJZ33uv9b5L1HFDEncCNvJQwEJ AVXW1TJ0k0SiNiMy0KjfGrmNKzGE7hwHx7bwt+J7l269jBTCbNoyw3JCnyLSwX/NgS+7 cdcEhdmxsZMhJlZmkA+1bYOdzPs5ItPgjq0ULbkhJ46wZRCf94W1ZIVFcBJOBJYF9Xcs XOiA== X-Forwarded-Encrypted: i=1; AFNElJ8znWwTvpuPDOOa6ySoE8IKU/PZVPhYViHZiNwoWI8KQcC/9ubv72zM95rGKwfRwkxgm92UxnRzhRLHIUg=@vger.kernel.org X-Gm-Message-State: AOJu0YxAT2kRq6fTqZM6zJFCNMKjW4I0H+s8BESLwB20Y7am9/oKoYEq iL2kJNDQJE179bifWh0mfD9P7n/0NRd5f+uDuhRjvqfqpg/lbLeMhy1kI1VUZToNX0Ov3KjDjMs hTf/WMSaQijfTxKeI2xeiXDBMi/A8lxE9MfUKRRxU9+J3nNM7GDR/nWOfKduKwC6L7lI= X-Gm-Gg: Acq92OEIGZySFChtVAfBK1lnBlz5yBLksY04a0fuoWupJcHWhiUTuObYFjc+Mfdasxi sil7wSZxuOEr2VWkp19t3XI0vjKks1j7lbgi1P0jjuI4G69b8Bag3ubkLdeL562lpvN0xVSfxjv rnqHESsn9oJSmCC+ZRv0WtEfLwxvcaUJ4DdF5Ny95cdX3N2ozmr309wNhJNsJRGv0p5wwaXWysn vI1ZB0AXnBAWIroeBsxZ91cfEvhe8qm5zkzSQUWP1Qi2jAyWGNyH0M9INTbGnoY6O+jeCJAA4PO 8yPAb1T1HmhDUIy9nHUk1ezcLjZt8SzzhBznYO7Cff/0NJe2frmEMILe3fsZEacyIFUS1R7X2Ux AvpjcpCURNO7LTCmTIVteaAP7T0DqleuyiDCaCnZ3vmS9NRPeiycpm/lq X-Received: by 2002:a17:903:3bcf:b0:2be:39bd:8dd8 with SMTP id d9443c01a7336-2c66429433bmr125719815ad.33.1781545915155; Mon, 15 Jun 2026 10:51:55 -0700 (PDT) X-Received: by 2002:a17:903:3bcf:b0:2be:39bd:8dd8 with SMTP id d9443c01a7336-2c66429433bmr125719415ad.33.1781545914674; Mon, 15 Jun 2026 10:51:54 -0700 (PDT) Received: from [10.187.126.18] ([106.221.183.253]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c433460a60sm130287695ad.76.2026.06.15.10.51.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jun 2026 10:51:53 -0700 (PDT) Message-ID: Date: Mon, 15 Jun 2026 23:21:45 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] dma-iommu: Introduce API to reserve IOVA regions for dynamically created devices To: Jason Gunthorpe , Vikash Garodia Cc: Robin Murphy , joro@8bytes.org, will@kernel.org, m.szyprowski@samsung.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, dikshita.agarwal@oss.qualcomm.com References: <20260119054936.3350128-1-busanna.reddy@oss.qualcomm.com> <20260612172649.GM1066031@ziepe.ca> <20260615125257.GS1066031@ziepe.ca> Content-Language: en-US From: Vishnu Reddy In-Reply-To: <20260615125257.GS1066031@ziepe.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE1MDE4OSBTYWx0ZWRfXy2oD/YS/CB0F 160jwmCamj16WCrL8PLwe7zmcKo3E7wkKm00H9zSLtkBWDk4rfwGFaUCZZRevleeQoI2St2by2K KioIHn/Qvf98yO7x9oi48nKcGghEs4HBY4CMuHuCQaZZz8YmPVtnZPvnTAHbaIShIC81GQYGhYd MsGnJq50XquIaIplB8ZFZEbktE7ThrgigyOwcEYbvfnOClRKSRsCq36UyXopLix1PuJofSvFTfN VDMrKYbV3/GSxEJGMI6kOOTIvJGanVin2Odp1ucWd3Ig+5omT6q9MLvFIpL40CVNuZHRxJuzC8m Ky9jAeWaIcySwJT801is548sq6sNmj6/YI9ucHtYDMRjpZCME+Whu9zdDB64YXzfZz5OWoogIPO D512E/T54tUqkQcBpJIIjmxOnI1s74Mh2pn7gi6Lvv0zYD0re2iDMNtiZvqLgouL5zUS9T+sbCL cZNcchkLatLGPPfLErw== X-Proofpoint-ORIG-GUID: PRRqTevGh-qfF4ZWKhJM2UWhUnQUyoVY X-Authority-Analysis: v=2.4 cv=HMvz0Itv c=1 sm=1 tr=0 ts=6a303bbc cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ym48ABLkKUHSTpi9L/JoRg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=QHREdudD40185EaPPEQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE1MDE4OSBTYWx0ZWRfX9RVDmivCUsAt KmeHPik7/TdNRDIGQGjC03imTWMiZOIUkA/07J7ydDLzF4i80W1Rq7rErb5ym6Nyhg9vHhZQrTE 5+tau7/D0j0/4uIEVx71O2USdui/BN8= X-Proofpoint-GUID: PRRqTevGh-qfF4ZWKhJM2UWhUnQUyoVY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-15_04,2026-06-15_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606150189 On 6/15/2026 6:22 PM, Jason Gunthorpe wrote: > On Mon, Jun 15, 2026 at 12:26:25PM +0530, Vikash Garodia wrote: > >> To handle such case, we create the device dynamically and associated the >> distinct IOVA range to them,via the api introduced in this patch. >> This was prototyped in recent SOC here [1] >> >> [1] https://lore.kernel.org/linux-media/20260313-kaanapali-iris-v3-1-9c0d1a67af4b@oss.qualcomm.com/ > Well, I'm not enthused by this: > > +static int iris_vpu_bus_dma_configure(struct device *dev) > +{ > + struct iris_context_bank *cb = dev_get_drvdata(dev); > + > + if (!cb) > + return -ENODEV; > + > + return of_dma_configure_id(dev, dev->parent->of_node, true, &cb->f_id); > +} > > A custom bus and then calling configure_id on the parent which would > have already called of_dma_configure on that same of_node seems very > hacky to me. Hi Jason, Here, the parent node does not have an iommus property — it only has iommu-map, like example below: iommu-map = <0x0 &apps_smmu 0x1940 0x0 0x1>,  /* function_id 0 → SID 0x1940 */             <0x1 &apps_smmu 0x1943 0x0 0x1>,  /* function_id 1 → SID 0x1943 */             <0x2 &apps_smmu 0x1944 0x0 0x1>;  /* function_id 2 → SID 0x1944 */ When the parent device is probed, of_dma_configure() is called, which internally invokes of_dma_configure_id() with NULL as the function ID. Since there is no iommus entry, no stream ID gets mapped to the parent device. The child devices are created at runtime and have no of_node of their own. The only place the iommu-map property exists is on the parent's of_node. So when configuring a child device, we pass the parent's of_node along with the child's specific function_id — this is how of_dma_configure_id() finds and maps the correct stream ID to the child device only. So to be clear — the parent of_node is not being configured again. It is just being used as a lookup source for the iommu-map property, since the child has no of_node of its own. Thanks, Vishnu Reddy. > Jason