NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
* [PATCH] gpu: nova-core: switch NVKV dead_code attributes from expect to allow
@ 2026-12-04  7:18 Eliot Courtney
  2026-12-05  1:22 ` John Hubbard
  0 siblings, 1 reply; 2+ messages in thread
From: Eliot Courtney @ 2026-12-04  7:18 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, Alexandre Courbot, David Airlie,
	Simona Vetter
  Cc: John Hubbard, Alistair Popple, Timur Tabi, nova-gpu, dri-devel,
	linux-kernel, Eliot Courtney

Once the r000 GSP_INIT command uses the NVKV encoder and decoder outside
of KUnit tests, rustc before 1.97.0 warns without `CONFIG_KUNIT=y` that
the `expect(dead_code)` at the top of encode.rs and decode.rs is
unfulfilled:

    warning: this lint expectation is unfulfilled
     --> drivers/gpu/nova-core/gsp/nvkv/encode.rs:4:45

    warning: this lint expectation is unfulfilled
     --> drivers/gpu/nova-core/gsp/nvkv/decode.rs:4:45

Switch both files from `expect(dead_code)` to `allow(dead_code)`. Once
GSP_INIT is merged, we can remove the attribute from encode.rs.

Reported-by: Timur Tabi <ttabi@nvidia.com>
Closes: https://lore.kernel.org/all/1f88322ae5c6d879b293b2f2a96a36413dbafef3.camel@nvidia.com/
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
This is a prerequisite for [1], which adds the GSP_INIT command and hits
build errors for rustc before 1.97.0.

This is based on drm-rust-next.

[1]: https://lore.kernel.org/all/20261203-b4-r000-switch-v1-0-b1463ec6dae2@nvidia.com/
---
 drivers/gpu/nova-core/gsp/nvkv/decode.rs | 4 +++-
 drivers/gpu/nova-core/gsp/nvkv/encode.rs | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/nvkv/decode.rs b/drivers/gpu/nova-core/gsp/nvkv/decode.rs
index 84c0c998b2c9..8445ac96c66c 100644
--- a/drivers/gpu/nova-core/gsp/nvkv/decode.rs
+++ b/drivers/gpu/nova-core/gsp/nvkv/decode.rs
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
-#![cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
+// TODO: expect() doesn't work here before rustc 1.97.0
+// https://github.com/rust-lang/rust/pull/154377
+#![cfg_attr(not(CONFIG_KUNIT = "y"), allow(dead_code))]
 
 use core::marker::PhantomData;
 
diff --git a/drivers/gpu/nova-core/gsp/nvkv/encode.rs b/drivers/gpu/nova-core/gsp/nvkv/encode.rs
index c6891c0441ff..fa9e0421af79 100644
--- a/drivers/gpu/nova-core/gsp/nvkv/encode.rs
+++ b/drivers/gpu/nova-core/gsp/nvkv/encode.rs
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
-#![cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
+// TODO: expect() doesn't work here before rustc 1.97.0
+// https://github.com/rust-lang/rust/pull/154377
+#![cfg_attr(not(CONFIG_KUNIT = "y"), allow(dead_code))]
 
 use kernel::prelude::*;
 use zerocopy::Immutable;

---
base-commit: d9da44362d77bcbf1f5bfd2ba1c514e776fdb07c
change-id: 20261124-nvkv-build-fix-5d7bb239fff3

Best regards,
--  
Eliot Courtney <ecourtney@nvidia.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpu: nova-core: switch NVKV dead_code attributes from expect to allow
  2026-12-04  7:18 [PATCH] gpu: nova-core: switch NVKV dead_code attributes from expect to allow Eliot Courtney
@ 2026-12-05  1:22 ` John Hubbard
  0 siblings, 0 replies; 2+ messages in thread
From: John Hubbard @ 2026-12-05  1:22 UTC (permalink / raw)
  To: Eliot Courtney, Danilo Krummrich, Alice Ryhl, Alexandre Courbot,
	David Airlie, Simona Vetter
  Cc: Alistair Popple, Timur Tabi, nova-gpu, dri-devel, linux-kernel

On 12/3/26 11:18 PM, Eliot Courtney wrote:
> Once the r000 GSP_INIT command uses the NVKV encoder and decoder outside
> of KUnit tests, rustc before 1.97.0 warns without `CONFIG_KUNIT=y` that
> the `expect(dead_code)` at the top of encode.rs and decode.rs is
> unfulfilled:

Might be nice to add here: 

"That's because of a bug in rust..."

Either way,

Reviewed-by: John Hubbard <jhubbard@nvidia.com>

thanks,
-- 
John Hubbard
> 
>     warning: this lint expectation is unfulfilled
>      --> drivers/gpu/nova-core/gsp/nvkv/encode.rs:4:45
> 
>     warning: this lint expectation is unfulfilled
>      --> drivers/gpu/nova-core/gsp/nvkv/decode.rs:4:45
> 
> Switch both files from `expect(dead_code)` to `allow(dead_code)`. Once
> GSP_INIT is merged, we can remove the attribute from encode.rs.
> 
> Reported-by: Timur Tabi <ttabi@nvidia.com>
> Closes: https://lore.kernel.org/all/1f88322ae5c6d879b293b2f2a96a36413dbafef3.camel@nvidia.com/
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
> ---
> This is a prerequisite for [1], which adds the GSP_INIT command and hits
> build errors for rustc before 1.97.0.
> 
> This is based on drm-rust-next.
> 
> [1]: https://lore.kernel.org/all/20261203-b4-r000-switch-v1-0-b1463ec6dae2@nvidia.com/
> ---
>  drivers/gpu/nova-core/gsp/nvkv/decode.rs | 4 +++-
>  drivers/gpu/nova-core/gsp/nvkv/encode.rs | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/gsp/nvkv/decode.rs b/drivers/gpu/nova-core/gsp/nvkv/decode.rs
> index 84c0c998b2c9..8445ac96c66c 100644
> --- a/drivers/gpu/nova-core/gsp/nvkv/decode.rs
> +++ b/drivers/gpu/nova-core/gsp/nvkv/decode.rs
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0
>  // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>  
> -#![cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
> +// TODO: expect() doesn't work here before rustc 1.97.0
> +// https://github.com/rust-lang/rust/pull/154377
> +#![cfg_attr(not(CONFIG_KUNIT = "y"), allow(dead_code))]
>  
>  use core::marker::PhantomData;
>  
> diff --git a/drivers/gpu/nova-core/gsp/nvkv/encode.rs b/drivers/gpu/nova-core/gsp/nvkv/encode.rs
> index c6891c0441ff..fa9e0421af79 100644
> --- a/drivers/gpu/nova-core/gsp/nvkv/encode.rs
> +++ b/drivers/gpu/nova-core/gsp/nvkv/encode.rs
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0
>  // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>  
> -#![cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
> +// TODO: expect() doesn't work here before rustc 1.97.0
> +// https://github.com/rust-lang/rust/pull/154377
> +#![cfg_attr(not(CONFIG_KUNIT = "y"), allow(dead_code))]
>  
>  use kernel::prelude::*;
>  use zerocopy::Immutable;
> 
> ---
> base-commit: d9da44362d77bcbf1f5bfd2ba1c514e776fdb07c
> change-id: 20261124-nvkv-build-fix-5d7bb239fff3
> 
> Best regards,
> --  
> Eliot Courtney <ecourtney@nvidia.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-05  1:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  7:18 [PATCH] gpu: nova-core: switch NVKV dead_code attributes from expect to allow Eliot Courtney
2026-12-05  1:22 ` John Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox