From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796366661; b=pAdljT4a9MFwZfeZoohZCimlR4pYNvuLIlUjjMfN7mfAGwbtXdyurSh5vNZ3jGOiSPK6 NwXUn0GoxYvSZQSOV32MhfXmRHmncW/s68b5KjROWhrchEMpfjsU5tQ8xT6dsxqG83yDp GNyPYpJyQODfwK1uILV0V5b3D4xMPAAcwhCwpCsmZL0NFwD1LY4q5KLzN/ISBgbByp0vR PoEMhHvWRmpIrjdVSuZLvqDelFrzuXXxZTjZOvptArfxGK7UdukBGZNNJ6BHFEzv0Kxr7 iwRgfEUEs4B8UOP2/SrF1IZtZLSukVs8HYYixjGceRMjT7n01jSkK+UTemI98I0+C5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796366661; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=z9HhI3PuDfM0wat5UGgMrV4tQLsQkuU7jRk3DVszA1Y=; b=aANpy/B3UEINIvO5iFxu7vtfFTXccjVFqmLOEm96nS37Mt+N8Cxxii0cvLZp1s558NGl En60u8QePZowie2J0DaN1HZvC+7r4viN2fy7N7TYgiTfmZS61xfsbF0Y1qUgEwVN9QLyj L4OEGVGR8RJ24popEMxcnVh8Qe+FhLru6Odk1KLw5PDBRJzLwuNEii8S76F5Qo/glxmbQ vMXcpk2IL8jZqDZcdlVHjRnpOJO9pOFXRMZx8aWmiHxAG9XcEnnuGA6cEzJEdKL9Im4CD idSK1OMOG0ZBDzYh6zsmuon9sf8OLnBxPTQ5tcozGBVfKZoF+ceaOSWCaVZ97oDfQnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W3uwQ7Yp; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9A67606A336 for ; Fri, 4 Dec 2026 06:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W3uwQ7Yp Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A23C1F00933; Fri, 4 Dec 2026 06:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796366661; bh=z9HhI3PuDfM0wat5UGgMrV4tQLsQkuU7jRk3DVszA1Y=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=W3uwQ7Yph/3C3sptjezVC7SW+marvgQ8aIt+9q6NqQlYGuT8QGaweudIXZ6hkM3uc mhtj6xdKo16fhhBxGlMLMmEb8SXSZgieBwXWc4G/iara26kzFu5bpqr0ICRUkSamIJ eNWhXTtOHag2STrqf7j4yMLHcBo93MNdOgpUQKaWva4v+BRCjstVdbJ0fU8T3c9k0N DDnnZKFD3LVH0HK6STVN4uZmTUARmtnyirOL8/iM4zSeVTs92H+pK2xiIQMXzBmLK9 pU6QOYKXWlfzNYJOXK26UlZDZX56liPeJCar6yza6fxyeqqWuShDVaCjYUrfytoTPD gDmHONz991eog== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH 1/3] iommu/rockchip: Report the reserved regions from the devicetree Reply-To: sashiko-reviews@lists.linux.dev To: "Francesco Saverio Pavone" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <172d332977751cca112c89e91aaff8f3ab71c1a0.1796334467.git.pavone.lawyer@gmail.com> References: <172d332977751cca112c89e91aaff8f3ab71c1a0.1796334467.git.pavone.lawyer@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 06:44:20 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] iommu/rockchip: >4 GiB reserved regions silently alias in rk_iommu_map() -- commit a62eae58527cef7e91d832e94bf0e1249fddc4d9 Author: Francesco Saverio Pavone iommu/rockchip: Report the reserved regions from the devicetree This commit wires of_iommu_get_resv_regions() into rk_iommu_ops so that devicetree reserved-memory regions listed in iommu-addresses are reported for Rockchip IOMMUs. > diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iomm= u.c > index 1fa3110b142ad..757532a86975c 100644 > --- a/drivers/iommu/rockchip-iommu.c > +++ b/drivers/iommu/rockchip-iommu.c [ ... ] > @@ -1204,6 +1205,7 @@ static const struct iommu_ops rk_iommu_ops =3D { > .probe_device =3D rk_iommu_probe_device, > .release_device =3D rk_iommu_release_device, > .device_group =3D generic_single_device_group, > + .get_resv_regions =3D of_iommu_get_resv_regions, [Severity: Medium] Can a devicetree reserved region at or above 4 GiB silently alias into the low 32-bit IOVA space here? iommu_create_device_direct_mappings() passes the 64-bit addresses from of_iommu_get_resv_regions() straight to rk_iommu_iova_to_phys() and rk_iommu_map() without checking domain->geometry.aperture_end. Because rk_iova_dte_index() masks the IOVA with 0xffc00000 and casts to u32, bits 63:32 are silently discarded. On a 64-bit board with >4 GiB RAM, a reserved region at or above 4 GiB installs PTEs at the wrapped low 32-bit IOVA and returns 0 instead of failing. Meanwhile, iova_reserve_iommu_regions() reserves the >4 GiB PFN range, leaving the aliased low IOVAs unreserved. Later DMA allocations in that range fail with -EADDRINUSE, and DMA to unallocated low IOVAs (including IOVA 0 for a 4 GiB-aligned region) silently hits the reserved memory. A Rockchip get_resv_regions wrapper could filter out regions above DMA_BIT_MASK(32), alongside bounds checks in rk_iommu_map(), rk_iommu_unmap(), and rk_iommu_iova_to_phys() for the IOVA aperture and physical address width. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796334467.gi= t.pavone.lawyer@gmail.com?part=3D1