Re: [RFC 18/29] nvkm/vgpu: introduce pci_driver.sriov_configure() in nvkm

Zhi Wang
2024-10-15T15:14:06Z

On 15/10/2024 15.27, Jason Gunthorpe wrote:
> On Mon, Oct 14, 2024 at 08:32:03AM +0000, Zhi Wang wrote:
>
>> Turning on the SRIOV feature is just a part of the process enabling a
>> vGPU. The VF is not instantly usable before a vGPU type is chosen via
>> another userspace interface (e.g. fwctl).
>
> That's OK, that has become pretty normal now that VFs are just empty
> handles when they are created until they are properly profiled.
>
>> Besides, admin has to enable the vGPU support by some means (e.g. a
>> kernel parameter is just one candidate) and GSP firmware needs to be
>> configured accordingly when being loaded.
>
> Definitely not a kernel parameter..
>
>> As this is related to user space interface, I am leaning towards putting
>> some restriction/checks for the pre-condition in the
>> driver.sriov_configure(), so admin would know there is something wrong
>> in his configuration as early as possible, instead of he failed to
>> creating vGPUs again and again, then he found he forgot to enable the
>> vGPU support.
>
> Well, as I've said, this is poor, you shouldn't have a FW SRIOV enable
> bit at all, or at least it shouldn't be user configurable.
>
> If the PCI function supports SRIOV then it should work to turn it on.
>
> Jason

Makes sense. Then we don't need a user-configurable option for
enabling/disable SRIOV at least so far. We just enable it when we see
the HW supports SRIOV.