From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 8FD7B3B2FCE for ; Mon, 15 Jun 2026 06:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781506597; cv=none; b=nr9X6c8Gi4OKaGUlFg9DUvFQV3gxE6T9ul6MIo5uyddC9pemSSmBlmbbc0oPWitmvPG4uFaWQjbktLIpsw3SAhi8Z9Vw7riv4XJT/nuzRg1P4qz1i42peaS1TAtu2l/XOqOUcvPWq7KpAq1Bcl7MoIHoH13aWGTvfXku1aqSvtI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781506597; c=relaxed/simple; bh=VhRbl3votj3DkChC23JYZLTe2jkD4YtFTMppnhoSaoE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=LV7j6UFQX2qMvqGH4bAim1cqr5ZujST4gaCqvf+fBSoCvMRx6LXWi0O0GDcdlDuqS8SJrgMYRrSUvOgpBVvIxkt8Vxp7Z5FCGzrOZ1Cf+MdhnYDt/o5dnwgMX5oZnq6nS0D2AutytqpDIr91ZZx8CRUde/6B3ySV+3W0VOZ3NZA= 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=AZYFKOgo; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PUG6hEc4; arc=none smtp.client-ip=205.220.168.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="AZYFKOgo"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PUG6hEc4" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65F6Iu8b3332455 for ; Mon, 15 Jun 2026 06:56:36 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= LVIkiUalj7kmCYffsOKMUSZ85BbQoEwmJuQ8RR6Nb+4=; b=AZYFKOgo+xLopqNl ugAc3z03AnWZplpyjAOhnm2crTWP1SxqR5MKUS9/2vl1sGTQ0G4nRajSshH9K+ub lEp8OnQ8lExxYT7opwQQyHWnnQPPzr3RpU9lomL1sIsqMJZimhsU+iu9kVC78ddX bQA18Khk5anOwWlLeKjIj0y/ejwaVrtCC9516GW7ufqmPJYQhFO/Ye01fbZ/IF++ 6BKv0WyRL6jNcAfaG4uysNGNL6ncc4LTRPF9nKMf+Cal3bZobmu1n6vh9dhB1mcB meBwm+DYHcOHcxjQFNayp1FxNItEFV82avDN7FWpq4s8IYpCQBmaouV1fy/vwP9Z Y9hwvQ== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4erye16431-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 15 Jun 2026 06:56:35 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-91598ab3a1aso353786685a.3 for ; Sun, 14 Jun 2026 23:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781506595; x=1782111395; 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=LVIkiUalj7kmCYffsOKMUSZ85BbQoEwmJuQ8RR6Nb+4=; b=PUG6hEc4XZHbrWymQiC2XcP2YDiQSDeiGyKkwO75pMjewfKhQhqoXoTvs9/JpiV+M1 CpILs4QqYfPRVxRBp5OMh8L5zxGLRiz7cDOQoIO5xb/C/tzJ4XE1AqUIdJzoiiAjMHYK UTcf+bFTc97SXGzfvCqFGpD2nHP9e57pSICbDZlwVaRWd8n9vs2v+TJNauYIy3KskEKK khPzEj2EDABAU0ySZInLkyr3V1fege1Fd5gaX7UZKCw49vkeMqm3xw6keqGCRoNIvCY9 NEp0lqto+QXlvxDOeZ0fAFM5hMo4SMcRabVmKB3miU+DKS+E6Xxoa9F6mxK5sJv2uMnl tqyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781506595; x=1782111395; 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=LVIkiUalj7kmCYffsOKMUSZ85BbQoEwmJuQ8RR6Nb+4=; b=ASKwPrFY3hQy2kVKDa18CCxGAtqYGWdLwq+vxBPkYuGnVFY4ZlziN8dQl9nwhSPzap DHk6OXPwtR9GH6WwsaN2iEEUjO08nDgpQVq07pH1THBO/9jL/bmyG9a1DDxbsqoE1Ewo 91tBSbkBdMhFjqsNsYVIwTulZDWCYEfzGIsnTUXpY37Q5sZAMclpe3I1baOuiOStgtRh iSj+gSDznQGF+EXvOwfabolTNvE8sqcWsCvnr+a1jDT+cJw03YIlGXyWqc/cU7jz7fwg RmO23tk6A8A25ODY1PachdGfLNarhURmMqXae4rqCjKU+HpXL2Oih0b5yRX/sccD/2Zq VWqg== X-Forwarded-Encrypted: i=1; AFNElJ/Azhs38TDB11HOvf/Gqe4WY9ZVRTniAeJEkHqB5Rr0yuDN5gvhR4zmoqu40lf6ohAc1juj65aKMeROP9k=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4ZasVIrnPJNwDPx5qwvG6LxC//Yl5YCNTI07QgK/ZquJIxjTX DFVJnHQLzXJCC+ORC7Nu4lK7Hd7Bc0MwuU6n1gRfTGAzZtwGtNFY+5GXeFYcvN8HVng6WyK2srM znLwYwszQ/qf6fKc2oG2sTqbzVkAEX59iW180CfQs0adqmjt72VR5lSlxuqAEcRfAoRG09aispI s= X-Gm-Gg: Acq92OHjpyoNSLkUap/YPS5sLRjBecI7kmeVPI5Hu5jIGW/6zs9CTt7wpSL2LxBx6I6 fn32TNhOB5nskTK/d6g0BjthCx+n1175d/mLgU+jIsmbz7NivoBCKsaXEE3RmzPRMKtTex8s8h6 dVavRAP5b4wfx8AUDp1+E2u12wdk49mYJGZNDqUjjfAkCH8JvvFJv9oiz4YlbZbOLN4byOMWkfO 5e3QFFkp+NsV2lNWZ6iuYWW1+6sOr4iwJLQjvemXck76mFtSSAllkby5yEOqSBZFabVj3GGvBvP 5mWUY11ibXvcgBLthSaH2+MT7AYPhXpMVfPORFpejWyEk08gkcMDbWinhNq+dAUxHlK+RmsnvoU t/8YLAqnqN9c0h70yV13d36aBY4/0eTdOuHuHwqiQxM4gduUg8gVEoJSd X-Received: by 2002:a05:620a:2722:b0:916:12ec:12a7 with SMTP id af79cd13be357-9161bc59545mr1936590185a.18.1781506594619; Sun, 14 Jun 2026 23:56:34 -0700 (PDT) X-Received: by 2002:a05:620a:2722:b0:916:12ec:12a7 with SMTP id af79cd13be357-9161bc59545mr1936588085a.18.1781506594162; Sun, 14 Jun 2026 23:56:34 -0700 (PDT) Received: from [192.168.0.172] ([49.205.249.212]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bfdb442083esm405057266b.3.2026.06.14.23.56.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Jun 2026 23:56:33 -0700 (PDT) Message-ID: Date: Mon, 15 Jun 2026 12:26:25 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] dma-iommu: Introduce API to reserve IOVA regions for dynamically created devices To: Jason Gunthorpe , Vishnu Reddy 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> Content-Language: en-US From: Vikash Garodia In-Reply-To: <20260612172649.GM1066031@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: vTjOGVW01dvXBl2wNCgCVo2irqum84RC X-Authority-Analysis: v=2.4 cv=MNlQXsZl c=1 sm=1 tr=0 ts=6a2fa223 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=1BxbLvcILuCGMxPr/bnfdA==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=i1ClbB10qyHwisSbbGoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE1MDA3MCBTYWx0ZWRfXw14RspbM8OwA V4F3pIzXsNAAGfIc2f/xXKGx8PM9QtyYRd2/qWAHDJvm3nx4+towq0X6pBbvRz75lQKQLR2MSX/ Y0Goykptfw9TXN7ON6JuzhLNxQ80uA4= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE1MDA3MCBTYWx0ZWRfXxZUNL4913632 P4ArvrSam9Bfs1qSW9M5dwpd6tG3nWsAp18Xvn00m5iIPYb/QnbgqrmbykrK2Bb0kPGEWuepeUB PEBZwZ95E7WLC1fvDbXa+l86YgoMQsO+TH3XAZk1maTDo+DFo7KbS0BbdCZou3EKoCub599drFL FpLDxFcQ+06HmriISVLxw0c85cABquH7Cdi3/BfTAzN6hTQo/YrL5ZhJkBUBYJ36oWkfz1YVMe2 U0EIhl7wNQBjNMJ13HVf6HI3puLf2JUyUDiEYyAPyqHCmUsPwAcRSb72L4O/IMvZ+EWDo+TNt5W a1nrnUdHJQlQMKILWWhVzDVqrt2BjtM9TrVx817hviwD8CvnEZ9nXpWGEpDnhH4fbQQUgwr/BMr 25xB15lcBC1LKWiwv8/rt6oBwv9GnchGzpo6kW6aHQSHVxBz4ylVUBzpO8WLXzFeUHJqOunm/Io UunfSQxo5dkKoHPPcbQ== X-Proofpoint-ORIG-GUID: vTjOGVW01dvXBl2wNCgCVo2irqum84RC 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_02,2026-06-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 spamscore=0 priorityscore=1501 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606150070 On 6/12/2026 10:56 PM, Jason Gunthorpe wrote: > On Wed, Jun 10, 2026 at 07:57:50PM +0530, Vishnu Reddy wrote: > >>   +--------------------------------------------------+ >>   |                  VPU Hardware                    | >>   |                                                  | >>   |  +------------+   SID-0   IOVA: 600MB - 3500MB   | >>   |  |  Block 0   |                                  | >>   |  +------------+                                  | >>   |                                                  | >>   |  +------------+   SID-1   IOVA: 0MB  - 3500MB    | >>   |  |  Block 1   |                                  | >>   |  +------------+                                  | >>   |                                                  | >>   |  +------------+   SID-2   IOVA: 16MB - 600MB     | >>   |  |  Block 2   |                                  | >>   |  +------------+                                  | >>   +--------------------------------------------------+ >> >> Each Stream ID maps to a distinct IOMMU context bank, and each context >> bank enforces a different IOVA range. > > I think Robin is saying you have to describe your HW properly in > device tree. In Linux a single struct device should not own multiple > *different* IOMMU contexts. > > So your DT should describe all those blocks as unique DT nodes with > the proper dma ranges and related data so they can do DMA > correctly. Then the parent device has to assemble itself from that > collection of struct devices. For VPUs, these devices(or blocks) shares everything with the parent except the IOVA aspects associated with the stream-IDs from these block, something like Iris { reg = <>; interrupts = <>; block1 { iommus = <> iommu-addresses = <>; } block2 { iommus = <> iommu-addresses = <>; } ..... .... blockN { iommus = <> iommu-addresses = <>; } } 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/ > >> These are synthetic child devices created at runtime and do not have their >> own of_node. Inheriting the parent of_node might not be the correct way. > > Why would you create child devices at runtime? Linux doesn't really > have a good way to create a fully DMA capable struct device at runtime > without a DT backing description. The fact you immediately hit API > problems like this is a big clue :) Other than this API to associate the iova, i think we did not hit any other problem so far. Regards, Vikash > > Jason