Skip to contentSkip to conversation

PCI-Express Non-Transparent Bridge Support

PATCH In review Jon Mason 3 participants 5 messages Nov 17, 2012 – Jan 18, 2013

Subsystems (4)
lore
Share & tools
lore

Jon Mason

author
#0 lore raw

v6 cover PCI-Express Non-Transparent Bridge Support

I am submitting version 6 of the PCI-Express Non-Transparent Bridge patches for inclusion in 3.8 via Greg KH's char-misc-next tree. All outstanding issues have been addressed.

Version 6 corrects Greg KH's issues, most notably the improper usage of the Linux device model.
http://thread.gmane.org/gmane.linux.kernel.pci/18599

Thanks,
Jon

author
#1 lore raw

PATCH v6 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        | 1157 +++++++++++++++++++++++++++++++++++
 drivers/ntb/ntb_hw.h        |  181 ++++++
 drivers/ntb/ntb_regs.h      |  139 +++++
 drivers/ntb/ntb_transport.c | 1427 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/ntb.h         |   83 +++
 10 files changed, 3012 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 bb0b27d..b6139ad 100644
@@ -5193,6 +5193,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 dbdefa3..7992e69 100644
@@ -150,6 +150,8 @@ source "drivers/memory/Kconfig"
 
 source "drivers/iio/Kconfig"
 
+source "drivers/ntb/Kconfig"
+
 source "drivers/vme/Kconfig"
 
 source "drivers/pwm/Kconfig"
drivers/Makefile +1 -0
index a16a8d0..fdafa34 100644
@@ -145,3 +145,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 +1157 -0

1,157 lines not on this page · raw message

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

181 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 +1427 -0

1,427 lines not on this page · raw message

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

56 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.

#2 lore raw
Quoted 26 lines · Jon Mason

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 2 lines

Sorry for the very long delay, I've now applied these two patches, thanks for the cleanups and changes from the original versions.

But, I now get the following build warning, so can you send a follow-on patch that fixes it up before you start getting angry emails from the 0-day build bot?

drivers/ntb/ntb_transport.c: In function ‘ntb_transport_rx’:
drivers/ntb/ntb_transport.c:895:7: warning: ‘offset’ may be used uninitialized in this function [-Wuninitialized] drivers/ntb/ntb_transport.c:891:8: note: ‘offset’ was declared here

thanks,

greg k-h

author
#3 lore raw

PATCH v6 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.

---
 MAINTAINERS              |    1 +
 drivers/net/Kconfig      |    4 +
 drivers/net/Makefile     |    1 +
 drivers/net/ntb_netdev.c |  419 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 425 insertions(+)
 create mode 100644 drivers/net/ntb_netdev.c
MAINTAINERS +1 -0
index b6139ad..e4e7652 100644
@@ -5197,6 +5197,7 @@ NTB DRIVER
 M:	Jon Mason <[email protected]>
 S:	Supported
 F:	drivers/ntb/
+F:	drivers/net/ntb_netdev.c
 F:	include/linux/ntb.h
 
 NTFS FILESYSTEM
drivers/net/Kconfig +4 -0
index 6a70184..5db9acb 100644
@@ -189,6 +189,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 335db78..ef3d090 100644
@@ -71,3 +71,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 +419 -0

419 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer Acked-by on the v6 series
#4 lore raw
In reply to Jon Mason

From: Jon Mason <[email protected]>
Date: Fri, 16 Nov 2012 19:27:11 -0700

Quoted 7 lines

I am submitting version 6 of the PCI-Express Non-Transparent Bridge patches for inclusion in 3.8 via Greg KH's char-misc-next tree. All outstanding issues have been addressed.

Version 6 corrects Greg KH's issues, most notably the improper usage of the Linux device model.
http://thread.gmane.org/gmane.linux.kernel.pci/18599

For the networking bits: