Add a concrete example showing how to pack multiple memory windows into
a single BAR by using 'mwN_bar' and 'mwN_offset'.

Signed-off-by: Koichiro Den <[email protected]>
---
 Documentation/PCI/endpoint/pci-vntb-howto.rst | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/Documentation/PCI/endpoint/pci-vntb-howto.rst 
b/Documentation/PCI/endpoint/pci-vntb-howto.rst
index 3679f5c30254..097826f946a9 100644
--- a/Documentation/PCI/endpoint/pci-vntb-howto.rst
+++ b/Documentation/PCI/endpoint/pci-vntb-howto.rst
@@ -90,9 +90,9 @@ of the function device and is populated with the following 
NTB specific
 attributes that can be configured by the user::
 
        # ls functions/pci_epf_vntb/func1/pci_epf_vntb.0/
-       ctrl_bar  db_count  mw1_bar  mw2_bar  mw3_bar  mw4_bar  spad_count
-       db_bar    mw1       mw2      mw3      mw4      num_mws  vbus_number
-       vntb_vid  vntb_pid
+       ctrl_bar  mw1         mw2         mw3         mw4         num_mws      
vntb_pid
+       db_bar    mw1_bar     mw2_bar     mw3_bar     mw4_bar     spad_count   
vntb_vid
+       db_count  mw1_offset  mw2_offset  mw3_offset  mw4_offset  vbus_number
 
 A sample configuration for NTB function is given below::
 
@@ -111,6 +111,19 @@ A sample configuration for virtual NTB driver for virtual 
PCI bus::
        # echo 0x080A > functions/pci_epf_vntb/func1/pci_epf_vntb.0/vntb_pid
        # echo 0x10 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/vbus_number
 
+When BAR resources are tight but you still need to create many memory
+windows, you can pack multiple windows into a single BAR by setting
+``mwN_bar`` to the same BAR number and using ``mwN_offset`` to place each
+MW within that BAR. Offsets are in bytes and the resulting regions must not
+overlap and must exactly fit within the BAR size. This may fail depending
+on the underlying EPC capabilities::
+
+       # echo 0xE0000 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/mw1
+       # echo 0x20000 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/mw2
+       # echo 0xE0000 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/mw2_offset
+       # echo 2 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/mw1_bar
+       # echo 2 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/mw2_bar
+
 Binding pci-epf-vntb Device to EP Controller
 --------------------------------------------
 
-- 
2.51.0


Reply via email to