Re: [PATCH v2 3/3] vfio/nvgrace-gpu: Check the HBM training and C2C link status

From: Ankit Agrawal
Date: Thu Jan 09 2025 - 17:46:35 EST


Thanks Alex for the review.

>> +static int nvgrace_gpu_check_device_status(struct pci_dev *pdev)
>
> "nvgrace_gpu_wait_device_ready()"?

Ok, I'll rename it.

>> +{
>> +     void __iomem *io;
>> +     int time_elasped;
>> +
>> +     io = pci_iomap(pdev, 0, ~0UL);
>
> The documentation is unclear here, but existing code suggests passing 0
> here rather than -1 to map the full BAR.  It ends up being equivalent
> since the code doesn't error attempting to map longer than the BAR, but
> there's no reason to add a bad example.

Ack, will change to use 0.

>> +             }
>> +             msleep(POLL_QUANTUM_MS);
>> +     }
>
> time_after() would simplify things here.  I'd also suggest a common
> exit path.

Understood, will change.

>> +
>> +     pci_iounmap(pdev, io);
>> +     return -ENODEV;
>
> ETIME could work for the error code too.  Thanks,

Ack.