From: Alvin Sun Date: Fri, 07 Aug 2026 01:07:28 +0800 Subject: [PATCH v3 6/8] rust: drm: gpuvm: add dump_gpuva_info to UniqueRefGpuVm MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260807-tyr-debugfs-v2-v3-6-ff5595ac66ae@linux.dev> References: <20260807-tyr-debugfs-v2-v3-0-ff5595ac66ae@linux.dev> In-Reply-To: <20260807-tyr-debugfs-v2-v3-0-ff5595ac66ae@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Greg Kroah-Hartman , "Rafael J. Wysocki" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Alexander Viro , Christian Brauner , Jan Kara , Matthew Brost , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786036192; l=1591; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=0SevxM4QseTr6vo1UBUryrO8o+ks3okCtZz/y52EsJY=; b=iQQbLPYqcK2qdOzUHwdC80CHg75KN+Z/RKSJaI4MvvRPMI1fCfbiWcsk1Ev5nNdhkboKAwdV9 xbvlNvVyrgiC9ixL6YQ6Q9rWqSyBL9DoXrEDRUG250lfoT/Ei99JAGC X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 List-Id: B4 Relay Submissions Add method wrapping drm_debugfs_gpuva_info to dump GPU VA space mappings into a seq_file. Needed by the Tyr gpuvas debugfs file. Reviewed-by: Alice Ryhl Signed-off-by: Alvin Sun --- rust/bindings/bindings_helper.h | 1 + rust/kernel/drm/gpuvm/mod.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index 1124785e210b3..c3b2a86528934 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/rust/kernel/drm/gpuvm/mod.rs b/rust/kernel/drm/gpuvm/mod.rs index 20a08b3defeb8..9348b1c3064ec 100644 --- a/rust/kernel/drm/gpuvm/mod.rs +++ b/rust/kernel/drm/gpuvm/mod.rs @@ -312,6 +312,15 @@ pub fn data_ref(&self) -> &T { unsafe { &*self.0.data.get() } } + /// Dumps GPU VA space info into a seq_file. + /// + /// Wraps the C `drm_debugfs_gpuva_info` function. + #[inline] + pub fn dump_gpuva_info(&self, m: &crate::seq_file::SeqFile) -> Result { + // SAFETY: `m.as_raw()` and `self.as_raw()` are valid by the type invariants. + to_result(unsafe { bindings::drm_debugfs_gpuva_info(m.as_raw(), self.as_raw()) }) + } + /// Access the data owned by this `UniqueRefGpuVm` mutably. #[inline] pub fn data(&mut self) -> &mut T { -- 2.43.0