public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig
@ 2026-04-27 10:54 Alice Ryhl
  2026-04-28  4:35 ` Claude review: " Claude Code Review Bot
  2026-04-28  4:35 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Alice Ryhl @ 2026-04-27 10:54 UTC (permalink / raw)
  To: Danilo Krummrich, Matthew Brost, Thomas Hellström
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, dri-devel,
	linux-kernel, rust-for-linux, Alice Ryhl

Since Rust uses GPUVM via the kernel crate, which is built-in, the GPUVM
module must also be built-in to use GPUVM from Rust. Adjust the Kconfig
settings accordingly.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
 drivers/gpu/drm/Kconfig      | 7 +++++++
 rust/helpers/drm_gpuvm.c     | 4 ++--
 rust/kernel/drm/gpuvm/mod.rs | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 8f5a8d3012e4..323422861e8f 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -218,6 +218,13 @@ config DRM_GPUVM
 	  GPU-VM representation providing helpers to manage a GPUs virtual
 	  address space
 
+config RUST_DRM_GPUVM
+	bool
+	depends on DRM
+	select DRM_GPUVM
+	help
+	  Choose this if you need GPUVM functions in Rust
+
 config DRM_GPUSVM
 	tristate
 	depends on DRM
diff --git a/rust/helpers/drm_gpuvm.c b/rust/helpers/drm_gpuvm.c
index ca959d9a66f6..4130b6325213 100644
--- a/rust/helpers/drm_gpuvm.c
+++ b/rust/helpers/drm_gpuvm.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 or MIT
 
-#ifdef CONFIG_DRM_GPUVM
+#ifdef CONFIG_RUST_DRM_GPUVM
 
 #include <drm/drm_gpuvm.h>
 
@@ -23,4 +23,4 @@ bool rust_helper_drm_gpuvm_is_extobj(struct drm_gpuvm *gpuvm,
 	return drm_gpuvm_is_extobj(gpuvm, obj);
 }
 
-#endif // CONFIG_DRM_GPUVM
+#endif // CONFIG_RUST_DRM_GPUVM
diff --git a/rust/kernel/drm/gpuvm/mod.rs b/rust/kernel/drm/gpuvm/mod.rs
index dc755f248143..ae58f6f667c1 100644
--- a/rust/kernel/drm/gpuvm/mod.rs
+++ b/rust/kernel/drm/gpuvm/mod.rs
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
 
-#![cfg(CONFIG_DRM_GPUVM = "y")]
+#![cfg(CONFIG_RUST_DRM_GPUVM)]
 
 //! DRM GPUVM in immediate mode
 //!

---
base-commit: 5ba12cca3230f6bee5fe1090a30db6b70733e2c7
change-id: 20260427-gpuvm-config-7abf27967f8d
prerequisite-change-id: 20251128-gpuvm-rust-b719cac27ad6:v6
prerequisite-patch-id: f1f55d8f1e7d6e5378673812830d40a6ab00ac15
prerequisite-patch-id: 69eaacfa09229181832b2c2a19ce1a2f96e5e532
prerequisite-patch-id: 27fb7278e13bb18b493e207720dcad4e41862281
prerequisite-patch-id: 76a7592dd4f4da18243091a615f9a8f8579b5d56
prerequisite-patch-id: 0044f8f6356e6fe0759db08ec663822df204cdad

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


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

* Claude review: drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig
  2026-04-27 10:54 [PATCH] drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig Alice Ryhl
  2026-04-28  4:35 ` Claude review: " Claude Code Review Bot
@ 2026-04-28  4:35 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  4:35 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig
Author: Alice Ryhl <aliceryhl@google.com>
Patches: 1
Reviewed: 2026-04-28T14:35:26.268059

---

This is a single, well-scoped patch that introduces a dedicated `RUST_DRM_GPUVM` Kconfig option to ensure GPUVM is built-in (not as a module) when used from Rust code. The rationale is sound: the Rust kernel crate is always built-in, so any C code it calls must also be built-in. The patch follows the established pattern set by `RUST_DRM_GEM_SHMEM_HELPER`, which does the same thing for GEM shmem helpers.

The change is minimal and correct. No functional issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig
  2026-04-27 10:54 [PATCH] drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig Alice Ryhl
@ 2026-04-28  4:35 ` Claude Code Review Bot
  2026-04-28  4:35 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  4:35 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Kconfig addition** (`drivers/gpu/drm/Kconfig`):

```
+config RUST_DRM_GPUVM
+	bool
+	depends on DRM
+	select DRM_GPUVM
+	help
+	  Choose this if you need GPUVM functions in Rust
```

This correctly mirrors the existing `RUST_DRM_GEM_SHMEM_HELPER` pattern at line 278. Key points:
- `bool` (not `tristate`) — forces built-in, which is the whole point.
- `select DRM_GPUVM` — ensures the C implementation is pulled in when selected.
- No user-visible prompt (no string after `bool`) — intended to be selected by drivers, not manually enabled. This is correct.

One minor observation: `DRM_GPUVM` is `tristate`, and `RUST_DRM_GPUVM` is `bool` that selects it. When a `bool` symbol selects a `tristate`, Kconfig forces the tristate to `y` (built-in). This is exactly the desired behavior and matches the commit message explanation.

**C helper guard change** (`rust/helpers/drm_gpuvm.c`):

```c
-#ifdef CONFIG_DRM_GPUVM
+#ifdef CONFIG_RUST_DRM_GPUVM
```

Correct. The helper functions are only needed for Rust consumers, so guarding them behind `RUST_DRM_GPUVM` rather than `DRM_GPUVM` avoids compiling them when only C code uses GPUVM (where the inline/macro versions are used directly). The closing comment is also updated consistently.

**Rust cfg change** (`rust/kernel/drm/gpuvm/mod.rs`):

```rust
-#![cfg(CONFIG_DRM_GPUVM = "y")]
+#![cfg(CONFIG_RUST_DRM_GPUVM)]
```

Two things happen here:
1. The config symbol is updated to match the new Kconfig option.
2. The `= "y"` check is dropped. Since `RUST_DRM_GPUVM` is `bool` (never `m`), a bare `cfg(CONFIG_RUST_DRM_GPUVM)` is sufficient — it will be either defined or not. This is consistent with how other `bool` configs are checked elsewhere in `rust/kernel/` (e.g., `#![cfg(CONFIG_MMU)]`).

**Overall**: Clean, minimal patch. Follows established conventions. No issues found.

Reviewed-by: Claude <noreply@anthropic.com>

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-04-28  4:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 10:54 [PATCH] drm/gpuvm: rust: add RUST_DRM_GPUVM option to Kconfig Alice Ryhl
2026-04-28  4:35 ` Claude review: " Claude Code Review Bot
2026-04-28  4:35 ` Claude Code Review Bot

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