Re: [PATCH v7 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper

From: Ankit Agrawal
Date: Wed Aug 23 2023 - 10:18:59 EST


>> +
>> + /*
>> + * 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.

(gdb) p/x *(mr->ops)
$7 = {read = 0xaaab5e0b1c50, write = 0xaaab5e0b1a50, read_with_attrs = 0x0, write_with_attrs = 0x0,
endianness = 0x2, valid = {min_access_size = 0x1, max_access_size = 0x8, unaligned = 0x0, accepts = 0x0},
impl = {min_access_size = 0x1, max_access_size = 0x8, unaligned = 0x0}}

Thanks
Ankit Agrawal