Re: [PATCH v3 2/3] vfio/nvgrace-gpu: Expose the blackwell device PF BAR1 to the VM
From: Ankit Agrawal
Date: Fri Jan 17 2025 - 13:52:06 EST
>> + if (!nvdev->has_mig_hw_bug_fix) {
>> + /*
>> + * If the device memory is split to workaround the MIG bug,
>> + * the USEMEM part of the device memory has to be MEMBLK_SIZE
>> + * aligned. This is a hardwired ABI value between the GPU FW and
>> + * VFIO driver. The VM device driver is also aware of it and make
>> + * use of the value for its calculation to determine USEMEM size.
>> + *
>> + * If the hardware has the fix for MIG, there is no requirement
>> + * for splitting the device memory to create RESMEM. The entire
>> + * device memory is usable and will be USEMEM.
>> + */
>> + nvdev->usemem.memlength = round_down(nvdev->usemem.memlength,
>> + MEMBLK_SIZE);
>> + if (nvdev->usemem.memlength == 0) {
>> + ret = -EINVAL;
>> + goto done;
>> + }
>
> Why does this operation need to be predicated on the buggy device?
> Does GB have memory that's not a multiple of 512MB? I was expecting
> this would be a no-op on GB and therefore wouldn't need to be
> conditional. Thanks,
>
> Alex
Thanks Alex, yeah the device memory size is not necessarily 512M aligned.