On 6/23/23 13:47, Jason Gunthorpe wrote:
On Fri, Jun 23, 2023 at 08:27:17AM +0200, Cédric Le Goater wrote:
+ req_len = vma->vm_end - vma->vm_start;
+ pgoff = vma->vm_pgoff &
+ ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1);
+ if (pgoff >= (nvdev->mem_prop.mem_length >> PAGE_SHIFT))
+ return -EINVAL;
you cound introduce accessor macros for nvdev->mem_prop.mem_length and
nvdev->mem_prop.hpa
Accessors are not the usual style..
I meant something like
#define nvgpu_mem_size(nvdev) (nvdev)->mem_prop.mem_length
#define nvgpu_mem_pa_base(nvdev) (nvdev)->mem_prop.hpa
This is minor.
+static const struct pci_device_id nvgpu_vfio_pci_table[] = {
+ { PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_NVIDIA, 0x2342) },
+ { PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_NVIDIA, 0x2343) },
+ { PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_NVIDIA, 0x2345) },
It would be good to add definitions for the PCI IDs.
The common form these days is to have a comment with the marketing
name, we stopped putting constants for every device a while ago.
OK then.
Thanks,
C.