Skip to contentSkip to conversation

PCI-Express Non-Transparent Bridge Support

RFC Superseded Jon Mason 2 participants 5 messages Sep 21, 2012

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

v3 cover PCI-Express Non-Transparent Bridge Support

Version 3 of the patch that adds support for PCI-Express Non-Transparent Bridges in Linux. This version incorporates changes to conform NTB and client devices to the Linux device model (per Greg KH's request).

Thanks,
Jon

author
#1 lore raw

RFC v3 1/2 PCI-Express Non-Transparent Bridge Support

A PCI-Express non-transparent bridge (NTB) is a point-to-point PCIe bus connecting 2 systems, providing electrical isolation between the two subsystems. A non-transparent bridge is functionally similar to a transparent bridge except that both sides of the bridge have their own independent address domains. The host on one side of the bridge will not have the visibility of the complete memory or I/O space on the other side of the bridge. To communicate across the non-transparent bridge, each NTB endpoint has one (or more) apertures exposed to the local system. Writes to these apertures are mirrored to memory on the remote system. Communications can also occur through the use of doorbell registers that initiate interrupts to the alternate domain, and scratch-pad registers accessible from both sides.

The NTB device driver is needed to configure these memory windows, doorbell, and scratch-pad registers as well as use them in such a way as they can be turned into a viable communication channel to the remote system. ntb_hw.[ch] determines the usage model (NTB to NTB or NTB to Root Port) and abstracts away the underlying hardware to provide access and a common interface to the doorbell registers, scratch pads, and memory windows. These hardware interfaces are exported so that other, non-mainlined kernel drivers can access these. ntb_transport.[ch] also uses the exported interfaces in ntb_hw.[ch] to setup a communication channel(s) and provide a reliable way of transferring data from one side to the other, which it then exports so that "client" drivers can access them. These client drivers are used to provide a standard kernel interface (i.e., Ethernet device) to NTB, such that Linux can transfer data from one system to the other in a standard way.

---
 MAINTAINERS                 |    6 +
 drivers/Kconfig             |    2 +
 drivers/Makefile            |    1 +
 drivers/ntb/Kconfig         |   13 +
 drivers/ntb/Makefile        |    3 +
 drivers/ntb/ntb_hw.c        | 1167 ++++++++++++++++++++++++++++++++++
 drivers/ntb/ntb_hw.h        |  195 ++++++
 drivers/ntb/ntb_regs.h      |  139 +++++
 drivers/ntb/ntb_transport.c | 1452 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/ntb.h         |   81 +++
 10 files changed, 3059 insertions(+)
 create mode 100644 drivers/ntb/Kconfig
 create mode 100644 drivers/ntb/Makefile
 create mode 100644 drivers/ntb/ntb_hw.c
 create mode 100644 drivers/ntb/ntb_hw.h
 create mode 100644 drivers/ntb/ntb_regs.h
 create mode 100644 drivers/ntb/ntb_transport.c
 create mode 100644 include/linux/ntb.h
MAINTAINERS +6 -0
index 53cc13c..a634314 100644
@@ -4849,6 +4849,12 @@ S:	Maintained
 F:	Documentation/scsi/NinjaSCSI.txt
 F:	drivers/scsi/nsp32*
 
+NTB DRIVER
+M:	Jon Mason <[email protected]>
+S:	Supported
+F:	drivers/ntb/
+F:	include/linux/ntb.h
+
 NTFS FILESYSTEM
 M:	Anton Altaparmakov <[email protected]>
 L:	[email protected]
drivers/Kconfig +2 -0
index ece958d..dccaa52 100644
@@ -152,4 +152,6 @@ source "drivers/vme/Kconfig"
 
 source "drivers/pwm/Kconfig"
 
+source "drivers/ntb/Kconfig"
+
 endmenu
drivers/Makefile +1 -0
index 5b42184..dfa5978 100644
@@ -139,3 +139,4 @@ obj-$(CONFIG_EXTCON)		+= extcon/
 obj-$(CONFIG_MEMORY)		+= memory/
 obj-$(CONFIG_IIO)		+= iio/
 obj-$(CONFIG_VME_BUS)		+= vme/
+obj-$(CONFIG_NTB)		+= ntb/
drivers/ntb/Kconfig new file +13 -0
new file mode 100644
index 0000000..f69df793
@@ -0,0 +1,13 @@
+config NTB
+       tristate "Intel Non-Transparent Bridge support"
+       depends on PCI
+       depends on X86
+       help
+        The PCI-E Non-transparent bridge hardware is a point-to-point PCI-E bus
+        connecting 2 systems.  When configured, writes to the device's PCI
+        mapped memory will be mirrored to a buffer on the remote system.  The
+        ntb Linux driver uses this point-to-point communication as a method to
+        transfer data from one system to the other.
+
+        If unsure, say N.
+
drivers/ntb/Makefile new file +3 -0
new file mode 100644
index 0000000..15cb59f
@@ -0,0 +1,3 @@
+obj-$(CONFIG_NTB) += ntb.o
+
+ntb-objs := ntb_hw.o ntb_transport.o
drivers/ntb/ntb_hw.c new file +1167 -0

1,167 lines not on this page · raw message

drivers/ntb/ntb_hw.h new file +195 -0

195 lines not on this page · raw message

drivers/ntb/ntb_regs.h new file +139 -0

139 lines not on this page · raw message

drivers/ntb/ntb_transport.c new file +1452 -0

1,452 lines not on this page · raw message

include/linux/ntb.h new file +81 -0

9 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.9.5

Part of the diff is not shown here. View the raw message.

author
#4 lore raw

RFC v3 2/2 net: Add support for NTB virtual ethernet device

In reply to Jon Mason

A virtual ethernet device that uses the NTB transport API to send/receive data.

---
 drivers/net/Kconfig      |    4 +
 drivers/net/Makefile     |    1 +
 drivers/net/ntb_netdev.c |  407 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 412 insertions(+)
 create mode 100644 drivers/net/ntb_netdev.c
drivers/net/Kconfig +4 -0
index 0c2bd80..9bf8a71 100644
@@ -178,6 +178,10 @@ config NETPOLL_TRAP
 config NET_POLL_CONTROLLER
 	def_bool NETPOLL
 
+config NTB_NETDEV
+	tristate "Virtual Ethernet over NTB"
+	depends on NTB
+
 config RIONET
 	tristate "RapidIO Ethernet over messaging driver support"
 	depends on RAPIDIO
drivers/net/Makefile +1 -0
index 3d375ca..9890148 100644
@@ -69,3 +69,4 @@ obj-$(CONFIG_USB_IPHETH)        += usb/
 obj-$(CONFIG_USB_CDC_PHONET)   += usb/
 
 obj-$(CONFIG_HYPERV_NET) += hyperv/
+obj-$(CONFIG_NTB_NETDEV) += ntb_netdev.o
drivers/net/ntb_netdev.c new file +407 -0

407 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#2 lore raw
In reply to Jon Mason

From: Jon Mason <[email protected]>
Date: Fri, 21 Sep 2012 11:09:48 -0700

Quoted 26 lines

A PCI-Express non-transparent bridge (NTB) is a point-to-point PCIe bus connecting 2 systems, providing electrical isolation between the two subsystems. A non-transparent bridge is functionally similar to a transparent bridge except that both sides of the bridge have their own independent address domains. The host on one side of the bridge will not have the visibility of the complete memory or I/O space on the other side of the bridge. To communicate across the non-transparent bridge, each NTB endpoint has one (or more) apertures exposed to the local system. Writes to these apertures are mirrored to memory on the remote system. Communications can also occur through the use of doorbell registers that initiate interrupts to the alternate domain, and scratch-pad registers accessible from both sides.

The NTB device driver is needed to configure these memory windows, doorbell, and scratch-pad registers as well as use them in such a way as they can be turned into a viable communication channel to the remote system. ntb_hw.[ch] determines the usage model (NTB to NTB or NTB to Root Port) and abstracts away the underlying hardware to provide access and a common interface to the doorbell registers, scratch pads, and memory windows. These hardware interfaces are exported so that other, non-mainlined kernel drivers can access these. ntb_transport.[ch] also uses the exported interfaces in ntb_hw.[ch] to setup a communication channel(s) and provide a reliable way of transferring data from one side to the other, which it then exports so that "client" drivers can access them. These client drivers are used to provide a standard kernel interface (i.e., Ethernet device) to NTB, such that Linux can transfer data from one system to the other in a standard way.

Quoted 1 line

I really don't see anything that requires the TX networking processing to occur in a tasklet. I see no sleeping, strange locking, or anything like that.

And if that's the case, it's just pure overhead.

author
#3 lore raw
Quoted 29 lines · David Miller

From: Jon Mason <[email protected]>
Date: Fri, 21 Sep 2012 11:09:48 -0700

Quoted 26 lines

A PCI-Express non-transparent bridge (NTB) is a point-to-point PCIe bus connecting 2 systems, providing electrical isolation between the two subsystems. A non-transparent bridge is functionally similar to a transparent bridge except that both sides of the bridge have their own independent address domains. The host on one side of the bridge will not have the visibility of the complete memory or I/O space on the other side of the bridge. To communicate across the non-transparent bridge, each NTB endpoint has one (or more) apertures exposed to the local system. Writes to these apertures are mirrored to memory on the remote system. Communications can also occur through the use of doorbell registers that initiate interrupts to the alternate domain, and scratch-pad registers accessible from both sides.

The NTB device driver is needed to configure these memory windows, doorbell, and scratch-pad registers as well as use them in such a way as they can be turned into a viable communication channel to the remote system. ntb_hw.[ch] determines the usage model (NTB to NTB or NTB to Root Port) and abstracts away the underlying hardware to provide access and a common interface to the doorbell registers, scratch pads, and memory windows. These hardware interfaces are exported so that other, non-mainlined kernel drivers can access these. ntb_transport.[ch] also uses the exported interfaces in ntb_hw.[ch] to setup a communication channel(s) and provide a reliable way of transferring data from one side to the other, which it then exports so that "client" drivers can access them. These client drivers are used to provide a standard kernel interface (i.e., Ethernet device) to NTB, such that Linux can transfer data from one system to the other in a standard way.

Quoted 7 lines
Quoted 1 line

I really don't see anything that requires the TX networking processing to occur in a tasklet. I see no sleeping, strange locking, or anything like that.

And if that's the case, it's just pure overhead.

Good point. Removed (and I see a nice little perf bump).

Thanks,
Jon