xref: /openbmc/linux/Documentation/PCI/endpoint/pci-vntb-function.rst (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
14ac8c8e5SFrank Li.. SPDX-License-Identifier: GPL-2.0
24ac8c8e5SFrank Li
34ac8c8e5SFrank Li=================
44ac8c8e5SFrank LiPCI vNTB Function
54ac8c8e5SFrank Li=================
64ac8c8e5SFrank Li
74ac8c8e5SFrank Li:Author: Frank Li <Frank.Li@nxp.com>
84ac8c8e5SFrank Li
94ac8c8e5SFrank LiThe difference between PCI NTB function and PCI vNTB function is
104ac8c8e5SFrank Li
114ac8c8e5SFrank LiPCI NTB function need at two endpoint instances and connect HOST1
124ac8c8e5SFrank Liand HOST2.
134ac8c8e5SFrank Li
144ac8c8e5SFrank LiPCI vNTB function only use one host and one endpoint(EP), use NTB
154ac8c8e5SFrank Liconnect EP and PCI host
164ac8c8e5SFrank Li
174ac8c8e5SFrank Li.. code-block:: text
184ac8c8e5SFrank Li
194ac8c8e5SFrank Li
204ac8c8e5SFrank Li  +------------+         +---------------------------------------+
214ac8c8e5SFrank Li  |            |         |                                       |
224ac8c8e5SFrank Li  +------------+         |                        +--------------+
234ac8c8e5SFrank Li  | NTB        |         |                        | NTB          |
244ac8c8e5SFrank Li  | NetDev     |         |                        | NetDev       |
254ac8c8e5SFrank Li  +------------+         |                        +--------------+
264ac8c8e5SFrank Li  | NTB        |         |                        | NTB          |
274ac8c8e5SFrank Li  | Transfer   |         |                        | Transfer     |
284ac8c8e5SFrank Li  +------------+         |                        +--------------+
294ac8c8e5SFrank Li  |            |         |                        |              |
304ac8c8e5SFrank Li  |  PCI NTB   |         |                        |              |
314ac8c8e5SFrank Li  |    EPF     |         |                        |              |
324ac8c8e5SFrank Li  |   Driver   |         |                        | PCI Virtual  |
334ac8c8e5SFrank Li  |            |         +---------------+        | NTB Driver   |
344ac8c8e5SFrank Li  |            |         | PCI EP NTB    |<------>|              |
354ac8c8e5SFrank Li  |            |         |  FN Driver    |        |              |
364ac8c8e5SFrank Li  +------------+         +---------------+        +--------------+
374ac8c8e5SFrank Li  |            |         |               |        |              |
384ac8c8e5SFrank Li  |  PCI BUS   | <-----> |  PCI EP BUS   |        |  Virtual PCI |
394ac8c8e5SFrank Li  |            |  PCI    |               |        |     BUS      |
404ac8c8e5SFrank Li  +------------+         +---------------+--------+--------------+
414ac8c8e5SFrank Li      PCI RC                        PCI EP
424ac8c8e5SFrank Li
434ac8c8e5SFrank LiConstructs used for Implementing vNTB
444ac8c8e5SFrank Li=====================================
454ac8c8e5SFrank Li
464ac8c8e5SFrank Li	1) Config Region
474ac8c8e5SFrank Li	2) Self Scratchpad Registers
484ac8c8e5SFrank Li	3) Peer Scratchpad Registers
494ac8c8e5SFrank Li	4) Doorbell (DB) Registers
504ac8c8e5SFrank Li	5) Memory Window (MW)
514ac8c8e5SFrank Li
524ac8c8e5SFrank Li
534ac8c8e5SFrank LiConfig Region:
544ac8c8e5SFrank Li--------------
554ac8c8e5SFrank Li
564ac8c8e5SFrank LiIt is same as PCI NTB Function driver
574ac8c8e5SFrank Li
584ac8c8e5SFrank LiScratchpad Registers:
594ac8c8e5SFrank Li---------------------
604ac8c8e5SFrank Li
614ac8c8e5SFrank LiIt is appended after Config region.
62*e9ac6e33SBagas Sanjaya
63*e9ac6e33SBagas Sanjaya.. code-block:: text
64*e9ac6e33SBagas Sanjaya
654ac8c8e5SFrank Li
664ac8c8e5SFrank Li  +--------------------------------------------------+ Base
674ac8c8e5SFrank Li  |                                                  |
684ac8c8e5SFrank Li  |                                                  |
694ac8c8e5SFrank Li  |                                                  |
704ac8c8e5SFrank Li  |          Common Config Register                  |
714ac8c8e5SFrank Li  |                                                  |
724ac8c8e5SFrank Li  |                                                  |
734ac8c8e5SFrank Li  |                                                  |
744ac8c8e5SFrank Li  +-----------------------+--------------------------+ Base + span_offset
754ac8c8e5SFrank Li  |                       |                          |
764ac8c8e5SFrank Li  |    Peer Span Space    |    Span Space            |
774ac8c8e5SFrank Li  |                       |                          |
784ac8c8e5SFrank Li  |                       |                          |
794ac8c8e5SFrank Li  +-----------------------+--------------------------+ Base + span_offset
804ac8c8e5SFrank Li  |                       |                          |      + span_count * 4
814ac8c8e5SFrank Li  |                       |                          |
824ac8c8e5SFrank Li  |     Span Space        |   Peer Span Space        |
834ac8c8e5SFrank Li  |                       |                          |
844ac8c8e5SFrank Li  +-----------------------+--------------------------+
854ac8c8e5SFrank Li        Virtual PCI             Pcie Endpoint
864ac8c8e5SFrank Li        NTB Driver               NTB Driver
874ac8c8e5SFrank Li
884ac8c8e5SFrank Li
894ac8c8e5SFrank LiDoorbell Registers:
904ac8c8e5SFrank Li-------------------
914ac8c8e5SFrank Li
924ac8c8e5SFrank Li  Doorbell Registers are used by the hosts to interrupt each other.
934ac8c8e5SFrank Li
944ac8c8e5SFrank LiMemory Window:
954ac8c8e5SFrank Li--------------
964ac8c8e5SFrank Li
974ac8c8e5SFrank Li  Actual transfer of data between the two hosts will happen using the
984ac8c8e5SFrank Li  memory window.
994ac8c8e5SFrank Li
1004ac8c8e5SFrank LiModeling Constructs:
1014ac8c8e5SFrank Li====================
1024ac8c8e5SFrank Li
1034ac8c8e5SFrank Li32-bit BARs.
1044ac8c8e5SFrank Li
1054ac8c8e5SFrank Li======  ===============
1064ac8c8e5SFrank LiBAR NO  CONSTRUCTS USED
1074ac8c8e5SFrank Li======  ===============
1084ac8c8e5SFrank LiBAR0    Config Region
1094ac8c8e5SFrank LiBAR1    Doorbell
1104ac8c8e5SFrank LiBAR2    Memory Window 1
1114ac8c8e5SFrank LiBAR3    Memory Window 2
1124ac8c8e5SFrank LiBAR4    Memory Window 3
1134ac8c8e5SFrank LiBAR5    Memory Window 4
1144ac8c8e5SFrank Li======  ===============
1154ac8c8e5SFrank Li
1164ac8c8e5SFrank Li64-bit BARs.
1174ac8c8e5SFrank Li
1184ac8c8e5SFrank Li======  ===============================
1194ac8c8e5SFrank LiBAR NO  CONSTRUCTS USED
1204ac8c8e5SFrank Li======  ===============================
1214ac8c8e5SFrank LiBAR0    Config Region + Scratchpad
1224ac8c8e5SFrank LiBAR1
1234ac8c8e5SFrank LiBAR2    Doorbell
1244ac8c8e5SFrank LiBAR3
1254ac8c8e5SFrank LiBAR4    Memory Window 1
1264ac8c8e5SFrank LiBAR5
1274ac8c8e5SFrank Li======  ===============================
1284ac8c8e5SFrank Li
1294ac8c8e5SFrank Li
130