PCI: Expose PCIe Resizable BAR support via sysfs
[sfrench/cifs-2.6.git] / Documentation / ABI / testing / sysfs-bus-pci
index 6fc2c2efe8ab2655c9ce697865a45a0aaf1ec798..840727fc75dcf90347455225ca1df58dc80400ea 100644 (file)
@@ -457,3 +457,36 @@ Description:
 
                The file is writable if the PF is bound to a driver that
                implements ->sriov_set_msix_vec_count().
+
+What:          /sys/bus/pci/devices/.../resourceN_resize
+Date:          September 2022
+Contact:       Alex Williamson <alex.williamson@redhat.com>
+Description:
+               These files provide an interface to PCIe Resizable BAR support.
+               A file is created for each BAR resource (N) supported by the
+               PCIe Resizable BAR extended capability of the device.  Reading
+               each file exposes the bitmap of available resource sizes:
+
+               # cat resource1_resize
+               00000000000001c0
+
+               The bitmap represents supported resource sizes for the BAR,
+               where bit0 = 1MB, bit1 = 2MB, bit2 = 4MB, etc.  In the above
+               example the device supports 64MB, 128MB, and 256MB BAR sizes.
+
+               When writing the file, the user provides the bit position of
+               the desired resource size, for example:
+
+               # echo 7 > resource1_resize
+
+               This indicates to set the size value corresponding to bit 7,
+               128MB.  The resulting size is 2 ^ (bit# + 20).  This definition
+               matches the PCIe specification of this capability.
+
+               In order to make use of resource resizing, all PCI drivers must
+               be unbound from the device and peer devices under the same
+               parent bridge may need to be soft removed.  In the case of
+               VGA devices, writing a resize value will remove low level
+               console drivers from the device.  Raw users of pci-sysfs
+               resourceN attributes must be terminated prior to resizing.
+               Success of the resizing operation is not guaranteed.