On Wed, Mar 04, 2026 at 06:27:11PM +0200, Leon Romanovsky wrote: > On Wed, Mar 04, 2026 at 03:57:57PM +0100, Danilo Krummrich wrote: > > On Wed Mar 4, 2026 at 3:26 PM CET, Leon Romanovsky wrote: > > > On Wed, Mar 04, 2026 at 10:18:52AM -0400, Jason Gunthorpe wrote: > > >> On Wed, Mar 04, 2026 at 10:47:50AM +0200, Leon Romanovsky wrote: > > >> > On Tue, Mar 03, 2026 at 04:15:20PM -0500, Peter Colberg wrote: > > >> > > Add Rust abstractions for the Single Root I/O Virtualization (SR-IOV) > > >> > > capability of a PCI device. Provide a minimal set of wrappers for the > > >> > > SR-IOV C API to enable and disable SR-IOV for a device, and query if > > >> > > a PCI device is a Physical Function (PF) or Virtual Function (VF). > > >> > > > >> > <...> > > >> > > > >> > > For PF drivers written in C, disabling SR-IOV on remove() may be > > >> > > opted > > >> > > into by setting the flag managed_sriov in the pci_driver structure. > > >> > > For > > >> > > PF drivers written in Rust, disabling SR-IOV on unbind() is > > >> > > mandatory. > > >> > > > >> > Why? Could you explain the rationale behind this difference between C > > >> > and > > >> > Rust? Let me remind you that SR‑IOV devices which do not disable VFs > > >> > do so > > >> > for a practical and well‑established reason: maximizing hardware > > >> > utilization. > > >> > > >> Personally I think drivers doing this are wrong. That such a driver > > >> bug was allowed to become UAPI is pretty bad. The rust approach is > > >> better. > > > > > > We already had this discussion. I see this as a perfectly valid > > > use-case. > > > > Can you remind about a specific use-case for this please? (Ideally, one that > > can't be solved otherwise.) > > You create X VFs through sriov_configure, unbind PF, bind it to vfio > instead and forward (X + 1) functions to different VMs.
No, illegal, and it doesn't even work right. When VFIO FLRs the PF it will blow up the half baked SRIOV and break everything. VFIO already has its own sriov_config support, the right flow is to bind the PF to VFIO and then enable sriov and do your assignments. Jason
