xref: /linux/Documentation/ABI/testing/sysfs-bus-pci (revision 60675d4ca1ef0857e44eba5849b74a3a998d0c0f)
1d22157b3SChris WrightWhat:		/sys/bus/pci/drivers/.../bind
2bab2f3c1SMauro Carvalho ChehabWhat:		/sys/devices/pciX/.../bind
3d22157b3SChris WrightDate:		December 2003
4d22157b3SChris WrightContact:	linux-pci@vger.kernel.org
5d22157b3SChris WrightDescription:
6d22157b3SChris Wright		Writing a device location to this file will cause
7d22157b3SChris Wright		the driver to attempt to bind to the device found at
8d22157b3SChris Wright		this location.	This is useful for overriding default
9d22157b3SChris Wright		bindings.  The format for the location is: DDDD:BB:DD.F.
10d22157b3SChris Wright		That is Domain:Bus:Device.Function and is the same as
1154a19b4dSMauro Carvalho Chehab		found in /sys/bus/pci/devices/.  For example::
1254a19b4dSMauro Carvalho Chehab
13d22157b3SChris Wright		  # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/bind
1454a19b4dSMauro Carvalho Chehab
15d22157b3SChris Wright		(Note: kernels before 2.6.28 may require echo -n).
16d22157b3SChris Wright
17d22157b3SChris WrightWhat:		/sys/bus/pci/drivers/.../unbind
18bab2f3c1SMauro Carvalho ChehabWhat:		/sys/devices/pciX/.../unbind
19d22157b3SChris WrightDate:		December 2003
20d22157b3SChris WrightContact:	linux-pci@vger.kernel.org
21d22157b3SChris WrightDescription:
22d22157b3SChris Wright		Writing a device location to this file will cause the
23d22157b3SChris Wright		driver to attempt to unbind from the device found at
24d22157b3SChris Wright		this location.	This may be useful when overriding default
25d22157b3SChris Wright		bindings.  The format for the location is: DDDD:BB:DD.F.
26d22157b3SChris Wright		That is Domain:Bus:Device.Function and is the same as
2754a19b4dSMauro Carvalho Chehab		found in /sys/bus/pci/devices/. For example::
2854a19b4dSMauro Carvalho Chehab
29d22157b3SChris Wright		  # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/unbind
3054a19b4dSMauro Carvalho Chehab
31d22157b3SChris Wright		(Note: kernels before 2.6.28 may require echo -n).
32d22157b3SChris Wright
33d22157b3SChris WrightWhat:		/sys/bus/pci/drivers/.../new_id
34bab2f3c1SMauro Carvalho ChehabWhat:		/sys/devices/pciX/.../new_id
35d22157b3SChris WrightDate:		December 2003
36d22157b3SChris WrightContact:	linux-pci@vger.kernel.org
37d22157b3SChris WrightDescription:
38d22157b3SChris Wright		Writing a device ID to this file will attempt to
39d22157b3SChris Wright		dynamically add a new device ID to a PCI device driver.
40d22157b3SChris Wright		This may allow the driver to support more hardware than
41d22157b3SChris Wright		was included in the driver's static device ID support
42d22157b3SChris Wright		table at compile time.  The format for the device ID is:
43d22157b3SChris Wright		VVVV DDDD SVVV SDDD CCCC MMMM PPPP.  That is Vendor ID,
44d22157b3SChris Wright		Device ID, Subsystem Vendor ID, Subsystem Device ID,
45d22157b3SChris Wright		Class, Class Mask, and Private Driver Data.  The Vendor ID
46d22157b3SChris Wright		and Device ID fields are required, the rest are optional.
47d22157b3SChris Wright		Upon successfully adding an ID, the driver will probe
4854a19b4dSMauro Carvalho Chehab		for the device and attempt to bind to it.  For example::
4954a19b4dSMauro Carvalho Chehab
50d22157b3SChris Wright		  # echo "8086 10f5" > /sys/bus/pci/drivers/foo/new_id
51d22157b3SChris Wright
520994375eSChris WrightWhat:		/sys/bus/pci/drivers/.../remove_id
53bab2f3c1SMauro Carvalho ChehabWhat:		/sys/devices/pciX/.../remove_id
540994375eSChris WrightDate:		February 2009
550994375eSChris WrightContact:	Chris Wright <chrisw@sous-sol.org>
560994375eSChris WrightDescription:
570994375eSChris Wright		Writing a device ID to this file will remove an ID
580994375eSChris Wright		that was dynamically added via the new_id sysfs entry.
590994375eSChris Wright		The format for the device ID is:
600994375eSChris Wright		VVVV DDDD SVVV SDDD CCCC MMMM.	That is Vendor ID, Device
610994375eSChris Wright		ID, Subsystem Vendor ID, Subsystem Device ID, Class,
620994375eSChris Wright		and Class Mask.  The Vendor ID and Device ID fields are
630994375eSChris Wright		required, the rest are optional.  After successfully
640994375eSChris Wright		removing an ID, the driver will no longer support the
650994375eSChris Wright		device.  This is useful to ensure auto probing won't
6654a19b4dSMauro Carvalho Chehab		match the driver to the device.  For example::
6754a19b4dSMauro Carvalho Chehab
680994375eSChris Wright		  # echo "8086 10f5" > /sys/bus/pci/drivers/foo/remove_id
690994375eSChris Wright
70705b1aaaSAlex ChiangWhat:		/sys/bus/pci/rescan
71705b1aaaSAlex ChiangDate:		January 2009
72705b1aaaSAlex ChiangContact:	Linux PCI developers <linux-pci@vger.kernel.org>
73705b1aaaSAlex ChiangDescription:
74705b1aaaSAlex Chiang		Writing a non-zero value to this attribute will
75705b1aaaSAlex Chiang		force a rescan of all PCI buses in the system, and
76705b1aaaSAlex Chiang		re-discover previously removed devices.
77705b1aaaSAlex Chiang
78468ff15aSYijing WangWhat:		/sys/bus/pci/devices/.../msi_bus
79468ff15aSYijing WangDate:		September 2014
80468ff15aSYijing WangContact:	Linux PCI developers <linux-pci@vger.kernel.org>
81468ff15aSYijing WangDescription:
82468ff15aSYijing Wang		Writing a zero value to this attribute disallows MSI and
83468ff15aSYijing Wang		MSI-X for any future drivers of the device.  If the device
84468ff15aSYijing Wang		is a bridge, MSI and MSI-X will be disallowed for future
85468ff15aSYijing Wang		drivers of all child devices under the bridge.  Drivers
86468ff15aSYijing Wang		must be reloaded for the new setting to take effect.
87468ff15aSYijing Wang
88b50cac55SNeil HormanWhat:		/sys/bus/pci/devices/.../msi_irqs/
89b50cac55SNeil HormanDate:		September, 2011
90b50cac55SNeil HormanContact:	Neil Horman <nhorman@tuxdriver.com>
91b50cac55SNeil HormanDescription:
92b50cac55SNeil Horman		The /sys/devices/.../msi_irqs directory contains a variable set
931c51b50cSGreg Kroah-Hartman		of files, with each file being named after a corresponding msi
941c51b50cSGreg Kroah-Hartman		irq vector allocated to that device.
95b50cac55SNeil Horman
961c51b50cSGreg Kroah-HartmanWhat:		/sys/bus/pci/devices/.../msi_irqs/<N>
97b50cac55SNeil HormanDate:		September 2011
98b50cac55SNeil HormanContact:	Neil Horman <nhorman@tuxdriver.com>
99b50cac55SNeil HormanDescription:
100b50cac55SNeil Horman		This attribute indicates the mode that the irq vector named by
1011c51b50cSGreg Kroah-Hartman		the file is in (msi vs. msix)
102b50cac55SNeil Horman
1035e3be666SBarry SongWhat:		/sys/bus/pci/devices/.../irq
1045e3be666SBarry SongDate:		August 2021
1055e3be666SBarry SongContact:	Linux PCI developers <linux-pci@vger.kernel.org>
1065e3be666SBarry SongDescription:
1075e3be666SBarry Song		If a driver has enabled MSI (not MSI-X), "irq" contains the
1085e3be666SBarry Song		IRQ of the first MSI vector. Otherwise "irq" contains the
1095e3be666SBarry Song		IRQ of the legacy INTx interrupt.
1105e3be666SBarry Song
1115e3be666SBarry Song		"irq" being set to 0 indicates that the device isn't
1125e3be666SBarry Song		capable of generating legacy INTx interrupts.
1135e3be666SBarry Song
11477c27c7bSAlex ChiangWhat:		/sys/bus/pci/devices/.../remove
11577c27c7bSAlex ChiangDate:		January 2009
11677c27c7bSAlex ChiangContact:	Linux PCI developers <linux-pci@vger.kernel.org>
11777c27c7bSAlex ChiangDescription:
11877c27c7bSAlex Chiang		Writing a non-zero value to this attribute will
11977c27c7bSAlex Chiang		hot-remove the PCI device and any of its children.
12077c27c7bSAlex Chiang
121b9d320fcSYinghai LuWhat:		/sys/bus/pci/devices/.../pci_bus/.../rescan
122b9d320fcSYinghai LuDate:		May 2011
123b9d320fcSYinghai LuContact:	Linux PCI developers <linux-pci@vger.kernel.org>
124b9d320fcSYinghai LuDescription:
125b9d320fcSYinghai Lu		Writing a non-zero value to this attribute will
126b9d320fcSYinghai Lu		force a rescan of the bus and all child buses,
127b9d320fcSYinghai Lu		and re-discover devices removed earlier from this
12840b31360SStephen Rothwell		part of the device tree.
129b9d320fcSYinghai Lu
130738a6396SAlex ChiangWhat:		/sys/bus/pci/devices/.../rescan
131738a6396SAlex ChiangDate:		January 2009
132738a6396SAlex ChiangContact:	Linux PCI developers <linux-pci@vger.kernel.org>
133738a6396SAlex ChiangDescription:
134738a6396SAlex Chiang		Writing a non-zero value to this attribute will
135738a6396SAlex Chiang		force a rescan of the device's parent bus and all
136738a6396SAlex Chiang		child buses, and re-discover devices removed earlier
137738a6396SAlex Chiang		from this part of the device tree.
138738a6396SAlex Chiang
139d88f521dSAmey NarkhedeWhat:		/sys/bus/pci/devices/.../reset_method
140d88f521dSAmey NarkhedeDate:		August 2021
141d88f521dSAmey NarkhedeContact:	Amey Narkhede <ameynarkhede03@gmail.com>
142d88f521dSAmey NarkhedeDescription:
143d88f521dSAmey Narkhede		Some devices allow an individual function to be reset
144d88f521dSAmey Narkhede		without affecting other functions in the same slot.
145d88f521dSAmey Narkhede
146d88f521dSAmey Narkhede		For devices that have this support, a file named
147d88f521dSAmey Narkhede		reset_method is present in sysfs.  Reading this file
148d88f521dSAmey Narkhede		gives names of the supported and enabled reset methods and
149d88f521dSAmey Narkhede		their ordering.  Writing a space-separated list of names of
150d88f521dSAmey Narkhede		reset methods sets the reset methods and ordering to be
151d88f521dSAmey Narkhede		used when resetting the device.  Writing an empty string
152d88f521dSAmey Narkhede		disables the ability to reset the device.  Writing
153d88f521dSAmey Narkhede		"default" enables all supported reset methods in the
154d88f521dSAmey Narkhede		default ordering.
155d88f521dSAmey Narkhede
156711d5779SMichael S. TsirkinWhat:		/sys/bus/pci/devices/.../reset
157711d5779SMichael S. TsirkinDate:		July 2009
158711d5779SMichael S. TsirkinContact:	Michael S. Tsirkin <mst@redhat.com>
159711d5779SMichael S. TsirkinDescription:
160711d5779SMichael S. Tsirkin		Some devices allow an individual function to be reset
161711d5779SMichael S. Tsirkin		without affecting other functions in the same device.
162711d5779SMichael S. Tsirkin		For devices that have this support, a file named reset
163711d5779SMichael S. Tsirkin		will be present in sysfs.  Writing 1 to this file
164711d5779SMichael S. Tsirkin		will perform reset.
165711d5779SMichael S. Tsirkin
166*2fa04644SKeith BuschWhat:		/sys/bus/pci/devices/.../reset_subordinate
167*2fa04644SKeith BuschDate:		October 2024
168*2fa04644SKeith BuschContact:	linux-pci@vger.kernel.org
169*2fa04644SKeith BuschDescription:
170*2fa04644SKeith Busch		This is visible only for bridge devices. If you want to reset
171*2fa04644SKeith Busch		all devices attached through the subordinate bus of a specific
172*2fa04644SKeith Busch		bridge device, writing 1 to this will try to do it.  This will
173*2fa04644SKeith Busch		affect all devices attached to the system through this bridge
174*2fa04644SKeith Busch		similiar to writing 1 to their individual "reset" file, so use
175*2fa04644SKeith Busch		with caution.
176*2fa04644SKeith Busch
17794e61088SBen HutchingsWhat:		/sys/bus/pci/devices/.../vpd
17894e61088SBen HutchingsDate:		February 2008
179473153afSBen HutchingsContact:	Ben Hutchings <bwh@kernel.org>
18094e61088SBen HutchingsDescription:
18194e61088SBen Hutchings		A file named vpd in a device directory will be a
18294e61088SBen Hutchings		binary file containing the Vital Product Data for the
18394e61088SBen Hutchings		device.  It should follow the VPD format defined in
18494e61088SBen Hutchings		PCI Specification 2.1 or 2.2, but users should consider
1853e42d1deSCarlos Bilbao		that some devices may have incorrectly formatted data.
1863e42d1deSCarlos Bilbao		If the underlying VPD has a writable section then the
18794e61088SBen Hutchings		corresponding section of this file will be writable.
18801db4957SYu Zhao
18924d732a9SMauro Carvalho ChehabWhat:		/sys/bus/pci/devices/.../virtfn<N>
19001db4957SYu ZhaoDate:		March 2009
19101db4957SYu ZhaoContact:	Yu Zhao <yu.zhao@intel.com>
19201db4957SYu ZhaoDescription:
19301db4957SYu Zhao		This symbolic link appears when hardware supports the SR-IOV
19401db4957SYu Zhao		capability and the Physical Function driver has enabled it.
19501db4957SYu Zhao		The symbolic link points to the PCI device sysfs entry of the
19601db4957SYu Zhao		Virtual Function whose index is N (0...MaxVFs-1).
19701db4957SYu Zhao
19801db4957SYu ZhaoWhat:		/sys/bus/pci/devices/.../dep_link
19901db4957SYu ZhaoDate:		March 2009
20001db4957SYu ZhaoContact:	Yu Zhao <yu.zhao@intel.com>
20101db4957SYu ZhaoDescription:
20201db4957SYu Zhao		This symbolic link appears when hardware supports the SR-IOV
20301db4957SYu Zhao		capability and the Physical Function driver has enabled it,
20401db4957SYu Zhao		and this device has vendor specific dependencies with others.
20501db4957SYu Zhao		The symbolic link points to the PCI device sysfs entry of
20601db4957SYu Zhao		Physical Function this device depends on.
20701db4957SYu Zhao
20801db4957SYu ZhaoWhat:		/sys/bus/pci/devices/.../physfn
20901db4957SYu ZhaoDate:		March 2009
21001db4957SYu ZhaoContact:	Yu Zhao <yu.zhao@intel.com>
21101db4957SYu ZhaoDescription:
21201db4957SYu Zhao		This symbolic link appears when a device is a Virtual Function.
21301db4957SYu Zhao		The symbolic link points to the PCI device sysfs entry of the
21401db4957SYu Zhao		Physical Function this device associates with.
215c825bc94SKenji Kaneshige
2169919c339SMauro Carvalho ChehabWhat:		/sys/bus/pci/devices/.../modalias
2179919c339SMauro Carvalho ChehabDate:		May 2005
2189919c339SMauro Carvalho ChehabContact:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2199919c339SMauro Carvalho ChehabDescription:
2209919c339SMauro Carvalho Chehab		This attribute indicates the PCI ID of the device object.
2219919c339SMauro Carvalho Chehab
2229919c339SMauro Carvalho Chehab		That is in the format:
2239919c339SMauro Carvalho Chehab		pci:vXXXXXXXXdXXXXXXXXsvXXXXXXXXsdXXXXXXXXbcXXscXXiXX,
2249919c339SMauro Carvalho Chehab		where:
2259919c339SMauro Carvalho Chehab
2269919c339SMauro Carvalho Chehab		    - vXXXXXXXX contains the vendor ID;
2279919c339SMauro Carvalho Chehab		    - dXXXXXXXX contains the device ID;
2289919c339SMauro Carvalho Chehab		    - svXXXXXXXX contains the sub-vendor ID;
2299919c339SMauro Carvalho Chehab		    - sdXXXXXXXX contains the subsystem device ID;
2309919c339SMauro Carvalho Chehab		    - bcXX contains the device class;
2319919c339SMauro Carvalho Chehab		    - scXX contains the device subclass;
2329919c339SMauro Carvalho Chehab		    - iXX contains the device class programming interface.
2339919c339SMauro Carvalho Chehab
234c825bc94SKenji KaneshigeWhat:		/sys/bus/pci/slots/.../module
235c825bc94SKenji KaneshigeDate:		June 2009
236c825bc94SKenji KaneshigeContact:	linux-pci@vger.kernel.org
237c825bc94SKenji KaneshigeDescription:
238c825bc94SKenji Kaneshige		This symbolic link points to the PCI hotplug controller driver
239c825bc94SKenji Kaneshige		module that manages the hotplug slot.
240911e1c9bSNarendra K
241911e1c9bSNarendra KWhat:		/sys/bus/pci/devices/.../label
242911e1c9bSNarendra KDate:		July 2010
243911e1c9bSNarendra KContact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
244911e1c9bSNarendra KDescription:
245911e1c9bSNarendra K		Reading this attribute will provide the firmware
2466058989bSNarendra_K@Dell.com		given name (SMBIOS type 41 string or ACPI _DSM string) of
2476058989bSNarendra_K@Dell.com		the PCI device.	The attribute will be created only
2486058989bSNarendra_K@Dell.com		if the firmware	has given a name to the PCI device.
2496058989bSNarendra_K@Dell.com		ACPI _DSM string name will be given priority if the
2506058989bSNarendra_K@Dell.com		system firmware provides SMBIOS type 41 string also.
251911e1c9bSNarendra KUsers:
252911e1c9bSNarendra K		Userspace applications interested in knowing the
253911e1c9bSNarendra K		firmware assigned name of the PCI device.
254911e1c9bSNarendra K
255911e1c9bSNarendra KWhat:		/sys/bus/pci/devices/.../index
256911e1c9bSNarendra KDate:		July 2010
257911e1c9bSNarendra KContact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
258911e1c9bSNarendra KDescription:
25981bbf039SNiklas Schnelle		Reading this attribute will provide the firmware given instance
26081bbf039SNiklas Schnelle		number of the PCI device.  Depending on the platform this can
26181bbf039SNiklas Schnelle		be for example the SMBIOS type 41 device type instance or the
26281bbf039SNiklas Schnelle		user-defined ID (UID) on s390. The attribute will be created
26381bbf039SNiklas Schnelle		only if the firmware has given an instance number to the PCI
26481bbf039SNiklas Schnelle		device and that number is guaranteed to uniquely identify the
26581bbf039SNiklas Schnelle		device in the system.
266911e1c9bSNarendra KUsers:
267911e1c9bSNarendra K		Userspace applications interested in knowing the
268911e1c9bSNarendra K		firmware assigned device type instance of the PCI
269911e1c9bSNarendra K		device that can help in understanding the firmware
270911e1c9bSNarendra K		intended order of the PCI device.
2716058989bSNarendra_K@Dell.com
2726058989bSNarendra_K@Dell.comWhat:		/sys/bus/pci/devices/.../acpi_index
2736058989bSNarendra_K@Dell.comDate:		July 2010
2746058989bSNarendra_K@Dell.comContact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
2756058989bSNarendra_K@Dell.comDescription:
2766058989bSNarendra_K@Dell.com		Reading this attribute will provide the firmware
2776058989bSNarendra_K@Dell.com		given instance (ACPI _DSM instance number) of the PCI device.
2786058989bSNarendra_K@Dell.com		The attribute will be created only if the firmware has given
2796058989bSNarendra_K@Dell.com		an instance number to the PCI device. ACPI _DSM instance number
2806058989bSNarendra_K@Dell.com		will be given priority if the system firmware provides SMBIOS
2816058989bSNarendra_K@Dell.com		type 41 device type instance also.
2826058989bSNarendra_K@Dell.comUsers:
2836058989bSNarendra_K@Dell.com		Userspace applications interested in knowing the
2846058989bSNarendra_K@Dell.com		firmware assigned instance number of the PCI
2856058989bSNarendra_K@Dell.com		device that can help in understanding the firmware
2866058989bSNarendra_K@Dell.com		intended order of the PCI device.
287046c6531SHuang Ying
288046c6531SHuang YingWhat:		/sys/bus/pci/devices/.../d3cold_allowed
289046c6531SHuang YingDate:		July 2012
290046c6531SHuang YingContact:	Huang Ying <ying.huang@intel.com>
291046c6531SHuang YingDescription:
292046c6531SHuang Ying		d3cold_allowed is bit to control whether the corresponding PCI
293046c6531SHuang Ying		device can be put into D3Cold state.  If it is cleared, the
294046c6531SHuang Ying		device will never be put into D3Cold state.  If it is set, the
295046c6531SHuang Ying		device may be put into D3Cold state if other requirements are
296046c6531SHuang Ying		satisfied too.  Reading this attribute will show the current
297046c6531SHuang Ying		value of d3cold_allowed bit.  Writing this attribute will set
298046c6531SHuang Ying		the value of d3cold_allowed bit.
2992597ba76SDonald Dutile
3002597ba76SDonald DutileWhat:		/sys/bus/pci/devices/.../sriov_totalvfs
3012597ba76SDonald DutileDate:		November 2012
3022597ba76SDonald DutileContact:	Donald Dutile <ddutile@redhat.com>
3032597ba76SDonald DutileDescription:
3042597ba76SDonald Dutile		This file appears when a physical PCIe device supports SR-IOV.
3052597ba76SDonald Dutile		Userspace applications can read this file to determine the
3062597ba76SDonald Dutile		maximum number of Virtual Functions (VFs) a PCIe physical
3072597ba76SDonald Dutile		function (PF) can support. Typically, this is the value reported
3082597ba76SDonald Dutile		in the PF's SR-IOV extended capability structure's TotalVFs
3092597ba76SDonald Dutile		element.  Drivers have the ability at probe time to reduce the
3102597ba76SDonald Dutile		value read from this file via the pci_sriov_set_totalvfs()
3112597ba76SDonald Dutile		function.
3122597ba76SDonald Dutile
3132597ba76SDonald DutileWhat:		/sys/bus/pci/devices/.../sriov_numvfs
3142597ba76SDonald DutileDate:		November 2012
3152597ba76SDonald DutileContact:	Donald Dutile <ddutile@redhat.com>
3162597ba76SDonald DutileDescription:
3172597ba76SDonald Dutile		This file appears when a physical PCIe device supports SR-IOV.
3182597ba76SDonald Dutile		Userspace applications can read and write to this file to
3192597ba76SDonald Dutile		determine and control the enablement or disablement of Virtual
3202597ba76SDonald Dutile		Functions (VFs) on the physical function (PF). A read of this
3212597ba76SDonald Dutile		file will return the number of VFs that are enabled on this PF.
3222597ba76SDonald Dutile		A number written to this file will enable the specified
3232597ba76SDonald Dutile		number of VFs. A userspace application would typically read the
3242597ba76SDonald Dutile		file and check that the value is zero, and then write the number
3252597ba76SDonald Dutile		of VFs that should be enabled on the PF; the value written
3262597ba76SDonald Dutile		should be less than or equal to the value in the sriov_totalvfs
3272597ba76SDonald Dutile		file. A userspace application wanting to disable the VFs would
3282597ba76SDonald Dutile		write a zero to this file. The core ensures that valid values
3292597ba76SDonald Dutile		are written to this file, and returns errors when values are not
3302597ba76SDonald Dutile		valid.  For example, writing a 2 to this file when sriov_numvfs
3312597ba76SDonald Dutile		is not 0 and not 2 already will return an error. Writing a 10
3322597ba76SDonald Dutile		when the value of sriov_totalvfs is 8 will return an error.
333782a985dSAlex Williamson
334782a985dSAlex WilliamsonWhat:		/sys/bus/pci/devices/.../driver_override
335782a985dSAlex WilliamsonDate:		April 2014
336782a985dSAlex WilliamsonContact:	Alex Williamson <alex.williamson@redhat.com>
337782a985dSAlex WilliamsonDescription:
338782a985dSAlex Williamson		This file allows the driver for a device to be specified which
339782a985dSAlex Williamson		will override standard static and dynamic ID matching.  When
340782a985dSAlex Williamson		specified, only a driver with a name matching the value written
341782a985dSAlex Williamson		to driver_override will have an opportunity to bind to the
342782a985dSAlex Williamson		device.  The override is specified by writing a string to the
343782a985dSAlex Williamson		driver_override file (echo pci-stub > driver_override) and
344782a985dSAlex Williamson		may be cleared with an empty string (echo > driver_override).
345782a985dSAlex Williamson		This returns the device to standard matching rules binding.
346782a985dSAlex Williamson		Writing to driver_override does not automatically unbind the
347782a985dSAlex Williamson		device from its current driver or make any attempt to
348782a985dSAlex Williamson		automatically load the specified driver.  If no driver with a
349782a985dSAlex Williamson		matching name is currently loaded in the kernel, the device
350782a985dSAlex Williamson		will not bind to any driver.  This also allows devices to
351782a985dSAlex Williamson		opt-out of driver binding using a driver_override name such as
352782a985dSAlex Williamson		"none".  Only a single driver may be specified in the override,
353782a985dSAlex Williamson		there is no support for parsing delimiters.
35463692df1SPrarit Bhargava
35563692df1SPrarit BhargavaWhat:		/sys/bus/pci/devices/.../numa_node
35663692df1SPrarit BhargavaDate:		Oct 2014
35763692df1SPrarit BhargavaContact:	Prarit Bhargava <prarit@redhat.com>
35863692df1SPrarit BhargavaDescription:
35963692df1SPrarit Bhargava		This file contains the NUMA node to which the PCI device is
36063692df1SPrarit Bhargava		attached, or -1 if the node is unknown.  The initial value
36163692df1SPrarit Bhargava		comes from an ACPI _PXM method or a similar firmware
36263692df1SPrarit Bhargava		source.  If that is missing or incorrect, this file can be
36363692df1SPrarit Bhargava		written to override the node.  In that case, please report
36463692df1SPrarit Bhargava		a firmware bug to the system vendor.  Writing to this file
36563692df1SPrarit Bhargava		taints the kernel with TAINT_FIRMWARE_WORKAROUND, which
36663692df1SPrarit Bhargava		reduces the supportability of your system.
367702ed3beSEmil Velikov
368702ed3beSEmil VelikovWhat:		/sys/bus/pci/devices/.../revision
369702ed3beSEmil VelikovDate:		November 2016
370702ed3beSEmil VelikovContact:	Emil Velikov <emil.l.velikov@gmail.com>
371702ed3beSEmil VelikovDescription:
37288486beeSsayli karnik		This file contains the revision field of the PCI device.
373702ed3beSEmil Velikov		The value comes from device config space. The file is read only.
3740e7df224SBodong Wang
3750e7df224SBodong WangWhat:		/sys/bus/pci/devices/.../sriov_drivers_autoprobe
3760e7df224SBodong WangDate:		April 2017
3770e7df224SBodong WangContact:	Bodong Wang<bodong@mellanox.com>
3780e7df224SBodong WangDescription:
3790e7df224SBodong Wang		This file is associated with the PF of a device that
3800e7df224SBodong Wang		supports SR-IOV.  It determines whether newly-enabled VFs
3810e7df224SBodong Wang		are immediately bound to a driver.  It initially contains
3820e7df224SBodong Wang		1, which means the kernel automatically binds VFs to a
3830e7df224SBodong Wang		compatible driver immediately after they are enabled.  If
3840e7df224SBodong Wang		an application writes 0 to the file before enabling VFs,
3850e7df224SBodong Wang		the kernel will not bind VFs to a driver.
3860e7df224SBodong Wang
3870e7df224SBodong Wang		A typical use case is to write 0 to this file, then enable
3880e7df224SBodong Wang		VFs, then assign the newly-created VFs to virtual machines.
3890e7df224SBodong Wang		Note that changing this file does not affect already-
3900e7df224SBodong Wang		enabled VFs.  In this scenario, the user must first disable
3910e7df224SBodong Wang		the VFs, write 0 to sriov_drivers_autoprobe, then re-enable
3920e7df224SBodong Wang		the VFs.
3930e7df224SBodong Wang
3940e7df224SBodong Wang		This is similar to /sys/bus/pci/drivers_autoprobe, but
3950e7df224SBodong Wang		affects only the VFs associated with a specific PF.
396cbb8ca69SLogan Gunthorpe
397cbb8ca69SLogan GunthorpeWhat:		/sys/bus/pci/devices/.../p2pmem/size
398cbb8ca69SLogan GunthorpeDate:		November 2017
399cbb8ca69SLogan GunthorpeContact:	Logan Gunthorpe <logang@deltatee.com>
400cbb8ca69SLogan GunthorpeDescription:
401cbb8ca69SLogan Gunthorpe		If the device has any Peer-to-Peer memory registered, this
402cbb8ca69SLogan Gunthorpe	        file contains the total amount of memory that the device
403cbb8ca69SLogan Gunthorpe		provides (in decimal).
404cbb8ca69SLogan Gunthorpe
405cbb8ca69SLogan GunthorpeWhat:		/sys/bus/pci/devices/.../p2pmem/available
406cbb8ca69SLogan GunthorpeDate:		November 2017
407cbb8ca69SLogan GunthorpeContact:	Logan Gunthorpe <logang@deltatee.com>
408cbb8ca69SLogan GunthorpeDescription:
409cbb8ca69SLogan Gunthorpe		If the device has any Peer-to-Peer memory registered, this
410cbb8ca69SLogan Gunthorpe	        file contains the amount of memory that has not been
411cbb8ca69SLogan Gunthorpe		allocated (in decimal).
412cbb8ca69SLogan Gunthorpe
413cbb8ca69SLogan GunthorpeWhat:		/sys/bus/pci/devices/.../p2pmem/published
414cbb8ca69SLogan GunthorpeDate:		November 2017
415cbb8ca69SLogan GunthorpeContact:	Logan Gunthorpe <logang@deltatee.com>
416cbb8ca69SLogan GunthorpeDescription:
417cbb8ca69SLogan Gunthorpe		If the device has any Peer-to-Peer memory registered, this
418cbb8ca69SLogan Gunthorpe	        file contains a '1' if the memory has been published for
419cbb8ca69SLogan Gunthorpe		use outside the driver that owns the device.
42072ea91afSHeiner Kallweit
4216d4338cbSLogan GunthorpeWhat:		/sys/bus/pci/devices/.../p2pmem/allocate
4226d4338cbSLogan GunthorpeDate:		August 2022
4236d4338cbSLogan GunthorpeContact:	Logan Gunthorpe <logang@deltatee.com>
4246d4338cbSLogan GunthorpeDescription:
4256d4338cbSLogan Gunthorpe		This file allows mapping p2pmem into userspace. For each
4266d4338cbSLogan Gunthorpe		mmap() call on this file, the kernel will allocate a chunk
4276d4338cbSLogan Gunthorpe		of Peer-to-Peer memory for use in Peer-to-Peer transactions.
4286d4338cbSLogan Gunthorpe		This memory can be used in O_DIRECT calls to NVMe backed
4296d4338cbSLogan Gunthorpe		files for Peer-to-Peer copies.
4306d4338cbSLogan Gunthorpe
43172ea91afSHeiner KallweitWhat:		/sys/bus/pci/devices/.../link/clkpm
43272ea91afSHeiner Kallweit		/sys/bus/pci/devices/.../link/l0s_aspm
43372ea91afSHeiner Kallweit		/sys/bus/pci/devices/.../link/l1_aspm
43472ea91afSHeiner Kallweit		/sys/bus/pci/devices/.../link/l1_1_aspm
43572ea91afSHeiner Kallweit		/sys/bus/pci/devices/.../link/l1_2_aspm
43672ea91afSHeiner Kallweit		/sys/bus/pci/devices/.../link/l1_1_pcipm
43772ea91afSHeiner Kallweit		/sys/bus/pci/devices/.../link/l1_2_pcipm
43872ea91afSHeiner KallweitDate:		October 2019
43972ea91afSHeiner KallweitContact:	Heiner Kallweit <hkallweit1@gmail.com>
44072ea91afSHeiner KallweitDescription:	If ASPM is supported for an endpoint, these files can be
44172ea91afSHeiner Kallweit		used to disable or enable the individual power management
44272ea91afSHeiner Kallweit		states. Write y/1/on to enable, n/0/off to disable.
44380a129afSMaximilian Luz
44480a129afSMaximilian LuzWhat:		/sys/bus/pci/devices/.../power_state
44580a129afSMaximilian LuzDate:		November 2020
44680a129afSMaximilian LuzContact:	Linux PCI developers <linux-pci@vger.kernel.org>
44780a129afSMaximilian LuzDescription:
44880a129afSMaximilian Luz		This file contains the current PCI power state of the device.
44980a129afSMaximilian Luz		The value comes from the PCI kernel device state and can be one
45080a129afSMaximilian Luz		of: "unknown", "error", "D0", D1", "D2", "D3hot", "D3cold".
45180a129afSMaximilian Luz		The file is read only.
452c3d5c2d9SLeon Romanovsky
453c3d5c2d9SLeon RomanovskyWhat:		/sys/bus/pci/devices/.../sriov_vf_total_msix
454c3d5c2d9SLeon RomanovskyDate:		January 2021
455c3d5c2d9SLeon RomanovskyContact:	Leon Romanovsky <leonro@nvidia.com>
456c3d5c2d9SLeon RomanovskyDescription:
457c3d5c2d9SLeon Romanovsky		This file is associated with a SR-IOV physical function (PF).
458c3d5c2d9SLeon Romanovsky		It contains the total number of MSI-X vectors available for
459c3d5c2d9SLeon Romanovsky		assignment to all virtual functions (VFs) associated with PF.
460c3d5c2d9SLeon Romanovsky		The value will be zero if the device doesn't support this
461c3d5c2d9SLeon Romanovsky		functionality. For supported devices, the value will be
462c3d5c2d9SLeon Romanovsky		constant and won't be changed after MSI-X vectors assignment.
463c3d5c2d9SLeon Romanovsky
464c3d5c2d9SLeon RomanovskyWhat:		/sys/bus/pci/devices/.../sriov_vf_msix_count
465c3d5c2d9SLeon RomanovskyDate:		January 2021
466c3d5c2d9SLeon RomanovskyContact:	Leon Romanovsky <leonro@nvidia.com>
467c3d5c2d9SLeon RomanovskyDescription:
468c3d5c2d9SLeon Romanovsky		This file is associated with a SR-IOV virtual function (VF).
469c3d5c2d9SLeon Romanovsky		It allows configuration of the number of MSI-X vectors for
470c3d5c2d9SLeon Romanovsky		the VF. This allows devices that have a global pool of MSI-X
471c3d5c2d9SLeon Romanovsky		vectors to optimally divide them between VFs based on VF usage.
472c3d5c2d9SLeon Romanovsky
473c3d5c2d9SLeon Romanovsky		The values accepted are:
474c3d5c2d9SLeon Romanovsky		 * > 0 - this number will be reported as the Table Size in the
475c3d5c2d9SLeon Romanovsky			 VF's MSI-X capability
476c3d5c2d9SLeon Romanovsky		 * < 0 - not valid
477c3d5c2d9SLeon Romanovsky		 * = 0 - will reset to the device default value
478c3d5c2d9SLeon Romanovsky
479c3d5c2d9SLeon Romanovsky		The file is writable if the PF is bound to a driver that
480c3d5c2d9SLeon Romanovsky		implements ->sriov_set_msix_vec_count().
48191fa1277SAlex Williamson
48291fa1277SAlex WilliamsonWhat:		/sys/bus/pci/devices/.../resourceN_resize
48391fa1277SAlex WilliamsonDate:		September 2022
48491fa1277SAlex WilliamsonContact:	Alex Williamson <alex.williamson@redhat.com>
48591fa1277SAlex WilliamsonDescription:
48691fa1277SAlex Williamson		These files provide an interface to PCIe Resizable BAR support.
48791fa1277SAlex Williamson		A file is created for each BAR resource (N) supported by the
48891fa1277SAlex Williamson		PCIe Resizable BAR extended capability of the device.  Reading
48991fa1277SAlex Williamson		each file exposes the bitmap of available resource sizes:
49091fa1277SAlex Williamson
49191fa1277SAlex Williamson		# cat resource1_resize
49291fa1277SAlex Williamson		00000000000001c0
49391fa1277SAlex Williamson
49491fa1277SAlex Williamson		The bitmap represents supported resource sizes for the BAR,
49591fa1277SAlex Williamson		where bit0 = 1MB, bit1 = 2MB, bit2 = 4MB, etc.  In the above
49691fa1277SAlex Williamson		example the device supports 64MB, 128MB, and 256MB BAR sizes.
49791fa1277SAlex Williamson
49891fa1277SAlex Williamson		When writing the file, the user provides the bit position of
49991fa1277SAlex Williamson		the desired resource size, for example:
50091fa1277SAlex Williamson
50191fa1277SAlex Williamson		# echo 7 > resource1_resize
50291fa1277SAlex Williamson
50391fa1277SAlex Williamson		This indicates to set the size value corresponding to bit 7,
50491fa1277SAlex Williamson		128MB.  The resulting size is 2 ^ (bit# + 20).  This definition
50591fa1277SAlex Williamson		matches the PCIe specification of this capability.
50691fa1277SAlex Williamson
50791fa1277SAlex Williamson		In order to make use of resource resizing, all PCI drivers must
50891fa1277SAlex Williamson		be unbound from the device and peer devices under the same
50991fa1277SAlex Williamson		parent bridge may need to be soft removed.  In the case of
51091fa1277SAlex Williamson		VGA devices, writing a resize value will remove low level
51191fa1277SAlex Williamson		console drivers from the device.  Raw users of pci-sysfs
51291fa1277SAlex Williamson		resourceN attributes must be terminated prior to resizing.
51391fa1277SAlex Williamson		Success of the resizing operation is not guaranteed.
5144e893545SMariusz Tkaczyk
5154e893545SMariusz TkaczykWhat:		/sys/bus/pci/devices/.../leds/*:enclosure:*/brightness
5164e893545SMariusz TkaczykWhat:		/sys/class/leds/*:enclosure:*/brightness
5174e893545SMariusz TkaczykDate:		August 2024
5184e893545SMariusz TkaczykKernelVersion:	6.12
5194e893545SMariusz TkaczykDescription:
5204e893545SMariusz Tkaczyk		LED indications on PCIe storage enclosures which are controlled
5214e893545SMariusz Tkaczyk		through the NPEM interface (Native PCIe Enclosure Management,
5224e893545SMariusz Tkaczyk		PCIe r6.1 sec 6.28) are accessible as led class devices, both
5234e893545SMariusz Tkaczyk		below /sys/class/leds and below NPEM-capable PCI devices.
5244e893545SMariusz Tkaczyk
5254e893545SMariusz Tkaczyk		Although these led class devices could be manipulated manually,
5264e893545SMariusz Tkaczyk		in practice they are typically manipulated automatically by an
5274e893545SMariusz Tkaczyk		application such as ledmon(8).
5284e893545SMariusz Tkaczyk
5294e893545SMariusz Tkaczyk		The name of a led class device is as follows:
5304e893545SMariusz Tkaczyk		<bdf>:enclosure:<indication>
5314e893545SMariusz Tkaczyk		where:
5324e893545SMariusz Tkaczyk
5334e893545SMariusz Tkaczyk		- <bdf> is the domain, bus, device and function number
5344e893545SMariusz Tkaczyk		  (e.g. 10000:02:05.0)
5354e893545SMariusz Tkaczyk		- <indication> is a short description of the LED indication
5364e893545SMariusz Tkaczyk
5374e893545SMariusz Tkaczyk		Valid indications per PCIe r6.1 table 6-27 are:
5384e893545SMariusz Tkaczyk
5394e893545SMariusz Tkaczyk		- ok (drive is functioning normally)
5404e893545SMariusz Tkaczyk		- locate (drive is being identified by an admin)
5414e893545SMariusz Tkaczyk		- fail (drive is not functioning properly)
5424e893545SMariusz Tkaczyk		- rebuild (drive is part of an array that is rebuilding)
5434e893545SMariusz Tkaczyk		- pfa (drive is predicted to fail soon)
5444e893545SMariusz Tkaczyk		- hotspare (drive is marked to be used as a replacement)
5454e893545SMariusz Tkaczyk		- ica (drive is part of an array that is degraded)
5464e893545SMariusz Tkaczyk		- ifa (drive is part of an array that is failed)
5474e893545SMariusz Tkaczyk		- idt (drive is not the right type for the connector)
5484e893545SMariusz Tkaczyk		- disabled (drive is disabled, removal is safe)
5494e893545SMariusz Tkaczyk		- specific0 to specific7 (enclosure-specific indications)
5504e893545SMariusz Tkaczyk
5514e893545SMariusz Tkaczyk		Broadly, the indications fall into one of these categories:
5524e893545SMariusz Tkaczyk
5534e893545SMariusz Tkaczyk		- to signify drive state (ok, locate, fail, idt, disabled)
5544e893545SMariusz Tkaczyk		- to signify drive role or state in a software RAID array
5554e893545SMariusz Tkaczyk		  (rebuild, pfa, hotspare, ica, ifa)
5564e893545SMariusz Tkaczyk		- to signify any other role or state (specific0 to specific7)
5574e893545SMariusz Tkaczyk
5584e893545SMariusz Tkaczyk		Mandatory indications per PCIe r6.1 sec 7.9.19.2 comprise:
5594e893545SMariusz Tkaczyk		ok, locate, fail, rebuild. All others are optional.
5604e893545SMariusz Tkaczyk		A led class device is only visible if the corresponding
5614e893545SMariusz Tkaczyk		indication is supported by the device.
5624e893545SMariusz Tkaczyk
5634e893545SMariusz Tkaczyk		To manipulate the indications, write 0 (LED_OFF) or 1 (LED_ON)
5644e893545SMariusz Tkaczyk		to the "brightness" file. Note that manipulating an indication
5654e893545SMariusz Tkaczyk		may implicitly manipulate other indications at the vendor's
5664e893545SMariusz Tkaczyk		discretion. E.g. when the user lights up the "ok" indication,
5674e893545SMariusz Tkaczyk		the vendor may choose to automatically turn off the "fail"
5684e893545SMariusz Tkaczyk		indication. The current state of an indication can be
5694e893545SMariusz Tkaczyk		retrieved by reading its "brightness" file.
5704e893545SMariusz Tkaczyk
5714e893545SMariusz Tkaczyk		The PCIe Base Specification allows vendors leeway to choose
5724e893545SMariusz Tkaczyk		different colors or blinking patterns for the indications,
5734e893545SMariusz Tkaczyk		but they typically follow the IBPI standard. E.g. the "locate"
5744e893545SMariusz Tkaczyk		indication is usually presented as one or two LEDs blinking at
5754e893545SMariusz Tkaczyk		4 Hz frequency:
5764e893545SMariusz Tkaczyk		https://en.wikipedia.org/wiki/International_Blinking_Pattern_Interpretation
577759ec282SMariusz Tkaczyk
578759ec282SMariusz Tkaczyk		PCI Firmware Specification r3.3 sec 4.7 defines a DSM interface
579759ec282SMariusz Tkaczyk		to facilitate shared access by operating system and platform
580759ec282SMariusz Tkaczyk		firmware to a device's NPEM registers. The kernel will use
581759ec282SMariusz Tkaczyk		this DSM interface where available, instead of accessing NPEM
582759ec282SMariusz Tkaczyk		registers directly. The DSM interface does not support the
583759ec282SMariusz Tkaczyk		enclosure-specific indications "specific0" to "specific7",
584759ec282SMariusz Tkaczyk		hence the corresponding led class devices are unavailable if
585759ec282SMariusz Tkaczyk		the DSM interface is used.
586