forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PCI/IOV: Add sysfs MSI-X vector assignment interface
A typical cloud provider SR-IOV use case is to create many VFs for use by guest VMs. The VFs may not be assigned to a VM until a customer requests a VM of a certain size, e.g., number of CPUs. A VF may need MSI-X vectors proportional to the number of CPUs in the VM, but there is no standard way to change the number of MSI-X vectors supported by a VF. Some Mellanox ConnectX devices support dynamic assignment of MSI-X vectors to SR-IOV VFs. This can be done by the PF driver after VFs are enabled, and it can be done without affecting VFs that are already in use. The hardware supports a limited pool of MSI-X vectors that can be assigned to the PF or to individual VFs. This is device-specific behavior that requires support in the PF driver. Add a read-only "sriov_vf_total_msix" sysfs file for the PF and a writable "sriov_vf_msix_count" file for each VF. Management software may use these to learn how many MSI-X vectors are available and to dynamically assign them to VFs before the VFs are passed through to a VM. If the PF driver implements the ->sriov_get_vf_total_msix() callback, "sriov_vf_total_msix" contains the total number of MSI-X vectors available for distribution among VFs. If no driver is bound to the VF, writing "N" to "sriov_vf_msix_count" uses the PF driver ->sriov_set_msix_vec_count() callback to assign "N" MSI-X vectors to the VF. When a VF driver subsequently reads the MSI-X Message Control register, it will see the new Table Size "N". Link: https://lore.kernel.org/linux-pci/[email protected] Acked-by: Bjorn Helgaas <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
- Loading branch information
Showing
5 changed files
with
137 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,3 +375,32 @@ Description: | |
The value comes from the PCI kernel device state and can be one | ||
of: "unknown", "error", "D0", D1", "D2", "D3hot", "D3cold". | ||
The file is read only. | ||
|
||
What: /sys/bus/pci/devices/.../sriov_vf_total_msix | ||
Date: January 2021 | ||
Contact: Leon Romanovsky <[email protected]> | ||
Description: | ||
This file is associated with a SR-IOV physical function (PF). | ||
It contains the total number of MSI-X vectors available for | ||
assignment to all virtual functions (VFs) associated with PF. | ||
The value will be zero if the device doesn't support this | ||
functionality. For supported devices, the value will be | ||
constant and won't be changed after MSI-X vectors assignment. | ||
|
||
What: /sys/bus/pci/devices/.../sriov_vf_msix_count | ||
Date: January 2021 | ||
Contact: Leon Romanovsky <[email protected]> | ||
Description: | ||
This file is associated with a SR-IOV virtual function (VF). | ||
It allows configuration of the number of MSI-X vectors for | ||
the VF. This allows devices that have a global pool of MSI-X | ||
vectors to optimally divide them between VFs based on VF usage. | ||
|
||
The values accepted are: | ||
* > 0 - this number will be reported as the Table Size in the | ||
VF's MSI-X capability | ||
* < 0 - not valid | ||
* = 0 - will reset to the device default value | ||
|
||
The file is writable if the PF is bound to a driver that | ||
implements ->sriov_set_msix_vec_count(). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters