aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 15:14:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 15:14:47 -0500
commit193c0d682525987db59ac3a24531a77e4947aa95 (patch)
tree7b58346171c4d07e2c2ee6c3c469c325495149a4 /Documentation
parent8b0cab14951fbf8126795ab301835a8f8126a988 (diff)
parent1cb73f8c479e66541fefd3f7fa547b1fa56cdc54 (diff)
Merge tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI update from Bjorn Helgaas: "Host bridge hotplug: - Untangle _PRT from struct pci_bus (Bjorn Helgaas) - Request _OSC control before scanning root bus (Taku Izumi) - Assign resources when adding host bridge (Yinghai Lu) - Remove root bus when removing host bridge (Yinghai Lu) - Remove _PRT during hot remove (Yinghai Lu) SRIOV - Add sysfs knobs to control numVFs (Don Dutile) Power management - Notify devices when power resource turned on (Huang Ying) Bug fixes - Work around broken _SEG on HP xw9300 (Bjorn Helgaas) - Keep runtime PM enabled for unbound PCI devices (Huang Ying) - Fix Optimus dual-GPU runtime D3 suspend issue (Dave Airlie) - Fix xen frontend shutdown issue (David Vrabel) - Work around PLX PCI 9050 BAR alignment erratum (Ian Abbott) Miscellaneous - Add GPL license for drivers/pci/ioapic (Andrew Cooks) - Add standard PCI-X, PCIe ASPM register #defines (Bjorn Helgaas) - NumaChip remote PCI support (Daniel Blueman) - Fix PCIe Link Capabilities Supported Link Speed definition (Jingoo Han) - Convert dev_printk() to dev_info(), etc (Joe Perches) - Add support for non PCI BAR ROM data (Matthew Garrett) - Add x86 support for host bridge translation offset (Mike Yoknis) - Report success only when every driver supports AER (Vijay Pandarathil)" Fix up trivial conflicts. * tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (48 commits) PCI: Use phys_addr_t for physical ROM address x86/PCI: Add NumaChip remote PCI support ath9k: Use standard #defines for PCIe Capability ASPM fields iwlwifi: Use standard #defines for PCIe Capability ASPM fields iwlwifi: collapse wrapper for pcie_capability_read_word() iwlegacy: Use standard #defines for PCIe Capability ASPM fields iwlegacy: collapse wrapper for pcie_capability_read_word() cxgb3: Use standard #defines for PCIe Capability ASPM fields PCI: Add standard PCIe Capability Link ASPM field names PCI/portdrv: Use PCI Express Capability accessors PCI: Use standard PCIe Capability Link register field names x86: Use PCI setup data PCI: Add support for non-BAR ROMs PCI: Add pcibios_add_device EFI: Stash ROMs if they're not in the PCI BAR PCI: Add and use standard PCI-X Capability register names PCI/PM: Keep runtime PM enabled for unbound PCI devices xen-pcifront: Handle backend CLOSED without CLOSING PCI: SRIOV control and status via sysfs (documentation) PCI/AER: Report success only when every device has AER-aware driver ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-bus-pci34
-rw-r--r--Documentation/PCI/pci-iov-howto.txt48
2 files changed, 78 insertions, 4 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index dff1f48d252d..1ce5ae329c04 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -222,3 +222,37 @@ Description:
222 satisfied too. Reading this attribute will show the current 222 satisfied too. Reading this attribute will show the current
223 value of d3cold_allowed bit. Writing this attribute will set 223 value of d3cold_allowed bit. Writing this attribute will set
224 the value of d3cold_allowed bit. 224 the value of d3cold_allowed bit.
225
226What: /sys/bus/pci/devices/.../sriov_totalvfs
227Date: November 2012
228Contact: Donald Dutile <ddutile@redhat.com>
229Description:
230 This file appears when a physical PCIe device supports SR-IOV.
231 Userspace applications can read this file to determine the
232 maximum number of Virtual Functions (VFs) a PCIe physical
233 function (PF) can support. Typically, this is the value reported
234 in the PF's SR-IOV extended capability structure's TotalVFs
235 element. Drivers have the ability at probe time to reduce the
236 value read from this file via the pci_sriov_set_totalvfs()
237 function.
238
239What: /sys/bus/pci/devices/.../sriov_numvfs
240Date: November 2012
241Contact: Donald Dutile <ddutile@redhat.com>
242Description:
243 This file appears when a physical PCIe device supports SR-IOV.
244 Userspace applications can read and write to this file to
245 determine and control the enablement or disablement of Virtual
246 Functions (VFs) on the physical function (PF). A read of this
247 file will return the number of VFs that are enabled on this PF.
248 A number written to this file will enable the specified
249 number of VFs. A userspace application would typically read the
250 file and check that the value is zero, and then write the number
251 of VFs that should be enabled on the PF; the value written
252 should be less than or equal to the value in the sriov_totalvfs
253 file. A userspace application wanting to disable the VFs would
254 write a zero to this file. The core ensures that valid values
255 are written to this file, and returns errors when values are not
256 valid. For example, writing a 2 to this file when sriov_numvfs
257 is not 0 and not 2 already will return an error. Writing a 10
258 when the value of sriov_totalvfs is 8 will return an error.
diff --git a/Documentation/PCI/pci-iov-howto.txt b/Documentation/PCI/pci-iov-howto.txt
index fc73ef5d65b8..cfaca7e69893 100644
--- a/Documentation/PCI/pci-iov-howto.txt
+++ b/Documentation/PCI/pci-iov-howto.txt
@@ -2,6 +2,9 @@
2 Copyright (C) 2009 Intel Corporation 2 Copyright (C) 2009 Intel Corporation
3 Yu Zhao <yu.zhao@intel.com> 3 Yu Zhao <yu.zhao@intel.com>
4 4
5 Update: November 2012
6 -- sysfs-based SRIOV enable-/disable-ment
7 Donald Dutile <ddutile@redhat.com>
5 8
61. Overview 91. Overview
7 10
@@ -24,10 +27,21 @@ real existing PCI device.
24 27
252.1 How can I enable SR-IOV capability 282.1 How can I enable SR-IOV capability
26 29
27The device driver (PF driver) will control the enabling and disabling 30Multiple methods are available for SR-IOV enablement.
28of the capability via API provided by SR-IOV core. If the hardware 31In the first method, the device driver (PF driver) will control the
29has SR-IOV capability, loading its PF driver would enable it and all 32enabling and disabling of the capability via API provided by SR-IOV core.
30VFs associated with the PF. 33If the hardware has SR-IOV capability, loading its PF driver would
34enable it and all VFs associated with the PF. Some PF drivers require
35a module parameter to be set to determine the number of VFs to enable.
36In the second method, a write to the sysfs file sriov_numvfs will
37enable and disable the VFs associated with a PCIe PF. This method
38enables per-PF, VF enable/disable values versus the first method,
39which applies to all PFs of the same device. Additionally, the
40PCI SRIOV core support ensures that enable/disable operations are
41valid to reduce duplication in multiple drivers for the same
42checks, e.g., check numvfs == 0 if enabling VFs, ensure
43numvfs <= totalvfs.
44The second method is the recommended method for new/future VF devices.
31 45
322.2 How can I use the Virtual Functions 462.2 How can I use the Virtual Functions
33 47
@@ -40,13 +54,22 @@ requires device driver that is same as a normal PCI device's.
403.1 SR-IOV API 543.1 SR-IOV API
41 55
42To enable SR-IOV capability: 56To enable SR-IOV capability:
57(a) For the first method, in the driver:
43 int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 58 int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
44 'nr_virtfn' is number of VFs to be enabled. 59 'nr_virtfn' is number of VFs to be enabled.
60(b) For the second method, from sysfs:
61 echo 'nr_virtfn' > \
62 /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_numvfs
45 63
46To disable SR-IOV capability: 64To disable SR-IOV capability:
65(a) For the first method, in the driver:
47 void pci_disable_sriov(struct pci_dev *dev); 66 void pci_disable_sriov(struct pci_dev *dev);
67(b) For the second method, from sysfs:
68 echo 0 > \
69 /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_numvfs
48 70
49To notify SR-IOV core of Virtual Function Migration: 71To notify SR-IOV core of Virtual Function Migration:
72(a) In the driver:
50 irqreturn_t pci_sriov_migration(struct pci_dev *dev); 73 irqreturn_t pci_sriov_migration(struct pci_dev *dev);
51 74
523.2 Usage example 753.2 Usage example
@@ -88,6 +111,22 @@ static void dev_shutdown(struct pci_dev *dev)
88 ... 111 ...
89} 112}
90 113
114static int dev_sriov_configure(struct pci_dev *dev, int numvfs)
115{
116 if (numvfs > 0) {
117 ...
118 pci_enable_sriov(dev, numvfs);
119 ...
120 return numvfs;
121 }
122 if (numvfs == 0) {
123 ....
124 pci_disable_sriov(dev);
125 ...
126 return 0;
127 }
128}
129
91static struct pci_driver dev_driver = { 130static struct pci_driver dev_driver = {
92 .name = "SR-IOV Physical Function driver", 131 .name = "SR-IOV Physical Function driver",
93 .id_table = dev_id_table, 132 .id_table = dev_id_table,
@@ -96,4 +135,5 @@ static struct pci_driver dev_driver = {
96 .suspend = dev_suspend, 135 .suspend = dev_suspend,
97 .resume = dev_resume, 136 .resume = dev_resume,
98 .shutdown = dev_shutdown, 137 .shutdown = dev_shutdown,
138 .sriov_configure = dev_sriov_configure,
99}; 139};