linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alvin Sun <alvin.sun@linux.dev>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: "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>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, "Onur Özkan" <work@onurozkan.dev>
Subject: Re: [PATCH 1/4] rust: sizes: add SZ_4G constant
Date: Fri, 17 Apr 2026 19:56:42 +0800	[thread overview]
Message-ID: <cb3dd598-04f8-486c-ba6b-9965d93170a0@linux.dev> (raw)
In-Reply-To: <DHV3SQ191564.3FMK513OJUMKV@nvidia.com>

Hi Alexandre,

On 4/17/26 11:18, Alexandre Courbot wrote:
> Hi Alvin,
>
> On Fri Apr 17, 2026 at 10:05 AM JST, Alvin Sun wrote:
>> Add SZ_4G constant defined as SZ_2G * 2. This constant will be used by
>> the Tyr driver for calculating user and kernel VA layout.
>>
>> Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
>> ---
>>   rust/kernel/sizes.rs | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/rust/kernel/sizes.rs b/rust/kernel/sizes.rs
>> index 661e680d93306..872f5bb181ecf 100644
>> --- a/rust/kernel/sizes.rs
>> +++ b/rust/kernel/sizes.rs
>> @@ -48,3 +48,5 @@
>>   pub const SZ_1G: usize = bindings::SZ_1G as usize;
>>   /// 0x80000000
>>   pub const SZ_2G: usize = bindings::SZ_2G as usize;
>> +/// 0x100000000
>> +pub const SZ_4G: usize = SZ_2G * 2;
> Note that the way size constants are defined has changed in `master` -
> you will probably want to update this patch accordingly.
I just noticed that my development baseline is based on the stable
repository.
>
> Also there is a `SZ_4G` define in `include/linux/sizes.h`; I am not sure
> why it is not in the bindings, but we should probably add it and get our
> value from that.
SZ_4G is a complex macro that internally uses the _AC macro, which bindgen
cannot handle by default. I found a similar issue that Miguel replied to in
October 2025 [1], where adding --clang-macro-fallback to bindgen can solve
this problem.

I tried adding this parameter to bindgen_parameters, but SZ_4G still
doesn't appear in bindings_generated.rs. However, when using
--clang-macro-fallback with just sizes.h alone, I can successfully generate
the bindings.
>
> Finally, maybe I missed something but the new value doesn't appear to be
> used by this series?
This patchset is a prerequisite for the Tyr ioctls patchset [2] that I'm
currently developing, which hasn't been submitted to the list yet.
[1]: 
https://lore.kernel.org/rust-for-linux/CANiq72m20pom+B9EmWO+91E8fjbMEob3JmvHRQ6UaXe_JmatfA@mail.gmail.com/
[2]: https://gitlab.freedesktop.org/panfrost/linux/-/merge_requests/64


  reply	other threads:[~2026-04-17 11:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  1:05 [PATCH 0/4] rust: Add helper functions and constants for Tyr driver Alvin Sun
2026-04-17  1:05 ` [PATCH 1/4] rust: sizes: add SZ_4G constant Alvin Sun
2026-04-17  3:18   ` Alexandre Courbot
2026-04-17 11:56     ` Alvin Sun [this message]
2026-04-17  1:05 ` [PATCH 2/4] rust: mm: Add task_size() method to Mm Alvin Sun
2026-04-17  1:05 ` [PATCH 3/4] rust: xarray: Update StoreError comments for alloc() Alvin Sun
2026-04-17  1:05 ` [PATCH 4/4] rust: xarray: Add Guard::find() helper Alvin Sun
2026-04-17  1:18   ` Matthew Wilcox
2026-04-17  2:16     ` Alvin Sun
2026-04-17  8:28   ` Onur Özkan
2026-04-17 12:43     ` Alvin Sun
2026-04-17  7:43 ` [PATCH 0/4] rust: Add helper functions and constants for Tyr driver Onur Özkan
2026-04-17 12:44   ` Alvin Sun

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=cb3dd598-04f8-486c-ba6b-9965d93170a0@linux.dev \
    --to=alvin.sun@linux.dev \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox