gpu: nova: fix rust-analyzer generation
Subsystems (5)
Alexandre Courbot
maintainerPATCH 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.
--- drivers/gpu/drm/nova/Makefile | 1 + drivers/gpu/nova-core/Makefile | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/nova/Makefile +1 -0
@@ -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
@@ -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]>
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
.oappears in the Rust source file's immediateMakefileorKbuildfile.Commit
ca524e273c43("gpu: build nova-core and nova-drm fromdrivers/gpu/Makefile") moves the build rules fornova-coreandnova-drmintodrivers/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 restorerust-analyzerfunctionality on them.Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")Signed-off-by Alexandre Courbot <[email protected]>
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@@ -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@@ -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-8dd146dc53a3Best regards,
Signature · 1 line
Alexandre Courbot <[email protected]>
Alexandre Courbot
maintainerQuoted 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
.oappears in the Rust source file's immediateMakefileorKbuildfile.
Quoted 7 lines
Quoted 4 lines
Commit
ca524e273c43("gpu: build nova-core and nova-drm fromdrivers/gpu/Makefile") moves the build rules fornova-coreandnova-drmintodrivers/gpu/Makefile, which results in the generator script ignoring these crates.So this regression shows that
generate_rust_analyzer.pyshould 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 restorerust-analyzerfunctionality on them.
Quoted 7 lines
Quoted 2 lines
Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")Signed-off-by Alexandre Courbot <[email protected]>That said, this is a reasonable quick fix for the current generator as it fixes the rust-analyzer functionality for nova, so:
Reviewed-by Onur Özkan <[email protected]>
Thanks!
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
Quoted 9 lines · Alexandre Courbot
The rust-analyzer generator script recognizes a crate when its corresponding
.oappears in the Rust source file's immediateMakefileorKbuildfile.Commit
ca524e273c43("gpu: build nova-core and nova-drm fromdrivers/gpu/Makefile") moves the build rules fornova-coreandnova-drmintodrivers/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 restorerust-analyzerfunctionality on them.Fixes ca524e273c43 ("gpu: build nova-core and nova-drm from drivers/gpu/Makefile")Signed-off-by Alexandre Courbot <[email protected]>
Thanks for fixing this bug so quickly. It was driving me crazy.
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.