Re: [PATCH 1/2] rust: sizes: add u64 variants of SZ_* constants
From: Miguel Ojeda
Date: Tue Mar 10 2026 - 18:10:08 EST
On Tue, Mar 10, 2026 at 9:55 PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> Forgot to mention, the background of this is that existing DRM components, such
> as GPUVM, Buddy, etc. just use u64 as a common denominator. However, this
> becomes annoying when the corresponding device is u32 (or even smaller outside
> of DRM). Because then we have all the fallible conversions on the other end
> where the driver interacts with the HW.
>
> So, on the Rust side I think we want to abstract this, such that drivers can
> choose the actual device size type and the corresponding APIs just work with
> this type and store the actual value in the backing u64 internally, but hand it
> out as the actual type the driver passed in originally.
I see, thanks for that context -- yes, if the types are different and
known, it would be better to abstract over the right one.
(And perhaps it may even make sense to use newtypes too, depending on
the details.)
Cheers,
Miguel