linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support
@ 2014-08-06 14:53 Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 1/4] ntb: split Intel specifics out of the "NTB hardware" interface Gerhard Sittig
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-06 14:53 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel, Gerhard Sittig

The current implementation of the PCI non-transparent bridge
support exclusively supports Intel hardware.  This series
prepares for the introduction of other vendor's hardware support,
by separating the generic 'data transport' driver from the
specific 'hardware support' driver.

The current implementation has a circular dependency, where the
data transport uses hardware specific routines for its
communication, while the hardware driver calls into the data
transport layer to have the data link established upon probe.  In
addition, existing documentation suggests that out-of-tree
drivers may use the hardware driver's routines, working in
parallel to the in-tree data transport and the network interface
on top if it.

This series "puts the data transport first", to provide routines
to register hardware drivers with the transport and to have the
transport become available as hardware is found.  While several
hardware drivers may implement the common "hw" API, and one of
those drivers gets probed at runtime and then is used for the
data transport.  The relation of exactly one hardware driver to
one transport instance is kept, as is the NTB driver's API within
the kernel.  No new hardware support gets introduced by this
series.  It's "mere refactoring".


Unfortunately I don't have Intel hardware to exercise runtime
tests for the series.  It has only been compile-tested for
bisectability and with several combinations of the tristate
options, and the series is checkpatch clean including --strict.
Testers who have access to hardware are cordially invited. :)


BTW was I surprised to find the NTB driver under drivers/ntb/,
and not underneath the PCI subsystem.  I hope I got the list of
recipients correct for the series.


Gerhard Sittig (4):
  ntb: split Intel specifics out of the "NTB hardware" interface
  ntb: header file nits (multiple inclusion, explicit entries)
  ntb: prepare to build the 'data transport' as a separate module
  ntb: de-couple data transport from hardware support

 drivers/ntb/Kconfig                          |   45 ++++--
 drivers/ntb/Makefile                         |    5 +-
 drivers/ntb/ntb_hw.h                         |  101 +++++++------
 drivers/ntb/{ntb_hw.c => ntb_hw_intel.c}     |   83 +++++++----
 drivers/ntb/ntb_hw_intel.h                   |   73 ++++++++++
 drivers/ntb/{ntb_regs.h => ntb_regs_intel.h} |    0
 drivers/ntb/ntb_transport.c                  |  196 ++++++++++++++++++++++++++
 include/linux/ntb.h                          |    7 +
 8 files changed, 426 insertions(+), 84 deletions(-)
 rename drivers/ntb/{ntb_hw.c => ntb_hw_intel.c} (94%)
 create mode 100644 drivers/ntb/ntb_hw_intel.h
 rename drivers/ntb/{ntb_regs.h => ntb_regs_intel.h} (100%)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RFC v1 1/4] ntb: split Intel specifics out of the "NTB hardware" interface
  2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
@ 2014-08-06 14:53 ` Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 2/4] ntb: header file nits (multiple inclusion, explicit entries) Gerhard Sittig
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-06 14:53 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel, Gerhard Sittig

Rename the ntb_hw.c compile unit and adjust the Makefile, to reflect
that this code drives Intel hardware.  Move Intel specific declarations
from ntb_hw.h to a separate ntb_hw_intel.h header file and rename the
Intel specific register set header file.

This leaves the ntb_hw.h header file with the declaration of the
interface between the 'data transport' and the 'hardware' aspects.

Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
 drivers/ntb/Makefile                         |    2 +-
 drivers/ntb/ntb_hw.h                         |   21 --------
 drivers/ntb/{ntb_hw.c => ntb_hw_intel.c}     |   11 ++--
 drivers/ntb/ntb_hw_intel.h                   |   73 ++++++++++++++++++++++++++
 drivers/ntb/{ntb_regs.h => ntb_regs_intel.h} |    0
 5 files changed, 80 insertions(+), 27 deletions(-)
 rename drivers/ntb/{ntb_hw.c => ntb_hw_intel.c} (99%)
 create mode 100644 drivers/ntb/ntb_hw_intel.h
 rename drivers/ntb/{ntb_regs.h => ntb_regs_intel.h} (100%)

diff --git a/drivers/ntb/Makefile b/drivers/ntb/Makefile
index 15cb59fd354e..468ca8ea395e 100644
--- a/drivers/ntb/Makefile
+++ b/drivers/ntb/Makefile
@@ -1,3 +1,3 @@
 obj-$(CONFIG_NTB) += ntb.o
 
-ntb-objs := ntb_hw.o ntb_transport.o
+ntb-objs := ntb_hw_intel.o ntb_transport.o
diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
index 465517b7393e..9cb288c045db 100644
--- a/drivers/ntb/ntb_hw.h
+++ b/drivers/ntb/ntb_hw.h
@@ -47,19 +47,6 @@
  */
 #include <linux/ntb.h>
 
-#define PCI_DEVICE_ID_INTEL_NTB_B2B_JSF		0x3725
-#define PCI_DEVICE_ID_INTEL_NTB_PS_JSF		0x3726
-#define PCI_DEVICE_ID_INTEL_NTB_SS_JSF		0x3727
-#define PCI_DEVICE_ID_INTEL_NTB_B2B_SNB		0x3C0D
-#define PCI_DEVICE_ID_INTEL_NTB_PS_SNB		0x3C0E
-#define PCI_DEVICE_ID_INTEL_NTB_SS_SNB		0x3C0F
-#define PCI_DEVICE_ID_INTEL_NTB_B2B_IVT		0x0E0D
-#define PCI_DEVICE_ID_INTEL_NTB_PS_IVT		0x0E0E
-#define PCI_DEVICE_ID_INTEL_NTB_SS_IVT		0x0E0F
-#define PCI_DEVICE_ID_INTEL_NTB_B2B_HSX		0x2F0D
-#define PCI_DEVICE_ID_INTEL_NTB_PS_HSX		0x2F0E
-#define PCI_DEVICE_ID_INTEL_NTB_SS_HSX		0x2F0F
-#define PCI_DEVICE_ID_INTEL_NTB_B2B_BWD		0x0C4E
 
 #ifndef readq
 static inline u64 readq(void __iomem *addr)
@@ -76,14 +63,6 @@ static inline void writeq(u64 val, void __iomem *addr)
 }
 #endif
 
-#define NTB_BAR_MMIO		0
-#define NTB_BAR_23		2
-#define NTB_BAR_45		4
-#define NTB_BAR_MASK		((1 << NTB_BAR_MMIO) | (1 << NTB_BAR_23) |\
-				 (1 << NTB_BAR_45))
-
-#define NTB_HB_TIMEOUT		msecs_to_jiffies(1000)
-
 #define NTB_MAX_NUM_MW		2
 
 enum ntb_hw_event {
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw_intel.c
similarity index 99%
rename from drivers/ntb/ntb_hw.c
rename to drivers/ntb/ntb_hw_intel.c
index 372e08c4ffef..699f05132a61 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw_intel.c
@@ -54,13 +54,14 @@
 #include <linux/random.h>
 #include <linux/slab.h>
 #include "ntb_hw.h"
-#include "ntb_regs.h"
+#include "ntb_hw_intel.h"
+#include "ntb_regs_intel.h"
 
-#define NTB_NAME	"Intel(R) PCI-E Non-Transparent Bridge Driver"
-#define NTB_VER		"1.0"
+#define NTB_HW_INTEL_NAME	"Intel(R) PCI-E Non-Transparent Bridge Driver"
+#define NTB_HW_INTEL_VER	"1.0"
 
-MODULE_DESCRIPTION(NTB_NAME);
-MODULE_VERSION(NTB_VER);
+MODULE_DESCRIPTION(NTB_HW_INTEL_NAME);
+MODULE_VERSION(NTB_HW_INTEL_VER);
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Intel Corporation");
 
diff --git a/drivers/ntb/ntb_hw_intel.h b/drivers/ntb/ntb_hw_intel.h
new file mode 100644
index 000000000000..93e2c3977394
--- /dev/null
+++ b/drivers/ntb/ntb_hw_intel.h
@@ -0,0 +1,73 @@
+/*
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ *   redistributing this file, you may do so under either license.
+ *
+ *   GPL LICENSE SUMMARY
+ *
+ *   Copyright(c) 2012 Intel Corporation. All rights reserved.
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of version 2 of the GNU General Public License as
+ *   published by the Free Software Foundation.
+ *
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2012 Intel Corporation. All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copy
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Intel PCIe NTB Linux driver
+ *
+ * Contact Information:
+ * Jon Mason <jon.mason@intel.com>
+ */
+#ifndef NTB_HW_INTEL_H
+#define NTB_HW_INTEL_H
+
+#define PCI_DEVICE_ID_INTEL_NTB_B2B_JSF		0x3725
+#define PCI_DEVICE_ID_INTEL_NTB_PS_JSF		0x3726
+#define PCI_DEVICE_ID_INTEL_NTB_SS_JSF		0x3727
+#define PCI_DEVICE_ID_INTEL_NTB_B2B_SNB		0x3C0D
+#define PCI_DEVICE_ID_INTEL_NTB_PS_SNB		0x3C0E
+#define PCI_DEVICE_ID_INTEL_NTB_SS_SNB		0x3C0F
+#define PCI_DEVICE_ID_INTEL_NTB_B2B_IVT		0x0E0D
+#define PCI_DEVICE_ID_INTEL_NTB_PS_IVT		0x0E0E
+#define PCI_DEVICE_ID_INTEL_NTB_SS_IVT		0x0E0F
+#define PCI_DEVICE_ID_INTEL_NTB_B2B_HSX		0x2F0D
+#define PCI_DEVICE_ID_INTEL_NTB_PS_HSX		0x2F0E
+#define PCI_DEVICE_ID_INTEL_NTB_SS_HSX		0x2F0F
+#define PCI_DEVICE_ID_INTEL_NTB_B2B_BWD		0x0C4E
+
+#define NTB_BAR_MMIO		0
+#define NTB_BAR_23		2
+#define NTB_BAR_45		4
+#define NTB_BAR_MASK		((1 << NTB_BAR_MMIO) | (1 << NTB_BAR_23) |\
+				 (1 << NTB_BAR_45))
+
+#define NTB_HB_TIMEOUT		msecs_to_jiffies(1000)
+
+#endif /* NTB_HW_INTEL_H */
diff --git a/drivers/ntb/ntb_regs.h b/drivers/ntb/ntb_regs_intel.h
similarity index 100%
rename from drivers/ntb/ntb_regs.h
rename to drivers/ntb/ntb_regs_intel.h
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFC v1 2/4] ntb: header file nits (multiple inclusion, explicit entries)
  2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 1/4] ntb: split Intel specifics out of the "NTB hardware" interface Gerhard Sittig
@ 2014-08-06 14:53 ` Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 3/4] ntb: prepare to build the 'data transport' as a separate module Gerhard Sittig
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-06 14:53 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel, Gerhard Sittig

Protect NTB related header files against multiple inclusion, because
in addition to function signatures they declare data structures, too.

Add more explicit include items such that header files can be used
independently from each other, i.e. calling code does not depend on
the order of include specs to have all data types declared correctly.

Minor whitespace adjustment, to separate license texts from system
includes from local includes for easier navigation.

Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
 drivers/ntb/ntb_hw.h        |    8 +++++++-
 drivers/ntb/ntb_hw_intel.c  |    1 +
 drivers/ntb/ntb_transport.c |    3 +++
 include/linux/ntb.h         |    7 +++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
index 9cb288c045db..fe4c6306f11c 100644
--- a/drivers/ntb/ntb_hw.h
+++ b/drivers/ntb/ntb_hw.h
@@ -45,8 +45,12 @@
  * Contact Information:
  * Jon Mason <jon.mason@intel.com>
  */
-#include <linux/ntb.h>
+#ifndef NTB_HW_H
+#define NTB_HW_H
 
+#include <linux/interrupt.h>
+#include <linux/ntb.h>
+#include <linux/types.h>
 
 #ifndef readq
 static inline u64 readq(void __iomem *addr)
@@ -224,3 +228,5 @@ void *ntb_find_transport(struct pci_dev *pdev);
 
 int ntb_transport_init(struct pci_dev *pdev);
 void ntb_transport_free(void *transport);
+
+#endif /* NTB_HW_H */
diff --git a/drivers/ntb/ntb_hw_intel.c b/drivers/ntb/ntb_hw_intel.c
index 699f05132a61..a81a06c50148 100644
--- a/drivers/ntb/ntb_hw_intel.c
+++ b/drivers/ntb/ntb_hw_intel.c
@@ -53,6 +53,7 @@
 #include <linux/pci.h>
 #include <linux/random.h>
 #include <linux/slab.h>
+
 #include "ntb_hw.h"
 #include "ntb_hw_intel.h"
 #include "ntb_regs_intel.h"
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 9dd63b822025..436326ad87bd 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -45,6 +45,7 @@
  * Contact Information:
  * Jon Mason <jon.mason@intel.com>
  */
+
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
@@ -53,9 +54,11 @@
 #include <linux/export.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/ntb.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/types.h>
+
 #include "ntb_hw.h"
 
 #define NTB_TRANSPORT_VERSION	3
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
index 9ac1a62fc6f5..5b69d09db84f 100644
--- a/include/linux/ntb.h
+++ b/include/linux/ntb.h
@@ -45,6 +45,11 @@
  * Contact Information:
  * Jon Mason <jon.mason@intel.com>
  */
+#ifndef LINUX_NTB_H
+#define LINUX_NTB_H
+
+#include <linux/pci.h>
+#include <linux/types.h>
 
 struct ntb_transport_qp;
 
@@ -86,3 +91,5 @@ void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len);
 void ntb_transport_link_up(struct ntb_transport_qp *qp);
 void ntb_transport_link_down(struct ntb_transport_qp *qp);
 bool ntb_transport_link_query(struct ntb_transport_qp *qp);
+
+#endif /* LINUX_NTB_H */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFC v1 3/4] ntb: prepare to build the 'data transport' as a separate module
  2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 1/4] ntb: split Intel specifics out of the "NTB hardware" interface Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 2/4] ntb: header file nits (multiple inclusion, explicit entries) Gerhard Sittig
@ 2014-08-06 14:53 ` Gerhard Sittig
  2014-08-06 14:53 ` [PATCH RFC v1 4/4] ntb: de-couple data transport from hardware support Gerhard Sittig
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-06 14:53 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel, Gerhard Sittig

Export those routines of the data transport which the PCI NTB hardware
drivers will reference, and provide module properties such that the data
transport over PCI NTB can build as a separate module.

This change does not alter the Makefile, the data transport still gets
statically linked against the driver for Intel hardware support.

Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
 drivers/ntb/ntb_transport.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 436326ad87bd..70f358c8cc09 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -61,7 +61,14 @@
 
 #include "ntb_hw.h"
 
+#define NTB_TRANSPORT_NAME	"Data transport over Non-Transparent Bridge"
 #define NTB_TRANSPORT_VERSION	3
+#define NTB_TRANSPORT_VERSTEXT	"3"
+
+MODULE_DESCRIPTION(NTB_TRANSPORT_NAME);
+MODULE_VERSION(NTB_TRANSPORT_VERSTEXT);
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Intel Corporation");
 
 static unsigned int transport_mtu = 0x401E;
 module_param(transport_mtu, uint, 0644);
@@ -979,6 +986,7 @@ err:
 	kfree(nt);
 	return rc;
 }
+EXPORT_SYMBOL(ntb_transport_init);
 
 void ntb_transport_free(void *transport)
 {
@@ -1009,6 +1017,7 @@ void ntb_transport_free(void *transport)
 	ntb_unregister_transport(ndev);
 	kfree(nt);
 }
+EXPORT_SYMBOL(ntb_transport_free);
 
 static void ntb_rx_copy_callback(void *data)
 {
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFC v1 4/4] ntb: de-couple data transport from hardware support
  2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
                   ` (2 preceding siblings ...)
  2014-08-06 14:53 ` [PATCH RFC v1 3/4] ntb: prepare to build the 'data transport' as a separate module Gerhard Sittig
