Re: [PATCH v19 0/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-22 Thread Ankit Agrawal
>> Ankit Agrawal (3): >>   vfio/pci: rename and export do_io_rw() >>   vfio/pci: rename and export range_intersect_range >>   vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper >> >>  MAINTAINERS   |  16 +- >>  d

Re: [PATCH v18 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-19 Thread Ankit Agrawal
>> diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c >> b/drivers/vfio/pci/nvgrace-gpu/main.c new file mode 100644 >> index ..5a251a6a782e >> --- /dev/null >> +++ b/drivers/vfio/pci/nvgrace-gpu/main.c >> @@ -0,0 +1,888 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + *

Re: [PATCH v18 2/3] vfio/pci: rename and export range_intersect_range

2024-02-18 Thread Ankit Agrawal
>> + >> +/** >> + * vfio_pci_core_range_intersect_range() - Determine overlap between a >> buffer >> + *  and register offset ranges. >> + * @buf_start:   start offset of the buffer >> + * @buf_cnt: number of buffer bytes. > > You could drop

Re: [PATCH v18 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-18 Thread Ankit Agrawal
+  * use of the value for its calculation to determine USEMEM size. >> +  */ >> + nvdev->usemem.memlength = round_down(nvdev->usemem.memlength, >> +  MEMBLK_SIZE); >> + if ((check_add_overflow(nvdev->usemem.memp

Re: [PATCH v17 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-09 Thread Ankit Agrawal
>> > >> > IMO, this seems like adding too much code to reduce the call length for a >> > very specific case. If there aren't any strong opinion on this, I'm >> > planning to >> > leave this code as it is. >> >> a slight difference. if mem_count==0 the result should always succeed >> no matter

Re: [PATCH v17 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-09 Thread Ankit Agrawal
Thanks Kevin for the review. Comments inline. >> >> Note that the usemem memory is added by the VM Nvidia device driver [5] >> to the VM kernel as memblocks. Hence make the usable memory size >> memblock >> aligned. > > Is memblock size defined in spec or purely a guest implementation choice?

Re: [PATCH v17 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-08 Thread Ankit Agrawal
>> >> >> >> If mem_count == 0, going through nvgrace_gpu_map_and_read() is not >> >> necessary. >> > >> > Harmless, other than the possibly unnecessary call through to >> > nvgrace_gpu_map_device_mem().  Maybe both >> nvgrace_gpu_map_and_read() >> > and nvgrace_gpu_map_and_write() could

Re: [PATCH v17 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-07 Thread Ankit Agrawal
>> > +/* Memory size expected as non cached and reserved by the VM driver >> > */ +#define RESMEM_SIZE 0x4000 >> > +#define MEMBLK_SIZE 0x2000 >> > + >> >> Maybe use SZ_* definitions in linux/size.h > > Good suggestion. Ack. >> >> Better move this part to the place between

Re: [PATCH v17 3/3] vfio/nvgrace-gpu: Add vfio pci variant module for grace hopper

2024-02-07 Thread Ankit Agrawal
>> diff --git a/MAINTAINERS b/MAINTAINERS >> index 8999497011a2..529ec8966f58 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -23103,6 +23103,12 @@ L:   k...@vger.kernel.org >>  S:   Maintained >>  F:   drivers/vfio/platform/ >> >> +VFIO

Re: [PATCH v17 2/3] vfio/pci: rename and export range_intesect_range

2024-02-07 Thread Ankit Agrawal
Thanks Kevin. >> range_intesect_range determines an overlap between two ranges. If an > > s/intesect/intersect/ Will fix the typo. >> + * vfio_pci_core_range_intersect_range() - Determine overlap between a >> buffer >> + *  and register offset ranges. >> + *