From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 36E2A2F547D; Mon, 27 Oct 2025 09:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761559009; cv=none; b=Hv6ubjZPTOV0ITEUZ2HYRpotHgLa0cgSQISgQMx7PrkHwPWbgwWDyXxT3iA1nCmphrb28v4QeBtGSDrmNGTwMOxZ84oR+HQU0HwlWhAAQvytVzQTHJv7w7Lsfla22EeDSBSbycXkyESGRuM08sR6WSUgpabknSbRS5xzAAlxqh8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761559009; c=relaxed/simple; bh=Lxu5cscL1HwCBzlPnIr1BaQwvaRrU0uoXTu5LjXze2o=; h=Mime-Version:Content-Type:Date:Message-Id:To:From:Subject:Cc: References:In-Reply-To; b=dvoQX1ICegdPbYNp9whFNCI+UwsR01rcHbJo/P4/F9/BB4g48RD6gcuke6RCp6MrmPttvNab0qKiPjWw+LF1VDjlspmwBnGHsxV2VqACuFmZYcDXDhaYWsTFl6KMrr5elg4y8WUS9im8QhBZU+xJ8YLLhSmEhlkjvi5D07LoydE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BTmPnrk7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BTmPnrk7" 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== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 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.