From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: rust: drm: gem: shmem: Add vmap functions Date: Thu, 04 Jun 2026 11:29:38 +1000 Message-ID: In-Reply-To: <20260603195210.693856-4-lyude@redhat.com> References: <20260603195210.693856-1-lyude@redhat.com> <20260603195210.693856-4-lyude@redhat.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Verdict: Looks good, minor nits.** This is the largest patch and is well-structured. The `make_vmap()` pattern with generics to support both borrowed and owned references is clean. **Size validation is correct:** ```rust if self.size() < SIZE { return Err(ENOSPC); } ``` **The iomem fallback returns `ENOTSUPP`:** ```rust if map.is_iomem { unsafe { self.raw_vunmap(map) }; Err(ENOTSUPP) } ``` This is fine. `ENOTSUPP` vs `EOPNOTSUPP` has been debated in kernel circles, but both are used for this kind of situation. The cleanup path (calling `raw_vunmap` on the iomem map) is correct. **VMap::drop reconstructs the iosys_map:** ```rust fn drop(&mut self) { unsafe { self.owner.raw_vunmap(bindings::iosys_map { is_iomem: false, __bindgen_anon_1: bindings::iosys_map__bindgen_ty_1 { vaddr: self.addr }, }) }; } ``` This is correct since we only create VMap for non-iomem mappings (iomem returns an error in `make_vmap`). **IoCapable implementations look correct.** The `ptr::read`/`ptr::write` calls delegate safety to the `Io` trait's bounds checking. **Unit tests are good** -- they test compile-time size validation and basic I/O through the vmap. The kunit boilerplate DRM driver is minimal and appropriate. **Nit:** In the `vmap_io` test, the read-back of individual bytes from a u32 write assumes little-endian. This will work on x86 and ARM (LE mode) but would be worth a comment or `#[cfg(target_endian = "little")]` if it matters for test correctness on BE platforms. --- --- Generated by Claude Code Patch Reviewer