[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJXKk1csyLTfIRmm@nvidia.com>
Date: Fri, 23 Jun 2023 13:38:43 -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 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
Powered by blists - more mailing lists