From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380091; b=T45nuzOzLUe3dkY+6u+gw8x1btFNfrA4QavZeiOeT5RjvKxo1MvqzLFec9wj4atW7zjS o3kRTgK0rFo1uhLoAhl8z8WWlBdvhrYNavMmtC1xpEjjkP4lJkbX5OgNoJrSdJIr7rvn4 qmjMOPD5YsULiEKhmLJnVjIA3it4E2VH2xjvm7IQpW3ij/mCTKZaHzhK1R1r1bCyoLFhG RqXcIuil9Lan5BMe17ToBGfcyCj7MJdHTk3KiiUl1Oshf1dxPDF6lkmh2wvsLmSYR/Pm5 FVGZsvv+Agiay8KJ6RlJLKl+uih4aN6DPUg2N1rpei9h7U/eG8oYgYi6T/7Yn7Tx64Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380091; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=aTxV1hNK+rCkU/wH8FY8SWfUMcEQ3ifwPgxwMRAf86s=; b=rZnuYY4FFqTv117MCNd5mnFygdUEWmJT5yTI4ZWU7uH9SINHkbKbYNKY+s3YXIIe4X4/ 3QUZiJS0jN41jBbHqGeQtgVpx1UY5TP0l1qRwf02f8WedDUrlVx5jlvTKvzqm8fjPGdr9 7UzjaNwMoVIJmH/vr2a6kqSqhL7eYmDnQMK16GgEYkEKFi0wFWEm2NJkiSg3TQXct9vvl QfAdcEdbFg3Ji/csduVggy5bzDw099+VwCNEi+ZhYgEnpyLUsAeHAx4iawUchVCBHsm9t w3Z2GJjxNEzdj+xBSwOhyHq5n+aqUcsP0icdnqgPEgOXdcyRrvwGgzkDmI0v+qhqdrA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=vcGIcEig; arc=none smtp.remote-ip=209.85.128.43 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08E54606A32D for ; Fri, 4 Dec 2026 10:28:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08E54606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=vcGIcEig Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4bb6ba3b244so5682385e9.3 for ; Fri, 04 Dec 2026 02:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796380089; x=1796984889; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aTxV1hNK+rCkU/wH8FY8SWfUMcEQ3ifwPgxwMRAf86s=; b=vcGIcEig7TFqa47sxhmhjy9ofmXVRm+coesHrZB1AvstXoi8HtfaEe/y8Jkx/Gwwso qrEsZpqVQ1QWx8JHjhzX4RkQFzZeoc6Yvtz2MMS5Xo3ohv5v23ZGQpslll43LFSs9NBk w/0wpCY1DyAUxXbMn16hdwDywsZ5VhzOfY9/yv/66jfWE8dIGaba05n93RWFfLE9McxU m41WjaNrfBW9hYV3HI2xShTbhg+PbCcGe90jCNqTu6GsFujXPZ9WfD1W0Ike3xOX/JUZ OXn1lmxO5B0VY2PvDpmjdaj9MHrk3cXst8IvUgV7qO9v7VkFTMhgwvZp3yqP75uhz6hb SOnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796380089; x=1796984889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=aTxV1hNK+rCkU/wH8FY8SWfUMcEQ3ifwPgxwMRAf86s=; b=k4qmauOSTVKWfVZwJiB1cxqddmka/OPgLLIa1Hdre1Ajb4uw4rAoTqB4F/rRXtw9Kh t4KjiiZN+dvMXWfCc1d4C8qNHklvldU5GV43ZwjXsPBZcZRxKLhk2Ruck6+6axXhfUoD e/ebiVbypk9JgcjSicQaju5NNboj9fKLEC4mKvqcuV2CDwfQ697FL2iPvfyb/SGPJg3U 1uLaEb8mY/4MrM58N3ZL8DanEaA6hyF7aMchcEY69OuSY+xpdntehIqxLJqxt8xJ/cj6 Vgg/95mAUgSjgvsf4no3b6JJSTglC18FZZaUCQ7iFKxYnmDP5nAamUTfffdkKec8Tnuw txIg== X-Forwarded-Encrypted: i=1; AL+hErGSF58B+UDitD61wIPYLO3VG2Wz0mwZzAX92iXPK7XBy/P6JGX/5Mr17259xzORkcq8UmvgMZu1S44T@vger.kernel.org X-Gm-Message-State: APuU4Z9LC2KHishvEbbXxAdyRb9gTBPTJfQ1DgcD+uHXz8j4dL8K6dZ9 WBYEcgbosihL6Te3egsCxvOb9ylfJBgrD1VfYMXuELSRB/e7LFJkUGs= X-Gm-Gg: AZFdTZd8h0pGrah0jtIosMElcAsMp6SMumDoTSSsrK2UzcuGamrDXkIyrqAusgdA8H0 98fd8q4dtx0mVbePLE0i0CSEuQ526OLvu+kHyh/P4pmZvusrsd5P2WhWWduHCpANpSFlifg5XSU 7QQns4QzRojZHKNwj5ZG0cDvu/kCiQrC+xxZhDLtUT0AorFeOKSnHh6+tMauQUrZbqntMCIFzL/ TJTRTOeFab7z2N1xsjSVhfyiTqN7JaLvX62Q+cjhlUljz+WVsz2gNckB574R9KEDT1SjPEuv4nA 8hUQXFXOAzS/S1ShxeAg2sEil9yCnj2K5NKvhimVY04J1rkS6AiB8tQPPSJj+P2FcPrr3CCulPP 2TqrTsuVGlddEd82X4hKzRPGDD+suwSQuCGJodTLWnS69jwixQx7kAietEdR78R6rA5Gv6Z1PCc NlrkYRHdIxkeu4Vry4iLPTNM18K535229SU+h7MueB8HOI9BGYj06kvSsnyeW1t3BAsEqP0PRSy Z1mMwYgSW3Mw/4IdoMlWCLEa3SEl2YtDfXH+7PAeD3bu2xjPTPnC5kdXYdDcQmoBpdqvTs5IuMp fbfuR52olkvscXmurq3/uiA5rbxX5XTNaR8XyXdZ1Kpg/w646GgC4lOKPsMvx072PuaAFcI1L49 WBxiQs7MFoUNwH9sZ X-Received: by 2002:a05:600c:c104:b0:4bb:e63a:eb62 with SMTP id 5b1f17b1804b1-4bbeb8f592emr22580325e9.30.1796380089370; Fri, 04 Dec 2026 02:28:09 -0800 (PST) Received: from localhost.localdomain ([151.57.87.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00df154sm157625515e9.14.2026.12.04.02.28.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Dec 2026 02:28:08 -0800 (PST) From: Francesco Saverio Pavone To: Joerg Roedel , Will Deacon , Robin Murphy , Sandy Huang , Heiko Stuebner , Andy Yan , Chaoyi Chen Cc: Damon Ding , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jiaxing Hu , iommu@lists.linux.dev, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v2 1/3] iommu/rockchip: Report the reserved regions from the devicetree Date: Fri, 4 Dec 2026 11:27:51 +0100 Message-ID: <20261204102757.47697-2-pavone.lawyer@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204102757.47697-1-pavone.lawyer@gmail.com> References: <20261204102757.47697-1-pavone.lawyer@gmail.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The driver has no .get_resv_regions callback, so the iommu core ignores a reserved-memory node that lists a device in "iommu-addresses". A bootloader framebuffer that the VOP still scans out is then not mapped in the default domain, and the VOP MMU faults on it. Report the regions with of_iommu_get_resv_regions(). It is called directly, not through iommu_dma_get_resv_regions(), so that the DRM driver can read the regions on 32-bit ARM too. The IOVA space is 32 bits wide and the page table index would wrap a higher address. So drop a direct region that does not fit, with a warning, clip a reserved one that crosses 4 GiB and drop one above it. Signed-off-by: Francesco Saverio Pavone --- drivers/iommu/rockchip-iommu.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 1fa3110b142ad..2df71a3e62e2e 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1198,12 +1199,43 @@ static int rk_iommu_of_xlate(struct device *dev, return 0; } +static void rk_iommu_get_resv_regions(struct device *dev, + struct list_head *head) +{ + struct iommu_resv_region *region, *next; + LIST_HEAD(regions); + LIST_HEAD(drop); + + of_iommu_get_resv_regions(dev, ®ions); + + /* The IOVA is 32 bits wide, see rk_iova_dte_index() */ + list_for_each_entry_safe(region, next, ®ions, list) { + if (region->start <= DMA_BIT_MASK(32) && + region->length - 1 <= DMA_BIT_MASK(32) - region->start) + continue; + + if (region->type == IOMMU_RESV_RESERVED && + region->start <= DMA_BIT_MASK(32)) { + region->length = DMA_BIT_MASK(32) - region->start + 1; + continue; + } + + dev_warn_ratelimited(dev, "ignoring reserved region %pa+%#zx beyond 4 GiB\n", + ®ion->start, region->length); + list_move_tail(®ion->list, &drop); + } + + iommu_put_resv_regions(dev, &drop); + list_splice_tail(®ions, head); +} + static const struct iommu_ops rk_iommu_ops = { .identity_domain = &rk_identity_domain, .domain_alloc_paging = rk_iommu_domain_alloc_paging, .probe_device = rk_iommu_probe_device, .release_device = rk_iommu_release_device, .device_group = generic_single_device_group, + .get_resv_regions = rk_iommu_get_resv_regions, .of_xlate = rk_iommu_of_xlate, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = rk_iommu_attach_device, -- 2.54.0