@ 2014-08-06 14:53 ` Gerhard Sittig
  2014-08-06 15:01 ` [PATCH RFC v1 0/4] PCI NTB: prepare for more " Gerhard Sittig
  2014-08-06 20:23 ` Rajat Jain
  5 siblings, 0 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-06 14:53 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel, Gerhard Sittig

The previous implementation at compile time statically linked one
specific hardware driver (Intel) against the generic data transport
over PCI NTB.

Make the hardware driver's public routines static, to register them with
the data transport at runtime.  And make the data transport wrap those
routines, to raise appropriate error codes or provide neutral return
values in the absence of hardware support.  There still is only support
for exactly one hardware driver that is used by the data transport.

Adjust the build support to reflect the fact that the data transport and
the hardware support can get built independently from each other.
Multiple hardware support drivers can implement PCI NTB intrinsics, and
the data transport picks up at runtime whatever matches the found
hardware.

Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
 drivers/ntb/Kconfig         |   45 ++++++++---
 drivers/ntb/Makefile        |    5 +-
 drivers/ntb/ntb_hw.h        |   72 +++++++++++------
 drivers/ntb/ntb_hw_intel.c  |   71 ++++++++++++-----
 drivers/ntb/ntb_transport.c |  184 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 320 insertions(+), 57 deletions(-)

diff --git a/drivers/ntb/Kconfig b/drivers/ntb/Kconfig
index f69df793dbe2..3c5f8f88c55d 100644
--- a/drivers/ntb/Kconfig
+++ b/drivers/ntb/Kconfig
@@ -1,13 +1,34 @@
-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.
+menuconfig NTB
+	bool "PCI Non-Transparent Bridge support"
+	depends on PCI
+	help
+	  The PCI non-transparent bridge hardware is a point-to-point PCI bus
+	  connecting two systems.  When configured, reads and writes to the
+	  device's PCI mapped memory will be mirrored to a buffer on the remote
+	  system.  The Linux ntb driver uses this point-to-point communication
+	  as a method to transfer data from one system to the other.
 
+	  If unsure, say N.
+
+if NTB
+
+config NTB_TRANSPORT
+	tristate "Data Transport over PCI Non-Transparent Bridges"
+	depends on NTB
+	help
+	  Enable support for data transports over the PCIe non-transparent
+	  bridge connections.  This requires specific hardware support for
+	  PCI NTBs to become operational.
+
+	  If unsure, say N.
+
+config NTB_HW_INTEL
+	tristate "Intel Hardware Support for PCI NTB"
+	depends on X86
+	depends on NTB_TRANSPORT
+	help
+	  Enable support for PCIe non-transparent bridges on Intel hardware.
+
+	  If unsure, say N.
+
+endif # NTB
diff --git a/drivers/ntb/Makefile b/drivers/ntb/Makefile
index 468ca8ea395e..021a5c66b862 100644
--- a/drivers/ntb/Makefile
+++ b/drivers/ntb/Makefile
@@ -1,3 +1,2 @@
-obj-$(CONFIG_NTB) += ntb.o
-
-ntb-objs := ntb_hw_intel.o ntb_transport.o
+obj-$(CONFIG_NTB_HW_INTEL) += ntb_hw_intel.o
+obj-$(CONFIG_NTB_TRANSPORT) += ntb_transport.o
diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
index fe4c6306f11c..3cd9df3dd690 100644
--- a/drivers/ntb/ntb_hw.h
+++ b/drivers/ntb/ntb_hw.h
@@ -203,29 +203,57 @@ static inline struct dentry *ntb_query_debugfs(struct ntb_device *ndev)
 	return ndev->debugfs_dir;
 }
 
-struct ntb_device *ntb_register_transport(struct pci_dev *pdev,
-					  void *transport);
-void ntb_unregister_transport(struct ntb_device *ndev);
-void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr);
-int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
-			     void *data, int (*db_cb_func)(void *data,
-							   int db_num));
-void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx);
-int ntb_register_event_callback(struct ntb_device *ndev,
-				void (*event_cb_func)(void *handle,
-						      enum ntb_hw_event event));
-void ntb_unregister_event_callback(struct ntb_device *ndev);
-int ntb_get_max_spads(struct ntb_device *ndev);
-int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
-int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
-int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
-int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
-resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw);
-void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
-u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw);
-void ntb_ring_doorbell(struct ntb_device *ndev, unsigned int idx);
-void *ntb_find_transport(struct pci_dev *pdev);
+/*
+ * These are a hardware driver's public routines, which the transport will
+ * reference.  Phrasing them as callbacks allows for registration and
+ * unregistration of hardware drivers at runtime, and allows for multiple
+ * hardware drivers to implement NTB support.
+ */
+typedef void (*event_cb_func_t)(void *handle, enum ntb_hw_event event);
+typedef int (*doorbell_cb_func_t)(void *data, int db_num);
+struct ntb_hw_desc {
+	const char *ntb_hardware_name;
+	/* transports */
+	struct ntb_device *(*ntb_register_transport)(struct pci_dev *pdev,
+						     void *transport);
+	void (*ntb_unregister_transport)(struct ntb_device *ndev);
+	void *(*ntb_find_transport)(struct pci_dev *pdev);
+	/* doorbells */
+	int (*ntb_register_db_callback)(struct ntb_device *ndev,
+					unsigned int idx, void *data,
+					doorbell_cb_func_t db_cb_func);
+	void (*ntb_unregister_db_callback)(struct ntb_device *ndev,
+					   unsigned int idx);
+	void (*ntb_ring_doorbell)(struct ntb_device *ndev, unsigned int idx);
+	/* events */
+	int (*ntb_register_event_callback)(struct ntb_device *ndev,
+					   event_cb_func_t event_cb_func);
+	void (*ntb_unregister_event_callback)(struct ntb_device *ndev);
+	/* scratch pad */
+	int (*ntb_write_local_spad)(struct ntb_device *ndev, unsigned int idx,
+				    u32 val);
+	int (*ntb_read_local_spad)(struct ntb_device *ndev, unsigned int idx,
+				   u32 *val);
+	int (*ntb_write_remote_spad)(struct ntb_device *ndev, unsigned int idx,
+				     u32 val);
+	int (*ntb_read_remote_spad)(struct ntb_device *ndev, unsigned int idx,
+				    u32 *val);
+	/* memory windows */
+	void (*ntb_set_mw_addr)(struct ntb_device *ndev, unsigned int mw,
+				u64 addr);
+	resource_size_t (*ntb_get_mw_base)(struct ntb_device *ndev,
+					   unsigned int mw);
+	void __iomem *(*ntb_get_mw_vbase)(struct ntb_device *ndev,
+					  unsigned int mw);
+	u64 (*ntb_get_mw_size)(struct ntb_device *ndev, unsigned int mw);
+};
 
+/*
+ * These are the transport's public routines, and get referenced
+ * from hardware drivers.
+ */
+int ntb_transport_addhw(struct ntb_hw_desc *desc);
+void ntb_transport_delhw(struct ntb_hw_desc *desc);
 int ntb_transport_init(struct pci_dev *pdev);
 void ntb_transport_free(void *transport);
 
diff --git a/drivers/ntb/ntb_hw_intel.c b/drivers/ntb/ntb_hw_intel.c
index a81a06c50148..3ab1fcbf52cc 100644
--- a/drivers/ntb/ntb_hw_intel.c
+++ b/drivers/ntb/ntb_hw_intel.c
@@ -121,9 +121,8 @@ MODULE_DEVICE_TABLE(pci, ntb_pci_tbl);
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-int ntb_register_event_callback(struct ntb_device *ndev,
-				void (*func)(void *handle,
-					     enum ntb_hw_event event))
+static int ntb_register_event_callback(struct ntb_device *ndev,
+				       event_cb_func_t func)
 {
 	if (ndev->event_cb)
 		return -EINVAL;
@@ -139,7 +138,7 @@ int ntb_register_event_callback(struct ntb_device *ndev,
  *
  * This function unregisters the existing callback from transport
  */
-void ntb_unregister_event_callback(struct ntb_device *ndev)
+static void ntb_unregister_event_callback(struct ntb_device *ndev)
 {
 	ndev->event_cb = NULL;
 }
@@ -175,8 +174,8 @@ static void ntb_irq_work(unsigned long data)
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
-			     void *data, int (*func)(void *data, int db_num))
+static int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
+				    void *data, doorbell_cb_func_t func)
 {
 	unsigned long mask;
 
@@ -208,7 +207,8 @@ int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
  * This function unregisters a callback function for the doorbell interrupt
  * on the primary side. The function will also mask the said doorbell.
  */
-void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx)
+static void ntb_unregister_db_callback(struct ntb_device *ndev,
+				       unsigned int idx)
 {
 	unsigned long mask;
 
@@ -233,7 +233,7 @@ void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx)
  *
  * RETURNS: pointer to transport.
  */
-void *ntb_find_transport(struct pci_dev *pdev)
+static void *ntb_find_transport(struct pci_dev *pdev)
 {
 	struct ntb_device *ndev = pci_get_drvdata(pdev);
 	return ndev->ntb_transport;
@@ -248,7 +248,8 @@ void *ntb_find_transport(struct pci_dev *pdev)
  *
  * RETURNS: pointer to ntb_device, NULL on error.
  */
-struct ntb_device *ntb_register_transport(struct pci_dev *pdev, void *transport)
+static struct ntb_device *ntb_register_transport(struct pci_dev *pdev,
+						 void *transport)
 {
 	struct ntb_device *ndev = pci_get_drvdata(pdev);
 
@@ -266,7 +267,7 @@ struct ntb_device *ntb_register_transport(struct pci_dev *pdev, void *transport)
  * This function unregisters the transport from the HW driver and performs any
  * necessary cleanups.
  */
-void ntb_unregister_transport(struct ntb_device *ndev)
+static void ntb_unregister_transport(struct ntb_device *ndev)
 {
 	int i;
 
@@ -292,7 +293,8 @@ void ntb_unregister_transport(struct ntb_device *ndev)
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val)
+static int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx,
+				u32 val)
 {
 	if (idx >= ndev->limits.max_spads)
 		return -EINVAL;
@@ -316,7 +318,8 @@ int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val)
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
+static int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx,
+			       u32 *val)
 {
 	if (idx >= ndev->limits.max_spads)
 		return -EINVAL;
@@ -341,7 +344,8 @@ int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val)
+static int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx,
+				 u32 val)
 {
 	if (idx >= ndev->limits.max_spads)
 		return -EINVAL;
@@ -365,7 +369,8 @@ int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val)
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
+static int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx,
+				u32 *val)
 {
 	if (idx >= ndev->limits.max_spads)
 		return -EINVAL;
@@ -386,7 +391,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
  *
  * RETURNS: address, or NULL on error.
  */
-resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw)
+static resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw)
 {
 	if (mw >= ntb_max_mw(ndev))
 		return 0;
@@ -404,7 +409,7 @@ resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw)
  *
  * RETURNS: pointer to virtual address, or NULL on error.
  */
-void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
+static void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
 {
 	if (mw >= ntb_max_mw(ndev))
 		return NULL;
@@ -421,7 +426,7 @@ void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
  *
  * RETURNS: the size of the memory window or zero on error
  */
-u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
+static u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
 {
 	if (mw >= ntb_max_mw(ndev))
 		return 0;
@@ -439,7 +444,7 @@ u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
  * memory address is where data from the remote system will be transfered into
  * or out of depending on how the transport is configured.
  */
-void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr)
+static void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr)
 {
 	if (mw >= ntb_max_mw(ndev))
 		return;
@@ -469,7 +474,7 @@ void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr)
  *
  * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
  */
-void ntb_ring_doorbell(struct ntb_device *ndev, unsigned int db)
+static void ntb_ring_doorbell(struct ntb_device *ndev, unsigned int db)
 {
 	dev_dbg(&ndev->pdev->dev, "%s: ringing doorbell %d\n", __func__, db);
 
@@ -1401,6 +1406,26 @@ static void ntb_hw_link_down(struct ntb_device *ndev)
 	writel(ntb_cntl, ndev->reg_ofs.lnk_cntl);
 }
 
+static struct ntb_hw_desc hwdesc = {
+	.ntb_hardware_name = NTB_HW_INTEL_NAME,
+	.ntb_register_transport = ntb_register_transport,
+	.ntb_unregister_transport = ntb_unregister_transport,
+	.ntb_find_transport = ntb_find_transport,
+	.ntb_register_db_callback = ntb_register_db_callback,
+	.ntb_unregister_db_callback = ntb_unregister_db_callback,
+	.ntb_ring_doorbell = ntb_ring_doorbell,
+	.ntb_register_event_callback = ntb_register_event_callback,
+	.ntb_unregister_event_callback = ntb_unregister_event_callback,
+	.ntb_write_local_spad = ntb_write_local_spad,
+	.ntb_read_local_spad = ntb_read_local_spad,
+	.ntb_write_remote_spad = ntb_write_remote_spad,
+	.ntb_read_remote_spad = ntb_read_remote_spad,
+	.ntb_set_mw_addr = ntb_set_mw_addr,
+	.ntb_get_mw_base = ntb_get_mw_base,
+	.ntb_get_mw_vbase = ntb_get_mw_vbase,
+	.ntb_get_mw_size = ntb_get_mw_size,
+};
+
 static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	struct ntb_device *ndev;
@@ -1485,14 +1510,19 @@ static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		ntb_write_remote_spad(ndev, i, 0);
 	}
 
-	rc = ntb_transport_init(pdev);
+	rc = ntb_transport_addhw(&hwdesc);
 	if (rc)
 		goto err6;
+	rc = ntb_transport_init(pdev);
+	if (rc)
+		goto err7;
 
 	ntb_hw_link_up(ndev);
 
 	return 0;
 
+err7:
+	ntb_transport_delhw(&hwdesc);
 err6:
 	ntb_free_interrupts(ndev);
 err5:
@@ -1523,6 +1553,7 @@ static void ntb_pci_remove(struct pci_dev *pdev)
 	ntb_hw_link_down(ndev);
 
 	ntb_transport_free(ndev->ntb_transport);
+	ntb_transport_delhw(&hwdesc);
 
 	ntb_free_interrupts(ndev);
 	ntb_free_callbacks(ndev);
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 70f358c8cc09..527c1b53b77f 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -210,6 +210,190 @@ enum {
 	MAX_SPAD,
 };
 
+/*
+ * This transport layer can use one of several hardware drivers.  So
+ * wrap the hardware driver's routines such that they can get registered
+ * and unregistered at runtime.  Since hardware drivers can always
+ * return error codes, this transport layer should transparently cope
+ * with the situation of not (yet) registered hardware drivers.
+ *
+ * At the moment there is no support for parallel registration of
+ * multiple hardware drivers at the same time, which should be
+ * acceptable.
+ */
+static struct ntb_hw_desc *hwdesc;
+
+struct ntb_device *ntb_register_transport(struct pci_dev *pdev,
+					  void *transport)
+{
+	if (!hwdesc)
+		return NULL;
+	if (!hwdesc->ntb_register_transport)
+		return NULL;
+	return hwdesc->ntb_register_transport(pdev, transport);
+}
+
+void ntb_unregister_transport(struct ntb_device *ndev)
+{
+	if (!hwdesc)
+		return;
+	if (!hwdesc->ntb_unregister_transport)
+		return;
+	return hwdesc->ntb_unregister_transport(ndev);
+}
+
+void *ntb_find_transport(struct pci_dev *pdev)
+{
+	if (!hwdesc)
+		return NULL;
+	if (!hwdesc->ntb_find_transport)
+		return NULL;
+	return hwdesc->ntb_find_transport(pdev);
+}
+
+int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
+			     void *data, doorbell_cb_func_t db_cb_func)
+{
+	if (!hwdesc)
+		return -ENXIO;
+	if (!hwdesc->ntb_register_db_callback)
+		return -ENXIO;
+	return hwdesc->ntb_register_db_callback(ndev, idx, data, db_cb_func);
+}
+
+void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx)
+{
+	if (!hwdesc)
+		return;
+	if (!hwdesc->ntb_unregister_db_callback)
+		return;
+	return hwdesc->ntb_unregister_db_callback(ndev, idx);
+}
+
+void ntb_ring_doorbell(struct ntb_device *ndev, unsigned int idx)
+{
+	if (!hwdesc)
+		return;
+	if (!hwdesc->ntb_ring_doorbell)
+		return;
+	return hwdesc->ntb_ring_doorbell(ndev, idx);
+}
+
+int ntb_register_event_callback(struct ntb_device *ndev,
+				event_cb_func_t event_cb_func)
+{
+	if (!hwdesc)
+		return -ENXIO;
+	if (!hwdesc->ntb_register_event_callback)
+		return -ENXIO;
+	return hwdesc->ntb_register_event_callback(ndev, event_cb_func);
+}
+
+void ntb_unregister_event_callback(struct ntb_device *ndev)
+{
+	if (!hwdesc)
+		return;
+	if (!hwdesc->ntb_unregister_event_callback)
+		return;
+	return hwdesc->ntb_unregister_event_callback(ndev);
+}
+
+int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val)
+{
+	if (!hwdesc)
+		return -ENXIO;
+	if (!hwdesc->ntb_write_local_spad)
+		return -ENXIO;
+	return hwdesc->ntb_write_local_spad(ndev, idx, val);
+}
+
+int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
+{
+	if (!hwdesc)
+		return -ENXIO;
+	if (!hwdesc->ntb_read_local_spad)
+		return -ENXIO;
+	return hwdesc->ntb_read_local_spad(ndev, idx, val);
+}
+
+int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val)
+{
+	if (!hwdesc)
+		return -ENXIO;
+	if (!hwdesc->ntb_write_remote_spad)
+		return -ENXIO;
+	return hwdesc->ntb_write_remote_spad(ndev, idx, val);
+}
+
+int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
+{
+	if (!hwdesc)
+		return -ENXIO;
+	if (!hwdesc->ntb_read_remote_spad)
+		return -ENXIO;
+	return hwdesc->ntb_read_remote_spad(ndev, idx, val);
+}
+
+void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr)
+{
+	if (!hwdesc)
+		return;
+	if (!hwdesc->ntb_set_mw_addr)
+		return;
+	return hwdesc->ntb_set_mw_addr(ndev, mw, addr);
+}
+
+resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw)
+{
+	if (!hwdesc)
+		return 0;
+	if (!hwdesc->ntb_get_mw_base)
+		return 0;
+	return hwdesc->ntb_get_mw_base(ndev, mw);
+}
+
+void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
+{
+	if (!hwdesc)
+		return NULL;
+	if (!hwdesc->ntb_get_mw_vbase)
+		return NULL;
+	return hwdesc->ntb_get_mw_vbase(ndev, mw);
+}
+
+u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
+{
+	if (!hwdesc)
+		return 0;
+	if (!hwdesc->ntb_get_mw_size)
+		return 0;
+	return hwdesc->ntb_get_mw_size(ndev, mw);
+}
+
+int ntb_transport_addhw(struct ntb_hw_desc *desc)
+{
+	if (hwdesc) {
+		pr_warn("PCI NTB: %s already registered, rejecting %s\n",
+			hwdesc->ntb_hardware_name, desc->ntb_hardware_name);
+		return -EBUSY;
+	}
+	pr_info("PCI NTB: registered %s hardware routines\n",
+		hwdesc->ntb_hardware_name);
+	hwdesc = desc;
+	return 0;
+}
+EXPORT_SYMBOL(ntb_transport_addhw);
+
+void ntb_transport_delhw(struct ntb_hw_desc *desc)
+{
+	if (desc != hwdesc)
+		return;
+	pr_info("PCI NTB: unregistering %s hardware routines\n",
+		hwdesc->ntb_hardware_name);
+	hwdesc = NULL;
+}
+EXPORT_SYMBOL(ntb_transport_delhw);
+
 #define QP_TO_MW(ndev, qp)	((qp) % ntb_max_mw(ndev))
 #define NTB_QP_DEF_NUM_ENTRIES	100
 #define NTB_LINK_DOWN_TIMEOUT	10
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support
  2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
                   ` (3 preceding siblings ...)
  2014-08-06 14:53 ` [PATCH RFC v1 4/4] ntb: de-couple data transport from hardware support Gerhard Sittig
@ 2014-08-06 15:01 ` Gerhard Sittig
  2014-08-18 16:24   ` Gerhard Sittig
  2014-08-06 20:23 ` Rajat Jain
  5 siblings, 1 reply; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-06 15:01 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel

