Re: [PATCH v7 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper
From: Jason Gunthorpe
Date: Wed Aug 23 2023 - 10:25:20 EST
On Wed, Aug 23, 2023 at 02:18:52PM +0000, Ankit Agrawal wrote:
> >> +
> >> + /*
> >> + * Handle read on the BAR2 region. Map to the target device memory
> >> + * physical address and copy to the request read buffer.
> >> + */
> >> + if (copy_to_user(buf, (u8 *)addr + offset, read_count))
> >> + return -EFAULT;
> >
> > Just to verify, does this memory allow access of arbitrary alignment
> > and size?
>
> Please correct me if I'm wrong, but based on following gdb dump data on
> the corresponding MemoryRegion->ops, unaligned access isn't supported, and
> a read of size upto 8 may be done.
Regardless, you used MEMREMAP_WB which is equivalent to normal system
memory. It supports all accesses, including atomics, and doesn't
require __iomem accessors.
Jason