Skip to contentSkip to conversation

libmlx5: add support for the s390x platform

PATCH In review Kittipon Meesompop 3 participants 5 messages Sep 6, 2017 – Sep 13, 2017 4 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libmlx5: add support for the s390x platform

Since s390x platform requires execution of privileged CPU instructions to work with PCI I/O memory, the PCI I/O memory cannot be directly accessed from the userspace programs via the mapped memory areas.

This patch is created against libmlx5-1.2.1 and contains the changes to the libmlx5 userspace Mellanox device driver library required to provide support for the DAPL API on the s390x platform. The original code that directly used mapped memory areas to access the PCI I/O memory of the Mellanox networking device is replaced with the new system call invocation for writing the data to mapped memory areas. The functions for reading and writing are added analogously to libmlx4.

libmlx4 comparison to:

        commit f5c26f8762135f629c8cbe73d808e3029f07b176                          
        Author: Alexey Ishchuk <[email protected]>                     
        Date:   Wed Nov 19 11:17:19 2014 +0100                                   
libmlx5-1.2.1/Makefile.am renamed from libmlx5-1.2.1.orig/Makefile.am +1 -1
index 39ca65d..45fa45d 100644
@@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4
 mlx5_version_script = @MLX5_VERSION_SCRIPT@
 
 MLX5_SOURCES = src/buf.c src/cq.c src/dbrec.c src/mlx5.c src/qp.c src/srq.c src/verbs.c
-noinst_HEADERS = src/bitmap.h src/doorbell.h src/list.h src/mlx5-abi.h src/mlx5.h src/wqe.h
+noinst_HEADERS = src/bitmap.h src/doorbell.h src/list.h src/mlx5-abi.h src/mlx5.h src/wqe.h src/mmio.h
 
 
 if HAVE_IBV_DEVICE_LIBRARY_EXTENSION
libmlx5-1.2.1/src/doorbell.h renamed from libmlx5-1.2.1.orig/src/doorbell.h +5 -3
index 7d4df8a..436c1cb 100644
@@ -34,6 +34,8 @@
 #ifndef DOORBELL_H
 #define DOORBELL_H
 
+#include "mmio.h"
+
 #if SIZEOF_LONG == 8
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -46,7 +48,7 @@
 
 static inline void mlx5_write64(uint32_t val[2], void *dest, struct mlx5_spinlock *lock)
 {
-	*(volatile uint64_t *)dest = MLX5_PAIR_TO_64(val);
+	mmio_writeq((unsigned long)dest, MLX5_PAIR_TO_64(val));
 }
 
 #else