On Wed, 2014-08-06 at 16:53 +0200, Gerhard Sittig wrote:
> 
> The current implementation of the PCI non-transparent bridge
> support exclusively supports Intel hardware.  This series
> prepares for the introduction of other vendor's hardware support,
> by separating the generic 'data transport' driver from the
> specific 'hardware support' driver.

For the record:  Email to Jon Mason, the original NTB driver
author, bounced with SMTP error 550.  The MAINTAINERS file's
"NTB DRIVER" section might need an update.  Is the address
listed under "NETERION 10GbE DRIVERS" correct, or is it a
coincidence that the name matches?


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support
  2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
                   ` (4 preceding siblings ...)
  2014-08-06 15:01 ` [PATCH RFC v1 0/4] PCI NTB: prepare for more " Gerhard Sittig
@ 2014-08-06 20:23 ` Rajat Jain
  2014-08-11 10:11   ` Gerhard Sittig
  5 siblings, 1 reply; 9+ messages in thread
From: Rajat Jain @ 2014-08-06 20:23 UTC (permalink / raw)
  To: Gerhard Sittig, linux-pci, Jon Mason
  Cc: Bjorn Helgaas, Detlev Zundel, rajatxjain

Hello Gerhard,

> -----Original Message-----
> From: linux-pci-owner@vger.kernel.org [mailto:linux-pci-
> owner@vger.kernel.org] On Behalf Of Gerhard Sittig
> Sent: Wednesday, August 06, 2014 7:54 AM
> To: linux-pci@vger.kernel.org; Jon Mason
> Cc: Bjorn Helgaas; Detlev Zundel; Gerhard Sittig
> Subject: [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support
> 
> The current implementation of the PCI non-transparent bridge support
> exclusively supports Intel hardware.  This series prepares for the introduction
> of other vendor's hardware support, by separating the generic 'data
> transport' driver from the specific 'hardware support' driver.

Thanks for this effort. I also have a PLX NT bridge that I was exploring to add support for. This will definitely make it easier.

Just curious, do you have any kind of NT bridge hardware that you want to add support for?

Thanks,

Rajat


> 
> The current implementation has a circular dependency, where the data
> transport uses hardware specific routines for its communication, while the
> hardware driver calls into the data transport layer to have the data link
> established upon probe.  In addition, existing documentation suggests that
> out-of-tree drivers may use the hardware driver's routines, working in
> parallel to the in-tree data transport and the network interface on top if it.
> 
> This series "puts the data transport first", to provide routines to register
> hardware drivers with the transport and to have the transport become
> available as hardware is found.  While several hardware drivers may
> implement the common "hw" API, and one of those drivers gets probed at
> runtime and then is used for the data transport.  The relation of exactly one
> hardware driver to one transport instance is kept, as is the NTB driver's API
> within the kernel.  No new hardware support gets introduced by this series.
> It's "mere refactoring".
> 
> 
> Unfortunately I don't have Intel hardware to exercise runtime tests for the
> series.  It has only been compile-tested for bisectability and with several
> combinations of the tristate options, and the series is checkpatch clean
> including --strict.
> Testers who have access to hardware are cordially invited. :)
> 
> 
> BTW was I surprised to find the NTB driver under drivers/ntb/, and not
> underneath the PCI subsystem.  I hope I got the list of recipients correct for
> the series.
> 
> 
> Gerhard Sittig (4):
>   ntb: split Intel specifics out of the "NTB hardware" interface
>   ntb: header file nits (multiple inclusion, explicit entries)
>   ntb: prepare to build the 'data transport' as a separate module
>   ntb: de-couple data transport from hardware support
> 
>  drivers/ntb/Kconfig                          |   45 ++++--
>  drivers/ntb/Makefile                         |    5 +-
>  drivers/ntb/ntb_hw.h                         |  101 +++++++------
>  drivers/ntb/{ntb_hw.c => ntb_hw_intel.c}     |   83 +++++++----
>  drivers/ntb/ntb_hw_intel.h                   |   73 ++++++++++
>  drivers/ntb/{ntb_regs.h => ntb_regs_intel.h} |    0
>  drivers/ntb/ntb_transport.c                  |  196
> ++++++++++++++++++++++++++
>  include/linux/ntb.h                          |    7 +
>  8 files changed, 426 insertions(+), 84 deletions(-)  rename
> drivers/ntb/{ntb_hw.c => ntb_hw_intel.c} (94%)  create mode 100644
> drivers/ntb/ntb_hw_intel.h  rename drivers/ntb/{ntb_regs.h =>
> ntb_regs_intel.h} (100%)
> 
> --
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in the
> body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support
  2014-08-06 20:23 ` Rajat Jain
@ 2014-08-11 10:11   ` Gerhard Sittig
  0 siblings, 0 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-11 10:11 UTC (permalink / raw)
  To: Rajat Jain; +Cc: linux-pci, Jon Mason, Bjorn Helgaas, Detlev Zundel, rajatxjain

