Re: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper
From: Jason Gunthorpe
Date: Fri Jun 23 2023 - 12:38:52 EST
On Fri, Jun 23, 2023 at 05:07:37PM +0200, Cédric Le Goater wrote:
> On 6/23/23 15:07, Jason Gunthorpe wrote:
> > On Fri, Jun 23, 2023 at 03:04:17PM +0200, Cédric Le Goater wrote:
> > > 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.
> >
> > Yeah, this is what I thought you ment, I'm against this kind of
> > obfuscation in the kernel without a very strong purpose, and if you do
> > something like this it should be a static inline function.
>
> OK. We could drop the intermediate struct attribute instead then.
Yah, if the struct isn't needed for some other reason
Jason