From f567cddf4314d9e95a2bad06ac9b655c01b87530 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 16:04:34 +0000 Subject: import libpsm2-0.7-4.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7fe2e9b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/hfi1-psm-0.7-1.tar.gz diff --git a/.libpsm2.metadata b/.libpsm2.metadata new file mode 100644 index 0000000..5a902b3 --- /dev/null +++ b/.libpsm2.metadata @@ -0,0 +1 @@ +03c2bf2d7231fef6fa07242e98b78ebdcf095ee7 SOURCES/hfi1-psm-0.7-1.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-avoid-executable-flag-on-installed-header-files.patch b/SOURCES/0001-avoid-executable-flag-on-installed-header-files.patch new file mode 100644 index 0000000..fc5d42f --- /dev/null +++ b/SOURCES/0001-avoid-executable-flag-on-installed-header-files.patch @@ -0,0 +1,29 @@ +From 2a39086d7bc5b95fa691a33f19da8338e9e8fe00 Mon Sep 17 00:00:00 2001 +From: Michal Schmidt +Date: Wed, 12 Aug 2015 14:23:32 +0200 +Subject: [PATCH] avoid executable flag on installed header files + +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 63686c6f30..92e4295740 100644 +--- a/Makefile ++++ b/Makefile +@@ -152,9 +152,9 @@ install: all + ln -sf ${TARGLIB}.so.${MAJOR}.${MINOR} ${COMPATLIB}.so ; \ + ln -sf ${TARGLIB}.so.${MAJOR}.${MINOR} ${TARGLIB}.so.${MAJOR} ; \ + ln -sf ${TARGLIB}.so.${MAJOR} ${TARGLIB}.so) +- install -D psm2.h ${DESTDIR}/usr/include/psm2.h +- install -D psm2_mq.h ${DESTDIR}/usr/include/psm2_mq.h +- install -D psm2_am.h ${DESTDIR}/usr/include/psm2_am.h ++ install -m 0644 -D psm2.h ${DESTDIR}/usr/include/psm2.h ++ install -m 0644 -D psm2_mq.h ${DESTDIR}/usr/include/psm2_mq.h ++ install -m 0644 -D psm2_am.h ${DESTDIR}/usr/include/psm2_am.h + (cd ${DESTDIR}/usr/include ; \ + ln -sf psm2.h psm.h ; \ + ln -sf psm2_mq.h psm_mq.h ; \ +-- +2.4.3 + diff --git a/SOURCES/0002-avoid-calling-memset-with-zero-length.patch b/SOURCES/0002-avoid-calling-memset-with-zero-length.patch new file mode 100644 index 0000000..c675643 --- /dev/null +++ b/SOURCES/0002-avoid-calling-memset-with-zero-length.patch @@ -0,0 +1,44 @@ +From 378ffb7cca7fca1cb64ff3a2e50496c18011dd07 Mon Sep 17 00:00:00 2001 +From: Michal Schmidt +Date: Wed, 12 Aug 2015 14:25:53 +0200 +Subject: [PATCH] avoid calling memset with zero length + +This avoids the following build error: + +In file included from /usr/include/string.h:638:0, + from ./include/opa_user.h:77, + from psm_user.h:67, + from psm_diags.c:56: +In function 'memset', + inlined from 'memcpy_check_one.constprop.4' at psm_diags.c:278:8, + inlined from 'memcpy_check_size.constprop.2' at psm_diags.c:335:30, + inlined from 'psmi_test_memcpy.constprop.1' at psm_diags.c:230:6, + inlined from 'psmi_diags' at psm_diags.c:84:25: +/usr/include/bits/string3.h:81:30: error: call to +'__warn_memset_zero_len' declared with attribute warning: memset used +with constant zero length parameter; this could be due to transposed +parameters [-Werror] + __warn_memset_zero_len (); + ^ +--- + psm_diags.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/psm_diags.c b/psm_diags.c +index 286e72bd8a..152968750c 100644 +--- a/psm_diags.c ++++ b/psm_diags.c +@@ -275,6 +275,10 @@ void *memcpy_check_one(memcpy_fn_t fn, void *dst, void *src, size_t n) + ((uintptr_t) dst ^ (uintptr_t) src ^ (uintptr_t) n); + unsigned int state; + size_t i; ++ ++ if (!n) ++ return dst; ++ + memset(src, 0x55, n); + memset(dst, 0xaa, n); + srand(seed); +-- +2.4.3 + diff --git a/SOURCES/0003-use-pkg-config-to-find-udev-rules-dir.patch b/SOURCES/0003-use-pkg-config-to-find-udev-rules-dir.patch new file mode 100644 index 0000000..d95b314 --- /dev/null +++ b/SOURCES/0003-use-pkg-config-to-find-udev-rules-dir.patch @@ -0,0 +1,39 @@ +From dd1eb4ed6a00bd5e25b952962a1dfebc213fa920 Mon Sep 17 00:00:00 2001 +From: Michal Schmidt +Date: Wed, 12 Aug 2015 16:58:32 +0200 +Subject: [PATCH] use pkg-config to find udev rules dir + +--- + Makefile | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 92e4295740..5568eb84b5 100644 +--- a/Makefile ++++ b/Makefile +@@ -116,6 +116,13 @@ VERSION_RELEASE := $(VERSION)-$(RELEASE) + + LDLIBS := -lrt -lpthread -ldl ${EXTRA_LIBS} + ++PKG_CONFIG ?= pkg-config ++ ++UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null) ++ifndef UDEVDIR ++ UDEVDIR = /lib/udev ++endif ++ + all: symlinks + for subdir in $(SUBDIRS); do \ + $(MAKE) -C $$subdir $@ ;\ +@@ -159,7 +166,7 @@ install: all + ln -sf psm2.h psm.h ; \ + ln -sf psm2_mq.h psm_mq.h ; \ + ln -sf psm2_am.h psm_am.h) +- install -m 0644 -D 40-psm-compat.rules ${DESTDIR}/etc/udev/rules.d/40-psm-compat.rules ++ install -m 0644 -D 40-psm-compat.rules ${DESTDIR}$(UDEVDIR)/rules.d/40-psm-compat.rules + + install-noship: all + mkdir -p ${DESTDIR}/usr/include/hfi1diag +-- +2.4.3 + diff --git a/SOURCES/0004-prevent-having-executable-stack.patch b/SOURCES/0004-prevent-having-executable-stack.patch new file mode 100644 index 0000000..dcff1f1 --- /dev/null +++ b/SOURCES/0004-prevent-having-executable-stack.patch @@ -0,0 +1,39 @@ +From 619b42357a3743c9d3d006d7cc7b57d6a45f033c Mon Sep 17 00:00:00 2001 +From: Michal Schmidt +Date: Mon, 31 Aug 2015 23:58:29 +0200 +Subject: [PATCH] prevent having executable stack + +Add .note.GNU-stack sections to objects compiled from assembly. +This allows libpsm2.so.2.0 to have non-executable stack. +--- + opa/opa_dwordcpy-i386.S | 4 ++++ + opa/opa_dwordcpy-x86_64-fast.S | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/opa/opa_dwordcpy-i386.S b/opa/opa_dwordcpy-i386.S +index 140c5d18bd..f3d898ded7 100644 +--- a/opa/opa_dwordcpy-i386.S ++++ b/opa/opa_dwordcpy-i386.S +@@ -78,3 +78,7 @@ hfi_dwordcpy: + mov %eax,%edi + mov %edx,%esi + ret ++ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif +diff --git a/opa/opa_dwordcpy-x86_64-fast.S b/opa/opa_dwordcpy-x86_64-fast.S +index 63e209f890..fe07ebfa92 100644 +--- a/opa/opa_dwordcpy-x86_64-fast.S ++++ b/opa/opa_dwordcpy-x86_64-fast.S +@@ -71,3 +71,7 @@ hfi_dwordcpy: + rep + movsd + ret ++ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif +-- +2.4.3 + diff --git a/SOURCES/hfi1_user.h b/SOURCES/hfi1_user.h new file mode 100644 index 0000000..1fc6398 --- /dev/null +++ b/SOURCES/hfi1_user.h @@ -0,0 +1,427 @@ +/* + * + * 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) 2015 Intel Corporation. + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. + * + * 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 copyright + * 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. + * + */ + +/* + * This file contains defines, structures, etc. that are used + * to communicate between kernel and user code. + */ + +#ifndef _LINUX__HFI1_USER_H +#define _LINUX__HFI1_USER_H + +#include + +/* + * This version number is given to the driver by the user code during + * initialization in the spu_userversion field of hfi1_user_info, so + * the driver can check for compatibility with user code. + * + * The major version changes when data structures change in an incompatible + * way. The driver must be the same for initialization to succeed. + */ +#define HFI1_USER_SWMAJOR 4 + +/* + * Minor version differences are always compatible + * a within a major version, however if user software is larger + * than driver software, some new features and/or structure fields + * may not be implemented; the user code must deal with this if it + * cares, or it must abort after initialization reports the difference. + */ +#define HFI1_USER_SWMINOR 0 + +/* + * Set of HW and driver capability/feature bits. + * These bit values are used to configure enabled/disabled HW and + * driver features. The same set of bits are communicated to user + * space. + */ +#define HFI1_CAP_DMA_RTAIL (1UL << 0) /* Use DMA'ed RTail value */ +#define HFI1_CAP_SDMA (1UL << 1) /* Enable SDMA support */ +#define HFI1_CAP_SDMA_AHG (1UL << 2) /* Enable SDMA AHG support */ +#define HFI1_CAP_EXTENDED_PSN (1UL << 3) /* Enable Extended PSN support */ +#define HFI1_CAP_HDRSUPP (1UL << 4) /* Enable Header Suppression */ +/* 1UL << 5 reserved */ +#define HFI1_CAP_USE_SDMA_HEAD (1UL << 6) /* DMA Hdr Q tail vs. use CSR */ +#define HFI1_CAP_MULTI_PKT_EGR (1UL << 7) /* Enable multi-packet Egr buffs*/ +#define HFI1_CAP_NODROP_RHQ_FULL (1UL << 8) /* Don't drop on Hdr Q full */ +#define HFI1_CAP_NODROP_EGR_FULL (1UL << 9) /* Don't drop on EGR buffs full */ +#define HFI1_CAP_TID_UNMAP (1UL << 10) /* Enable Expected TID caching */ +#define HFI1_CAP_PRINT_UNIMPL (1UL << 11) /* Show for unimplemented feats */ +#define HFI1_CAP_ALLOW_PERM_JKEY (1UL << 12) /* Allow use of permissive JKEY */ +#define HFI1_CAP_NO_INTEGRITY (1UL << 13) /* Enable ctxt integrity checks */ +#define HFI1_CAP_PKEY_CHECK (1UL << 14) /* Enable ctxt PKey checking */ +#define HFI1_CAP_STATIC_RATE_CTRL (1UL << 15) /* Allow PBC.StaticRateControl */ +#define HFI1_CAP_QSFP_ENABLED (1UL << 16) /* Enable QSFP check during LNI */ +#define HFI1_CAP_SDMA_HEAD_CHECK (1UL << 17) /* SDMA head checking */ +#define HFI1_CAP_EARLY_CREDIT_RETURN (1UL << 18) /* early credit return */ + +#define HFI1_RCVHDR_ENTSIZE_2 (1UL << 0) +#define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1) +#define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2) + +/* + * If the unit is specified via open, HFI choice is fixed. If port is + * specified, it's also fixed. Otherwise we try to spread contexts + * across ports and HFIs, using different algorithms. WITHIN is + * the old default, prior to this mechanism. + */ +#define HFI1_ALG_ACROSS 0 /* round robin contexts across HFIs, then + * ports; this is the default */ +#define HFI1_ALG_WITHIN 1 /* use all contexts on an HFI (round robin + * active ports within), then next HFI */ +#define HFI1_ALG_COUNT 2 /* number of algorithm choices */ + + +/* User commands. */ +#define HFI1_CMD_ASSIGN_CTXT 1 /* allocate HFI and context */ +#define HFI1_CMD_CTXT_INFO 2 /* find out what resources we got */ +#define HFI1_CMD_USER_INFO 3 /* set up userspace */ +#define HFI1_CMD_TID_UPDATE 4 /* update expected TID entries */ +#define HFI1_CMD_TID_FREE 5 /* free expected TID entries */ +#define HFI1_CMD_CREDIT_UPD 6 /* force an update of PIO credit */ +#define HFI1_CMD_SDMA_STATUS_UPD 7 /* force update of SDMA status ring */ + +#define HFI1_CMD_RECV_CTRL 8 /* control receipt of packets */ +#define HFI1_CMD_POLL_TYPE 9 /* set the kind of polling we want */ +#define HFI1_CMD_ACK_EVENT 10 /* ack & clear user status bits */ +#define HFI1_CMD_SET_PKEY 11 /* set context's pkey */ +#define HFI1_CMD_CTXT_RESET 12 /* reset context's HW send context */ +/* separate EPROM commands from normal PSM commands */ +#define HFI1_CMD_EP_INFO 64 /* read EPROM device ID */ +#define HFI1_CMD_EP_ERASE_CHIP 65 /* erase whole EPROM */ +#define HFI1_CMD_EP_ERASE_P0 66 /* erase EPROM partition 0 */ +#define HFI1_CMD_EP_ERASE_P1 67 /* erase EPROM partition 1 */ +#define HFI1_CMD_EP_READ_P0 68 /* read EPROM partition 0 */ +#define HFI1_CMD_EP_READ_P1 69 /* read EPROM partition 1 */ +#define HFI1_CMD_EP_WRITE_P0 70 /* write EPROM partition 0 */ +#define HFI1_CMD_EP_WRITE_P1 71 /* write EPROM partition 1 */ + +#define _HFI1_EVENT_FROZEN_BIT 0 +#define _HFI1_EVENT_LINKDOWN_BIT 1 +#define _HFI1_EVENT_LID_CHANGE_BIT 2 +#define _HFI1_EVENT_LMC_CHANGE_BIT 3 +#define _HFI1_EVENT_SL2VL_CHANGE_BIT 4 +#define _HFI1_MAX_EVENT_BIT _HFI1_EVENT_SL2VL_CHANGE_BIT + +#define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT) +#define HFI1_EVENT_LINKDOWN_BIT (1UL << _HFI1_EVENT_LINKDOWN_BIT) +#define HFI1_EVENT_LID_CHANGE_BIT (1UL << _HFI1_EVENT_LID_CHANGE_BIT) +#define HFI1_EVENT_LMC_CHANGE_BIT (1UL << _HFI1_EVENT_LMC_CHANGE_BIT) +#define HFI1_EVENT_SL2VL_CHANGE_BIT (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT) + +/* + * These are the status bits readable (in ASCII form, 64bit value) + * from the "status" sysfs file. For binary compatibility, values + * must remain as is; removed states can be reused for different + * purposes. + */ +#define HFI1_STATUS_INITTED 0x1 /* basic initialization done */ +/* Chip has been found and initialized */ +#define HFI1_STATUS_CHIP_PRESENT 0x20 +/* IB link is at ACTIVE, usable for data traffic */ +#define HFI1_STATUS_IB_READY 0x40 +/* link is configured, LID, MTU, etc. have been set */ +#define HFI1_STATUS_IB_CONF 0x80 +/* A Fatal hardware error has occurred. */ +#define HFI1_STATUS_HWERROR 0x200 + +/* + * Number of supported shared contexts. + * This is the maximum number of software contexts that can share + * a hardware send/receive context. + */ +#define HFI1_MAX_SHARED_CTXTS 8 + +/* + * Poll types + */ +#define HFI1_POLL_TYPE_ANYRCV 0x0 +#define HFI1_POLL_TYPE_URGENT 0x1 + +/* + * This structure is passed to the driver to tell it where + * user code buffers are, sizes, etc. The offsets and sizes of the + * fields must remain unchanged, for binary compatibility. It can + * be extended, if userversion is changed so user code can tell, if needed + */ +struct hfi1_user_info { + /* + * version of user software, to detect compatibility issues. + * Should be set to HFI1_USER_SWVERSION. + */ + __u32 userversion; + __u16 pad; + /* HFI selection algorithm, if unit has not selected */ + __u16 hfi1_alg; + /* + * If two or more processes wish to share a context, each process + * must set the subcontext_cnt and subcontext_id to the same + * values. The only restriction on the subcontext_id is that + * it be unique for a given node. + */ + __u16 subctxt_cnt; + __u16 subctxt_id; + /* 128bit UUID passed in by PSM. */ + __u8 uuid[16]; +}; + +struct hfi1_ctxt_info { + __u64 runtime_flags; /* chip/drv runtime flags (HFI1_CAP_*) */ + __u32 rcvegr_size; /* size of each eager buffer */ + __u16 num_active; /* number of active units */ + __u16 unit; /* unit (chip) assigned to caller */ + __u16 ctxt; /* ctxt on unit assigned to caller */ + __u16 subctxt; /* subctxt on unit assigned to caller */ + __u16 rcvtids; /* number of Rcv TIDs for this context */ + __u16 credits; /* number of PIO credits for this context */ + __u16 numa_node; /* NUMA node of the assigned device */ + __u16 rec_cpu; /* cpu # for affinity (0xffff if none) */ + __u16 send_ctxt; /* send context in use by this user context */ + __u16 egrtids; /* number of RcvArray entries for Eager Rcvs */ + __u16 rcvhdrq_cnt; /* number of RcvHdrQ entries */ + __u16 rcvhdrq_entsize; /* size (in bytes) for each RcvHdrQ entry */ + __u16 sdma_ring_size; /* number of entries in SDMA request ring */ +}; + +struct hfi1_tid_info { + /* virtual address of first page in transfer */ + __u64 vaddr; + /* pointer to tid array. this array is big enough */ + __u64 tidlist; + /* number of tids programmed by this request */ + __u32 tidcnt; + /* length of transfer buffer programmed by this request */ + __u32 length; + /* + * pointer to bitmap of TIDs used for this call; + * checked for being large enough at open + */ + __u64 tidmap; +}; + +struct hfi1_cmd { + __u32 type; /* command type */ + __u32 len; /* length of struct pointed to by add */ + __u64 addr; /* pointer to user structure */ +}; + +enum hfi1_sdma_comp_state { + FREE = 0, + QUEUED, + COMPLETE, + ERROR +}; + +/* + * SDMA completion ring entry + */ +struct hfi1_sdma_comp_entry { + __u32 status; + __u32 errcode; +}; + +/* + * Device status and notifications from driver to user-space. + */ +struct hfi1_status { + __u64 dev; /* device/hw status bits */ + __u64 port; /* port state and status bits */ + char freezemsg[0]; +}; + +/* + * This structure is returned by the driver immediately after + * open to get implementation-specific info, and info specific to this + * instance. + * + * This struct must have explicit pad fields where type sizes + * may result in different alignments between 32 and 64 bit + * programs, since the 64 bit * bit kernel requires the user code + * to have matching offsets + */ +struct hfi1_base_info { + /* version of hardware, for feature checking. */ + __u32 hw_version; + /* version of software, for feature checking. */ + __u32 sw_version; + /* Job key */ + __u16 jkey; + __u16 padding1; + /* + * The special QP (queue pair) value that identifies PSM + * protocol packet from standard IB packets. + */ + __u32 bthqp; + /* PIO credit return address, */ + __u64 sc_credits_addr; + /* + * Base address of write-only pio buffers for this process. + * Each buffer has sendpio_credits*64 bytes. + */ + __u64 pio_bufbase_sop; + /* + * Base address of write-only pio buffers for this process. + * Each buffer has sendpio_credits*64 bytes. + */ + __u64 pio_bufbase; + /* address where receive buffer queue is mapped into */ + __u64 rcvhdr_bufbase; + /* base address of Eager receive buffers. */ + __u64 rcvegr_bufbase; + /* base address of SDMA completion ring */ + __u64 sdma_comp_bufbase; + /* + * User register base for init code, not to be used directly by + * protocol or applications. Always maps real chip register space. + * the register addresses are: + * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail, + * ur_rcvtidflow + */ + __u64 user_regbase; + /* notification events */ + __u64 events_bufbase; + /* status page */ + __u64 status_bufbase; + /* rcvhdrtail update */ + __u64 rcvhdrtail_base; + /* + * shared memory pages for subctxts if ctxt is shared; these cover + * all the processes in the group sharing a single context. + * all have enough space for the num_subcontexts value on this job. + */ + __u64 subctxt_uregbase; + __u64 subctxt_rcvegrbuf; + __u64 subctxt_rcvhdrbuf; +}; + +enum sdma_req_opcode { + EXPECTED = 0, + EAGER +}; + +#define HFI1_SDMA_REQ_VERSION_MASK 0xF +#define HFI1_SDMA_REQ_VERSION_SHIFT 0x0 +#define HFI1_SDMA_REQ_OPCODE_MASK 0xF +#define HFI1_SDMA_REQ_OPCODE_SHIFT 0x4 +#define HFI1_SDMA_REQ_IOVCNT_MASK 0xFF +#define HFI1_SDMA_REQ_IOVCNT_SHIFT 0x8 + +struct sdma_req_info { + /* + * bits 0-3 - version (currently unused) + * bits 4-7 - opcode (enum sdma_req_opcode) + * bits 8-15 - io vector count + */ + __u16 ctrl; + /* + * Number of fragments contained in this request. + * User-space has already computed how many + * fragment-sized packet the user buffer will be + * split into. + */ + __u16 npkts; + /* + * Size of each fragment the user buffer will be + * split into. + */ + __u16 fragsize; + /* + * Index of the slot in the SDMA completion ring + * this request should be using. User-space is + * in charge of managing its own ring. + */ + __u16 comp_idx; +} __attribute__((packed)); + +/* + * SW KDETH header. + * swdata is SW defined portion. + */ +struct hfi1_kdeth_header { + __le32 ver_tid_offset; + __le16 jkey; + __le16 hcrc; + __le32 swdata[7]; +} __attribute__((packed)); + +/* + * Structure describing the headers that User space uses. The + * structure above is a subset of this one. + */ +struct hfi1_pkt_header { + __le16 pbc[4]; + __be16 lrh[4]; + __be32 bth[3]; + struct hfi1_kdeth_header kdeth; +} __attribute__((packed)); + + +/* + * The list of usermode accessible registers. + */ +enum hfi1_ureg { + /* (RO) DMA RcvHdr to be used next. */ + ur_rcvhdrtail = 0, + /* (RW) RcvHdr entry to be processed next by host. */ + ur_rcvhdrhead = 1, + /* (RO) Index of next Eager index to use. */ + ur_rcvegrindextail = 2, + /* (RW) Eager TID to be processed next */ + ur_rcvegrindexhead = 3, + /* (RO) Receive Eager Offset Tail */ + ur_rcvegroffsettail = 4, + /* For internal use only; max register number. */ + ur_maxreg, + /* (RW) Receive TID flow table */ + ur_rcvtidflowtable = 256 +}; + +#endif /* _LINIUX__HFI1_USER_H */ diff --git a/SPECS/libpsm2.spec b/SPECS/libpsm2.spec new file mode 100644 index 0000000..2a23c53 --- /dev/null +++ b/SPECS/libpsm2.spec @@ -0,0 +1,126 @@ +%global tar_name hfi1-psm-0.7-1 +Summary: Intel PSM Libraries +Name: libpsm2 +Version: 0.7 +Release: 4%{?dist} +License: GPLv2 or BSD +Group: System Environment/Libraries +URL: http://www.intel.com/ +# Source tarball obtained by: +# git clone https://github.com/01org/opa-psm2 +# cd opa-psm2 +# git checkout 25bbc387f4b5054a479ddb2670fa02e2e8a7421f +# make dist +Source0: %{tar_name}.tar.gz +# Once we have hfi1 in our kernels, we'll build against kernel-headers +# instead of using this internal copy of hfi1_user.h. +Source1: hfi1_user.h +# https://github.com/01org/opa-psm2/pull/1 +Patch0001: 0001-avoid-executable-flag-on-installed-header-files.patch +Patch0002: 0002-avoid-calling-memset-with-zero-length.patch +Patch0003: 0003-use-pkg-config-to-find-udev-rules-dir.patch +# https://github.com/01org/opa-psm2/pull/2 +Patch0004: 0004-prevent-having-executable-stack.patch +BuildRequires: libuuid-devel +BuildRequires: pkgconfig(udev) +# OPA HFI is Intel's thing +ExclusiveArch: x86_64 + +%description +The PSM Messaging API, or PSM API, is Intel's low-level +user-level communications interface for the Truescale +family of products. PSM users are enabled with mechanisms +necessary to implement higher level communications +interfaces in parallel environments. + +%package devel +Summary: Development files for Intel PSM +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: libuuid-devel + +%description devel +Development files for the libpsm2 library + +%package compat +Summary: Support for MPIs linked with PSM1 +Group: System Environment/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description compat +Support for MPIs linked with PSM1. +The compat library is installed in a non-standard directory to avoid +conflicting with infinipath-psm. To use it, set: +LD_LIBRARY_PATH=%{_libdir}/psm2 + +%package compat-devel +Summary: Development files for unmodified PSM1 MPIs +Group: Development/Libraries +Requires: %{name}-compat%{?_isa} = %{version}-%{release} +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Conflicts: infinipath-psm-devel + +%description compat-devel +Support for compiling unmodified PSM1 MPIs. + +%prep +%setup -q -n %{tar_name} +%patch0001 -p1 +%patch0002 -p1 +%patch0003 -p1 +%patch0004 -p1 +mkdir -p include/rdma/hfi +cp %{SOURCE1} include/rdma/hfi/ + +%build +CFLAGS="%{optflags}" make %{?_smp_mflags} + +%install +%make_install + +# Avoid conflict with infinipath-psm. +# Move the compat symlink to a non-default directory, so that explicit +# LD_LIBRARY_PATH setting is required to use it. +test -L %{buildroot}/%{_libdir}/libpsm_infinipath.so.1 || exit 1 +mkdir %{buildroot}/%{_libdir}/psm2 +rm %{buildroot}/%{_libdir}/libpsm_infinipath.so.1 +ln -s ../libpsm2.so.2.0 %{buildroot}/%{_libdir}/psm2/libpsm_infinipath.so.1 + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc COPYING README +%{_libdir}/libpsm2.so.2.0 +%{_libdir}/libpsm2.so.2 + +%files devel +%{_libdir}/libpsm2.so +%{_includedir}/psm2.h +%{_includedir}/psm2_mq.h +%{_includedir}/psm2_am.h + +%files compat +%{_udevrulesdir}/40-psm-compat.rules +%{_libdir}/psm2 +%{_libdir}/psm2/libpsm_infinipath.so.1 + +%files compat-devel +%{_includedir}/psm.h +%{_includedir}/psm_am.h +%{_includedir}/psm_mq.h +%{_libdir}/libpsm_infinipath.so + +%changelog +* Tue Sep 01 2015 Michal Schmidt - 0.7-4 +- Prevent executable stack. +- Related: bz1173296 + +* Wed Aug 19 2015 Michal Schmidt - 0.7-3 +- Move the compat lib to /usr/lib64/psm2, drop Conflict with infinipath-psm. + +* Tue Aug 18 2015 Michal Schmidt - 0.7-2 +- Conflict with rather than Obsolete infinipath-psm. + +* Wed Aug 12 2015 Michal Schmidt - 0.7-1 +- Initial packaging for RHEL, based on upstream spec.