Re: [PATCH] uio/uio_pci_generic: Add SR-IOV support

From: Don Dutile
Date: Thu Sep 28 2017 - 08:22:33 EST


On 09/27/2017 07:06 PM, Alexander Duyck wrote:
On Wed, Sep 27, 2017 at 3:20 PM, David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote:
On Wed, 2017-09-27 at 17:00 -0500, Bjorn Helgaas wrote:


IIUC, this question is basically "why doesn't the PCI core enable IOV
automatically when it sees an IOV-capable device?"

I think one reason is that an admin might want to control the number
of VFs we enable (e.g., via 1789382a72a5 ("PCI: SRIOV control and
status via sysfs" [1]). But I guess you already know about that,
since this patch uses that sysfs path, so maybe I don't understand
your question.


I mean, why doesn't the PCI core *allow* SR-IOV to be enabled via
sysfs, unless the driver does this?

The general idea is that the driver usually has to free up resources
so they can be reassigned to the VF devices.

For example in the case of the Intel NICs enabling SR-IOV reassigns
the queues to the VFs, and the PF has to be aware that this change is
happening so that it doesn't try to make use of queues that then
belong to the VFs.

- Alex

After reading Alex's response, I now understand Dave's question
better and why the patch won't work in general.

In every SRIOV capable device I've run into to date, the PF has
to know the VFs are being assigned due to some resource mgmt, if not
internal (e.g., switch) configuration reasons.
The reasons are often subtle.

From the context of the patches (uio), why aren't VFs enabled via
user-level sysfs interface? That was provided for user-mgmt apps
to have a PCIe-generic/common, device-independent method of VF enablement
(read: libvirt for device-assignment of VFs to VMs).
This also enables one to manage it at a finer, not-all-or-nothing level,
which is good due to bios strengths/weaknesses that various systems have
for SRIOV/VF-enablement.