From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: vfio/pci: Add a helper to look up PFNs for DMABUFs Date: Thu, 28 May 2026 12:28:52 +1000 Message-ID: In-Reply-To: <20260527102319.100128-3-mattev@meta.com> References: <20260527102319.100128-1-mattev@meta.com> <20260527102319.100128-3-mattev@meta.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review Adds `vfio_pci_dma_buf_find_pfn()` for translating fault addresses to PFNs via the DMABUF's `phys_vec[]` ranges. **The comment block is quite long (lines 438-470)**. A 30+ line comment preceding the function duplicates what the code already communicates. Consider trimming to just the non-obvious parts (the `vma_pgoff_adjust` semantics and the hugepage/range-boundary limitation). **The `vma_pgoff_adjust` field and its WARN**: ```c + if (vpdmabuf->vma_pgoff_adjust != 0 && + vpdmabuf->vma_pgoff_adjust != (vma->vm_pgoff & + (VFIO_PCI_OFFSET_MASK >> PAGE_SHIFT))) { + WARN(1, "Unexpected vma_pgoff_adjust 0x%lx (vm_pgoff 0x%lx)\n", ``` This WARN fires if `vma_pgoff_adjust` is nonzero and doesn't match the VMA's pgoff. The check is a debugging assertion that should arguably be a `WARN_ON_ONCE` rather than `WARN(1, ...)` to avoid spamming dmesg. **Struct movement**: Moving `struct vfio_pci_dma_buf` to the header and adding `vma_pgoff_adjust` is clean. Good that `vma_pgoff_adjust` is `unsigned long` to match `vm_pgoff`. --- Generated by Claude Code Patch Reviewer