From c216ed4ca1d1cd9a1d3722cbd1aebfa9eb7ce7ca Mon Sep 17 00:00:00 2001 From: Jay Sternberg Date: Fri, 9 Oct 2015 11:41:06 -0700 Subject: [PATCH] xeon-phi: ibscif bug 2575: Allow xeon-phi support for Knights Landing New patch file for the compat-rdma tech-preview/xeon-phi directory The Knights Landing (KNL) version of Intel mpss will use the scif driver that was upstreamed to kernel.org. Although the data structure layout is the same as the Knights Corner (KNC) version, some functions have changed. The scif_get_nodeIDs call is renamed to scif_get_node_ids and the scif_pci_info is removed. These changes impact the ibscif and ib_qib drivers for KNL. The attached patch will allow OFED-3.18-1 --with-xeon-phi to work with both versions of mpss. This new patch file should be added to the compat-rdma source rpm in the tech-preview/xeon-phi directory. Signed-off-by: Jay Sternberg --- .../xeon-phi/0013-have-upstream-scif.patch | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 tech-preview/xeon-phi/0013-have-upstream-scif.patch diff --git a/tech-preview/xeon-phi/0013-have-upstream-scif.patch b/tech-preview/xeon-phi/0013-have-upstream-scif.patch new file mode 100644 index 0000000..a8711cf --- /dev/null +++ b/tech-preview/xeon-phi/0013-have-upstream-scif.patch @@ -0,0 +1,126 @@ +diff -Nrup a/drivers/infiniband/hw/qib/qib_knx.c b/drivers/infiniband/hw/qib/qib_knx.c +--- a/drivers/infiniband/hw/qib/qib_knx.c 2015-10-08 07:44:08.735979908 -0700 ++++ b/drivers/infiniband/hw/qib/qib_knx.c 2015-10-08 07:47:20.920988599 -0700 +@@ -203,6 +203,92 @@ inline struct qib_devdata *qib_knx_node_ + return knx ? knx->dd : NULL; + } + ++#ifdef HAVE_UPSTREAM_SCIF ++ ++#include ++#include ++ ++#define MIC_X100_PCI_DEVICE_2250 0x2250 ++#define MIC_X100_PCI_DEVICE_2251 0x2251 ++#define MIC_X100_PCI_DEVICE_2252 0x2252 ++#define MIC_X100_PCI_DEVICE_2253 0x2253 ++#define MIC_X100_PCI_DEVICE_2254 0x2254 ++#define MIC_X100_PCI_DEVICE_2255 0x2255 ++#define MIC_X100_PCI_DEVICE_2256 0x2256 ++#define MIC_X100_PCI_DEVICE_2257 0x2257 ++#define MIC_X100_PCI_DEVICE_2258 0x2258 ++#define MIC_X100_PCI_DEVICE_2259 0x2259 ++#define MIC_X100_PCI_DEVICE_225a 0x225a ++#define MIC_X100_PCI_DEVICE_225b 0x225b ++#define MIC_X100_PCI_DEVICE_225c 0x225c ++#define MIC_X100_PCI_DEVICE_225d 0x225d ++#define MIC_X100_PCI_DEVICE_225e 0x225e ++#define PLX_PCI_DEVICE_87A0 0x87A0 ++#define PLX_PCI_DEVICE_87B0 0x87B0 ++#define INTEL_PCI_DEVICE_2260 0x2260 ++#define INTEL_PCI_DEVICE_2265 0x2265 ++ ++static const struct pci_device_id xeon_phi_tbl[] = { ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2250)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2251)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2252)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2253)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2254)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2255)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2256)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2257)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2258)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2259)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225a)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225b)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225c)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225d)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225e)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_PLX, PLX_PCI_DEVICE_87A0)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_PLX, PLX_PCI_DEVICE_87B0)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_PCI_DEVICE_2260)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_PCI_DEVICE_2265)}, ++ {} ++}; ++ ++/* ++ * Emulate the scif_pci_info call which is not included in the upstream scif. ++ */ ++int scif_pci_info(uint16_t node, struct scif_pci_info *dev) ++{ ++ const struct pci_device_id *id; ++ struct pci_dev *pdev = NULL; ++ ++ /* node 0 is the host. */ ++ if (node < 1) ++ return -ENODEV; ++ ++ /* This assumes pci_get_device searches in the correct order. */ ++ while (node && ++ !!(pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) { ++ for (id = xeon_phi_tbl; id->vendor; id++) { ++ if (pdev->vendor == id->vendor && ++ pdev->device == id->device) { ++ --node; ++ break; ++ } ++ } ++ } ++ ++ if (node && !pdev) ++ return -EINVAL; ++ ++ /* The dev->va array is not used by ib_qib. */ ++ memset(dev, 0, sizeof(*dev)); ++ dev->pdev = pdev; ++ ++ pci_dev_put(pdev); ++ ++ return 0; ++} ++ ++#endif /* HAVE_UPSTREAM_SCIF */ ++ + static int qib_knx_init(struct qib_knx_server *server) + { + int ret = 0, num_devs = 0, i, seen = 0; +diff -Nrup a/drivers/infiniband/hw/scif/ibscif_driver.h b/drivers/infiniband/hw/scif/ibscif_driver.h +--- a/drivers/infiniband/hw/scif/ibscif_driver.h 2015-10-08 07:44:08.727979908 -0700 ++++ b/drivers/infiniband/hw/scif/ibscif_driver.h 2015-10-08 07:44:52.759981899 -0700 +@@ -74,6 +74,11 @@ + #include + #include "ibscif_protocol.h" + ++#ifdef HAVE_UPSTREAM_SCIF ++int scif_get_node_ids(u16 *nodes, int len, u16 *self); ++#define scif_get_nodeIDs scif_get_node_ids ++#endif ++ + #define IBSCIF_MTU 4096 + + #define IBSCIF_EP_TYPE_LISTEN 0 +diff -Nrup a/makefile b/makefile +--- a/makefile 2015-09-08 09:23:37.000000000 -0700 ++++ b/makefile 2015-10-08 07:44:52.759981899 -0700 +@@ -25,6 +25,11 @@ CFLAGS += \ + -DCOMPAT_PROJECT="\"Compat-rdma\"" \ + -DCOMPAT_VERSION="\"$(shell cat compat_version)\"" \ + ++ifneq ($(CONFIG_INFINIBAND_SCIF),) ++CFLAGS += \ ++ $(shell if find -L $(KSRC) -name scif.h | xargs grep -q scif_get_node_ids 2>/dev/null; then echo -n -DHAVE_UPSTREAM_SCIF; fi) ++endif ++ + DEPMOD = /sbin/depmod + INSTALL_MOD_DIR ?= $(shell test -f /etc/redhat-release && echo extra/ofa_kernel || echo updates) + -- 2.41.0