From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BAD5CCF9EC for ; Mon, 27 Oct 2025 09:56:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7BF610E42F; Mon, 27 Oct 2025 09:56:51 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="BTmPnrk7"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4111110E42B; Mon, 27 Oct 2025 09:56:50 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 325F46118B; Mon, 27 Oct 2025 09:56:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAE62C4CEFF; Mon, 27 Oct 2025 09:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761559008; bh=Lxu5cscL1HwCBzlPnIr1BaQwvaRrU0uoXTu5LjXze2o=; h=Date:To:From:Subject:Cc:References:In-Reply-To:From; b=BTmPnrk79MH8XqKW5zleIBNMoiZ+DkrLxXgRoVKSk8GlvqP+QgS6PiCze6RdRBesb kXJZfDFiMQA4aL0u+6nB99Ro7nPXzm/fC+IFPzu8ELy8bBu9384TzYVCuLqP7o7ZIa EHm9srXvTGeIFfvlXaHyl14MK3KB86liYqmsclni6sL+QnKKyWxWfy9KccKAyMXZ0d 4VpkCvtqtDWbtiKhX22Uu72chUrLISHb7dRMfBmNA9uDJj36tyXdgR3EpwGxkzOxb6 BHPjvgXER+dkfuQaoJYMz57olyW2cj4Tp4pBXUxEbaEk3hc8sUmfADuM4U1M1b3mrw VeJ/Bsejy9Ilg== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 27 Oct 2025 10:56:41 +0100 Message-Id: To: "Beata Michalska" From: "Danilo Krummrich" Subject: Re: [PATCH v6 4/5] rust: Move register and bitfield macros out of Nova Cc: "Joel Fernandes" , "linux-kernel@vger.kernel.org" , "rust-for-linux@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Alexandre Courbot" , "Alistair Popple" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , "bjorn3_gh@protonmail.com" , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "David Airlie" , "Simona Vetter" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "John Hubbard" , "Timur Tabi" , "joel@joelfernandes.org" , "Elle Rhumsaa" , "Yury Norov" , "Daniel Almeida" , "Andrea Righi" , "nouveau@lists.freedesktop.org" References: <20251003154748.1687160-1-joelagnelf@nvidia.com> <20251003154748.1687160-5-joelagnelf@nvidia.com> <47d6ab72-1526-457d-990a-928088ba7022@nvidia.com> In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon Oct 27, 2025 at 10:06 AM CET, Beata Michalska wrote: > It's more theoretical at this point, but there are drivers that do rely o= n > information from either DT or ACPI tables for the base address and size o= f the > MMIO region: anything that uses devm_platform_ioremap_resource() or > devm_platform_ioremap_resource_byname() I guess. Don't get confused, those are two different things: The size of the MMIO re= gion (or a PCI BAR) and the const SIZE generic in Io are two different thi= ngs. The former is the actual size of an MMIO region, whereas the latter is the minimum size requested by a driver for proper operation. For instance, let's assume your driver requests ten contiguous 32-bit regis= ters starting at offset zero of an MMIO region. In this case you can call req.iomap_sized<0x28>(), because you know that yo= ur driver is not able to properly work without an MMIO region with at least a = width of 0x28 bytes. The actual size of the MMIO region returned by req.iomap_sized<0x28>() may indeed be smaller or larger than that, depending on what is defined in the = DT, ACPI or PCI BAR. If smaller than the const SIZE generic, the call to req.iomap_sized<0x28>()= will fail, otherwise it will be successful. The actual size of the MMIO region i= s not influenced by the const SIZE generic.