On Wed, 2014-08-06 at 20:23 +0000, Rajat Jain wrote:
> 
> Thanks for this effort. I also have a PLX NT bridge that I was
> exploring to add support for. This will definitely make it
> easier.
> 
> Just curious, do you have any kind of NT bridge hardware that
> you want to add support for?

That would be IDT hardware.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support
  2014-08-06 15:01 ` [PATCH RFC v1 0/4] PCI NTB: prepare for more " Gerhard Sittig
@ 2014-08-18 16:24   ` Gerhard Sittig
  0 siblings, 0 replies; 9+ messages in thread
From: Gerhard Sittig @ 2014-08-18 16:24 UTC (permalink / raw)
  To: linux-pci, Jon Mason; +Cc: Bjorn Helgaas, Detlev Zundel

[ adjusted Jon Mason's email address ]

On Wed, 2014-08-06 at 17:01 +0200, Gerhard Sittig wrote:
> 
> On Wed, 2014-08-06 at 16:53 +0200, Gerhard Sittig wrote:
> > 
> > The current implementation of the PCI non-transparent bridge
> > support exclusively supports Intel hardware.  This series
> > prepares for the introduction of other vendor's hardware support,
> > by separating the generic 'data transport' driver from the
> > specific 'hardware support' driver.
> 
> For the record:  Email to Jon Mason, the original NTB driver
> author, bounced with SMTP error 550.  The MAINTAINERS file's
> "NTB DRIVER" section might need an update.  Is the address
> listed under "NETERION 10GbE DRIVERS" correct, or is it a
> coincidence that the name matches?

For the record:  In personal conversation Jon acknowledged his
new/other email address, that was listed in the MAINTAINERS file
as well.  The NTB entry should receive an update.


Jon is busy moving and changing jobs.  Is there any other
feedback, test results, opinions, requests, remarks?


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-18 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 14:53 [PATCH RFC v1 0/4] PCI NTB: prepare for more hardware support Gerhard Sittig
2014-08-06 14:53 ` [PATCH RFC v1 1/4] ntb: split Intel specifics out of the "NTB hardware" interface Gerhard Sittig
2014-08-06 14:53 ` [PATCH RFC v1 2/4] ntb: header file nits (multiple inclusion, explicit entries) Gerhard Sittig
2014-08-06 14:53 ` [PATCH RFC v1 3/4] ntb: prepare to build the 'data transport' as a separate module Gerhard Sittig
2014-08-06 14:53 ` [PATCH RFC v1 4/4] ntb: de-couple data transport from hardware support Gerhard Sittig
2014-08-06 15:01 ` [PATCH RFC v1 0/4] PCI NTB: prepare for more " Gerhard Sittig
2014-08-18 16:24   ` Gerhard Sittig
2014-08-06 20:23 ` Rajat Jain
2014-08-11 10:11   ` Gerhard Sittig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).