Re: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper

From: Jason Gunthorpe
Date: Fri Jun 23 2023 - 07:50:51 EST


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..

> > +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.

Jason