From: Alvin Sun <alvin.sun@linux.dev>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Lyude Paul" <lyude@redhat.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Johan Hovold" <johan@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>,
rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org,
driver-core@lists.linux.dev, Ke Sun <sunke@kylinos.cn>,
Alvin Sun <alvin.sun@linux.dev>
Subject: [PATCH v7 01/10] rust: sizes: add SZ_4G constant
Date: Sun, 22 Nov 2026 20:50:20 +0800 [thread overview]
Message-ID: <20261122-tyr-ioctls-v7-1-3a2af624b992@linux.dev> (raw)
In-Reply-To: <20261122-tyr-ioctls-v7-0-3a2af624b992@linux.dev>
SZ_4G is used by Tyr when splitting the GPU VA range into
user and kernel regions. Add a LargeSizeConstants trait, implemented
for u64 since SizeConstants only covers sizes that fit in a u32.
Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
---
rust/bindings/bindings_helper.h | 1 +
rust/kernel/sizes.rs | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 3791af0aadc73..fd39cc954eaba 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -116,6 +116,7 @@ const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;
const size_t RUST_CONST_HELPER_ARCH_KMALLOC_MINALIGN = ARCH_KMALLOC_MINALIGN;
const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
const size_t RUST_CONST_HELPER_GENLMSG_DEFAULT_SIZE = GENLMSG_DEFAULT_SIZE;
+const unsigned long long RUST_CONST_HELPER_SZ_4G = SZ_4G;
const gfp_t RUST_CONST_HELPER_GFP_ATOMIC = GFP_ATOMIC;
const gfp_t RUST_CONST_HELPER_GFP_KERNEL = GFP_KERNEL;
const gfp_t RUST_CONST_HELPER_GFP_KERNEL_ACCOUNT = GFP_KERNEL_ACCOUNT;
diff --git a/rust/kernel/sizes.rs b/rust/kernel/sizes.rs
index 188e00c2b8b46..760d26ebe6ff6 100644
--- a/rust/kernel/sizes.rs
+++ b/rust/kernel/sizes.rs
@@ -177,3 +177,15 @@ impl SizeConstants for $first {
}
define_sizes!(u32, u64, usize);
+
+/// Large size constants (≥ 4 GiB).
+///
+/// Only implemented for [`u64`].
+pub trait LargeSizeConstants {
+ /// `0x1_0000_0000`.
+ const SZ_4G: Self;
+}
+
+impl LargeSizeConstants for u64 {
+ const SZ_4G: Self = bindings::SZ_4G;
+}
--
2.43.0
next prev parent reply other threads:[~2026-11-22 12:50 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 12:50 [PATCH v7 00/10] drm/tyr: add VM and BO ioctl support Alvin Sun
2026-11-22 12:50 ` Alvin Sun [this message]
2026-11-22 12:50 ` [PATCH v7 02/10] rust: task: add task_size() Alvin Sun
2026-11-25 14:45 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 03/10] rust: sync: arc: relax `ForeignOwnable` for `Arc<T>` Alvin Sun
2026-11-22 12:50 ` [PATCH v7 04/10] drm/tyr: add per-file VM pool Alvin Sun
2026-11-24 23:43 ` Deborah Brouwer
2026-11-25 15:14 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 05/10] drm/tyr: add user and MCU VM specifications Alvin Sun
2026-11-25 16:13 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 06/10] drm/tyr: add BO creation and lookup helpers Alvin Sun
2026-11-22 12:50 ` [PATCH v7 07/10] drm/tyr: add VM-related ioctls Alvin Sun
2026-11-22 13:19 ` sashiko-bot
2026-11-24 23:40 ` Deborah Brouwer
2026-11-25 18:49 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 08/10] rust: device: expose the device DMA attribute Alvin Sun
2026-11-25 18:52 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 09/10] drm/tyr: support write-combine BO mappings Alvin Sun
2026-11-22 13:16 ` sashiko-bot
2026-11-30 23:47 ` Daniel Almeida
2026-11-25 19:59 ` Daniel Almeida
2026-11-30 20:09 ` Deborah Brouwer
2026-11-30 23:11 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 10/10] drm/tyr: add BO-related ioctls Alvin Sun
2026-11-22 13:15 ` sashiko-bot
2026-11-25 21:02 ` Daniel Almeida
2026-11-23 22:25 ` [PATCH v7 00/10] drm/tyr: add VM and BO ioctl support Daniel Almeida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261122-tyr-ioctls-v7-1-3a2af624b992@linux.dev \
--to=alvin.sun@linux.dev \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=simona@ffwll.ch \
--cc=sunke@kylinos.cn \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.