Re: [PATCH v5 5/7] vfio/nvgrace-gpu: split the code to wait for GPU ready

From: Ankit Agrawal
Date: Mon Nov 24 2025 - 10:39:58 EST


>> -     do {
>> -             if ((ioread32(io + C2C_LINK_BAR0_OFFSET) == STATUS_READY) &&
>> -                 (ioread32(io + HBM_TRAINING_BAR0_OFFSET) == STATUS_READY)) {
>> -                     ret = 0;
>> -                     goto reg_check_exit;
>> -             }
>> -             msleep(POLL_QUANTUM_MS);
>> -     } while (!time_after(jiffies, timeout));
>> +     ret = nvgrace_gpu_wait_device_ready(io);
>
> I think you're inadvertently fixing a bug here too.  The ret
> initialization to -ETIME is immediately clobbered by
> pci_enable_device(), so exceeding the timeout would never generate an
> error.  Now it will:
>
> Fixes: d85f69d520e6 ("vfio/nvgrace-gpu: Check the HBM training and C2C link status")

Oh yeah. Will add this line in the commit message.

> Also we should remove the ret initialization.  Otherwise the series
> LGTM.  Thanks,
>
> Alex

Thank you very much for the review, Alex!