Skip to contentSkip to conversation

gpu: nova: fix rust-analyzer generation

PATCH Applied Alexandre Courbot 5 participants 6 messages Jul 1 – Jul 3

Subsystems (5)
lore
Share & tools
lore

Alexandre Courbot

author maintainer
#0 lore raw

PATCH 1/1 gpu: nova: fix rust-analyzer generation

The rust-analyzer generator script recognizes a crate when its corresponding .o appears in the Rust source file's immediate Makefile or Kbuild file.

Commit ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile") moves the build rules for nova-core and nova-drm into drivers/gpu/Makefile, which results in the generator script ignoring these crates.

Fix this by naming the crates' module as a comment in their respective Makefile; this is enough for the script to pick them up and restore rust-analyzer functionality on them.

Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")
---
 drivers/gpu/drm/nova/Makefile  | 1 +
 drivers/gpu/nova-core/Makefile | 1 +
 2 files changed, 2 insertions(+)
drivers/gpu/drm/nova/Makefile +1 -0
index b9fad3956358..6355f7502c48 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 # nova-drm is built from drivers/gpu/Makefile.
+# nova.o (rust-analyzer marker - DO NOT REMOVE).
drivers/gpu/nova-core/Makefile +1 -0
index 4c15729704a1..216329760a5b 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 # nova-core is built from drivers/gpu/Makefile.
+# nova_core.o (rust-analyzer marker - DO NOT REMOVE).

---
base-commit: 431f10ba13a964c146ae05728e42e4074bf735ab
change-id: 20260701-nova-rust-analyzer-8dd146dc53a3

Best regards,

Signature · 1 line
Alexandre Courbot <[email protected]>
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Wed, 01 Jul 2026 15:40:51 +0900 Alexandre Courbot <[email protected]>…

The rust-analyzer generator script recognizes a crate when its corresponding .o appears in the Rust source file's immediate Makefile or Kbuild file.

Commit ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile") moves the build rules for nova-core and nova-drm into drivers/gpu/Makefile, which results in the generator script ignoring these crates.

So this regression shows that generate_rust_analyzer.py should probably handle this case better e.g. by checking and understanding parent build rules too.

Quoted 7 lines

Fix this by naming the crates' module as a comment in their respective Makefile; this is enough for the script to pick them up and restore rust-analyzer functionality on them.

Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")

That said, this is a reasonable quick fix for the current generator as it fixes the rust-analyzer functionality for nova, so:

Quoted 30 lines
---
 drivers/gpu/drm/nova/Makefile  | 1 +
 drivers/gpu/nova-core/Makefile | 1 +
 2 files changed, 2 insertions(+)
drivers/gpu/drm/nova/Makefile +1 -0
index b9fad3956358..6355f7502c48 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 # nova-drm is built from drivers/gpu/Makefile.
+# nova.o (rust-analyzer marker - DO NOT REMOVE).
drivers/gpu/nova-core/Makefile +1 -1
index 4c15729704a1..216329760a5b 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 # nova-core is built from drivers/gpu/Makefile.
+# nova_core.o (rust-analyzer marker - DO NOT REMOVE).
 
---

base-commit: 431f10ba13a964c146ae05728e42e4074bf735ab
change-id: 20260701-nova-rust-analyzer-8dd146dc53a3

Best regards,

Signature · 1 line
Alexandre Courbot <[email protected]>
author maintainer
#2 lore raw
Quoted 7 lines · Onur Özkan
Quoted 4 lines · On Wed, 01 Jul 2026 15:40:51 +0900 Alexandre Courbot <[email protected]>…

The rust-analyzer generator script recognizes a crate when its corresponding .o appears in the Rust source file's immediate Makefile or Kbuild file.

Quoted 7 lines
Quoted 4 lines

Commit ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile") moves the build rules for nova-core and nova-drm into drivers/gpu/Makefile, which results in the generator script ignoring these crates.

So this regression shows that generate_rust_analyzer.py should probably handle this case better e.g. by checking and understanding parent build rules too.

Ideally yes - I expect that this is something the improved build system will handle correctly. The current Nova build rules are a temporary workaround, so I wanted to keep this "fix" as small as possible as it will also be reverted eventually.

Quoted 6 lines
Quoted 6 lines

Fix this by naming the crates' module as a comment in their respective Makefile; this is enough for the script to pick them up and restore rust-analyzer functionality on them.

Quoted 7 lines
Quoted 2 lines
Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")

That said, this is a reasonable quick fix for the current generator as it fixes the rust-analyzer functionality for nova, so:

Thanks!

#3 lore raw
Quoted 5 lines · Alexandre Courbot

Ideally yes - I expect that this is something the improved build system will handle correctly. The current Nova build rules are a temporary workaround, so I wanted to keep this "fix" as small as possible as it will also be reverted eventually.

Yeah, the current approach is just a workaround for the missing information, and we will be able to just do it "properly" instead.

This is fine for now (and it is not the first "magic comment" in Linux anyway).

Cc'ing Jesung too.

Thanks!

Cheers,
Miguel

Tested-by on v1 1/1
#4 lore raw
In reply to Alexandre Courbot
Quoted 9 lines · Alexandre Courbot

The rust-analyzer generator script recognizes a crate when its corresponding .o appears in the Rust source file's immediate Makefile or Kbuild file.

Commit ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile") moves the build rules for nova-core and nova-drm into drivers/gpu/Makefile, which results in the generator script ignoring these crates.

Quoted 6 lines

Fix this by naming the crates' module as a comment in their respective Makefile; this is enough for the script to pick them up and restore rust-analyzer functionality on them.

Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")

Thanks for fixing this bug so quickly. It was driving me crazy.

maintainer Applied
#5 lore raw
In reply to Alexandre Courbot
Quoted 1 line · Alexandre Courbot

[PATCH] gpu: nova: fix rust-analyzer generation

Applied, thanks!

Branch: drm-rust-next
Tree: https://gitlab.freedesktop.org/drm/rust/kernel.git

[1/1] gpu: nova: fix rust-analyzer generation

      commit: 78900738d981

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is queued up for the upcoming merge window for the next major kernel release.