lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CB6E0292-A9D6-4476-A343-2A4C6BC00945@collabora.com>
Date: Fri, 25 Jul 2025 13:55:58 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: Danilo Krummrich <dakr@...nel.org>,
 David Airlie <airlied@...il.com>,
 Simona Vetter <simona@...ll.ch>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>,
 Thomas Zimmermann <tzimmermann@...e.de>,
 Beata Michalska <beata.michalska@....com>,
 nouveau@...ts.freedesktop.org,
 dri-devel@...ts.freedesktop.org,
 rust-for-linux@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 06/19] gpu: nova-core: register: remove `try_`
 accessors for relative registers



> On 18 Jul 2025, at 04:26, Alexandre Courbot <acourbot@...dia.com> wrote:
> 
> Relative registers are always accessed using a literal base, meaning
> their validity can always be checked at compile-time. Thus remove the
> `try_` accessors that have no purpose.
> 
> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>
> ---
> drivers/gpu/nova-core/regs/macros.rs | 38 +-----------------------------------
> 1 file changed, 1 insertion(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs
> index 37c7c454ba810447e1fe41231650e616e2f86eb8..742afd3ae1a3c798817bbf815945889077ce10d0 100644
> --- a/drivers/gpu/nova-core/regs/macros.rs
> +++ b/drivers/gpu/nova-core/regs/macros.rs
> @@ -57,9 +57,7 @@
> /// definition, or the field getter and setter methods they are attached to.
> ///
> /// Putting a `+` before the address of the register makes it relative to a base: the `read` and
> -/// `write` methods take a `base` argument that is added to the specified address before access,
> -/// and `try_read` and `try_write` methods are also created, allowing access with offsets unknown
> -/// at compile-time:
> +/// `write` methods take a `base` argument that is added to the specified address before access:
> ///
> /// ```no_run
> /// register!(CPU_CTL @ +0x0000010, "CPU core control" {
> @@ -386,40 +384,6 @@ pub(crate) fn alter<const SIZE: usize, T, F>(
>                 let reg = f(Self::read(io, base));
>                 reg.write(io, base);
>             }
> -
> -            #[inline]
> -            pub(crate) fn try_read<const SIZE: usize, T>(
> -                io: &T,
> -                base: usize,
> -            ) -> ::kernel::error::Result<Self> where
> -                T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
> -            {
> -                io.try_read32(base + $offset).map(Self)
> -            }
> -
> -            #[inline]
> -            pub(crate) fn try_write<const SIZE: usize, T>(
> -                self,
> -                io: &T,
> -                base: usize,
> -            ) -> ::kernel::error::Result<()> where
> -                T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
> -            {
> -                io.try_write32(self.0, base + $offset)
> -            }
> -
> -            #[inline]
> -            pub(crate) fn try_alter<const SIZE: usize, T, F>(
> -                io: &T,
> -                base: usize,
> -                f: F,
> -            ) -> ::kernel::error::Result<()> where
> -                T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
> -                F: ::core::ops::FnOnce(Self) -> Self,
> -            {
> -                let reg = f(Self::try_read(io, base)?);
> -                reg.try_write(io, base)
> -            }
>         }
>     };
> }
> 
> -- 
> 2.50.1
> 

Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