From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796019356; b=c6o20QJIlN9J7u4y/sFayylPJ1y6/hXRLetz2CjXhhCng4R2PI4Rom0W3bxHfxh4ZL2d f9N2zKtMfcq4CBVfUItzR/itopYM/0Pf08vrnDo3ug89Ljfh+An6VcuLkLBsZOelgVjD/ +eopL/FEYOTMakqg/OjXjG2KPz0hzuVuiZIcBO5hLt3F+b9hb+eiMbJz00SXoPrOXgPg5 laQmAVm4qSu6yj+JQEE32RN6YKQJVdp4yK2mJAC4OFimn3i6Qx8kcTz0QgqkB+p/nchlI 2gTsAE+ImeaHATHOnaw+zFX3lZ1TNUlb7JoK/FgHc2DPxR5e1VOECA5wF/2Y+n2HEdg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796019356; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Proofpoint-GUID:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Proofpoint-Spam-Info:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=af4bZLaQYOf4llb70zdhKPEtutvBgXSw1y+XeGnL93U=; b=rM3nR5vpOEOCN+Llh1M2nHGuBNfjPXICqbou7FAAiWGkfgC9dAOVRV9IKxTjFodwXyJk sabP37cpmlqjaoglUQtwBxV9zTBjXMD0DTRxeaLFJa0XdlVqQxqsflpMjBENG1cQbRvGG O65siAMwJy83MfBTbTZDYyTM8njHir7lqt6A0ebu0uHiWdATYuMDR3F8liikLofHWit7L jkhsIjTrGZ/l73V2X6epC1FxZbuPautX9P0HuAnQuJZVOmksuLUfW9Plw6wz5ap4M+aMe EYdVz/sCoJjzeFa23MsQ/Ba5WDVH0CXGa8GVpGI/eSgimvX8zqO2j8ELeNZnZsDhpEA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=BTQ85Uuv; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=CKN2bvxP; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28D20606A32A for ; Mon, 30 Nov 2026 06:15:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 28D20606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=BTQ85Uuv; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=CKN2bvxP Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU5GUIh2039725 for ; Mon, 30 Nov 2026 06:15:55 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= af4bZLaQYOf4llb70zdhKPEtutvBgXSw1y+XeGnL93U=; b=BTQ85UuveSovF01G 6zmwXOBtJiwUCDCvc4I2rQO1KrF5YCZyQ9dP9hArN2Zfo9JEH262hQffxI8o254m fVsnjJ1EOrXWWpZX8Mco5yECI7/Xye/SCpt4nodHNoG2mj/GC6zbjhXFI6GkazkW Il4WLZdQfaA9ljgFC3QzI0F9xoAi//x416lA2srcZGDfVT2aHs5KXxdYzeaC5SJ4 gFatfJH2QmOqS/aAccy/iLuiuVNMhpvFx7ww8SpFH+TRv2ADtlta74FwpMNVpQ79 0835ZOzVEWqaKDuqUc8zRIWN5DKF+13lO7tsYmSvLyIki7wO5RgJlxPMDdUDrJ2h FL3DWA== Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j92qur6s7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 06:15:55 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-375bac6bd21so9845021eec.0 for ; Sun, 29 Nov 2026 22:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796019355; x=1796624155; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=af4bZLaQYOf4llb70zdhKPEtutvBgXSw1y+XeGnL93U=; b=CKN2bvxPx/Zsg9NfWXvXTbqie8eZ28hCgmfv7k7xVVw6Gegmf3LNeTFhSjEY6ga8AE p++tm0XDAcCLvCdG41fWvQd6X6QgTAEa55in3rYWuF63vN6SZgczOwhgiDyeZBMsyXwB CwEcKgqyaOu31J61ZrroR6qgWxjIOvHFaEXKqThzn5MV2Olk1jH2XQtfKwMDEuHsFYmm iBceVg66ih8OBHAWAkzQqI+83d9NCaCL/woK4xag8YRfjmrmPVPX21CQ4gxMNvnSvKuh KDgTNO/BwLSPDfXDh3gbNO9XyTKnEo76mOX4hv2mEb5oN7O4CHywgpTnC+8BSDR2Mhe7 Ldjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796019355; x=1796624155; h=content-transfer-encoding:content-type: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:content-type; bh=af4bZLaQYOf4llb70zdhKPEtutvBgXSw1y+XeGnL93U=; b=RWsoEgJaC3dYaksQgVAdO0K9xp94BivwNuDFetzacKLBbdKsN9g2SX4IQGzbyHLFQ0 On0HQqv8HGz7ozYPwp4N68iuQnP2Hw+htB3EqOV6gpij+X18pMlfMmiqhqtf+si9H1Sm DY/mGbhPQhB8ey2TicBlBPbXxLV6/0xeglrwy4YrNzYN+9/KyY+vuSTrPPwWqoXVRBmM LnUoOU4DjG1w6cp50NlbrprRXeHko5ORnzn73Tbk2Zf3X+NeF8xOAZQBDMXQikwqgXXG Kezny/2Wa8CYd+RuBaArKuFLHZUuE9vp6B3tCMpffWJvVp+8DDGcfYaoZbGrCTXLBXGE ZKdg== X-Forwarded-Encrypted: i=1; AL+hErE0T5+/tkFVDMo/OD6iTCPpO9Y/L78Cc0lzHxDzm7JMGWoPAlABya/rdc9483qMX+Hy1H/Z5QF49a42D/I=@vger.kernel.org X-Gm-Message-State: APuU4Z+kj30JSe59SHhe1TtBKA3ocxyaExVaeUkcjg6MJPDnupsIwn9T ZpfLLPVmh+WdDkYQA4mQb5H5HSM2ca7zZ5NXfNUbN8r9u/NWG1HMJLFppHX5JxAkp09C+WvUChc QEJcn4HdN3TU8faGe4rnCeqC8Z2RL1x6rKQJ5cNA0/RUFPsk9MBFaIkztQKRdUs8gxhs= X-Gm-Gg: AZFdTZdVBQmdn5I6bB9cqRGeM+uBJUtSNE9X/htufklFK6L9YoOrvaOkaemeryumgRh ra7UX1tExFwOQQ8eDggy9Zv1rQgGWn4lXq5j5q2Vcdvv9/6MuFJeyUl8IbcerPohfJBen2/fnoF CyV7lMSXTpu5Mfy/TsSOVYUU2akpnyxX9u9EXdPu7qOUh3ZI2YHzr3WcEgvdAiBAWNMxAatpyDs 9bAeKkuUheD0uHhG41zoMqmKOFPEfS2UwmLlb2ISSyP4CFsoaBFQ9AUA2gxYwbyO0W7RJWFkWZW 73LX0dlS6N8ix6tenG3zdJv1eAfe3Ys8KCbUxpFghr4nWnw7ZMcGGnJt48vddsZe4HjjOYOQQ3F 2E1mfqs683PmeXeTZpyaeVKc84TRPzncxUgnFagq2AgioXh94203hplrDZIzmAslUQGZXvi5A61 4+SxdQXg== X-Received: by 2002:a05:7301:a0b:b0:386:a416:6c91 with SMTP id 5a478bee46e88-386a4166fdemr26142995eec.20.1796019354513; Sun, 29 Nov 2026 22:15:54 -0800 (PST) X-Received: by 2002:a05:7301:a0b:b0:386:a416:6c91 with SMTP id 5a478bee46e88-386a4166fdemr26142968eec.20.1796019354018; Sun, 29 Nov 2026 22:15:54 -0800 (PST) Received: from [10.204.101.12] ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385666e7f59sm101251364eec.6.2026.11.29.22.15.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2026 22:15:53 -0800 (PST) Message-ID: <83a84eb8-6f79-48b2-a1d9-7eed94e9f4c7@oss.qualcomm.com> Date: Mon, 30 Nov 2026 11:45:44 +0530 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] media: venus: use dma_iova_size() to check the reserved IOVA size To: Bryan O'Donoghue , Jason Gunthorpe Cc: Marek Szyprowski , iommu@lists.linux.dev, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Robin Murphy , Joerg Roedel , Will Deacon , Leon Romanovsky , Sibi Sankar , Honglei Huang , prakash.gupta@oss.qualcomm.com, Alex Williamson , Dikshita Agarwal , Abhinav Kumar , Mauro Carvalho Chehab , Hans Verkuil , stable@vger.kernel.org References: <20261127115849.2780625-1-m.szyprowski@samsung.com> <20261127115849.2780625-2-m.szyprowski@samsung.com> <20261127142912.GK114472@nvidia.com> <20261127172626.GQ114472@nvidia.com> <0b76ccad-877d-41b9-a7a6-02266a7bfd56@oss.qualcomm.com> <21a54a2a-9df8-49c7-a7a2-e0cadd075270@kernel.org> Content-Language: en-US From: Vikash Garodia In-Reply-To: <21a54a2a-9df8-49c7-a7a2-e0cadd075270@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: Z0L3g8FCkmttPWSjNRw3mpbhmfKwzN0k X-Authority-Analysis: v=2.4 cv=C4d8WgP+ c=1 sm=1 tr=0 ts=6b0d149b cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=ly1iAhnK1ZzXGD-xFiAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDAyNCBTYWx0ZWRfX4r+D2Zl0sAQD uPMM78zTnMR8IE2yuLLY0IHbAJBocvLqVeS8IXmwGEXYylJ1XMGTl5nja76/klRsmKohsi/9yPI QXmvKEuipnv7uYqPC5wgrgaMY1XWUwYTZ2DTinyuiRUxopQNEnGnEaxNtHDvWpnjTk9Zs/yQN2X xOm2X7VMxZZnMgkxaZ3yN3BjoYejkaoxHha1T2+i5CbPof/QTiTNEc6o1YKKEcsBX9X8K5ruc6L R9cyqQoCSRYnN5DMmuD4hdt77J0IkUNnRXucOsRh72s8XeWuesBlYWl7ryyWSU4XI8HO7vmfvAN lL4gmRiGzUkINQMscFlCPwrHfzBh123kGcSzW/4HRuiFwTNDrG5k4me+n9X0tRl4J59krOWFCEj kv2r5bqhqeTJ3qNySvWRtbHPza5Zrer6+vMwqYmQixbg6KLLURkE1po/I26GTlvWUCiFRybkIGm 7w4/aRwji/Yq6U9zCTA== X-Proofpoint-ORIG-GUID: Z0L3g8FCkmttPWSjNRw3mpbhmfKwzN0k X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDAyNCBTYWx0ZWRfX5Gy2vgxKyZ+I dsvhzFa0xRmhN09gJKLiVPpB0JVe15maJNorw5hCwYsAITy/ZGtn4Qh/ie6jSdHqv/IviC65KmV HA2wrv+p5RtG8YPS/j18w//q0BraY4Y= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_02,2026-11-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 impostorscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300024 On 11/30/2026 6:40 AM, Bryan O'Donoghue wrote: > On 29/11/2026 14:19, Vikash Garodia wrote: >> >> On 11/27/2026 10:56 PM, Jason Gunthorpe wrote: >>> On Fri, Nov 27, 2026 at 05:21:35PM +0000, Bryan O'Donoghue wrote: >>>> On 27/11/2026 14:29, Jason Gunthorpe wrote: >>>>> On Fri, Nov 27, 2026 at 12:58:45PM +0100, Marek Szyprowski wrote: >>>>>> The IOVA reservation code compares dma_iova_state::__size directly >>>>>> with >>>>>> the requested chunk size. __size is internal to the DMA IOVA API >>>>>> and may >>>>>> carry flags in its upper bits, so use the dma_iova_size() accessor >>>>>> instead. >>>>> >>>>> WTF is this even doing? >>>>> >>>>>        Fix this by reserving the 0-600MB range, below the boundary the >>>>>        non-pixel stream cannot address, using dma_iova_try_alloc() >>>>> so the >>>>>        IOMMU-DMA core never hands that range out to a real DMA >>>>> mapping. This >>>>>        reserves only IOVA space, it does not allocate any physical >>>>> memory. >>>>> >>>>> That isn't what this API is for, and it isn't how it even works! It is >>>>> pure luck that the first call to it happens to take out the lower >>>>> address space. >>>>> >>>>> We even had a long discussion about this driver and this need in >>>>> another thread and this is the hack job you guys merged? >>>> >>>> Have to say I wasn't aware of an objection from you, I don't think I >>>> was on >>>> that thread. >>> >>> Nobody ever shared this insane thing with us. Seriously, this isn't >>> even remotely using these APIs for what they are for. Nobody thought >>> "hey this seems like a creative use of APIs, lets ask someone" ? >>> >> >> Sure, its a miss to add the maintainers of the file which defines the >> api. Relying on b4 alone was not the right approach. Noted for any >> future submissions. >> >>>> It would be possible to reserve this IOVA range in DT so given what >>>> you've >>>> highlighted I think this and the Iris commit should be reverted and >>>> the DT >>>> constraint implemented. >>> >>> That was the other thread, obviously using DT to describe a hardware >>> issue is the correct choice. But there was some problem where they >>> also wanted to split the SID space using DT and then the DT mechansim >>> doesn't work because the whole thing becomes too hacky :\ >>> >> >> We discussed this earlier here[1] and concluded DT as the right place to >> address this. >> The DT approach is waiting for the series [2] to land, which should take >> care of the reservation in a definite way. >> >> [1] >> https://lore.kernel.org/all/c7b956a9-d3e8-4e18- >> b780-5d08f5cd2ca1@kernel.org/ >> >> [2] >> https://lore.kernel.org/all/20261120-add_iommu_ranges-v8-0- >> d90486973b73@oss.qualcomm.com/ > The other direction is to have venus and iris register their own IOMMU > domain and then the address allocator they will provide places the floor > at 600MB for the SID. > > Jason, do you think this is the right approach ? > > drivers/media/platform/nvidia/tegra-vde/ > >         vde->domain = iommu_paging_domain_alloc(dev); >         if (IS_ERR(vde->domain)) { >                 err = PTR_ERR(vde->domain); >                 vde->domain = NULL; >                 goto put_group; >         } > >         err = iova_cache_get(); >         if (err) >                 goto free_domain; > >         order = __ffs(vde->domain->pgsize_bitmap); >         init_iova_domain(&vde->iova, 1UL << order, 0); > >         err = iommu_attach_group(vde->domain, vde->group); >         if (err) >                 goto put_iova; > >         /* >          * We're using some static addresses that are not accessible by > VDE >          * to trap invalid memory accesses. >          */ >         shift = iova_shift(&vde->iova); >         iova = reserve_iova(&vde->iova, 0x60000000 >> shift, >                             0x70000000 >> shift); >         if (!iova) { >                 err = -ENOMEM; >                 goto detach_group; >         } > > Vikash I can prototype this up it, reverting Vishnu's patch will bring > back the reset and the upstream code now relies on dodgy behaviours. > If iommu-ranges lands, we can go back to using the default IOMMU domain and > drop rolling our own allocations. What's holding up the iommu-ranges patches? They've been pending for a while, and we’re waiting for maintainers to confirm whether they’re ready to apply or have any further suggestions.. > > --- > bod