@@ -54,8 +56,8 @@ static inline void mlx5_write64(uint32_t val[2], void *dest, struct mlx5_spinloc
 static inline void mlx5_write64(uint32_t val[2], void *dest, struct mlx5_spinlock *lock)
 {
 	mlx5_spin_lock(lock);
-	*(volatile uint32_t *)dest		= val[0];
-	*(volatile uint32_t *)(dest + 4)	= val[1];
+	mmio_writel((unsigned long)(dest), val[0]);
+	mmio_writel((unsigned long)(dest + 4), val[1]);
 	mlx5_spin_unlock(lock);
 }
 
libmlx5-1.2.1/src/mlx5.h renamed from libmlx5-1.2.1.orig/src/mlx5.h +2 -0
index feb095c..125652c 100644
@@ -85,6 +85,8 @@
 #define wc_wmb() asm volatile("sfence" ::: "memory")
 #elif defined(__ia64__)
 #define wc_wmb() asm volatile("fwb" ::: "memory")
+#elif defined(__s390x__)
+#define wc_wmb { asm volatile("" : : : "memory") } 
 #else
 #define wc_wmb() wmb()
 #endif
libmlx5-1.2.1/src/mmio.h new file +130 -0

130 lines not on this page · raw message

libmlx5-1.2.1/src/qp.c renamed from libmlx5-1.2.1.orig/src/qp.c +0 -23
index 51e1176..b9e2cc2 100644
@@ -222,29 +222,6 @@ static void set_data_ptr_seg_atomic(struct mlx5_wqe_data_seg *dseg,
 	dseg->addr       = htonll(sg->addr);
 }
 
-/*
- * Avoid using memcpy() to copy to BlueFlame page, since memcpy()
- * implementations may use move-string-buffer assembler instructions,
- * which do not guarantee order of copying.
- */
-static void mlx5_bf_copy(unsigned long long *dst, unsigned long long *src,
-			 unsigned bytecnt, struct mlx5_qp *qp)
-{
-	while (bytecnt > 0) {
-		*dst++ = *src++;
-		*dst++ = *src++;
-		*dst++ = *src++;
-		*dst++ = *src++;
-		*dst++ = *src++;
-		*dst++ = *src++;
-		*dst++ = *src++;
-		*dst++ = *src++;
-		bytecnt -= 8 * sizeof(unsigned long long);
-		if (unlikely(src == qp->sq.qend))
-			src = qp->sq_start;
-	}
-}
-
 static uint32_t send_ieth(struct ibv_send_wr *wr)
 {
 	switch (wr->opcode) {

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive
Quoted 12 lines · Kittipon Meesompop

Since s390x platform requires execution of privileged CPU instructions to work with PCI I/O memory, the PCI I/O memory cannot be directly accessed from the userspace programs via the mapped memory areas.

This patch is created against libmlx5-1.2.1 and contains the changes to the libmlx5 userspace Mellanox device driver library required to provide support for the DAPL API on the s390x platform. The original code that directly used mapped memory areas to access the PCI I/O memory of the Mellanox networking device is replaced with the new system call invocation for writing the data to mapped memory areas. The functions for reading and writing are added analogously to libmlx4.

Quoted 7 lines

libmlx4 comparison to:

        commit f5c26f8762135f629c8cbe73d808e3029f07b176
        Author: Alexey Ishchuk <[email protected]>
        Date:   Wed Nov 19 11:17:19 2014 +0100

Thank you for doing it. I afraid that you sent this patch to a wrong mailing list. I don't know exactly where you should sent it, but all new development for last ~12 months of RDMA user space stack is done against rdma-core [1].

Thanks

[1] http://github.com/linux-rdma/rdma-core

#4 lore raw
In reply to a message not in the archive
Quoted 18 lines · Leon Romanovsky
Quoted 17 lines · Kittipon Meesompop

Since s390x platform requires execution of privileged CPU instructions to work with PCI I/O memory, the PCI I/O memory cannot be directly accessed from the userspace programs via the mapped memory areas.

This patch is created against libmlx5-1.2.1 and contains the changes to the libmlx5 userspace Mellanox device driver library required to provide support for the DAPL API on the s390x platform. The original code that directly used mapped memory areas to access the PCI I/O memory of the Mellanox networking device is replaced with the new system call invocation for writing the data to mapped memory areas. The functions for reading and writing are added analogously to libmlx4.

libmlx4 comparison to:

        commit f5c26f8762135f629c8cbe73d808e3029f07b176
        Author: Alexey Ishchuk <[email protected]>
        Date:   Wed Nov 19 11:17:19 2014 +0100
Quoted 7 lines
Quoted 2 lines

Thank you for doing it. I afraid that you sent this patch to a wrong mailing list. I don't know exactly where you should sent it, but all new development for last ~12 months of RDMA user space stack is done against rdma-core [1].

.. and I already did s390 support for mlx5 drivers in rdma-core, you should test it.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 21 lines · Jason Gunthorpe
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Kittipon Meesompop

Since s390x platform requires execution of privileged CPU instructions to work with PCI I/O memory, the PCI I/O memory cannot be directly accessed from the userspace programs via the mapped memory areas.

This patch is created against libmlx5-1.2.1 and contains the changes to the libmlx5 userspace Mellanox device driver library required to provide support for the DAPL API on the s390x platform. The original code that directly used mapped memory areas to access the PCI I/O memory of the Mellanox networking device is replaced with the new system call invocation for writing the data to mapped memory areas. The functions for reading and writing are added analogously to libmlx4.

libmlx4 comparison to:

         commit f5c26f8762135f629c8cbe73d808e3029f07b176
         Author: Alexey Ishchuk <[email protected]>
         Date:   Wed Nov 19 11:17:19 2014 +0100
Quoted 8 lines
Quoted 4 lines

Thank you for doing it. I afraid that you sent this patch to a wrong mailing list. I don't know exactly where you should sent it, but all new development for last ~12 months of RDMA user space stack is done against rdma-core [1].

.. and I already did s390 support for mlx5 drivers in rdma-core, you should test it.

Jason

Thanks for your info; we should have listened better to linux-rdma. That means my sent libmlx5 patch is not needed anymore. I now have run dapltest with your rdma-core provided libraries libmlx4.so,1.0.15 and libmlx5.so.1.2.15 on an IBM internally built driver for s390. libmlx5 results with and without vlan interfaces look good, libmlx4 results look good for non-vlan interfaces. Analysis of the libmlx4 failure for vlan-interfaces is ongoing; it might just be a driver issue.

Kittipon

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to a message not in the archive
Quoted 7 lines · Kittipon Meesompop

Thanks for your info; we should have listened better to linux-rdma. That means my sent libmlx5 patch is not needed anymore. I now have run dapltest with your rdma-core provided libraries libmlx4.so,1.0.15 and libmlx5.so.1.2.15 on an IBM internally built driver for s390. libmlx5 results with and without vlan interfaces look good, libmlx4 results look good for non-vlan interfaces. Analysis of the libmlx4 failure for vlan-interfaces is ongoing; it might just be a driver issue.

Okay, thanks! That is good to hear.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html