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: <pjir6td3umd42nbowidfyxehentayumx2nc7rkxos5d3gjcayn@cvjvelmcj7ib>
Date: Tue, 9 Dec 2025 12:26:27 +1100
From: Alistair Popple <apopple@...dia.com>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: Danilo Krummrich <dakr@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, 
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, 
	John Hubbard <jhubbard@...dia.com>, Joel Fernandes <joelagnelf@...dia.com>, 
	Timur Tabi <ttabi@...dia.com>, Edwin Peer <epeer@...dia.com>, nouveau@...ts.freedesktop.org, 
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 2/9] gpu: nova-core: gsp: remove unnecessary Display impls

On 2025-12-08 at 20:26 +1100, Alexandre Courbot <acourbot@...dia.com> wrote...
> We only ever display these in debug context, for which the automatically
> derived `Debug` impls work just fine - so use them and remove these
> boilerplate-looking implementations.

Nice.

Reviewed-by: Alistair Popple <apopple@...dia.com>

> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>
> ---
>  drivers/gpu/nova-core/gsp/cmdq.rs |  2 +-
>  drivers/gpu/nova-core/gsp/fw.rs   | 54 ---------------------------------------
>  2 files changed, 1 insertion(+), 55 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
> index 5ce85ee1ffce..fa983a3f480c 100644
> --- a/drivers/gpu/nova-core/gsp/cmdq.rs
> +++ b/drivers/gpu/nova-core/gsp/cmdq.rs
> @@ -531,7 +531,7 @@ pub(crate) fn send_command<M>(&mut self, bar: &Bar0, command: M) -> Result
>  
>          dev_dbg!(
>              &self.dev,
> -            "GSP RPC: send: seq# {}, function={}, length=0x{:x}\n",
> +            "GSP RPC: send: seq# {}, function={:?}, length=0x{:x}\n",
>              self.seq,
>              M::FUNCTION,
>              dst.header.length(),
> diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
> index 3baa5455cc32..24e4eaaf1265 100644
> --- a/drivers/gpu/nova-core/gsp/fw.rs
> +++ b/drivers/gpu/nova-core/gsp/fw.rs
> @@ -10,7 +10,6 @@
>  
>  use kernel::{
>      dma::CoherentAllocation,
> -    fmt,
>      prelude::*,
>      ptr::{
>          Alignable,
> @@ -223,43 +222,6 @@ pub(crate) enum MsgFunction {
>      UcodeLibOsPrint = bindings::NV_VGPU_MSG_EVENT_UCODE_LIBOS_PRINT,
>  }
>  
> -impl fmt::Display for MsgFunction {
> -    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
> -        match self {
> -            // Common function codes
> -            MsgFunction::Nop => write!(f, "NOP"),
> -            MsgFunction::SetGuestSystemInfo => write!(f, "SET_GUEST_SYSTEM_INFO"),
> -            MsgFunction::AllocRoot => write!(f, "ALLOC_ROOT"),
> -            MsgFunction::AllocDevice => write!(f, "ALLOC_DEVICE"),
> -            MsgFunction::AllocMemory => write!(f, "ALLOC_MEMORY"),
> -            MsgFunction::AllocCtxDma => write!(f, "ALLOC_CTX_DMA"),
> -            MsgFunction::AllocChannelDma => write!(f, "ALLOC_CHANNEL_DMA"),
> -            MsgFunction::MapMemory => write!(f, "MAP_MEMORY"),
> -            MsgFunction::BindCtxDma => write!(f, "BIND_CTX_DMA"),
> -            MsgFunction::AllocObject => write!(f, "ALLOC_OBJECT"),
> -            MsgFunction::Free => write!(f, "FREE"),
> -            MsgFunction::Log => write!(f, "LOG"),
> -            MsgFunction::GetGspStaticInfo => write!(f, "GET_GSP_STATIC_INFO"),
> -            MsgFunction::SetRegistry => write!(f, "SET_REGISTRY"),
> -            MsgFunction::GspSetSystemInfo => write!(f, "GSP_SET_SYSTEM_INFO"),
> -            MsgFunction::GspInitPostObjGpu => write!(f, "GSP_INIT_POST_OBJGPU"),
> -            MsgFunction::GspRmControl => write!(f, "GSP_RM_CONTROL"),
> -            MsgFunction::GetStaticInfo => write!(f, "GET_STATIC_INFO"),
> -
> -            // Event codes
> -            MsgFunction::GspInitDone => write!(f, "INIT_DONE"),
> -            MsgFunction::GspRunCpuSequencer => write!(f, "RUN_CPU_SEQUENCER"),
> -            MsgFunction::PostEvent => write!(f, "POST_EVENT"),
> -            MsgFunction::RcTriggered => write!(f, "RC_TRIGGERED"),
> -            MsgFunction::MmuFaultQueued => write!(f, "MMU_FAULT_QUEUED"),
> -            MsgFunction::OsErrorLog => write!(f, "OS_ERROR_LOG"),
> -            MsgFunction::GspPostNoCat => write!(f, "NOCAT"),
> -            MsgFunction::GspLockdownNotice => write!(f, "LOCKDOWN_NOTICE"),
> -            MsgFunction::UcodeLibOsPrint => write!(f, "LIBOS_PRINT"),
> -        }
> -    }
> -}
> -
>  impl TryFrom<u32> for MsgFunction {
>      type Error = kernel::error::Error;
>  
> @@ -330,22 +292,6 @@ pub(crate) enum SeqBufOpcode {
>      RegWrite = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE,
>  }
>  
> -impl fmt::Display for SeqBufOpcode {
> -    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
> -        match self {
> -            SeqBufOpcode::CoreReset => write!(f, "CORE_RESET"),
> -            SeqBufOpcode::CoreResume => write!(f, "CORE_RESUME"),
> -            SeqBufOpcode::CoreStart => write!(f, "CORE_START"),
> -            SeqBufOpcode::CoreWaitForHalt => write!(f, "CORE_WAIT_FOR_HALT"),
> -            SeqBufOpcode::DelayUs => write!(f, "DELAY_US"),
> -            SeqBufOpcode::RegModify => write!(f, "REG_MODIFY"),
> -            SeqBufOpcode::RegPoll => write!(f, "REG_POLL"),
> -            SeqBufOpcode::RegStore => write!(f, "REG_STORE"),
> -            SeqBufOpcode::RegWrite => write!(f, "REG_WRITE"),
> -        }
> -    }
> -}
> -
>  impl TryFrom<u32> for SeqBufOpcode {
>      type Error = kernel::error::Error;
>  
> 
> -- 
> 2.52.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