Skip to contentSkip to conversation

PCI: endpoint: pci-epf-test: Allow overriding default BAR sizes

PATCH Superseded Niklas Cassel 1 participant 1 message Jan 28

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 PCI: endpoint: pci-epf-test: Allow overriding default BAR sizes

Add bar{0,1,2,3,4,5}_size attributes in configfs, so that the user is not restricted to run pci-epf-test with the hardcoded BAR size values defined in pci-epf-test.c.

This code is shamelessly more or less copy pasted from pci-epf-vntb.c

---
Changes since V2:
-Document that BAR sizes can only be changed before binding the EPF to an
EPC.
-Make the code return -EINVAL if trying to change a BAR size after binding
the EPF to an EPC.

 Documentation/PCI/endpoint/pci-test-howto.rst | 19 ++++
 drivers/pci/endpoint/functions/pci-epf-test.c | 99 ++++++++++++++++++-
 2 files changed, 116 insertions(+), 2 deletions(-)
Documentation/PCI/endpoint/pci-test-howto.rst +19 -0
index dd66858cde46..cf38daa512ea 100644
@@ -84,6 +84,25 @@ device, the following commands can be used::
 	# echo 32 > functions/pci_epf_test/func1/msi_interrupts
 	# echo 2048 > functions/pci_epf_test/func1/msix_interrupts
 
+By default, pci-epf-test uses the following BAR sizes::
+
+	# grep . functions/pci_epf_test/func1/pci_epf_test.0/bar?_size
+	  functions/pci_epf_test/func1/pci_epf_test.0/bar0_size:131072
+	  functions/pci_epf_test/func1/pci_epf_test.0/bar1_size:131072
+	  functions/pci_epf_test/func1/pci_epf_test.0/bar2_size:131072
+	  functions/pci_epf_test/func1/pci_epf_test.0/bar3_size:131072
+	  functions/pci_epf_test/func1/pci_epf_test.0/bar4_size:131072
+	  functions/pci_epf_test/func1/pci_epf_test.0/bar5_size:1048576
+
+The user can override a default value using e.g.::
+	# echo 1048576 > functions/pci_epf_test/func1/pci_epf_test.0/bar1_size
+
+Overriding the default BAR sizes can only be done before binding the
+pci-epf-test device to a PCI endpoint controller driver.
+
+Note: Some endpoint controllers might have fixed size BARs, or reserved BARs,
+for such controllers, the corresponding BAR size in configfs will be ignored.
+
 
 Binding pci-epf-test Device to EP Controller
 --------------------------------------------
drivers/pci/endpoint/functions/pci-epf-test.c +97 -2

147 lines not on this page · raw message

base-commit: 0ebf8e7943e01b2c38c199228f51adbb89c02425

Signature · 1 line
2.52.0