powerpc64*: port mlx5, OFED, KTLS and krping

Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

Differential Revision: https://reviews.freebsd.org/D38786
This commit is contained in:
Piotr Kubaj 2023-02-25 22:09:41 +01:00
parent b8bb73ab72
commit e552cac3d7
6 changed files with 41 additions and 3 deletions

View File

@ -318,8 +318,8 @@ BROKEN_OPTIONS+=LOADER_UBOOT
BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
.endif
# Kernel TLS is enabled by default on amd64 and aarch64
.if ${__T} == "aarch64" || ${__T} == "amd64"
# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
.else
__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS

View File

@ -84,7 +84,8 @@ BROKEN_OPTIONS+= ZFS
# Things that don't work because the kernel doesn't have the support
# for them.
.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
.if ${MACHINE} != "i386" && ${MACHINE} != "amd64" && \
${MACHINE_ARCH:Mpowerpc64*} == ""
BROKEN_OPTIONS+= OFED
.endif

View File

@ -69,9 +69,13 @@ MODULE_DEPEND(krping, linuxkpi, 1, 1, 1);
static __inline uint64_t
get_cycles(void)
{
#if defined(__amd64__) || defined(__i386__)
uint32_t low, high;
__asm __volatile("rdtsc" : "=a" (low), "=d" (high));
return (low | ((u_int64_t)high << 32));
#elif defined(__powerpc64__)
return __builtin_readcyclecounter();
#endif
}
typedef uint64_t cycles_t;

View File

@ -843,8 +843,21 @@ _nvme= nvme
.if ${MACHINE_ARCH:Mpowerpc64*} != ""
_ipmi= ipmi
_ixl= ixl
_mlx5= mlx5
_nvram= opal_nvram
.if ${MK_OFED} != "no" || defined(ALL_MODULES)
_ibcore= ibcore
_ipoib= ipoib
_iser= iser
_mlx5ib= mlx5ib
_rdma= rdma
.endif
.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
defined(ALL_MODULES)
_mlx5en= mlx5en
.endif
.endif
.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} != "powerpcspe"
# Don't build powermac_nvram for powerpcspe, it's never supported.
_nvram+= powermac_nvram

View File

@ -49,6 +49,7 @@ options TCP_BLACKBOX # Enhanced TCP event logging
options TCP_HHOOK # hhook(9) framework for TCP
options TCP_RFC7413 # TCP Fast Open
options SCTP_SUPPORT # Allow kldload of SCTP
options KERN_TLS # TLS transmit & receive offload
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
@ -128,6 +129,8 @@ device pci
options PCI_HP # PCI-Express native HotPlug
device agp
options COMPAT_LINUXKPI
# ATA controllers
device ahci # AHCI-compatible SATA controllers
device ata # Legacy ATA/SATA controllers
@ -189,6 +192,12 @@ device fxp # Intel EtherExpress PRO/100B (82557, 82558)
device re # RealTek 8139C+/8169/8169S/8110S
device rl # RealTek 8129/8139
# Nvidia/Mellanox Connect-X 4 and later, Ethernet only
# mlx5ib requires ibcore infra and is not included by default
device mlx5 # Base driver
device mlxfw # Firmware update
device mlx5en # Ethernet driver
# Pseudo devices.
device crypto # core crypto support
device loop # Network loopback
@ -199,6 +208,7 @@ device md # Memory "disks"
device ofwd # Open Firmware disks
device gif # IPv6 and IPv4 tunneling
device firmware # firmware assist module
device xz # lzma decompression
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!

View File

@ -46,6 +46,7 @@ options TCP_BLACKBOX # Enhanced TCP event logging
options TCP_HHOOK # hhook(9) framework for TCP
options TCP_RFC7413 # TCP Fast Open
options SCTP_SUPPORT # Allow kldload of SCTP
options KERN_TLS # TLS transmit & receive offload
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
@ -123,6 +124,8 @@ device pci
options PCI_HP # PCI-Express native HotPlug
device agp
options COMPAT_LINUXKPI
# ATA controllers
device ahci # AHCI-compatible SATA controllers
device ata # Legacy ATA/SATA controllers
@ -184,6 +187,12 @@ device fxp # Intel EtherExpress PRO/100B (82557, 82558)
device re # RealTek 8139C+/8169/8169S/8110S
device rl # RealTek 8129/8139
# Nvidia/Mellanox Connect-X 4 and later, Ethernet only
# mlx5ib requires ibcore infra and is not included by default
device mlx5 # Base driver
device mlxfw # Firmware update
device mlx5en # Ethernet driver
# Pseudo devices.
device crypto # core crypto support
device loop # Network loopback
@ -194,6 +203,7 @@ device md # Memory "disks"
device ofwd # Open Firmware disks
device gif # IPv6 and IPv4 tunneling
device firmware # firmware assist module
device xz # lzma decompression
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!