[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJWZA8ogUlGegx2C@nvidia.com>
Date: Fri, 23 Jun 2023 10:07:15 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Cédric Le Goater <clegoate@...hat.com>
Cc: ankita@...dia.com, alex.williamson@...hat.com, aniketa@...dia.com,
cjia@...dia.com, kwankhede@...dia.com, targupta@...dia.com,
vsethi@...dia.com, acurrid@...dia.com, apopple@...dia.com,
jhubbard@...dia.com, danw@...dia.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace
hopper
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.
Jason
Powered by blists - more mailing lists