diff --git a/centos_build_layer.cfg b/centos_build_layer.cfg deleted file mode 100644 index 0e093317..00000000 --- a/centos_build_layer.cfg +++ /dev/null @@ -1 +0,0 @@ -distro diff --git a/centos_extra_downloads.lst b/centos_extra_downloads.lst deleted file mode 100644 index 293e061b..00000000 --- a/centos_extra_downloads.lst +++ /dev/null @@ -1,8 +0,0 @@ -mlnx-ofa_kernel-5.5-OFED.5.5.1.0.3.1.src.rpm -mlnx-tools-5.2.0-0.55103.src.rpm -mstflint-4.16.0-1.55103.src.rpm -rdma-core-55mlnx37-1.55103.src.rpm -opae-intel-fpga-driver-2.0.1-10.src.rpm -ice_comms-1.3.35.0.zip -netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz -libbnxt_re-220.0.5.0-rhel7u9.src.rpm diff --git a/centos_guest_image.inc b/centos_guest_image.inc deleted file mode 100644 index 75bb51c9..00000000 --- a/centos_guest_image.inc +++ /dev/null @@ -1,22 +0,0 @@ -# List of packages to be included/installed in guest image -# If these have dependencies, they will be pulled in automatically -# - -# kernel -perf - -# -# Network Drivers -# - -# iavf-kmod -kmod-iavf - -# i40e-kmod -kmod-i40e - -# ice-kmod -kmod-ice - -# qat17 -qat17 diff --git a/centos_guest_image_rt.inc b/centos_guest_image_rt.inc deleted file mode 100644 index 101cc115..00000000 --- a/centos_guest_image_rt.inc +++ /dev/null @@ -1,23 +0,0 @@ -# List of packages to be included/installed in RT guest image -# If these have dependencies, they will be pulled in automatically -# - -# -# Network Drivers -# - -# iavf-kmod -kmod-iavf-rt - -# i40e-kmod -kmod-i40e-rt - -# ice-kmod -kmod-ice-rt - -# ixgbevf-kmod - -# ixgbe-kmod - -# qat17 -qat17-rt diff --git a/centos_iso_image.inc b/centos_iso_image.inc deleted file mode 100644 index 432dc9f0..00000000 --- a/centos_iso_image.inc +++ /dev/null @@ -1,67 +0,0 @@ -# List of packages to be included/installed in the ISO image. -# If these have dependencies, they will be pulled in automatically. -# - -# kernel -kernel -kernel-modules-extra -kernel-tools -kernel-tools-libs -kernel-headers -kernel-devel -bpftool -perf -python-perf - -# kernel-rt -kernel-rt -kernel-rt-kvm -kernel-rt-modules-extra -kernel-rt-tools -kernel-rt-headers -kernel-rt-devel - -# e1000e-kmod - -# i40e-kmod -kmod-i40e -kmod-i40e-rt - -# iavf-kmod -kmod-iavf -kmod-iavf-rt - -# ice-kmod -kmod-ice -kmod-ice-rt - -# ixgbevf-kmod - -# ixgbe-kmod - -# igb_uio-kmod -kmod-igb_uio -kmod-igb_uio-rt - -# drbd-kernel - -# qat17 -qat17 -qat17-rt - -# opae-intel-fpga-driver -kmod-opae-fpga-driver -kmod-opae-fpga-driver-rt - -# mellanox drivers -mlnx-ofa_kernel-modules -mlnx-ofa_kernel-rt-modules -rdma-core - -# mellanox firmware tool -mstflint - -# Broadcom device driver -kmod-bnxt_en -kmod-bnxt_en-rt -libbnxt_re diff --git a/centos_pkg_dirs b/centos_pkg_dirs deleted file mode 100644 index 5422010c..00000000 --- a/centos_pkg_dirs +++ /dev/null @@ -1,13 +0,0 @@ -kernel-std -kernel-modules/bnxt_en -kernel-modules/intel-iavf -kernel-modules/intel-i40e -kernel-modules/intel-ice -kernel-modules/intel-igb_uio -kernel-modules/qat17 -kernel-modules/intel-opae-fpga -kernel-modules/mlnx-ofa_kernel -userspace/broadcom/libbnxt_re -userspace/mellanox/rdma-core -userspace/mellanox/mlnx-tools -userspace/mellanox/mstflint diff --git a/centos_pkg_dirs_rt b/centos_pkg_dirs_rt deleted file mode 100644 index d682be57..00000000 --- a/centos_pkg_dirs_rt +++ /dev/null @@ -1,13 +0,0 @@ -kernel-rt -kernel-modules/bnxt_en -kernel-modules/mlnx-ofa_kernel -kernel-modules/intel-iavf -kernel-modules/intel-i40e -kernel-modules/intel-ice -kernel-modules/intel-igb_uio -kernel-modules/qat17 -kernel-modules/intel-opae-fpga -userspace/broadcom/libbnxt_re -userspace/mellanox/rdma-core -userspace/mellanox/mlnx-tools -userspace/mellanox/mstflint diff --git a/centos_tarball-dl.lst b/centos_tarball-dl.lst deleted file mode 100644 index 3a692acc..00000000 --- a/centos_tarball-dl.lst +++ /dev/null @@ -1,17 +0,0 @@ -dpdk-20.05.tar.gz#dpdk-20.05#https://fast.dpdk.org/rel/dpdk-20.05.tar.gz#http## -drbd-8.4.11-1.tar.gz#drbd-8.4.11-1#http://www.linbit.com/downloads/drbd/8.4/drbd-8.4.11-1.tar.gz#http## -e1000e-3.6.0.tar.gz#e1000e-3.6.0#https://sourceforge.net/projects/e1000/files/e1000e%20stable/3.6.0/e1000e-3.6.0.tar.gz#http## -i40e-2.18.9.tar.gz#i40e-2.18.9#https://sourceforge.net/projects/e1000/files/i40e%20stable/2.18.9/i40e-2.18.9.tar.gz/download#https## -iavf-4.4.2.tar.gz#iavf-4.4.2#https://sourceforge.net/projects/e1000/files/iavf%20stable/4.4.2/iavf-4.4.2.tar.gz/download#https## -ice-1.8.3.tar.gz#ice-1.8.3#https://sourceforge.net/projects/e1000/files/ice%20stable/1.8.3/ice-1.8.3.tar.gz/download#https## -ixgbe-5.6.5.tar.gz#ixgbe-5.6.5#https://sourceforge.net/projects/e1000/files/ixgbe%20stable/5.6.5/ixgbe-5.6.5.tar.gz/download#http## -ixgbevf-4.6.3.tar.gz#ixgbevf-4.6.3#https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/4.6.3/ixgbevf-4.6.3.tar.gz/download#http## -!kernel-rt-4.18.0-147.3.1.rt24.96.el8_1.src.rpm#kernel-rt#https://git.centos.org/rpms/kernel-rt#http_script#327ec52423c67051249291f131ec7f6fff44a828#post-dl-script/kernel-rt.sh -!MLNX_OFED_SRC-5.5-1.0.3.2.tgz#MLNX_OFED_SRC-5.5-1.0.3.2#https://content.mellanox.com/ofed/MLNX_OFED-5.5-1.0.3.2/MLNX_OFED_SRC-5.5-1.0.3.2.tgz#http_script##unused -opae-intel-fpga-driver-2.0.1-8.tar.gz#opae-intel-fpga-driver-2.0.1-8#https://github.com/OPAE/opae-sdk/releases/download/1.3.7-4/opae-intel-fpga-driver-2.0.1-8.tar.gz#http## -!qat1.7.l.4.5.0-00034.tar.gz#quickassist#https://01.org/sites/default/files/downloads/qat1.7.l.4.5.0-00034.tar.gz#http_script##post-dl-script/qat1.7.sh -!QAT1.7.L.4.14.0-00031.tar.gz#quickassist#https://downloadmirror.intel.com/30178/eng/QAT1.7.L.4.14.0-00031.tar.gz#http_script##unused -!dpdk-kmods-2a9f0f72a2d926382634cf8f1de10e1acf57542b.tar.gz#dpdk-kmods#git://dpdk.org/dpdk-kmods/#git#2a9f0f72a2d926382634cf8f1de10e1acf57542b## -!OPAE_1.3.7-5_el7.zip#OPAE#https://github.com/OPAE/opae-sdk/releases/download/1.3.7-5/OPAE_1.3.7-5_el7.zip#http_script##unused -!ice_comms-1.3.35.0.zip#unused-field#https://downloadmirror.intel.com/727568/ice_comms-1.3.35.0.zip#http_script##unused -!bcm_220.0.83.0.tar.gz#bcm_220.0.83.0#https://docs.broadcom.com/docs-and-downloads/ethernet-network-adapters/NXE/BRCM_220.0.83.0/bcm_220.0.83.0.tar.gz#http_script#85bdfc30b4bd3e184e3b57a48055c11085e3b97593f7b4a8347fa50a9d571336#unused diff --git a/kernel-modules/bnxt_en/centos/bnxt_en.spec b/kernel-modules/bnxt_en/centos/bnxt_en.spec deleted file mode 100644 index 9028543b..00000000 --- a/kernel-modules/bnxt_en/centos/bnxt_en.spec +++ /dev/null @@ -1,139 +0,0 @@ -%if "%{?_tis_build_type}" == "rt" -%define bt_ext -rt -%else -%undefine bt_ext -%endif - -%define kmod_name bnxt_en -%define upstream_release 220.0.13.0 - -## Condition to check if retpolines are needed. -## Default: retpolines are enabled. -%bcond_without retpoline - -# Disable the building of debug package(s). -%define debug_package %{nil} - -Name: kmod-%{kmod_name}%{?bt_ext} -Version: 1.10.2 -Release: %{upstream_release}%{?_tis_dist}.%{tis_patch_ver} -Group: System Environment/Base -Packager: StarlingX Community -Vendor: Broadcom Inc -URL: https://www.broadcom.com/support/download-search?pg=&pf=&pn=&pa=&po=&dk=bnxt_en&pl= -License: GPLv2 -Summary: Broadcom NetXtreme Gigabit Ethernet Driver - -Provides: %{kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -BuildRequires: findutils -BuildRequires: kernel%{?bt_ext}-devel kernel%{?bt_ext}-devel-keys -BuildRequires: mlnx-ofa_kernel%{?bt_ext}-devel mlnx-ofa_kernel%{?bt_ext}-source -Requires: mlnx-ofa_kernel%{?bt_ext}-modules -Requires(post): /usr/sbin/depmod -Requires(postun): /usr/sbin/depmod - -Source0: netxtreme-%{kmod_name}-%{version}-%{upstream_release}.tar.gz -Source1: modprobe.conf - -Patch0001: 0001-bnxt_re-Makefile-Adapt-to-mlnx-ofa_kernel-for-Starli.patch -Patch0002: 0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch -Patch0003: 0003-bnxt_en-bnxt_re-Use-irq_update_affinity_hint.patch - -#define some build variables required -%define bnxt_en_driver bnxt_en -%define bnxt_re_driver bnxt_re - -%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//') - -%description -This package provides the %{bnxt_en_driver} and %{bnxt_re_driver} kernel -modules built for the Linux kernel for the %{_target_cpu} family of processors. - -%prep -%autosetup -p 1 -n netxtreme-%{kmod_name}-%{version}-%{upstream_release} -cp %{bnxt_re_driver}/README.TXT %{bnxt_re_driver}/%{bnxt_re_driver}_README.TXT -cp %{bnxt_en_driver}/README.TXT %{bnxt_en_driver}/%{bnxt_en_driver}_README.TXT - -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif - -export EXTRA_CFLAGS+='-DVERSION=\"%{version}\"' - -%if %{with retpoline} - find . -name *.c -print0 | xargs -0 sed -i '/MODULE_LICENSE(/a MODULE_INFO(retpoline, "Y");' -%endif - -# Regenerate MANIFEST HASH -if [ -e bnxt_en/MANIFEST ]; then - pushd bnxt_en >/dev/null - sha512sum $(cat MANIFEST | cut -c 131-) > MANIFEST - popd >/dev/null -fi - -%{__make} %{_smp_mflags} -C bnxt_en \ - KVER=%{kversion} \ - KDIR=%{_usrsrc}/kernels/%{kversion} - -OFED_VERSION="$(ls -1vd %{_usrsrc}/ofa_kernel-* | xargs -r -n1 basename | \ - sed -e 's@^ofa_kernel-@@' | sort --version-sort | tail -n1)" -if test -z "${OFED_VERSION}"; then - echo "Error: Could not detect the OFED version" - exit 1 -fi - -%{__make} %{_smp_mflags} -C bnxt_re \ - KVER=%{kversion} \ - KDIR=%{_usrsrc}/kernels/%{kversion} \ - OFED_VERSION="${OFED_VERSION}" - -%install -export KVER=%{kversion} - -dest_dir_bnxt_en=${RPM_BUILD_ROOT}/lib/modules/${KVER}/extra/%{kmod_name}/ -src_dir_bnxt_en=$(find . -name %{bnxt_en_driver}.ko) -dest_dir_bnxt_re=${RPM_BUILD_ROOT}/lib/modules/${KVER}/extra/%{kmod_name}/drivers/infiniband/hw/%{bnxt_re_driver}/ -src_dir_bnxt_re=$(find . -name %{bnxt_re_driver}.ko) -mkdir -p ${dest_dir_bnxt_en} -mkdir -p ${dest_dir_bnxt_re} -install -m 744 ${src_dir_bnxt_en} ${dest_dir_bnxt_en} -install -m 744 ${src_dir_bnxt_re} ${dest_dir_bnxt_re} - -install -d %{buildroot}%{_sysconfdir}/modprobe.d -install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/modprobe.d/bnxt.conf - -### Adapted from i40e -# Strip the modules(s). -find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \; - -# Always Sign the modules(s). -# If the module signing keys are not defined, define them here. -%{!?privkey: %define privkey /usr/src/kernels/%{kversion}/signing_key.pem} -%{!?pubkey: %define pubkey /usr/src/kernels/%{kversion}/signing_key.x509} -for module in $(find %{buildroot} -type f -name \*.ko); -do /usr/src/kernels/%{kversion}/scripts/sign-file \ - sha256 %{privkey} %{pubkey} $module; -done - -%files -%defattr(644,root,root,755) -/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{_sysconfdir}/modprobe.d/bnxt.conf - -%post -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi - -%postun -/usr/sbin/depmod -a >/dev/null 2>&1 || true - -%clean -rm -rf %{buildroot} - -%changelog diff --git a/kernel-modules/bnxt_en/centos/build_srpm.data b/kernel-modules/bnxt_en/centos/build_srpm.data deleted file mode 100644 index 548c604a..00000000 --- a/kernel-modules/bnxt_en/centos/build_srpm.data +++ /dev/null @@ -1,12 +0,0 @@ -COPY_LIST=" \ - $PATCHES_BASE/* \ - $PKG_BASE/files/modprobe.conf \ - $STX_BASE/downloads/netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz \ - " - -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=1378583af6e040bc974f67850cd44e0c62d42f81 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=1378583af6e040bc974f67850cd44e0c62d42f81 -PKG_BASE_SRCREV=1378583af6e040bc974f67850cd44e0c62d42f81 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/kernel-modules/bnxt_en/centos/patches/0001-bnxt_re-Makefile-Adapt-to-mlnx-ofa_kernel-for-Starli.patch b/kernel-modules/bnxt_en/centos/patches/0001-bnxt_re-Makefile-Adapt-to-mlnx-ofa_kernel-for-Starli.patch deleted file mode 100644 index 4843ed30..00000000 --- a/kernel-modules/bnxt_en/centos/patches/0001-bnxt_re-Makefile-Adapt-to-mlnx-ofa_kernel-for-Starli.patch +++ /dev/null @@ -1,117 +0,0 @@ -From b4de4f0d87331a3df820ca78a7196b41a5ee74d5 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Fri, 4 Feb 2022 18:27:53 -0500 -Subject: [PATCH] bnxt_re/Makefile: Adapt to mlnx-ofa_kernel for StarlingX - -This patch adapts the bnxt_re kernel module's Makefile to -mlnx-ofa_kernel for StarlingX. - -Here is a summary of the changes: - -- $(shell uname -r) is replaced with $(KVER) to ensure that the target - kernel version is selected instead of the build host's kernel version. - -- To target Mellanox's OFED distribution instead of compat-rdma, the - references to "/usr/src/compat-rdma" are replaced with - "/usr/src/ofa_kernel". - -- Mellanox's OFED distribution has version numbers in the form 5.x, so - the Makefile version match patterns are adjusted. - -- "AUTOCONF_H += -include $(LINUXSRC)/include/linux/kconfig.h" line is - added avoid the following kernel module build errors indicating that - IS_ENABLED is unintendedly undefined: - - include/asm-generic/bitops/instrumented-non-atomic.h: In function \ - '__instrument_read_write_bitop': - include/asm-generic/bitops/instrumented-non-atomic.h:63:6: error: \ - implicit declaration of function 'IS_ENABLED' \ - [-Werror=implicit-function-declaration] - if (IS_ENABLED(CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC)) { - ^~~~~~~~~~ - -- The line that reads - "KBUILD_EXTRA_SYMBOLS := $(BNXT_PEER_MEM_INC)/Module.symvers" - is guarded to avoid the following build warning, which is encountered - as BNXT_PEER_MEM_INC is not defined by default: - WARNING: Symbol version dump "/Module.symvers" is missing. - -- OFA_BUILD_PATH and OFA_KERNEL_PATH are adjusted to refer to the kernel - source code belonging to the target kernel version in - "/usr/src/kernels/", because StarlingX's build environment does not - populate /lib/modules// with symbolic links for kernel source - and build trees. - -Signed-off-by: M. Vefa Bicakci ---- - bnxt_re-220.0.12.0/Makefile | 30 ++++++++++++++++++------------ - 1 file changed, 18 insertions(+), 12 deletions(-) - -diff --git a/bnxt_re-220.0.12.0/Makefile b/bnxt_re-220.0.12.0/Makefile -index 532fb8025465..d13a61379acb 100644 ---- a/bnxt_re-220.0.12.0/Makefile -+++ b/bnxt_re-220.0.12.0/Makefile -@@ -32,7 +32,7 @@ ifeq ($(shell ls /lib/modules/$(KVER)/build > /dev/null 2>&1 && echo build),) - # SuSE source RPMs - _KVER=$(shell echo $(KVER) | cut -d "-" -f1,2) - _KFLA=$(shell echo $(KVER) | cut -d "-" -f3) -- _ARCH=$(shell file -b /lib/modules/$(shell uname -r)/build | cut -d "/" -f5) -+ _ARCH=$(shell file -b /lib/modules/$(KVER)/build | cut -d "/" -f5) - ifeq ($(_ARCH),) - _ARCH=$(__ARCH) - endif -@@ -90,34 +90,40 @@ ifeq ($(OFED_VERSION), ) - endif - - #find OFED version and compat-includes --ofed_major=$(filter OFED-3.% OFED-4.%, $(OFED_VERSION)) -+ofed_major=$(filter OFED-3.% OFED-4.% 5.%, $(OFED_VERSION)) - ifneq ($(ofed_major), ) --exists=$(shell if [ -e /usr/src/compat-rdma$(OFED_VERSION) ];\ -+exists=$(shell if [ -e /usr/src/ofa_kernel-$(OFED_VERSION) ];\ - then echo y; fi) - ifeq ($(exists), ) --$(shell ln -s /usr/src/compat-rdma\ -- /usr/src/compat-rdma$(OFED_VERSION)) -+$(shell ln -s /usr/src/ofa_kernel\ -+ /usr/src/ofa_kernel-$(OFED_VERSION)) - endif --OFA_BUILD_PATH=/usr/src/compat-rdma$(OFED_VERSION) --OFA_KERNEL_PATH=/usr/src/compat-rdma$(OFED_VERSION) -+OFA_BUILD_PATH=/usr/src/ofa_kernel/default -+OFA_KERNEL_PATH=/usr/src/ofa_kernel-$(OFED_VERSION)/source - EXTRA_CFLAGS += -DOFED_3_x --ofed_4_17_x=$(filter OFED-4.17%, $(ofed_major)) -+ofed_4_17_x=$(filter OFED-4.17% 5.%, $(ofed_major)) - ifneq ($(ofed_4_17_x), ) - EXTRA_CFLAGS += -D__OFED_BUILD__ - endif - EXTRA_CFLAGS += -include $(OFA_KERNEL_PATH)/include/linux/compat-2.6.h - - AUTOCONF_H = -include $(shell /bin/ls -1 $(LINUX)/include/*/autoconf.h 2> /dev/null | head -1) -+AUTOCONF_H += -include $(LINUXSRC)/include/linux/kconfig.h - endif #end non 3.x OFED -+ -+ifneq ($(BNXT_PEER_MEM_INC),) - KBUILD_EXTRA_SYMBOLS := $(BNXT_PEER_MEM_INC)/Module.symvers -+else -+KBUILD_EXTRA_SYMBOLS := -+endif - - ifeq (OFED-NATIVE, $(findstring OFED-NATIVE, $(OFED_VERSION))) - ifeq ($(KERNELRELEASE),) --OFA_BUILD_PATH =/lib/modules/`uname -r`/build/ --OFA_KERNEL_PATH=/lib/modules/`uname -r`/source/ -+OFA_BUILD_PATH=/usr/src/kernels/$(KVER)/ -+OFA_KERNEL_PATH=/usr/src/kernels/$(KVER)/ - else --OFA_BUILD_PATH =/lib/modules/$(KERNELRELEASE)/build/ --OFA_KERNEL_PATH=/lib/modules/$(KERNELRELEASE)/source/ -+OFA_BUILD_PATH=/usr/src/kernels/$(KERNELRELEASE)/ -+OFA_KERNEL_PATH=/usr/src/kernels/$(KERNELRELEASE)/ - endif - else - # Add OFED symbols only if external OFED is used --- -2.29.2 - diff --git a/kernel-modules/bnxt_en/centos/patches/0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch b/kernel-modules/bnxt_en/centos/patches/0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch deleted file mode 100644 index 6f3fe3fe..00000000 --- a/kernel-modules/bnxt_en/centos/patches/0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c6e38e23c1a2d45efcab73793ebe28f8fcb504e4 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Fri, 4 Feb 2022 19:44:06 -0500 -Subject: [PATCH] bnxt_en/bnxt_compat.h: Fix up a build failure - -This commit resolves the following build failure: - - In file included from ./include/net/sock.h:59, - from ./include/linux/tcp.h:19, - from ./include/linux/ipv6.h:87, - from ./include/net/dsfield.h:12, - from ./include/net/ip_tunnels.h:13, - from ./include/net/dst_metadata.h:6, - from /builddir/build/BUILD/netxtreme-bnxt_en-1.10.2-219.0.55.0/bnxt_en-1.10.2-219.0.55.0/bnxt.h:30, - from /builddir/build/BUILD/netxtreme-bnxt_en-1.10.2-219.0.55.0/bnxt_en-1.10.2-219.0.55.0/bnxt_hwrm.c:26: - ./include/linux/filter.h:980:1: error: useless type name in empty declaration [-Werror] - void bpf_warn_invalid_xdp_action(u32 act); - ^~~~ - cc1: all warnings being treated as errors - -The problem arises from the fact that the function -bpf_warn_invalid_xdp_action is already defined in the kernel. Having a -placeholder macro definition with the same name causes the compilation -warning (which turns into an error due to -Werror). - -Signed-off-by: M. Vefa Bicakci ---- - bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h b/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h -index 63d27f2e8979..aeb15fc9ab2a 100644 ---- a/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h -+++ b/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h -@@ -1596,7 +1596,6 @@ enum xdp_action { - - #ifndef HAVE_BPF_TRACE - #define trace_xdp_exception(dev, xdp_prog, act) --#define bpf_warn_invalid_xdp_action(act) - #endif - - #ifdef HAVE_XDP_RXQ_INFO --- -2.29.2 - diff --git a/kernel-modules/bnxt_en/centos/patches/0003-bnxt_en-bnxt_re-Use-irq_update_affinity_hint.patch b/kernel-modules/bnxt_en/centos/patches/0003-bnxt_en-bnxt_re-Use-irq_update_affinity_hint.patch deleted file mode 100644 index 16107d03..00000000 --- a/kernel-modules/bnxt_en/centos/patches/0003-bnxt_en-bnxt_re-Use-irq_update_affinity_hint.patch +++ /dev/null @@ -1,134 +0,0 @@ -From f278ab69adb9e59041d2b8e78b6005587f94d0e3 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Wed, 2 Mar 2022 14:14:12 -0500 -Subject: [PATCH] bnxt_en, bnxt_re: Use irq_update_affinity_hint - -This commit updates the bnxt_en and bnxt_re device drivers to use the -irq_update_affinity_hint function instead of the irq_set_affinity_hint -function, so that StarlingX's CPU affinity requirements for interrupts -are met. (Note that the StarlingX kernel has been patched to add the -irq_update_affinity_hint API function, which originally did not exist in -kernel version 5.10.) - -irq_set_affinity_hint sets the IRQ affinity hint as well as the actual -IRQ affinity, which causes the IRQ affinity to not align with the value -of the irqaffinity= command line option. - -StarlingX's user-space initialization scripts set the IRQ affinities -too, but if a network interface is initialized after the completion of -the initialization scripts, then the network adapter's preferred IRQ -affinity passed to irq_set_affinity_hint takes effect. The latter is -undesirable if the CPU affinity of an interrupt includes CPUs that are -in the set of isolated CPUs configured by StarlingX, as isolated CPUs -should not service unrelated interrupts. - -To resolve the aforementioned issues, this patch updates the bnxt_en and -bnxt_re drivers to use irq_update_affinity_hint, which only sets the IRQ -affinity hint, and not the actual IRQ affinity. This allows interrupts -to be affined to the CPUs listed in the irqaffinity= command line -argument by default, and eliminates the need to set the IRQ affinities -after the initialization of network interfaces. - -Finally, please note that the changes in bnxt_en were confirmed to not -be compiled with StarlingX's 5.10-based kernel, because of the following -conditional compilation pre-processor directives that are above the -irq_set_affinity_hint/irq_update_affinity_hint call site: - - #if (!defined(CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR) || \ - KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE) && \ - (defined(HAVE_CPUMASK_LOCAL_FIRST) || \ - defined(HAVE_CPUMASK_LOCAL_SPREAD)) - - /* ... */ - cpumask_set_cpu(cpumask_local_spread(i, numa_node), - irq->cpu_mask); - /* ... */ - rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask); - /* ... */ - -The IRQ matrix allocator is enabled in StarlingX's kernel, which also -has a version greater than 4.15. 4.15 happens to be the kernel version -with which the IRQ matrix allocator was introduced. In other words, the -call site in question is not compiled at all with the out-of-tree -bnxt_en driver. The in-tree version of bnxt_en does not have conditional -compilation directives around the same code (i.e., the code is always -compiled in). - -Our imperfect understanding of the intent is that the out-of-tree -bnxt_en driver's authors decided to rely on the IRQ matrix allocator's -default IRQ vector distribution behaviour (which appears to occur at a -lower level) instead of setting the IRQ affinity hints explicitly. - -Thankfully, the lack of a call irq_update_affinity_hint does not prevent -the irqaffinity= command line argument from taking effect for such -interrupts. This was confirmed with a virtual machine and the e1000e -driver, which also manages multiple MSI-X interrupts and which also does -not explicitly set the IRQ affinities nor affinity hints. In our -experiments, the IRQ affinities of the emulated Intel network adapter -correctly matched the CPU list set by the irqaffinity= command line -argument. - -Despite what is discussed above, the code changes in bnxt_en are kept -for completeness. - -Signed-off-by: M. Vefa Bicakci ---- - bnxt_en-1.10.2-220.0.13.0/bnxt.c | 6 +++--- - bnxt_re-220.0.12.0/qplib_fp.c | 6 +++--- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/bnxt_en-1.10.2-220.0.13.0/bnxt.c b/bnxt_en-1.10.2-220.0.13.0/bnxt.c -index b0b99338c425..a2f55dfcd0c3 100644 ---- a/bnxt_en-1.10.2-220.0.13.0/bnxt.c -+++ b/bnxt_en-1.10.2-220.0.13.0/bnxt.c -@@ -10716,7 +10716,7 @@ static void bnxt_free_irq(struct bnxt *bp) - (defined(HAVE_CPUMASK_LOCAL_FIRST) || \ - defined(HAVE_CPUMASK_LOCAL_SPREAD)) - if (irq->have_cpumask) { -- irq_set_affinity_hint(irq->vector, NULL); -+ irq_update_affinity_hint(irq->vector, NULL); - free_cpumask_var(irq->cpu_mask); - irq->have_cpumask = 0; - } -@@ -10787,10 +10787,10 @@ static int bnxt_request_irq(struct bnxt *bp) - break; - } - #endif -- rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask); -+ rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask); - if (rc) { - netdev_warn(bp->dev, -- "Set affinity failed, IRQ = %d\n", -+ "Update affinity failed, IRQ = %d\n", - irq->vector); - break; - } -diff --git a/bnxt_re-220.0.12.0/qplib_fp.c b/bnxt_re-220.0.12.0/qplib_fp.c -index ef5f279fcb79..60d2eda3727d 100644 ---- a/bnxt_re-220.0.12.0/qplib_fp.c -+++ b/bnxt_re-220.0.12.0/qplib_fp.c -@@ -492,7 +492,7 @@ void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill) - bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, res->cctx, false); - /* Sync with last running IRQ handler */ - synchronize_irq(nq->msix_vec); -- irq_set_affinity_hint(nq->msix_vec, NULL); -+ irq_update_affinity_hint(nq->msix_vec, NULL); - free_irq(nq->msix_vec, nq); - - /* Cleanup Tasklet */ -@@ -546,10 +546,10 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx, - - cpumask_clear(&nq->mask); - cpumask_set_cpu(nq_indx, &nq->mask); -- rc = irq_set_affinity_hint(nq->msix_vec, &nq->mask); -+ rc = irq_update_affinity_hint(nq->msix_vec, &nq->mask); - if (rc) - dev_warn(&res->pdev->dev, -- "QPLIB: set affinity failed; vector: %d nq_idx: %d\n", -+ "QPLIB: update affinity failed; vector: %d nq_idx: %d\n", - nq->msix_vec, nq_indx); - nq->requested = true; - bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, res->cctx, true); --- -2.29.2 - diff --git a/kernel-modules/intel-i40e/centos/build_srpm.data b/kernel-modules/intel-i40e/centos/build_srpm.data deleted file mode 100644 index 43f7d750..00000000 --- a/kernel-modules/intel-i40e/centos/build_srpm.data +++ /dev/null @@ -1,9 +0,0 @@ -COPY_LIST=" \ - $PKG_BASE/files/* \ - $STX_BASE/downloads/i40e-2.18.9.tar.gz" -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=1378583af6e040bc974f67850cd44e0c62d42f81 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=1378583af6e040bc974f67850cd44e0c62d42f81 -PKG_BASE_SRCREV=1927a6d6250856164295aa1aca2ba0e40fa95c18 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/kernel-modules/intel-i40e/centos/i40e-kmod.spec b/kernel-modules/intel-i40e/centos/i40e-kmod.spec deleted file mode 100644 index b39c59d1..00000000 --- a/kernel-modules/intel-i40e/centos/i40e-kmod.spec +++ /dev/null @@ -1,130 +0,0 @@ -%if "%{?_tis_build_type}" == "rt" -%define bt_ext -rt -%else -%undefine bt_ext -%endif - -# Define the kmod package name here. -%define kmod_name i40e - -Name: %{kmod_name}-kmod%{?bt_ext} -Version: 2.18.9 -Release: 1%{?_tis_dist}.%{tis_patch_ver} -Group: System Environment/Kernel -License: GPLv2 -Summary: %{kmod_name}%{?bt_ext} kernel module(s) -URL: http://www.intel.com/ - -BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys, redhat-rpm-config, openssl -BuildRequires: elfutils-libelf-devel -%if 0%{?rhel} == 7 -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -%endif -ExclusiveArch: x86_64 - -# Sources. -Source0: %{kmod_name}-%{version}.tar.gz -Source5: GPL-v2.0.txt -Source11: modules-load.conf - -Patch01: i40e-Enable-getting-link-status-from-VF.patch -Patch02: i40e-add-more-debug-info-for-VFs-still-in-reset.patch -Patch03: i40e_main-Use-irq_update_affinity_hint.patch - -%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//') - -%package -n kmod-i40e%{?bt_ext} -Summary: i40e kernel module(s) -Group: System Environment/Kernel -%global _use_internal_dependency_generator 0 -Provides: kernel-modules >= %{kversion} -Provides: i40e-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -Requires(post): /usr/sbin/depmod -Requires(postun): /usr/sbin/depmod - -%description -n kmod-i40e%{?bt_ext} -This package provides the i40e kernel module(s) built -for the Linux kernel using the %{_target_cpu} family of processors. - -%post -n kmod-i40e%{?bt_ext} -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -echo "Done." - -%preun -n kmod-i40e%{?bt_ext} -rpm -ql kmod-i40e%{?bt_ext}-%{version}-%{release}.x86_64 | grep '\.ko$' > /var/run/rpm-kmod-i40e%{?bt_ext}-modules - -%postun -n kmod-i40e%{?bt_ext} -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -rm /var/run/rpm-kmod-i40e%{?bt_ext}-modules -echo "Done." - -%files -n kmod-i40e%{?bt_ext} -%defattr(644,root,root,755) -/lib/modules/%{kversion}/ -%doc /usr/share/doc/kmod-i40e-%{version}/ -%doc /usr/share/man/man7/ -%{_sysconfdir}/modules-load.d/i40e.conf - -# Disable the building of the debug package(s). -%define debug_package %{nil} - -%description -This package provides the %{kmod_name} kernel module(s). -It is built to depend upon the specific ABI provided by a range of releases -of the same variant of the Linux kernel and not on any one specific build. - -%prep -%autosetup -p 1 -n %{kmod_name}-%{version} -%{__gzip} %{kmod_name}.7 - -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif -pushd src >/dev/null -%{__make} KSRC=%{_usrsrc}/kernels/%{kversion} -popd >/dev/null - -%install -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif -%{__install} -d %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} src/%{kmod_name}.ko %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} -d %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} %{SOURCE5} %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} pci.updates %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} README %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} -d %{buildroot}%{_mandir}/man7/ -%{__install} %{kmod_name}.7.gz %{buildroot}%{_mandir}/man7/ -%{__install} -d %{buildroot}%{_sysconfdir}/modules-load.d -%{__install} -m 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/modules-load.d/i40e.conf - -# Strip the modules(s). -find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \; - -# Always Sign the modules(s). -# If the module signing keys are not defined, define them here. -%{!?privkey: %define privkey /usr/src/kernels/%{kversion}/signing_key.pem} -%{!?pubkey: %define pubkey /usr/src/kernels/%{kversion}/signing_key.x509} -for module in $(find %{buildroot} -type f -name \*.ko); -do /usr/src/kernels/%{kversion}/scripts/sign-file \ - sha256 %{privkey} %{pubkey} $module; -done - -%clean -%{__rm} -rf %{buildroot} - -%changelog -* Thu Feb 11 2016 Matthias Saou 1.4.25-1 -- Initial RPM package, based on elrepo.org's ixgbe one. - diff --git a/kernel-modules/intel-iavf/centos/build_srpm.data b/kernel-modules/intel-iavf/centos/build_srpm.data deleted file mode 100644 index 0592aac0..00000000 --- a/kernel-modules/intel-iavf/centos/build_srpm.data +++ /dev/null @@ -1,9 +0,0 @@ -COPY_LIST=" \ - $PKG_BASE/files/* \ - $STX_BASE/downloads/iavf-4.4.2.tar.gz" -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=1378583af6e040bc974f67850cd44e0c62d42f81 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=1378583af6e040bc974f67850cd44e0c62d42f81 -PKG_BASE_SRCREV=1927a6d6250856164295aa1aca2ba0e40fa95c18 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/kernel-modules/intel-iavf/centos/iavf-kmod.spec b/kernel-modules/intel-iavf/centos/iavf-kmod.spec deleted file mode 100644 index c5432538..00000000 --- a/kernel-modules/intel-iavf/centos/iavf-kmod.spec +++ /dev/null @@ -1,128 +0,0 @@ -%if "%{?_tis_build_type}" == "rt" -%define bt_ext -rt -%else -%undefine bt_ext -%endif - -# Define the kmod package name here. -%define kmod_name iavf - -Name: %{kmod_name}-kmod%{?bt_ext} -Version: 4.4.2 -Release: 1%{?_tis_dist}.%{tis_patch_ver} -Group: System Environment/Kernel -License: GPLv2 -Summary: %{kmod_name} kernel module(s) -URL: http://www.intel.com/ - -BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys, redhat-rpm-config, openssl -BuildRequires: elfutils-libelf-devel -%if 0%{?rhel} == 7 -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -%endif -ExclusiveArch: x86_64 - -# Sources. -Source0: %{kmod_name}-%{version}.tar.gz -Source5: GPL-v2.0.txt -Source11: modules-load.conf - -Patch01: iavf_main-Use-irq_update_affinity_hint.patch - -%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//') - -%package -n kmod-iavf%{?bt_ext} -Summary: iavf kernel module(s) -Group: System Environment/Kernel -%global _use_internal_dependency_generator 0 -Provides: kernel-modules >= %{kversion} -Provides: iavf-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -Requires(post): /usr/sbin/depmod -Requires(postun): /usr/sbin/depmod - -%description -n kmod-iavf%{?bt_ext} -This package provides the iavf kernel module(s) built -for the Linux kernel using the %{_target_cpu} family of processors. - -%post -n kmod-iavf%{?bt_ext} -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -echo "Done." - -%preun -n kmod-iavf%{?bt_ext} -rpm -ql kmod-iavf%{?bt_ext}-%{version}-%{release}.x86_64 | grep '\.ko$' > /var/run/rpm-kmod-iavf%{?bt_ext}-modules - -%postun -n kmod-iavf%{?bt_ext} -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -rm /var/run/rpm-kmod-iavf%{?bt_ext}-modules -echo "Done." - -%files -n kmod-iavf%{?bt_ext} -%defattr(644,root,root,755) -/lib/modules/%{kversion}/ -%doc /usr/share/doc/kmod-iavf-%{version}/ -%doc /usr/share/man/man7/ -%{_sysconfdir}/modules-load.d/iavf.conf - -# Disable the building of the debug package(s). -%define debug_package %{nil} - -%description -This package provides the %{kmod_name} kernel module(s). -It is built to depend upon the specific ABI provided by a range of releases -of the same variant of the Linux kernel and not on any one specific build. - -%prep -%autosetup -p 1 -n %{kmod_name}-%{version} -%{__gzip} %{kmod_name}.7 - -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif -pushd src >/dev/null -%{__make} KSRC=%{_usrsrc}/kernels/%{kversion} -popd >/dev/null - -%install -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif -%{__install} -d %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} src/%{kmod_name}.ko %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} -d %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} %{SOURCE5} %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} pci.updates %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} README %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} -d %{buildroot}%{_mandir}/man7/ -%{__install} %{kmod_name}.7.gz %{buildroot}%{_mandir}/man7/ -%{__install} -d %{buildroot}%{_sysconfdir}/modules-load.d -%{__install} -m 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/modules-load.d/iavf.conf - -# Strip the modules(s). -find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \; - -# Always Sign the modules(s). -# If the module signing keys are not defined, define them here. -%{!?privkey: %define privkey /usr/src/kernels/%{kversion}/signing_key.pem} -%{!?pubkey: %define pubkey /usr/src/kernels/%{kversion}/signing_key.x509} -for module in $(find %{buildroot} -type f -name \*.ko); -do /usr/src/kernels/%{kversion}/scripts/sign-file \ - sha256 %{privkey} %{pubkey} $module; -done - -%clean -%{__rm} -rf %{buildroot} - -%changelog -* Thu Feb 11 2016 Matthias Saou 1.4.25-1 -- Initial RPM package, based on elrepo.org's ixgbe one. - diff --git a/kernel-modules/intel-ice/centos/build_srpm.data b/kernel-modules/intel-ice/centos/build_srpm.data deleted file mode 100644 index 4537519b..00000000 --- a/kernel-modules/intel-ice/centos/build_srpm.data +++ /dev/null @@ -1,10 +0,0 @@ -COPY_LIST=" \ - $PKG_BASE/files/* \ - $STX_BASE/downloads/ice-1.8.3.tar.gz \ - $STX_BASE/downloads/ice_comms-1.3.35.0.zip" -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=1378583af6e040bc974f67850cd44e0c62d42f81 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=1378583af6e040bc974f67850cd44e0c62d42f81 -PKG_BASE_SRCREV=1927a6d6250856164295aa1aca2ba0e40fa95c18 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/kernel-modules/intel-ice/centos/ice-kmod.spec b/kernel-modules/intel-ice/centos/ice-kmod.spec deleted file mode 100644 index 17aa770f..00000000 --- a/kernel-modules/intel-ice/centos/ice-kmod.spec +++ /dev/null @@ -1,137 +0,0 @@ -%if "%{?_tis_build_type}" == "rt" -%define bt_ext -rt -%else -%undefine bt_ext -%endif - -%define kmod_name ice - -Name: %{kmod_name}-kmod%{?bt_ext} -Version: 1.8.3 -Release: 1%{?_tis_dist}.%{tis_patch_ver} -Group: System Environment/Kernel -License: GPL-2.0 -Summary: Intel(R) Ethernet Connection E800 Series Linux Driver -URL: http://support.intel.com - - -BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys, redhat-rpm-config, openssl, elfutils-libelf-devel -Requires: kernel%{?bt_ext}-devel, findutils, gawk, bash -%if 0%{?rhel} == 7 -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -%endif - -%define kernel_module_package_buildreqs kernel%{?bt_ext}-devel - -Source0: %{kmod_name}-%{version}.tar.gz -Source1: ice_comms-1.3.35.0.zip -Source11: modules-load.conf - - -Patch1: 0001-ice_main-ice_lib-Use-irq_update_affinity_hint.patch -Patch2: 0002-rename-the-ddp-file-to-avoid-conflict.patch - -%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//') -%define find() %(for f in %*; do if [ -e $f ]; then echo $f; break; fi; done) - -%package -n kmod-ice%{?bt_ext} -Summary: Intel(R) Ethernet Connection E800 Series Linux Driver -Group: System Environment/Kernel -%global _use_internal_dependency_generator 0 -Provides: kernel-modules >= %{kversion} -Provides: ice-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -Requires(post): /usr/sbin/depmod -Requires(postun): /usr/sbin/depmod - -%define debug_package %{nil} -%description -n kmod-ice%{?bt_ext} -This package provides the Intel(R) Ethernet Connection E800 Series Linux Driver, -ice, built for the Linux kernel using the %{_target_cpu} family of processors. - -%prep -%autosetup -p 1 -n %{kmod_name}-%{version} -unzip %{SOURCE1} -d ice_comms - -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif -pushd src >/dev/null -%{__make} KSRC=%{_usrsrc}/kernels/%{kversion} -popd >/dev/null - -%install -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif -%{__install} -d %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} src/%{kmod_name}.ko %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} -d %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} COPYING %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} pci.updates %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} README %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ -%{__install} -d %{buildroot}%{_mandir}/man7/ -%{__install} %{kmod_name}.7 %{buildroot}%{_mandir}/man7/ -%{__install} -d %{buildroot}%{_sysconfdir}/modules-load.d -%{__install} -m 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/modules-load.d/ice.conf - -# Install both the OS default regular DDP fw and the COMMS version -%{__install} -d %{buildroot}/lib/firmware/updates/intel/ice/ddp/ -%{__install} ddp/README %{buildroot}/lib/firmware/updates/intel/ice/ddp/README -%{__install} ddp/LICENSE %{buildroot}/lib/firmware/updates/intel/ice/ddp/LICENSE -%{__install} ddp/ice-*.pkg %{buildroot}/lib/firmware/updates/intel/ice/ddp/ -%{__install} -m 644 ice_comms/*.txt %{buildroot}/lib/firmware/updates/intel/ice/ddp/ -%{__install} -m 644 ice_comms/ice_comms*.pkg %{buildroot}/lib/firmware/updates/intel/ice/ddp/ - -# Make the regular DDP fw be the default one to load -mkdir -p %{buildroot}//lib/firmware/intel/ice/ddp/ -ln -frs %{buildroot}/lib/firmware/updates/intel/ice/ddp/ice-*.pkg %{buildroot}//lib/firmware/intel/ice/ddp/stx-ice.pkg - -# Strip the modules(s). -find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \; - -# Always Sign the modules(s). -# If the module signing keys are not defined, define them here. -%{!?privkey: %define privkey /usr/src/kernels/%{kversion}/signing_key.pem} -%{!?pubkey: %define pubkey /usr/src/kernels/%{kversion}/signing_key.x509} -for module in $(find %{buildroot} -type f -name \*.ko); -do /usr/src/kernels/%{kversion}/scripts/sign-file \ - sha256 %{privkey} %{pubkey} $module; -done - -%clean -rm -rf %{buildroot} - -%files -n kmod-ice%{?bt_ext} -%defattr(644,root,root,755) -/lib/modules/%{kversion}/ -/lib/firmware/updates/intel/ice/ddp/* -/lib/firmware/intel/ice/ddp/stx-ice.pkg -%{_sysconfdir}/modules-load.d/ice.conf -%doc /usr/share/doc/kmod-ice-%{version}/ -%doc /usr/share/man/man7/ - -# Disable the building of the debug package(s). -%define debug_package %{nil} - -%post -n kmod-ice%{?bt_ext} - -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -echo "Done." - -%preun -n kmod-ice%{?bt_ext} -rm -rf /usr/local/share/%{name} - -%postun -n kmod-ice%{?bt_ext} -uname -r | grep BOOT || /sbin/depmod -a > /dev/null 2>&1 || true - -%description -This package provides the ice kernel module(s) built -for the Linux kernel using the %{_target_cpu} family of processors. -This package contains the Intel(R) Ethernet Connection E800 Series Linux Driver. diff --git a/kernel-modules/intel-igb_uio/centos/build_srpm.data b/kernel-modules/intel-igb_uio/centos/build_srpm.data deleted file mode 100644 index 436a8562..00000000 --- a/kernel-modules/intel-igb_uio/centos/build_srpm.data +++ /dev/null @@ -1,9 +0,0 @@ -COPY_LIST=" \ - $PKG_BASE/files/* \ - $STX_BASE/downloads/dpdk-kmods-2a9f0f72a2d926382634cf8f1de10e1acf57542b.tar.gz" -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=145ff64b9734e5c45cfd8eb837a04e257b4b9581 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=c0fee2da8ef34aa816ddd76690ed425b2ff94c90 -PKG_BASE_SRCREV=654d249454a7e5c51c683a6bd453cae2711ade56 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT+1 diff --git a/kernel-modules/intel-igb_uio/centos/igb_uio-kmod.spec b/kernel-modules/intel-igb_uio/centos/igb_uio-kmod.spec deleted file mode 100644 index 3f913781..00000000 --- a/kernel-modules/intel-igb_uio/centos/igb_uio-kmod.spec +++ /dev/null @@ -1,121 +0,0 @@ -%if "%{?_tis_build_type}" == "rt" -%define bt_ext -rt -%else -%undefine bt_ext -%endif - -# dpdk-devbind.py uses Python 3. -%define __python python3 - -# Define the kmod package name here. -%define kmod_name igb_uio - -Name: %{kmod_name}-kmod%{?bt_ext} -Version: 21.02 -Release: 0%{?_tis_dist}.%{tis_patch_ver} -Group: System Environment/Kernel -License: GPLv2 -Summary: %{kmod_name} kernel module(s) -URL: http://www.intel.com/ - - -BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys, openssl, redhat-rpm-config -%if 0%{?rhel} == 7 -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -%endif - -ExclusiveArch: x86_64 i686 aarch64 ppc64le - -# Sources. -Source0: dpdk-kmods-2a9f0f72a2d926382634cf8f1de10e1acf57542b.tar.gz -Source1: dpdk-devbind.py - -%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//') - -%package -n kmod-igb_uio%{?bt_ext} -Summary: igb_uio kernel module(s) -Group: System Environment/Kernel -%global _use_internal_dependency_generator 0 -Provides: kernel-modules >= %{kversion} -Provides: igb_uio-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -Requires(post): /usr/sbin/depmod -Requires(postun): /usr/sbin/depmod - -%description -n kmod-igb_uio%{?bt_ext} -This package provides the igb_uio kernel module(s) built -for the Linux kernel using the %{_target_cpu} family of processors. - -%post -n kmod-igb_uio%{?bt_ext} -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -echo "Done." - -%preun -n kmod-igb_uio%{?bt_ext} -rpm -ql kmod-igb_uio%{?bt_ext}-%{version}-%{release}.x86_64 | grep '\.ko$' > /var/run/rpm-kmod-igb_uio%{?bt_ext}-modules - -%postun -n kmod-igb_uio%{?bt_ext} -echo "Working. This may take some time ..." -if [ -e "/boot/System.map-%{kversion}" ]; then - /usr/sbin/depmod -aeF "/boot/System.map-%{kversion}" "%{kversion}" > /dev/null || : -fi -rm /var/run/rpm-kmod-igb_uio%{?bt_ext}-modules -echo "Done." - -%files -n kmod-igb_uio%{?bt_ext} -%defattr(644,root,root,755) -/lib/modules/%{kversion}/ -%defattr(755,root,root,755) -%{_datadir}/starlingx/scripts/dpdk-devbind.py -%exclude %{_datadir}/starlingx/scripts/*.py[oc] - -# Disable the building of the debug package(s). -%define debug_package %{nil} - -%description -This package provides the %{kmod_name} kernel module(s). -It is built to depend upon the specific ABI provided by a range of releases -of the same variant of the Linux kernel and not on any one specific build. - -%prep -%autosetup -p 1 -n dpdk-kmods - -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -%endif - -cd linux/igb_uio -%{__make} KSRC=%{_usrsrc}/kernels/%{kversion} - -%install -find . -name *.ko -%{__install} -d %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} linux/igb_uio/%{kmod_name}.ko %{buildroot}/lib/modules/%{kversion}/extra/%{kmod_name}/ -%{__install} -d %{buildroot}%{_datadir}/starlingx/scripts -%{__install} -m755 %{SOURCE1} %{buildroot}%{_datadir}/starlingx/scripts/dpdk-devbind.py - -# Strip the modules(s). -find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \; - -# Always Sign the modules(s). -# If the module signing keys are not defined, define them here. -%{!?privkey: %define privkey /usr/src/kernels/%{kversion}/signing_key.pem} -%{!?pubkey: %define pubkey /usr/src/kernels/%{kversion}/signing_key.x509} -for module in $(find %{buildroot} -type f -name \*.ko); -do /usr/src/kernels/%{kversion}/scripts/sign-file \ - sha256 %{privkey} %{pubkey} $module; -done - -%clean -%{__rm} -rf %{buildroot} - -%changelog -* Mon Apr 26 2021 Jiping Ma - 21.02 -- Up to version 21.02, based on Linux kernel 5.10. -* Wed Jun 03 2020 Steven Webster - 20.05-1 -- Initial RPM package, based on Starlingx iavf-kmod. diff --git a/kernel-modules/intel-opae-fpga/centos/build_srpm.data b/kernel-modules/intel-opae-fpga/centos/build_srpm.data deleted file mode 100644 index 2b73a71c..00000000 --- a/kernel-modules/intel-opae-fpga/centos/build_srpm.data +++ /dev/null @@ -1,8 +0,0 @@ -COPY_LIST=" \ - $PATCHES_BASE/* " -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=b3b85950aecb5fef6902d4dfcf578b402ec6a69d -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=b3b85950aecb5fef6902d4dfcf578b402ec6a69d -PKG_BASE_SRCREV=aab4c0a0882fe82985726f45cffc692d1dfe1998 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/kernel-modules/intel-opae-fpga/centos/meta_patches/Add-BuildRequires-on-kernel-devel-keys.patch b/kernel-modules/intel-opae-fpga/centos/meta_patches/Add-BuildRequires-on-kernel-devel-keys.patch deleted file mode 100644 index f0073e09..00000000 --- a/kernel-modules/intel-opae-fpga/centos/meta_patches/Add-BuildRequires-on-kernel-devel-keys.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5c639bdbb7e4a652537d743b6303ce2c20eafe2e Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Thu, 25 Aug 2022 23:56:58 -0700 -Subject: [PATCH] Add BuildRequires on kernel-devel-keys - -Signed-off-by: Jiping Ma ---- - opae-intel-fpga-driver.spec | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/opae-intel-fpga-driver.spec b/opae-intel-fpga-driver.spec -index 193f149..d5d73b7 100755 ---- a/SPECS/opae-intel-fpga-driver.spec -+++ b/SPECS/opae-intel-fpga-driver.spec -@@ -23,7 +23,7 @@ Source: %{kmod_name}-%{version}.tar.gz - Exclusiveos: linux - ExclusiveArch: i386 i586 i686 x86_64 - Buildroot: %{_builddir}/%{kmod_name}-%{version} --BuildRequires: kernel%{?bt_ext}-devel, tar, gcc, make -+BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys, tar, gcc, make - %if 0%{?rhel} == 7 - BuildRequires: devtoolset-8-build - BuildRequires: devtoolset-8-binutils --- -2.35.1 - diff --git a/kernel-modules/intel-opae-fpga/centos/meta_patches/Fix-build-issues.patch b/kernel-modules/intel-opae-fpga/centos/meta_patches/Fix-build-issues.patch deleted file mode 100644 index 032d0e5d..00000000 --- a/kernel-modules/intel-opae-fpga/centos/meta_patches/Fix-build-issues.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 13a3b91f211ae9f8a965edcf47ae27992a472c23 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sun, 27 Jun 2021 23:52:04 -0700 -Subject: [PATCH] Fix build issues - -Signed-off-by: Jiping Ma -Signed-off-by: M. Vefa Bicakci ---- - SPECS/opae-intel-fpga-driver.spec | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/SPECS/opae-intel-fpga-driver.spec b/SPECS/opae-intel-fpga-driver.spec -index 6cf186ef8853..193f14950ef3 100755 ---- a/SPECS/opae-intel-fpga-driver.spec -+++ b/SPECS/opae-intel-fpga-driver.spec -@@ -42,6 +42,8 @@ BuildRequires: kernel%{?bt_ext}-devel - %endif - Requires: dkms, gcc, kernel%{?bt_ext}-devel, make - %define debug_package ${nil} -+Patch0001: Fix-build-errors.patch -+Patch0002: use-altera.h-from-driver-instead-of-from-kernel.patch - - %package -n kmod-opae-fpga-driver%{?bt_ext} - Summary: OPAE modules files -@@ -70,6 +72,8 @@ Source for the OPAE Drivers for common kernels - - %prep - %setup -q -n %{kmod_name}-%{version} -+%patch0001 -p1 -+%patch0002 -p1 - - %description - OPAE Driver -@@ -234,13 +238,15 @@ rm -rf $RPM_BUILD_ROOT - - %files -n kmod-opae-fpga-driver%{?bt_ext} - %defattr(-,root,root) --/usr/src/%{kmod_name}-%{version}-%{_release} -+/lib/modules -+/etc/udev - - %files -n kmod-opae-fpga-driver%{?bt_ext}-devel - #/usr/include/* - - %files -n kmod-opae-fpga-driver%{?bt_ext}-prebuilt - %defattr(-,root,root) -+/usr/src/%{kmod_name}-%{version}-%{_release} - /lib/modules - /etc/udev - --- -2.29.2 - diff --git a/kernel-modules/intel-opae-fpga/centos/meta_patches/PATCH_ORDER b/kernel-modules/intel-opae-fpga/centos/meta_patches/PATCH_ORDER deleted file mode 100644 index c68ce872..00000000 --- a/kernel-modules/intel-opae-fpga/centos/meta_patches/PATCH_ORDER +++ /dev/null @@ -1,3 +0,0 @@ -Support-TiS-system-and-devtoolset-8.patch -Fix-build-issues.patch -Add-BuildRequires-on-kernel-devel-keys.patch diff --git a/kernel-modules/intel-opae-fpga/centos/meta_patches/Support-TiS-system-and-devtoolset-8.patch b/kernel-modules/intel-opae-fpga/centos/meta_patches/Support-TiS-system-and-devtoolset-8.patch deleted file mode 100644 index 76477897..00000000 --- a/kernel-modules/intel-opae-fpga/centos/meta_patches/Support-TiS-system-and-devtoolset-8.patch +++ /dev/null @@ -1,285 +0,0 @@ -From 81f0f0db2b5444abee5ad58f3079f980db8b3f8d Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Tue, 22 Jun 2021 23:40:36 -0700 -Subject: [PATCH] Support-TiS-system and devtoolset-8 - -Support-TiS-system and build with devtoolset-8, also -change package name from opae-intel-fpga-driver to -kmod-opae-fpga-driver. - -Signed-off-by: Jiping Ma -Signed-off-by: M. Vefa Bicakci ---- - SPECS/opae-intel-fpga-driver.spec | 151 ++++++++++++++++++------------ - 1 file changed, 91 insertions(+), 60 deletions(-) - -diff --git a/SPECS/opae-intel-fpga-driver.spec b/SPECS/opae-intel-fpga-driver.spec -index c8374d89c3ca..6cf186ef8853 100755 ---- a/SPECS/opae-intel-fpga-driver.spec -+++ b/SPECS/opae-intel-fpga-driver.spec -@@ -1,19 +1,35 @@ - # - # OPAE Drivers rpm .spec file - # -+%if "%{?_tis_build_type}" == "rt" -+%define bt_ext -rt -+%else -+%undefine bt_ext -+%endif -+ -+# Define the kmod package name here. -+%define kmod_name opae-intel-fpga-driver -+ - Summary: Create OPAE Driver source and binary rpm packages. --Name: opae-intel-fpga-driver -+Name: opae-intel-fpga-driver%{?bt_ext} - Version: 2.0.1 --Release: 10 -+%define _release 10 -+Release: %{_release}%{?_tis_dist}.%{tis_patch_ver} - License: GPL V2 - Group: Applications/System - Distribution: CentOS Linux - Vendor: Intel Corporation --Source: %{name}-%{version}.tar.gz -+Source: %{kmod_name}-%{version}.tar.gz - Exclusiveos: linux - ExclusiveArch: i386 i586 i686 x86_64 --Buildroot: %{_builddir}/%{name}-%{version} --BuildRequires: kernel-headers, kernel-devel, tar, gcc, make -+Buildroot: %{_builddir}/%{kmod_name}-%{version} -+BuildRequires: kernel%{?bt_ext}-devel, tar, gcc, make -+%if 0%{?rhel} == 7 -+BuildRequires: devtoolset-8-build -+BuildRequires: devtoolset-8-binutils -+BuildRequires: devtoolset-8-gcc -+BuildRequires: devtoolset-8-make -+%endif - #BuildRequires: osv-linux4.14-devel - #BuildRequires: osv-linux4.16-devel - #BuildRequires: osv-linux4.19-devel -@@ -21,40 +37,52 @@ BuildRequires: kernel-headers, kernel-devel, tar, gcc, make - BuildRequires: kernel-default-devel - %else - %if %{?_vendor} != "clr" --BuildRequires: kernel-devel -+BuildRequires: kernel%{?bt_ext}-devel - %endif - %endif --Requires: dkms, gcc, kernel-devel, make -+Requires: dkms, gcc, kernel%{?bt_ext}-devel, make - %define debug_package ${nil} - --%package devel -+%package -n kmod-opae-fpga-driver%{?bt_ext} -+Summary: OPAE modules files -+Group: Applications/System -+%description -n kmod-opae-fpga-driver%{?bt_ext} -+OPAE Modules files -+ -+%package -n kmod-opae-fpga-driver%{?bt_ext}-devel - Summary: OPAE modules devel files - Group: Applications/System --%description devel -+%description -n kmod-opae-fpga-driver%{?bt_ext}-devel - OPAE Modules Development files - --%package prebuilt -+%package -n kmod-opae-fpga-driver%{?bt_ext}-prebuilt - Summary: Prebuilt OPAE drivers for common kernels - Group: Applications/System --%description prebuilt -+%description -n kmod-opae-fpga-driver%{?bt_ext}-prebuilt - Prebuilt OPAE Drivers for common kernels - --%package source -+%package -n kmod-opae-fpga-driver%{?bt_ext}-source - Summary: Source for the OPAE drivers for common kernels - Group: Applications/System - Requires: gcc, kernel-devel, make --%description source -+%description -n kmod-opae-fpga-driver%{?bt_ext}-source - Source for the OPAE Drivers for common kernels - - %prep --%setup -q -+%setup -q -n %{kmod_name}-%{version} - - %description - OPAE Driver - - %build -+%if 0%{?rhel} == 7 -+source scl_source enable devtoolset-8 || : -+%endif - - %install -+%if 0%{?rhel} == 7 -+source scl_source enable devtoolset-8 || : -+%endif - - FILES_TO_COPY=`ls | grep -v '^build-' | grep -v debian | grep -v spec` - -@@ -74,12 +102,6 @@ do - if [ -f $kern/Module.symvers ] - then - kernname=`basename $kern` -- if [[ $kernname == *"2.6."* ]]; then -- continue -- fi -- if [[ $kernname == *"4."* ]]; then -- continue -- fi - if ! grep -q "CONFIG_REGMAP=y" $kern/include/config/auto.conf ; then - continue - fi -@@ -95,57 +117,66 @@ done - # Remove the depmod related file we will not be including - rm -f $RPM_BUILD_ROOT/lib/modules/*/modules.* - -+# Always Sign the modules(s). -+# If the module signing keys are not defined, define them here. -+%{!?privkey: %define privkey /usr/src/kernels/${kernname}/signing_key.pem} -+%{!?pubkey: %define pubkey /usr/src/kernels/${kernname}/signing_key.x509} -+for module in $(find %{buildroot} -type f -name \*.ko); -+do /usr/src/kernels/${kernname}/scripts/sign-file \ -+ sha256 %{privkey} %{pubkey} $module; -+done -+ - # Now, install the source for the DKMS package --install -d $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a drivers $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a include $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a scripts $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a lib-4-12 $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a Makefile $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a 40-intel-fpga.rules $RPM_BUILD_ROOT/usr/src/%{name}-%{version} --cp -a LICENSE $RPM_BUILD_ROOT/usr/src/%{name}-%{version} -+install -d $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a drivers $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a include $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a scripts $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a lib-4-12 $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a Makefile $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a 40-intel-fpga.rules $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} -+cp -a LICENSE $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} - # Now, create/install a source tarball of the driver for the -source package - # Make a tarball of the driver source --tar -C $RPM_BUILD_ROOT/usr/src --group=root --owner=root -czf $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release}.tar.gz %{name}-%{version} -+tar -C $RPM_BUILD_ROOT/usr/src --group=root --owner=root -czf $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release}.tar.gz %{kmod_name}-%{version} - # Set up a specfile --sed -e 's/PKGVER/%{version}/' -e 's/PKGREL/%{release}/' build/specs/native-build.spec.in >$RPM_BUILD_ROOT/usr/src/%{name}.spec -+sed -e 's/PKGVER/%{version}/' -e 's/PKGREL/%{_release}/' build/specs/native-build.spec.in >$RPM_BUILD_ROOT/usr/src/%{kmod_name}.spec - # Create a source package tarball that rpmbuild can consume directly --tar -C $RPM_BUILD_ROOT/usr/src --group=root --owner=root -czf $RPM_BUILD_ROOT/usr/src/%{name}-source-%{version}-%{release}.tar.gz %{name}-%{version}-%{release}.tar.gz %{name}.spec -+tar -C $RPM_BUILD_ROOT/usr/src --group=root --owner=root -czf $RPM_BUILD_ROOT/usr/src/%{kmod_name}-source-%{version}-%{_release}.tar.gz %{kmod_name}-%{version}-%{_release}.tar.gz %{kmod_name}.spec - # Clean up the intemediate files --rm -rf $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release}.tar.gz $RPM_BUILD_ROOT/usr/src/%{name}.spec $RPM_BUILD_ROOT/usr/src/%{name}-%{version} -+rm -rf $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release}.tar.gz $RPM_BUILD_ROOT/usr/src/%{kmod_name}.spec $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version} - - # Prebuilt module udev file - install -d $RPM_BUILD_ROOT/etc/udev/rules.d - cp -a 40-intel-fpga.rules $RPM_BUILD_ROOT/etc/udev/rules.d - - # Now, install the source for the DKMS package --install -d $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a drivers $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a include $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a scripts $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a lib-4-12 $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a Makefile $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a 40-intel-fpga.rules $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a LICENSE $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} -+install -d $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a drivers $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a include $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a scripts $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a lib-4-12 $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a Makefile $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a 40-intel-fpga.rules $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a LICENSE $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} - - # DKMS stuff --cp -a dkms-postinst.sh $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --cp -a dkms-postrem.sh $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release} --sed -e 's/PKGVER/%{version}-%{release}/' dkms-preinst.sh >$RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release}/dkms-preinst.sh --chmod 0755 $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release}/dkms-preinst.sh --echo "Creating $RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release}/dkms.conf" --sed -e 's/PKGVER/%{version}-%{release}/' dkms.conf >$RPM_BUILD_ROOT/usr/src/%{name}-%{version}-%{release}/dkms.conf -+cp -a dkms-postinst.sh $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+cp -a dkms-postrem.sh $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release} -+sed -e 's/PKGVER/%{version}-%{_release}/' dkms-preinst.sh >$RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release}/dkms-preinst.sh -+chmod 0755 $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release}/dkms-preinst.sh -+echo "Creating $RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release}/dkms.conf" -+sed -e 's/PKGVER/%{version}-%{_release}/' dkms.conf >$RPM_BUILD_ROOT/usr/src/%{kmod_name}-%{version}-%{_release}/dkms.conf - - %post --if [ -z "`dkms status -m opae-intel-fpga-driver -v %{version}-%{release}`" ]; then -+if [ -z "`dkms status -m opae-intel-fpga-driver%{?bt_ext} -v %{version}-%{_release}`" ]; then - echo "Add module source to dkms" -- dkms add -m opae-intel-fpga-driver -v %{version}-%{release} --rpm_safe_upgrade -+ dkms add -m opae-intel-fpga-driver%{?bt_ext} -v %{version}-%{_release} --rpm_safe_upgrade - fi - - # If we haven't loaded a tarball, then try building it for the current kernel - if [ `uname -r | grep -c "BOOT"` -eq 0 ] && [ -e /lib/modules/`uname -r`/build/include ]; then -- dkms build -m opae-intel-fpga-driver -v %{version}-%{release} -- dkms install -m opae-intel-fpga-driver -v %{version}-%{release} --force -+ dkms build -m opae-intel-fpga-driver%{?bt_ext} -v %{version}-%{_release} -+ dkms install -m opae-intel-fpga-driver%{?bt_ext} -v %{version}-%{_release} --force - - elif [ `uname -r | grep -c "BOOT"` -gt 0 ]; then - echo -e "" -@@ -162,8 +193,8 @@ exit 0 - - %preun - echo -e --echo -e "Uninstall of opae-intel-fpga-driver module (version %{version}-%{release}) beginning:" --dkms remove -m opae-intel-fpga-driver -v %{version}-%{release} --all --rpm_safe_upgrade -+echo -e "Uninstall of opae-intel-fpga-driver%{?bt_ext} module (version %{version}-%{_release}) beginning:" -+dkms remove -m opae-intel-fpga-driver%{?bt_ext} -v %{version}-%{_release} --all --rpm_safe_upgrade - if [ "$1" -eq "0" ] - then - find /lib/modules -type f \( -name spi-nor-mod.ko* \ -@@ -179,7 +210,7 @@ echo -e "Force regeneration of new initramfs" - dracut --force /boot/initramfs-$(uname -r).img $(uname -r) - exit 0 - --%post prebuilt -+%post -n kmod-opae-fpga-driver%{?bt_ext}-prebuilt - depmod=/sbin/depmod - if [ -x /usr/sbin/depmod ] - then -@@ -201,22 +232,22 @@ done - %clean - rm -rf $RPM_BUILD_ROOT - --%files -+%files -n kmod-opae-fpga-driver%{?bt_ext} - %defattr(-,root,root) --/usr/src/%{name}-%{version}-%{release} -+/usr/src/%{kmod_name}-%{version}-%{_release} - --%files devel -+%files -n kmod-opae-fpga-driver%{?bt_ext}-devel - #/usr/include/* - --%files prebuilt -+%files -n kmod-opae-fpga-driver%{?bt_ext}-prebuilt - %defattr(-,root,root) - /lib/modules - /etc/udev - --%files source -+%files -n kmod-opae-fpga-driver%{?bt_ext}-source - %defattr(-,root,root) --/usr/src/%{name}-source-%{version}-%{release}.tar.gz -+/usr/src/%{kmod_name}-source-%{version}-%{_release}.tar.gz - - %changelog --* %(date "+%a %b %d %Y") %{version}-%{release} -+* %(date "+%a %b %d %Y") %{version}-%{_release} - -OPAE Intel FPGA Driver Build --- -2.29.2 - diff --git a/kernel-modules/intel-opae-fpga/centos/patches/Fix-build-errors.patch b/kernel-modules/intel-opae-fpga/centos/patches/Fix-build-errors.patch deleted file mode 100644 index 3230518f..00000000 --- a/kernel-modules/intel-opae-fpga/centos/patches/Fix-build-errors.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 262f8cbac0e4699edfcc5d1027479f85f9c8177f Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sun, 27 Jun 2021 23:13:51 -0700 -Subject: [PATCH 1/2] Fix build errors. - -Fix the following issues. -1. readx_poll_timeout redefined -2. change mmap_sem to mmap_lock - because commit da1c55f1b272f4bd54671d459b39ea7b54944ef9 - mmap locking API: rename mmap_sem to mmap_lock -3. change i2c_new_device to i2c_new_client_device because - i2c_new_device is deprecated. - -Signed-off-by: Jiping Ma ---- - drivers/fpga/intel/dma-region.c | 4 ++-- - drivers/fpga/intel/fme-main.c | 1 - - drivers/i2c/busses/i2c-altera.c | 3 +-- - drivers/mtd/devices/intel-on-chip-flash.c | 1 - - drivers/mtd/spi-nor/intel-generic-qspi.c | 1 - - 5 files changed, 3 insertions(+), 7 deletions(-) - -diff --git a/drivers/fpga/intel/dma-region.c b/drivers/fpga/intel/dma-region.c -index 87c8f32..d6749b1 100644 ---- a/drivers/fpga/intel/dma-region.c -+++ b/drivers/fpga/intel/dma-region.c -@@ -51,7 +51,7 @@ static long afu_dma_adjust_locked_vm(struct device *dev, long npages, bool incr) - if (!current->mm) - return 0; - -- down_write(¤t->mm->mmap_sem); -+ down_write(¤t->mm->mmap_lock); - - if (incr) { - locked = current->mm->locked_vm + npages; -@@ -75,7 +75,7 @@ static long afu_dma_adjust_locked_vm(struct device *dev, long npages, bool incr) - rlimit(RLIMIT_MEMLOCK), - ret ? "- execeeded" : ""); - -- up_write(¤t->mm->mmap_sem); -+ up_write(¤t->mm->mmap_lock); - - return ret; - } -diff --git a/drivers/fpga/intel/fme-main.c b/drivers/fpga/intel/fme-main.c -index 0b68232..29b2cc0 100644 ---- a/drivers/fpga/intel/fme-main.c -+++ b/drivers/fpga/intel/fme-main.c -@@ -30,7 +30,6 @@ - #include - #include - #include --#include - #include - #include - #include -diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c -index 381c562..cea3247 100644 ---- a/drivers/i2c/busses/i2c-altera.c -+++ b/drivers/i2c/busses/i2c-altera.c -@@ -20,7 +20,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -633,7 +632,7 @@ static int altr_i2c_probe(struct platform_device *pdev) - if (pdata) { - /* add in known devices to the bus */ - for (i = 0; i < pdata->num_devices; i++) -- i2c_new_device(&idev->adapter, pdata->devices + i); -+ i2c_new_client_device(&idev->adapter, pdata->devices + i); - } - - dev_info(&pdev->dev, "Altera SoftIP I2C Probe Complete\n"); -diff --git a/drivers/mtd/devices/intel-on-chip-flash.c b/drivers/mtd/devices/intel-on-chip-flash.c -index 259801d..05e16af 100644 ---- a/drivers/mtd/devices/intel-on-chip-flash.c -+++ b/drivers/mtd/devices/intel-on-chip-flash.c -@@ -11,7 +11,6 @@ - */ - - #include --#include - #include - #include - #include -diff --git a/drivers/mtd/spi-nor/intel-generic-qspi.c b/drivers/mtd/spi-nor/intel-generic-qspi.c -index 4183125..25d6d84 100644 ---- a/drivers/mtd/spi-nor/intel-generic-qspi.c -+++ b/drivers/mtd/spi-nor/intel-generic-qspi.c -@@ -10,7 +10,6 @@ - */ - - #include --#include - #include - #include - #include --- -2.31.1 - diff --git a/kernel-modules/intel-opae-fpga/centos/patches/use-altera.h-from-driver-instead-of-from-kernel.patch b/kernel-modules/intel-opae-fpga/centos/patches/use-altera.h-from-driver-instead-of-from-kernel.patch deleted file mode 100644 index af7f8d3e..00000000 --- a/kernel-modules/intel-opae-fpga/centos/patches/use-altera.h-from-driver-instead-of-from-kernel.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 6371907d1b4809fe6c1cb02a4a9dc8b2a18999fa Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Wed, 23 Jun 2021 23:38:47 -0700 -Subject: [PATCH] use altera.h from driver instead of from kernel - -linux/spi/altera.h in Kernel is very different from -the file in opae-intel-fpga-driver. So we use the -head file in opae-intel-fpga-driver driver. - -Signed-off-by: Jiping Ma ---- - Makefile | 28 ---------------------------- - drivers/fpga/intel/fme-main.c | 2 +- - drivers/spi/spi-altera-4-12.c | 2 +- - 3 files changed, 2 insertions(+), 30 deletions(-) - -diff --git a/Makefile b/Makefile -index bb31b0e..e5518ad 100644 ---- a/Makefile -+++ b/Makefile -@@ -10,11 +10,6 @@ ccflags-y += -I$(M)/build/include -I$(M)/build/include/uapi -I$(M)/build/include - ccflags-y += -DCONFIG_AS_AVX512 - ccflags-y += -I$(PWD)/scripts/dtc/libfdt-4-12 - --ifeq ($(kerval), $(filter $(kerval), 4.18 3.10)) --obj-m += spi-bitbang-mod.o --obj-m += regmap-mmio-mod.o --endif -- - obj-m += i2c-altera.o - obj-m += intel-generic-qspi.o - obj-m += intel-on-chip-flash.o -@@ -45,22 +40,11 @@ intel-max10-y += lib-4-12/fdt_sw.o - intel-max10-y += lib-4-12/fdt_strerror.o - intel-max10-y += lib-4-12/fdt_empty_tree.o - --ifeq ($(kerval), 4.18) --regmap-mmio-mod-y := drivers/base/regmap/regmap-mmio-4-18.o --else --regmap-mmio-mod-y := drivers/base/regmap/regmap-mmio-3-10.o --endif -- - i2c-altera-y := drivers/i2c/busses/i2c-altera.o - - intel-generic-qspi-y := drivers/mtd/spi-nor/intel-generic-qspi.o - intel-on-chip-flash-y := drivers/mtd/devices/intel-on-chip-flash.o - --ifeq ($(kerval), 4.18) --spi-bitbang-mod-y := drivers/spi/spi-bitbang-4-18.o --else --spi-bitbang-mod-y := drivers/spi/spi-bitbang-3-10.o --endif - - spi-altera-mod-y := drivers/spi/spi-altera-4-12.o - -@@ -108,13 +92,7 @@ load-drv: - if ! egrep -q '^intel_generic_qspi ' /proc/modules; then insmod intel-generic-qspi.ko; fi - if ! egrep -q '^intel_on_chip_flash ' /proc/modules; then insmod intel-on-chip-flash.ko; fi - if ! egrep -q '^altera_asmip2 ' /proc/modules; then insmod altera-asmip2.ko; fi --ifeq ($(kerval), $(filter $(kerval), 4.18 3.10)) -- if ! egrep -q '^regmap_mmio_mod ' /proc/modules; then insmod regmap-mmio-mod.ko; fi --endif - if ! egrep -q '^i2c_altera ' /proc/modules; then insmod i2c-altera.ko; fi --ifeq ($(kerval), $(filter $(kerval), 4.18 3.10)) -- if ! egrep -q '^spi_bitbang_mod ' /proc/modules; then insmod spi-bitbang-mod.ko; fi --endif - if ! egrep -q '^spi_altera_mod ' /proc/modules; then insmod spi-altera-mod.ko; fi - if ! egrep -q '^ifpga_sec_mgr ' /proc/modules; then insmod ifpga-sec-mgr.ko; fi - if ! egrep -q '^avmmi_bmc ' /proc/modules; then insmod avmmi-bmc.ko; fi -@@ -142,13 +120,7 @@ unload-drv: - if egrep -q '^avmmi_bmc ' /proc/modules; then rmmod avmmi_bmc; fi - if egrep -q '^ifpga_sec_mgr ' /proc/modules; then rmmod ifpga_sec_mgr; fi - if egrep -q '^spi_altera_mod ' /proc/modules; then rmmod spi_altera_mod; fi --ifeq ($(kerval), $(filter $(kerval), 4.18 3.10)) -- if egrep -q '^spi_bitbang_mod ' /proc/modules; then rmmod spi_bitbang_mod; fi --endif - if egrep -q '^i2c_altera ' /proc/modules; then rmmod i2c_altera; fi --ifeq ($(kerval), $(filter $(kerval), 4.18 3.10)) -- if egrep -q '^regmap_mmio_mod ' /proc/modules; then rmmod regmap_mmio_mod; fi --endif - if egrep -q '^altera_asmip2 ' /proc/modules; then rmmod altera_asmip2; fi - if egrep -q '^intel_on_chip_flash ' /proc/modules; then rmmod intel_on_chip_flash; fi - if egrep -q '^intel_generic_qspi ' /proc/modules; then rmmod intel_generic_qspi; fi -diff --git a/drivers/fpga/intel/fme-main.c b/drivers/fpga/intel/fme-main.c -index 29b2cc0..857cf87 100644 ---- a/drivers/fpga/intel/fme-main.c -+++ b/drivers/fpga/intel/fme-main.c -@@ -31,7 +31,7 @@ - #include - #include - #include --#include -+#include "../../../include/linux/spi/altera.h" - #include - #include - -diff --git a/drivers/spi/spi-altera-4-12.c b/drivers/spi/spi-altera-4-12.c -index 9cc2f27..a67b87b 100644 ---- a/drivers/spi/spi-altera-4-12.c -+++ b/drivers/spi/spi-altera-4-12.c -@@ -19,7 +19,7 @@ - #include - #include - #include --#include -+#include "../../../include/linux/spi/altera.h" - #include - #include - #include --- -2.31.1 - diff --git a/kernel-modules/intel-opae-fpga/centos/srpm_path b/kernel-modules/intel-opae-fpga/centos/srpm_path deleted file mode 100644 index d051e3b1..00000000 --- a/kernel-modules/intel-opae-fpga/centos/srpm_path +++ /dev/null @@ -1 +0,0 @@ -repo:stx/downloads/opae-intel-fpga-driver-2.0.1-10.src.rpm diff --git a/kernel-modules/mlnx-ofa_kernel/centos/build_srpm.data b/kernel-modules/mlnx-ofa_kernel/centos/build_srpm.data deleted file mode 100644 index f4dbf43b..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/build_srpm.data +++ /dev/null @@ -1,8 +0,0 @@ -COPY_LIST="$PKG_BASE/files/modules-load.conf" -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=19ca0df55a7c905dc062008862b7b76b577a2354 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=19ca0df55a7c905dc062008862b7b76b577a2354 -PKG_BASE_SRCREV=19ca0df55a7c905dc062008862b7b76b577a2354 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT -BUILD_IS_SLOW=3 diff --git a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Add-BuildRequires-on-kernel-devel-keys.patch b/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Add-BuildRequires-on-kernel-devel-keys.patch deleted file mode 100644 index dc0d3d36..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Add-BuildRequires-on-kernel-devel-keys.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 47ce98b70fcbf36998a0eb5995d13b73b1190708 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Thu, 25 Aug 2022 22:10:18 -0700 -Subject: [PATCH] Add BuildRequires on kernel-devel-keys - -Signed-off-by: Jiping Ma ---- - mlnx-ofa_kernel.spec | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mlnx-ofa_kernel.spec b/mlnx-ofa_kernel.spec -index 2a1b956..9d869d5 100644 ---- a/SPECS/mlnx-ofa_kernel.spec -+++ b/SPECS/mlnx-ofa_kernel.spec -@@ -33,7 +33,7 @@ - - # KMP is disabled by default - %{!?KMP: %global KMP 0} --BuildRequires: kernel%{?bt_ext}-devel, openssl -+BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys, openssl - BuildRequires: devtoolset-8-build - BuildRequires: devtoolset-8-binutils - BuildRequires: devtoolset-8-gcc --- -2.35.1 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Enable-mlx5-onboard-udev-name.patch b/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Enable-mlx5-onboard-udev-name.patch deleted file mode 100644 index 7c1f6aaa..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Enable-mlx5-onboard-udev-name.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0eb52f4a2a5d4d041afae205516515c4393fac2f Mon Sep 17 00:00:00 2001 -From: Steven Webster -Date: Mon, 11 Jul 2022 16:16:13 -0400 -Subject: [PATCH] Enable mlx5 onboard udev name - -Signed-off-by: Steven Webster ---- - SPECS/mlnx-ofa_kernel.spec | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/SPECS/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel.spec -index 2a1b956..d83da56 100644 ---- a/SPECS/mlnx-ofa_kernel.spec -+++ b/SPECS/mlnx-ofa_kernel.spec -@@ -91,6 +91,7 @@ Group: System Environment/Base - Source: %{_basename}-%{_version}.tgz - Source100: modules-load.conf - Patch01: 0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch -+Patch02: 0002-Enable-mlx5-onboard-udev-name.patch - BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED} - Vendor: Mellanox Technologies - Obsoletes: kernel-ib -@@ -267,6 +268,7 @@ mv "$@" source/ - mkdir obj - - %patch01 -p1 -+%patch02 -p1 - - %build - %if 0%{?rhel} == 7 --- -2.29.2 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Ensure-that-modules-are-signed.patch b/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Ensure-that-modules-are-signed.patch deleted file mode 100644 index e3880335..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Ensure-that-modules-are-signed.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 4d13d151ad85f7b0e47a518f5f8867511b8208f3 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Tue, 22 Mar 2022 00:20:08 -0700 -Subject: [PATCH] Ensure that modules are signed - -Always sign the modules for StarlingX by enabling WITH_MOD_SIGN. - -Also, change the definition of buildsubdir from "%{_name}-%{version}" -to "%{_basename}-%{version}" to fix the rt module build issue after -enabling WITH_MOD_SIGN, because there is no mlnx-ofa_kernel-rt-5.5 -directory. It should be mlnx-ofa_kernel-5.5. - -Signed-off-by: Jiping Ma ---- - mlnx-ofa_kernel.spec | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/SPECS/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel.spec -index 38ae4a5..2a1b956 100644 ---- a/SPECS/mlnx-ofa_kernel.spec -+++ b/SPECS/mlnx-ofa_kernel.spec -@@ -211,13 +211,9 @@ sourecs of driver. Use the -devel package if you want to build other - drivers against it. - - # --# setup module sign scripts if paths to the keys are given -+# Always Sign the modules(s). - # --%global WITH_MOD_SIGN %(if ( test -f "$MODULE_SIGN_PRIV_KEY" && test -f "$MODULE_SIGN_PUB_KEY" ); \ -- then \ -- echo -n '1'; \ -- else \ -- echo -n '0'; fi) -+%global WITH_MOD_SIGN 1 - - %if "%{WITH_MOD_SIGN}" == "1" - # call module sign script -@@ -226,7 +222,7 @@ drivers against it. - %{nil} - - %global __debug_package 1 --%global buildsubdir %{_name}-%{version} -+%global buildsubdir %{_basename}-%{version} - # Disgusting hack alert! We need to ensure we sign modules *after* all - # invocations of strip occur, which is in __debug_install_post if - # find-debuginfo.sh runs, and __os_install_post if not. --- -2.31.1 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/PATCH_ORDER b/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/PATCH_ORDER deleted file mode 100644 index bef176d0..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/PATCH_ORDER +++ /dev/null @@ -1,5 +0,0 @@ -Support-STX-system-and-introduce-devtoolset-8.patch -mlx5-pci_irq-Use-irq_update_affinity_hint.patch -Ensure-that-modules-are-signed.patch -Enable-mlx5-onboard-udev-name.patch -Add-BuildRequires-on-kernel-devel-keys.patch diff --git a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Support-STX-system-and-introduce-devtoolset-8.patch b/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Support-STX-system-and-introduce-devtoolset-8.patch deleted file mode 100644 index 734acfa2..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/Support-STX-system-and-introduce-devtoolset-8.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 24a7530968184bd133432e1f8dfccebef772bc7e Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Fri, 28 Jan 2022 23:28:18 -0800 -Subject: [PATCH] Support STX system and introduce devtoolset-8 - -Signed-off-by: Jiping Ma ---- - mlnx-ofa_kernel.spec | 46 ++++++++++++++++++++++++++++++++------------ - 1 file changed, 34 insertions(+), 12 deletions(-) - -diff --git a/SPECS/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel.spec -index 6a6cde0..3e0d564 100644 ---- a/SPECS/mlnx-ofa_kernel.spec -+++ b/SPECS/mlnx-ofa_kernel.spec -@@ -25,10 +25,19 @@ - # and/or other materials provided with the distribution. - # - # -+%if "%{_tis_build_type}" == "rt" -+%define bt_ext -rt -+%else -+%undefine bt_ext -+%endif - - # KMP is disabled by default - %{!?KMP: %global KMP 0} -- -+BuildRequires: kernel%{?bt_ext}-devel, openssl -+BuildRequires: devtoolset-8-build -+BuildRequires: devtoolset-8-binutils -+BuildRequires: devtoolset-8-gcc -+BuildRequires: devtoolset-8-make - %global WITH_SYSTEMD %(if ( test -d "%{_unitdir}" > /dev/null); then echo -n '1'; else echo -n '0'; fi) - - %{!?configure_options: %global configure_options --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-mlx5-mod --with-mlxfw-mod --with-ipoib-mod} -@@ -43,11 +52,11 @@ - - %global IS_RHEL_VENDOR "%{_vendor}" == "redhat" || ("%{_vendor}" == "bclinux") || ("%{_vendor}" == "openEuler") - --%{!?KVERSION: %global KVERSION %(uname -r)} -+%{!?KVERSION: %global KVERSION %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//')} - %global kernel_version %{KVERSION} - %global krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g') - # take path to kernel sources if provided, otherwise look in default location (for non KMP rpms). --%{!?K_SRC: %global K_SRC /lib/modules/%{KVERSION}/build} -+%{!?K_SRC: %global K_SRC /usr/src/kernels/%{KVERSION}} - - # Select packages to build - -@@ -62,7 +71,8 @@ - - %{!?KERNEL_SOURCES: %global KERNEL_SOURCES /lib/modules/%{KVERSION}/source} - --%{!?_name: %global _name mlnx-ofa_kernel} -+%define _basename mlnx-ofa_kernel -+%define _name %{_basename}%{?bt_ext} - %{!?_version: %global _version 5.5} - %{!?_release: %global _release OFED.5.5.1.0.3.1} - %global _kmp_rel %{_release}%{?_kmp_build_num}%{?_dist} -@@ -74,11 +84,12 @@ - Summary: Infiniband HCA Driver - Name: %{_name} - Version: %{_version} --Release: %{_release}%{?_dist} -+Release: %{_release}%{?_dist}%{?_tis_dist}.%{tis_patch_ver} - License: GPLv2 - Url: http://www.mellanox.com/ - Group: System Environment/Base --Source: %{_name}-%{_version}.tgz -+Source: %{_basename}-%{_version}.tgz -+Source100: modules-load.conf - BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED} - Vendor: Mellanox Technologies - Obsoletes: kernel-ib -@@ -148,7 +159,7 @@ Obsoletes: mlnx-en-debuginfo - Obsoletes: mlnx-en-sources - Obsoletes: mlnx-rdma-rxe - Version: %{_version} --Release: %{_release}.kver.%{krelver} -+Release: %{_release}%{?_tis_dist}.%{tis_patch_ver} - Summary: Infiniband Driver and ULPs kernel modules - Group: System Environment/Libraries - %description -n %{non_kmp_pname} -@@ -163,7 +174,7 @@ Version: %{_version} - %if "%{KMP}" == "1" - Release: %{_release}%{?_dist} - %else --Release: %{_release}.kver.%{krelver} -+Release: %{_release}%{?_tis_dist}.%{tis_patch_ver} - %endif - Obsoletes: kernel-ib-devel - Obsoletes: kernel-ib -@@ -252,13 +263,16 @@ drivers against it. - %{!?install_mod_dir: %global install_mod_dir updates} - - %prep --%setup -n %{_name}-%{_version} -+%setup -n %{_basename}-%{_version} - set -- * - mkdir source - mv "$@" source/ - mkdir obj - - %build -+%if 0%{?rhel} == 7 -+source scl_source enable devtoolset-8 || : -+%endif - export EXTRA_CFLAGS='-DVERSION=\"%version\"' - export INSTALL_MOD_DIR=%{install_mod_dir} - export CONF_OPTIONS="%{configure_options}" -@@ -277,12 +291,17 @@ for flavor in %flavors_to_build; do - done - - %install -+%if 0%{?rhel} == 7 -+source scl_source enable devtoolset-8 || : -+%endif - export RECORD_PY_FILES=1 - export INSTALL_MOD_PATH=%{buildroot} - export INSTALL_MOD_DIR=%{install_mod_dir} --export NAME=%{name} -+export NAME=%{_basename} - export VERSION=%{version} - export PREFIX=%{_prefix} -+export MODULE_SIGN_PRIV_KEY=/usr/src/kernels/%{KVERSION}/signing_key.pem -+export MODULE_SIGN_PUB_KEY=/usr/src/kernels/%{KVERSION}/signing_key.x509 - for flavor in %flavors_to_build; do - export KSRC=%{kernel_source $flavor} - export KVERSION=%{kernel_release $KSRC} -@@ -327,14 +346,16 @@ echo "override ${mod_name} * weak-updates/%{_name}${mod_path}" >> %{buildroot}%{ - echo "override ${mod_name} * extra/%{_name}${mod_path}" >> %{buildroot}%{_sysconfdir}/depmod.d/zz01-%{_name}-${mod_name}.conf - done - %endif -+%{__install} -d %{buildroot}%{_sysconfdir}/modules-load.d -+%{__install} -m 644 %{SOURCE100} %{buildroot}%{_sysconfdir}/modules-load.d/mlnx.conf - %endif - - # copy sources - mkdir -p %{buildroot}/%{_prefix}/src/ofa_kernel-%{version} - mkdir -p %{buildroot}/%{_prefix}/src/ofa_kernel/%{_arch} --cp -a %{_builddir}/%{name}-%{version}/source %{buildroot}/%{_prefix}/src/ofa_kernel-%{version}/source -+cp -a %{_builddir}/%{_basename}-%{version}/source %{buildroot}/%{_prefix}/src/ofa_kernel-%{version}/source - ln -s ofa_kernel-%{version}/source %{buildroot}/%{_prefix}/src/mlnx-ofa_kernel-%{version} --cp -a %{_builddir}/src/%{name}/* %{buildroot}/%{_prefix}/src/ofa_kernel/%{_arch}/%{KVERSION} -+cp -a %{_builddir}/src/%{_basename}/* %{buildroot}/%{_prefix}/src/ofa_kernel/%{_arch}/%{KVERSION} - # Fix path of BACKPORT_INCLUDES - sed -i -e "s@=-I.*backport_includes@=-I/usr/src/ofa_kernel-$VERSION/backport_includes@" %{buildroot}/%{_prefix}/src/ofa_kernel/%{_arch}/%{KVERSION}/configure.mk.kernel || true - rm -rf %{_builddir}/src -@@ -681,6 +702,7 @@ update-alternatives --remove \ - %config(noreplace) %{_sysconfdir}/depmod.d/zz01-%{_name}-*.conf - %endif - %endif -+%{_sysconfdir}/modules-load.d/mlnx.conf - %endif - - %files -n %{devel_pname} --- -2.31.1 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/mlx5-pci_irq-Use-irq_update_affinity_hint.patch b/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/mlx5-pci_irq-Use-irq_update_affinity_hint.patch deleted file mode 100644 index 88299b20..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/meta_patches/mlx5-pci_irq-Use-irq_update_affinity_hint.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 839816cfbe2151508e567b1a2244c07a3b592377 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sun, 20 Feb 2022 23:32:45 -0800 -Subject: [PATCH] mlx5: pci_irq: Use irq_update_affinity_hint - -(Please see the patch file for a description.) - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - mlnx-ofa_kernel.spec | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/SPECS/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel.spec -index 3e0d564..38ae4a5 100644 ---- a/SPECS/mlnx-ofa_kernel.spec -+++ b/SPECS/mlnx-ofa_kernel.spec -@@ -90,6 +90,7 @@ Url: http://www.mellanox.com/ - Group: System Environment/Base - Source: %{_basename}-%{_version}.tgz - Source100: modules-load.conf -+Patch01: 0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch - BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED} - Vendor: Mellanox Technologies - Obsoletes: kernel-ib -@@ -269,6 +270,8 @@ mkdir source - mv "$@" source/ - mkdir obj - -+%patch01 -p1 -+ - %build - %if 0%{?rhel} == 7 - source scl_source enable devtoolset-8 || : --- -2.31.1 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/patches/0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch b/kernel-modules/mlnx-ofa_kernel/centos/patches/0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch deleted file mode 100644 index a457f97a..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/patches/0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 88b2e22f1006dd802d44c1cdd901220e36ffd3ee Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Wed, 2 Mar 2022 03:44:53 +0000 -Subject: [PATCH] mlx5: pci_irq: Use irq_update_affinity_hint - -This commit applies a patch that modifies the mlx5 driver so that it -uses the irq_update_affinity_hint function instead of the -irq_set_affinity_hint function. The former only sets the hint, whereas -the latter sets both the hint and the IRQ affinity. - -The intent of the patch is to allow the user-specified IRQ affinity (via -the irqaffinity= command line argument) take effect for the IRQs set up -by the mlx5 device driver. - -(Please see the description of the applied patch for more information.) - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - ...pci_irq-Use-irq_update_affinity_hint.patch | 59 +++++++++++++++++++ - 1 file changed, 59 insertions(+) - create mode 100644 source/backports/1000-mlx5-pci_irq-Use-irq_update_affinity_hint.patch - -diff --git a/source/backports/1000-mlx5-pci_irq-Use-irq_update_affinity_hint.patch b/source/backports/1000-mlx5-pci_irq-Use-irq_update_affinity_hint.patch -new file mode 100644 -index 0000000..6b3d7bf ---- /dev/null -+++ b/source/backports/1000-mlx5-pci_irq-Use-irq_update_affinity_hint.patch -@@ -0,0 +1,59 @@ -+From 73bb521a587baf042d5e79aa2ff4b5e973c64a7b Mon Sep 17 00:00:00 2001 -+From: Jiping Ma -+Date: Tue, 1 Mar 2022 18:42:47 -0800 -+Subject: [PATCH] mlx5: pci_irq: Use irq_update_affinity_hint -+ -+The StarlingX kernel was patched to deprecate irq_set_affinity_hint -+by cherry-picking the patches at: -+ https://lore.kernel.org/netdev/20210903152430.244937-1-nitesh@redhat.com/t/#u -+ -+These patches have been mainlined as of this writing, with the following -+merge commit by Linus Torvalds: -+ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=147cc5838c0f5c76e908b816e924ca378e0d4735 -+ -+This commit modifies the mlx5 driver so that it uses the -+irq_update_affinity_hint function instead of the irq_set_affinity_hint -+function. The former only sets the hint, whereas the latter sets both -+the hint and the IRQ affinity. -+ -+Please note that this is a divergence from the aforementioned patch -+series, which make mlx5 use irq_set_affinity_and_hint, which currently -+behaves in the same way as irq_set_affinity_hint. The intent with -+diverging from mainline is to allow the user-specified IRQ affinity (via -+the irqaffinity= command line argument) take effect for the IRQs -+set up by the mlx5 device driver. -+ -+The mlx5 commit in mainline is accessible at: -+ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7451e9ea8e2055af39afe7ff39a5f68d8ec6b98d -+ -+Signed-off-by: M. Vefa Bicakci -+Signed-off-by: Jiping Ma -+--- -+ drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 4 ++-- -+ 1 file changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c -+index 06ea6fc..dd97f89 100644 -+--- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c -++++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c -+@@ -175,7 +175,7 @@ static void irq_release(struct kref *kref) -+ * before calling it. This is why there is asymmetry with set_rmap -+ * which should be called after alloc_irq but before request_irq. -+ */ -+- irq_set_affinity_hint(irq->irqn, NULL); -++ irq_update_affinity_hint(irq->irqn, NULL); -+ free_cpumask_var(irq->mask); -+ free_irq(irq->irqn, &irq->nh); -+ kfree(irq); -+@@ -276,7 +276,7 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i, -+ goto err_xa; -+ } -+ affinity_copy(irq, affinity, mlx5_irq_table_get(dev)); -+- irq_set_affinity_hint(irq->irqn, irq->mask); -++ irq_update_affinity_hint(irq->irqn, irq->mask); -+ cpu_get(mlx5_irq_table_get(dev), irq->mask); -+ return irq; -+ err_xa: -+-- -+2.31.1 -+ --- -2.29.2 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/patches/0002-Enable-mlx5-onboard-udev-name.patch b/kernel-modules/mlnx-ofa_kernel/centos/patches/0002-Enable-mlx5-onboard-udev-name.patch deleted file mode 100644 index 5c75a973..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/patches/0002-Enable-mlx5-onboard-udev-name.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 74ecb6be9dd81ff6a3c28d2d8f9e557cb76009c3 Mon Sep 17 00:00:00 2001 -From: Steven Webster -Date: Thu, 11 Aug 2022 12:32:48 -0400 -Subject: [PATCH] Enable mlx5 onboard udev name - -This patch prioritizes the udev renaming rule for mlx5 controlled -devices to take the onboard name over the slot/path name. - -This is consistent with the 70-persistent-net.rules file written -by the StarlingX installer. - -It is also consistent with the naming order in the 99-default.link -file. - -Without this patch, there could be an inconsistency with the -70-persistent-net.rules first re-naming the device to its -slot/path name, and then being overridden by the Mellanox specific -82-net-setup-link.rules. - -Signed-off-by: Steven Webster ---- - source/ofed_scripts/vf-net-link-name.sh | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/source/ofed_scripts/vf-net-link-name.sh b/source/ofed_scripts/vf-net-link-name.sh -index 65d8a7b..3bf87cc 100755 ---- a/source/ofed_scripts/vf-net-link-name.sh -+++ b/source/ofed_scripts/vf-net-link-name.sh -@@ -68,7 +68,9 @@ if [ "$ID_NET_DRIVER" == "mlx5e_rep" ]; then - fi - - if [ "$skip" == "0" ]; then -- if [ -n "$ID_NET_NAME_SLOT" ]; then -+ if [ -n "$ID_NET_NAME_ONBOARD" ]; then -+ NAME="${ID_NET_NAME_ONBOARD%%np[[:digit:]]}" -+ elif [ -n "$ID_NET_NAME_SLOT" ]; then - NAME="${ID_NET_NAME_SLOT%%np[[:digit:]]}" - elif [ -n "$ID_NET_NAME_PATH" ]; then - NAME="${ID_NET_NAME_PATH%%np[[:digit:]]}" -@@ -176,9 +178,12 @@ for cnt in {1..2}; do - continue - fi - -- parent_path=`get_pci_name $pci ID_NET_NAME_SLOT` -+ parent_path=`get_pci_name $pci ID_NET_NAME_ONBOARD` - if [ -z "$parent_path" ]; then -- parent_path=`get_pci_name $pci ID_NET_NAME_PATH` -+ parent_path=`get_pci_name $pci ID_NET_NAME_SLOT` -+ if [ -z "$parent_path" ]; then -+ parent_path=`get_pci_name $pci ID_NET_NAME_PATH` -+ fi - fi - echo "NAME=${parent_path}_$PORT" - exit --- -2.29.2 - diff --git a/kernel-modules/mlnx-ofa_kernel/centos/srpm_path b/kernel-modules/mlnx-ofa_kernel/centos/srpm_path deleted file mode 100644 index e2b3997f..00000000 --- a/kernel-modules/mlnx-ofa_kernel/centos/srpm_path +++ /dev/null @@ -1 +0,0 @@ -repo:stx/downloads/mlnx-ofa_kernel-5.5-OFED.5.5.1.0.3.1.src.rpm diff --git a/kernel-rt/centos/build_srpm b/kernel-rt/centos/build_srpm deleted file mode 100755 index 4e06cb97..00000000 --- a/kernel-rt/centos/build_srpm +++ /dev/null @@ -1,279 +0,0 @@ -#!/bin/bash -# set -x - -# -# Copyright (c) 2018-2021 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# Refer to build-tools/default_build_srpm and modify for git repo from linux-yocto. -# - -source "$SRC_BASE/build-tools/spec-utils" -source "$SRC_BASE/build-tools/srpm-utils" - -CUR_DIR=`pwd` -BUILD_DIR="$RPMBUILD_BASE" - -if [ "x$DATA" == "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): Environment variable 'DATA' not defined." - exit 1 -fi - -srpm_source_build_data "$DATA" "$SRC_BUILD_TYPE" "$SRPM_OR_SPEC_PATH" -if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): Failed to source build data from $DATA" - exit 1 -fi - -if [ "x$PBR_VERSION" != "x" ] && [ "x$PBR_VERSION" != "xNA" ]; then - VERSION=$PBR_VERSION -fi - -if [ "x$VERSION" == "x" ]; then - for SPEC in `find $SPECS_BASE -name '*.spec' | sort -V`; do - SPEC_PATH="$SPEC" - - VERSION_DERIVED=`spec_evaluate '%{version}' "$SPEC_PATH" 2>> /dev/null` - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): '%{version}' not found in '$PKG_BASE/$SPEC_PATH'" - VERSION_DERIVED="" - fi - - if [ "x$VERSION_DERIVED" != "x" ]; then - if [ "x$VERSION" == "x" ]; then - VERSION=$VERSION_DERIVED - else - if [ "x$SRC_DIR" != "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): multiple spec files found, can't set VERSION automatically" - exit 1 - fi - fi - fi - done - - if [ "x$VERSION" == "x" ]; then - if [ -f $SRC_DIR/PKG-INFO ]; then - VERSION=$(grep '^Version:' $SRC_DIR/PKG-INFO | awk -F ': ' '{print $2}' | sed -e 's/^[[:space:]]*//') - fi - fi - - if [ "x$VERSION" != "x" ]; then - echo "Derived VERSION=$VERSION" - else - echo "ERROR: kernel build_srpm (${LINENO}): Failed to derive a good VERSION from SPEC file, and none provided." - exit 1 - fi -fi - -if [ "x$TAR_NAME" == "x" ]; then - for SPEC in `find $SPECS_BASE -name '*.spec' | sort -V`; do - SPEC_PATH="$SPEC" - - SERVICE=`spec_find_global service "$SPEC_PATH" 2>> /dev/null` - if [ $? -eq 0 ]; then - if [ "x$TAR_NAME" == "x" ]; then - TAR_NAME=$SERVICE - else - if [ "x$SRC_DIR" != "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): multiple spec files found, can't set TAR_NAME automatically" - exit 1 - fi - fi - else - NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null` - if [ $? -eq 0 ]; then - if [ "x$TAR_NAME" == "x" ]; then - TAR_NAME=$NAME - else - if [ "x$SRC_DIR" != "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): multiple spec files found, can't set TAR_NAME automatically" - exit 1 - fi - fi - else - echo "WARNING: kernel build_srpm (${LINENO}): 'Name' not found in '$SPEC_PATH'" - NAME="" - fi - fi - done - - if [ "x$TAR_NAME" == "x" ]; then - if [ -f $SRC_DIR/PKG-INFO ]; then - TAR_NAME=$(grep '^Name:' $SRC_DIR/PKG-INFO | awk -F ': ' '{print $2}' | sed -e 's/^[[:space:]]*//') - fi - fi - - if [ "x$TAR_NAME" != "x" ]; then - echo "Derived TAR_NAME=$TAR_NAME" - else - echo "ERROR: kernel build_srpm (${LINENO}): Failed to derive a good TAR_NAME from SPEC file, and none provided." - exit 1 - fi -fi - -if [ "x$TAR" == "x" ]; then - TAR="$TAR_NAME-$VERSION.tar.gz" -fi - -SOURCE_PATH="$BUILD_DIR/SOURCES" -TAR_PATH="$SOURCE_PATH/$TAR" -STAGING="" - -if [ "x$COPY_LIST_TO_TAR" != "x" ] || [ "x$EXCLUDE_LIST_FROM_TAR" != "x" ]; then - STAGING="$BUILD_DIR/staging" - mkdir -p $STAGING -fi - -mkdir -p "$BUILD_DIR/SRPMS" -mkdir -p "$SOURCE_PATH" - -if [ "x$SRC_DIR" == "x" -a "x$COPY_LIST" == "x" -a "$ALLOW_EMPTY_RPM" != "true" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): '$PWD/$DATA' failed to provide at least one of 'SRC_DIR' or 'COPY_LIST'" - exit 1 -fi - -if [ "x$SRC_DIR" != "x" ]; then - if [ ! -d "$SRC_DIR" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): directory not found: '$SRC_DIR'" - exit 1 - fi -fi - -if [ "x$COPY_LIST" != "x" ]; then - echo "COPY_LIST: $COPY_LIST" - for p in $COPY_LIST; do - # echo "COPY_LIST: $p" - \cp -L -u -r -v $p $SOURCE_PATH - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): COPY_LIST: file not found: '$p'" - exit 1 - fi - done -fi - -if [ "x$STAGING" != "x" ]; then - \cp -L -u -r -v $SRC_DIR $STAGING - echo "COPY_LIST_TO_TAR: $COPY_LIST_TO_TAR" - for p in $COPY_LIST_TO_TAR; do - # echo "COPY_LIST_TO_TAR: $p" - \cp -L -u -r -v $p $STAGING/$SRC_DIR - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): COPY_LIST_TO_TAR: file not found: '$p'" - exit 1 - fi - done - echo "EXCLUDE_LIST_FROM_TAR: $EXCLUDE_LIST_FROM_TAR" - for p in $EXCLUDE_LIST_FROM_TAR; do - # echo "EXCLUDE_LIST_FROM_TAR: $p" - echo "rm -rf $STAGING/$SRC_DIR/$p" - \rm -rf $STAGING/$SRC_DIR/$p - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): EXCLUDE_LIST_FROM_TAR: could not remove file: '$p'" - exit 1 - fi - done - -fi - -TRANSFORM=`echo "$SRC_DIR" | sed 's/^\./\\./' | sed 's:^/::' | sed 's#^.*/\.\./##'` - -if [ "x$STAGING" != "x" ]; then - pushd $STAGING -fi - -TAR_NEEDED=0 -if [ "x$SRC_DIR" != "x" ]; then - echo "SRC_DIR=$SRC_DIR" - if [ -f $TAR_PATH ]; then - n=`find . -cnewer $TAR_PATH -and ! -path './.git*' \ - -and ! -path './.pc/*' \ - -and ! -path './patches/*' \ - -and ! -path "./$DISTRO/*" \ - -and ! -path './pbr-*.egg/*' \ - | wc -l` - if [ $n -gt 0 ]; then - TAR_NEEDED=1 - fi - else - TAR_NEEDED=1 - fi -fi - -if [ $TAR_NEEDED -gt 0 ]; then - echo "Creating tar file: $TAR_PATH ... $TAR_NAME $VERSION" - #cd $SRC_DIR - #pwd - #git checkout -b linux-rt remotes/origin/v5.10/standard/preempt-rt/intel-x86 - #cd - - echo "tar --exclude '.git*' --exclude='.pc' --exclude='patches' --exclude='$SRC_DIR/$DISTRO' --exclude='pbr-*.egg' --transform 's,^$TRANSFORM,$TAR_NAME-$VERSION,' -czf $TAR_PATH $SRC_DIR" - tar --exclude '.git*' --exclude='.pc' --exclude='patches' --exclude="$SRC_DIR/$DISTRO" --exclude='pbr-*.egg' --transform "s,^$TRANSFORM,$TAR_NAME-$VERSION," -czf "$TAR_PATH" "$SRC_DIR" - if [ $? -ne 0 ]; then - if [ "x$STAGING" != "x" ]; then - popd - fi - - echo "ERROR: kernel build_srpm (${LINENO}): failed to create tar file, cmd: tar --exclude '.git*' --exclude='.pc' --exclude='patches' --exclude="$SRC_DIR/$DISTRO" --exclude='pbr-*.egg' --transform \"s,^$TRANSFORM,$TAR_NAME-$VERSION,\" -czf '$TAR_PATH' '$SRC_DIR'" - exit 1 - fi - echo "Created tar file: $TAR_PATH" -else - echo "Tar file not needed." -fi - -if [ "x$STAGING" != "x" ]; then - popd -fi - -if [ ! -d $BUILD_DIR/SPECS ]; then - echo "Spec directory '$BUILD_DIR/SPECS' does not exist" - exit 1 -fi - -if [ $(ls -1 $BUILD_DIR/SPECS/*.spec | wc -l) -eq 0 ]; then - echo "No spec files found in spec directory '$BUILD_DIR/SPECS'" - exit 1 -fi - -for SPEC in `ls -1 $BUILD_DIR/SPECS`; do - SPEC_PATH="$BUILD_DIR/SPECS/$SPEC" - RELEASE=`spec_find_tag Release "$SPEC_PATH" 2>> /dev/null` - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): 'Release' not found in '$SPEC_PATH'" - fi - NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null` - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): 'Name' not found in '$SPEC_PATH'" - fi - SRPM="$NAME-$VERSION-$RELEASE.src.rpm" - SRPM_PATH="$BUILD_DIR/SRPMS/$SRPM" - - spec_validate_tis_release $SPEC_PATH - if [ $? -ne 0 ]; then - echo "TIS Validation of $SPEC_PATH failed" - exit 1 - fi - - BUILD_NEEDED=0 - if [ -f $SRPM_PATH ]; then - n=`find . -cnewer $SRPM_PATH | wc -l` - if [ $n -gt 0 ]; then - BUILD_NEEDED=1 - fi - else - BUILD_NEEDED=1 - fi - - if [ $BUILD_NEEDED -gt 0 ]; then - echo "SPEC file: $SPEC_PATH" - echo "SRPM build directory: $BUILD_DIR" - echo "TIS_PATCH_VER: $TIS_PATCH_VER" - echo "PBR_VERSION: $PBR_VERSION" - - sed -i -e "1 i%define _tis_build_type $BUILD_TYPE" $SPEC_PATH - sed -i -e "1 i%define tis_patch_ver $TIS_PATCH_VER" $SPEC_PATH - sed -i -e "1 i%define pbr_version $PBR_VERSION" $SPEC_PATH - rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --undefine=dist --define="_tis_dist .tis" - else - echo "SRPM build not needed" - fi -done diff --git a/kernel-rt/centos/build_srpm.data b/kernel-rt/centos/build_srpm.data deleted file mode 100644 index 218b4215..00000000 --- a/kernel-rt/centos/build_srpm.data +++ /dev/null @@ -1,16 +0,0 @@ -SRC_DIR="$STX_BASE/git/linux-yocto-rt" - -COPY_LIST=" \ - $PKG_BASE/files/* \ - $PKG_BASE/centos/patches/*" -BUILD_IS_BIG=21 -BUILD_IS_SLOW=16 - -# The base branch is: v5.10/standard/preempt-rt/base -# commit bd6e7290bc points to a minor fix-up on top of v5.10.112-rt61: -# bd6e7290bc76 (inet/hash: fixup -rt merge, 2022-04-25) -TIS_BASE_SRCREV=bd6e7290bc766ef13e42a1e37f75e6e708b4e317 - -PKG_BASE_SRCREV=4013790c6ef43fd9f936579b0cac50b8e0c4505a -TIS_PATCH_VER=GITREVCOUNT+PKG_GITREVCOUNT - diff --git a/kernel-rt/centos/kernel-rt.spec b/kernel-rt/centos/kernel-rt.spec deleted file mode 100644 index 3a4d4546..00000000 --- a/kernel-rt/centos/kernel-rt.spec +++ /dev/null @@ -1,3157 +0,0 @@ -# We have to override the new %%install behavior because, well... the kernel is special. -%global __spec_install_pre %{___build_pre} - -# this should go away soon -%define _legacy_common_support 1 - -# At the time of this writing (2019-03), RHEL8 packages use w2.xzdio -# compression for rpms (xz, level 2). -# Kernel has several large (hundreds of mbytes) rpms, they take ~5 mins -# to compress by single-threaded xz. Switch to threaded compression, -# and from level 2 to 3 to keep compressed sizes close to "w2" results. -# -# NB: if default compression in /usr/lib/rpm/redhat/macros ever changes, -# this one might need tweaking (e.g. if default changes to w3.xzdio, -# change below to w4T.xzdio): -# -# This is disabled on i686 as it triggers oom errors - -%ifnarch i686 -%define _binary_payload w3T.xzdio -%endif - -Summary: The Linux kernel - -# For a kernel released for public testing, released_kernel should be 1. -# For internal testing builds during development, it should be 0. -# For rawhide and/or a kernel built from an rc or git snapshot, -# released_kernel should be 0. -# For a stable, released kernel, released_kernel should be 1. -%global released_kernel 1 - -%if 0%{?fedora} -%define secure_boot_arch x86_64 -%else -%define secure_boot_arch x86_64 aarch64 -%endif - -# Signing for secure boot authentication -%ifarch %{secure_boot_arch} -%global signkernel 1 -%else -%global signkernel 0 -%endif - -# Sign modules on all arches -%global signmodules 1 - -# Compress modules only for architectures that build modules -%ifarch noarch -%global zipmodules 0 -%else -%global zipmodules 1 -%endif - -%if %{zipmodules} -%global zipsed -e 's/\.ko$/\.ko.xz/' -# for parallel xz processes, replace with 1 to go back to single process -%global zcpu `nproc --all` -%endif - -%if 0%{?centos} -%define dist .el7 -%endif - -# This is the STX patch release -%define buildid .%{tis_patch_ver}.tis - -# baserelease defines which build revision of this kernel version we're -# building. We used to call this fedora_build, but the magical name -# baserelease is matched by the rpmdev-bumpspec tool, which you should use. -# -# We used to have some extra magic weirdness to bump this automatically, -# but now we don't. Just use: rpmdev-bumpspec -c 'comment for changelog' -# When changing base_sublevel below or going from rc to a final kernel, -# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec). -# scripts/rebase.sh should be made to do that for you, actually. -# -# NOTE: baserelease must be > 0 or bad things will happen if you switch -# to a released kernel (released version will be < rc version) -# -# For non-released -rc kernels, this will be appended after the rcX and -# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3" -# -%global baserelease 200 -%global fedora_build %{baserelease} - -# base_sublevel is the kernel version we're starting with and patching -# on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base, -# which yields a base_sublevel of 0. -%define base_sublevel 10 - -# Do we have a -stable update to apply? -%define stable_update 112 -# Set rpm version accordingly -%define stablerev %{stable_update} -%define stable_base %{stable_update} -%define rpmversion 5.%{base_sublevel}.%{stable_update} - -# Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below. - -# What parts do we want to build? We must build at least one kernel. -# These are the kernels that are built IF the architecture allows it. -# All should default to 1 (enabled) and be flipped to 0 (disabled) -# by later arch-specific checks. - -# The following build options are enabled by default. -# Use either --without in your rpmbuild command or force values -# to 0 in here to disable them. -# -# standard kernel -%define with_up %{?_without_up: 0} %{?!_without_up: 1} -# kernel PAE (only valid for ARM (lpae)) -%define with_pae %{?_without_pae: 0} %{?!_without_pae: 1} -# STX: disable lpae build -%define with_pae 0 -# kernel-debug -%define with_debug %{?_without_debug: 0} %{?!_without_debug: 1} -# STX: disable debug build -%define with_debug 0 -# kernel-doc -%define with_doc %{?_without_doc: 0} %{?!_without_doc: 1} -# kernel-headers -%define with_headers %{?_without_headers: 0} %{?!_without_headers: 1} -%define with_cross_headers %{?_without_cross_headers: 0} %{?!_without_cross_headers: 1} -# perf -%define with_perf %{?_without_perf: 0} %{?!_without_perf: 1} -# tools -%define with_tools %{?_without_tools: 0} %{?!_without_tools: 1} -# bpf tool -%define with_bpftool %{?_without_bpftool: 0} %{?!_without_bpftool: 1} -# kernel-debuginfo -%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1} -# Want to build a the vsdo directories installed -%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1} -# kernel-zfcpdump (s390 specific kernel for zfcpdump) -%define with_zfcpdump %{?_without_zfcpdump: 0} %{?!_without_zfcpdump: 1} -# STX: disable zfcpdump build -%define with_zfcpdump 0 -# kernel-abi-whitelists -%define with_kernel_abi_whitelists %{?_without_kernel_abi_whitelists: 0} %{?!_without_kernel_abi_whitelists: 1} -# internal samples and selftests -%define with_selftests %{?_without_selftests: 0} %{?!_without_selftests: 1} -# -# Additional options for user-friendly one-off kernel building: -# -# Only build the base kernel (--with baseonly): -%define with_baseonly %{?_with_baseonly: 1} %{?!_with_baseonly: 0} -# Only build the pae kernel (--with paeonly): -%define with_paeonly %{?_with_paeonly: 1} %{?!_with_paeonly: 0} -# Only build the debug kernel (--with dbgonly): -%define with_dbgonly %{?_with_dbgonly: 1} %{?!_with_dbgonly: 0} -# Control whether we perform a compat. check against published ABI. -%define with_kabichk %{?_without_kabichk: 0} %{?!_without_kabichk: 1} -# Temporarily disable kabi checks until RC. -%define with_kabichk 0 -# Control whether we perform a compat. check against DUP ABI. -%define with_kabidupchk %{?_with_kabidupchk: 1} %{?!_with_kabidupchk: 0} -# -# Control whether to run an extensive DWARF based kABI check. -# Note that this option needs to have baseline setup in SOURCE300. -%define with_kabidwchk %{?_without_kabidwchk: 0} %{?!_without_kabidwchk: 1} -%define with_kabidw_base %{?_with_kabidw_base: 1} %{?!_with_kabidw_base: 0} -# -# should we do C=1 builds with sparse -%define with_sparse %{?_with_sparse: 1} %{?!_with_sparse: 0} -# -# Cross compile requested? -%define with_cross %{?_with_cross: 1} %{?!_with_cross: 0} -# -# build a release kernel on rawhide -%define with_release %{?_with_release: 1} %{?!_with_release: 0} - -# verbose build, i.e. no silent rules and V=1 -%define with_verbose %{?_with_verbose: 1} %{?!_with_verbose: 0} - -# -# check for mismatched config options -%define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 1} - -# -# gcov support -%define with_gcov %{?_with_gcov:1}%{?!_with_gcov:0} - -# -# ipa_clone support -%define with_ipaclones %{?_without_ipaclones: 0} %{?!_without_ipaclones: 1} - -# Want to build a vanilla kernel build without any non-upstream patches? -%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0} - -# Set debugbuildsenabled to 1 for production (build separate debug kernels) -# and 0 for rawhide (all kernels are debug kernels). -# See also 'make debug' and 'make release'. -%define debugbuildsenabled 1 - -%if 0%{?fedora} -# Kernel headers are being split out into a separate package -%define with_headers 0 -%define with_cross_headers 0 -# no selftests for now -%define with_selftests 0 -# no ipa_clone for now -%define with_ipaclones 0 -# no whitelist -%define with_kernel_abi_whitelists 0 -# Fedora builds these separately -%define with_perf 0 -%define with_tools 0 -%define with_bpftool 0 -%endif - -%if 0%{?centos} -# no selftests for now -%define with_selftests 0 -# no ipa_clone for now -%define with_ipaclones 0 -# no whitelist -%define with_kernel_abi_whitelists 0 -%define with_kabidw_base 0 -%define with_kabidwchk 0 -%define with_perf 0 -%define with_bpftool 0 -%endif - -%if %{with_verbose} -%define make_opts V=1 -%else -%define make_opts -s -%endif -%define with_realtime 1 - -# pkg_release is what we'll fill in for the rpm Release: field -%define pkg_release %{fedora_build}%{?buildid}.rt%{?dist} - -# The kernel tarball/base version -%define kversion 5.%{base_sublevel} - - -# turn off debug kernel and kabichk for gcov builds -%if %{with_gcov} -%define with_debug 0 -%define with_kabichk 0 -%define with_kabidupchk 0 -%define with_kabidwchk 0 -%endif - -# turn off kABI DWARF-based check if we're generating the base dataset -%if %{with_kabidw_base} -%define with_kabidwchk 0 -%endif - -# kpatch_kcflags are extra compiler flags applied to base kernel -# -fdump-ipa-clones is enabled only for base kernels on selected arches -%if %{with_ipaclones} -%ifarch x86_64 ppc64le -%define kpatch_kcflags -fdump-ipa-clones -%else -%define with_ipaclones 0 -%endif -%endif - -%define make_target bzImage -%define image_install_path boot - -%define KVERREL %{version}-%{release}.%{_target_cpu} -%define KVERREL_RE %(echo %KVERREL | sed 's/+/[+]/g') -%define hdrarch %_target_cpu -%define asmarch %_target_cpu - -%if 0%{!?nopatches:1} -%define nopatches 0 -%endif - -%if %{with_vanilla} -%define nopatches 1 -%endif - -%if %{nopatches} -%define variant -vanilla -%endif - -%if !%{debugbuildsenabled} -%define with_debug 0 -%endif - -%if !%{with_debuginfo} -%define _enable_debug_packages 0 -%endif -%define debuginfodir /usr/lib/debug -# Needed because we override almost everything involving build-ids -# and debuginfo generation. Currently we rely on the old alldebug setting. -%global _build_id_links alldebug - -# kernel PAE is only built on ARMv7 -%ifnarch armv7hl -%define with_pae 0 -%endif - -# if requested, only build base kernel -%if %{with_baseonly} -%define with_pae 0 -%define with_debug 0 -%endif - -# if requested, only build pae kernel -%if %{with_paeonly} -%define with_up 0 -%define with_debug 0 -%endif - -# if requested, only build debug kernel -%if %{with_dbgonly} -%if %{debugbuildsenabled} -%define with_up 0 -%endif -%define with_pae 0 -%define with_tools 0 -%define with_perf 0 -%define with_bpftool 0 -%endif - -# turn off kABI DUP check and DWARF-based check if kABI check is disabled -%if !%{with_kabichk} -%define with_kabidupchk 0 -%define with_kabidwchk 0 -%endif - -%if %{with_vdso_install} -%define use_vdso 1 -%endif - - -%ifnarch noarch -%define with_kernel_abi_whitelists 0 -%endif - -# Overrides for generic default options - -# only package docs noarch -%ifnarch noarch -%define with_doc 0 -%define doc_build_fail true -%endif - -%if 0%{?fedora}%{?centos} -# don't do debug builds on anything but i686 and x86_64 -%ifnarch i686 x86_64 -%define with_debug 0 -%endif -%endif - -# don't build noarch kernels or headers (duh) -%ifarch noarch -%define with_up 0 -%define with_headers 0 -%define with_cross_headers 0 -%define with_tools 0 -%define with_perf 0 -%define with_bpftool 0 -%define with_selftests 0 -%define with_debug 0 -%define all_arch_configs kernel-%{version}-*.config -%endif - -# sparse blows up on ppc -%ifnarch ppc64le -%define with_sparse 0 -%endif -BuildRequires: util-linux - -# zfcpdump mechanism is s390 only -%ifnarch s390x -%define with_zfcpdump 0 -%endif - -%if 0%{?fedora} -# This is not for Fedora -%define with_zfcpdump 0 -%endif - -# Per-arch tweaks - -%ifarch i686 -%define asmarch x86 -%define hdrarch i386 -%define all_arch_configs kernel-%{version}-i?86*.config -%define kernel_image arch/x86/boot/bzImage -%endif - -%ifarch x86_64 -%define asmarch x86 -%define all_arch_configs kernel-x86_64*.config -%define kernel_image arch/x86/boot/bzImage -%endif - -%ifarch ppc64le -%define asmarch powerpc -%define hdrarch powerpc -%define make_target vmlinux -%define kernel_image vmlinux -%define kernel_image_elf 1 -%define all_arch_configs kernel-%{version}-ppc64le*.config -%define kcflags -O3 -%endif - -%ifarch s390x -%define asmarch s390 -%define hdrarch s390 -%define all_arch_configs kernel-%{version}-s390x.config -%define kernel_image arch/s390/boot/bzImage -%endif - -%ifarch %{arm} -%define all_arch_configs kernel-%{version}-arm*.config -%define skip_nonpae_vdso 1 -%define asmarch arm -%define hdrarch arm -%define make_target bzImage -%define kernel_image arch/arm/boot/zImage -# http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091404.html -%define kernel_mflags KALLSYMS_EXTRA_PASS=1 -# we only build headers/perf/tools on the base arm arches -# just like we used to only build them on i386 for x86 -%ifnarch armv7hl -%define with_headers 0 -%define with_cross_headers 0 -%endif -# These currently don't compile on armv7 -%define with_selftests 0 -%endif - -%ifarch aarch64 -%define all_arch_configs kernel-%{version}-aarch64*.config -%define asmarch arm64 -%define hdrarch arm64 -%define make_target Image.gz -%define kernel_image arch/arm64/boot/Image.gz -%endif - -# Should make listnewconfig fail if there's config options -# printed out? -%if %{nopatches} -%define with_configchecks 0 -%endif - -# To temporarily exclude an architecture from being built, add it to -# %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we -# don't build kernel-headers then the new build system will no longer let -# us use the previous build of that package -- it'll just be completely AWOL. -# Which is a BadThing(tm). - -# We only build kernel-headers on the following... -%if 0%{?fedora}%{?centos} -%define nobuildarches i386 -%else -%define nobuildarches i386 i686 -%endif - -%ifarch %nobuildarches -%define with_up 0 -%define with_debug 0 -%define with_debuginfo 0 -%define with_perf 0 -%define with_tools 0 -%define with_bpftool 0 -%define with_selftests 0 -%define with_pae 0 -%define _enable_debug_packages 0 -%endif - -# Architectures we build tools/cpupower on -%if 0%{?fedora}%{?centos} -%define cpupowerarchs %{ix86} x86_64 ppc64le %{arm} aarch64 -%else -%define cpupowerarchs i686 x86_64 ppc64le aarch64 -%endif - -%if %{use_vdso} - -%if 0%{?skip_nonpae_vdso} -%define _use_vdso 0 -%else -%define _use_vdso 1 -%endif - -%else -%define _use_vdso 0 -%endif - -# -# Packages that need to be installed before the kernel is, because the %%post -# scripts use them. -# -%define kernel_prereq coreutils, systemd >= 203-2, /usr/bin/kernel-install -%define initrd_prereq dracut >= 027 - - -Name: kernel-rt -License: GPLv2 and Redistributable, no modification permitted -URL: https://www.kernel.org/ -Version: %{rpmversion} -Release: %{pkg_release} -# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD. -# SET %%nobuildarches (ABOVE) INSTEAD -%if 0%{?fedora} -ExclusiveArch: x86_64 s390x %{arm} aarch64 ppc64le -%else -ExclusiveArch: noarch i386 i686 x86_64 s390x %{arm} aarch64 ppc64le -%endif -ExclusiveOS: Linux -%ifnarch %{nobuildarches} -Requires: kernel-core-uname-r = %{KVERREL}%{?variant} -Requires: kernel-modules-uname-r = %{KVERREL}%{?variant} -Requires: rt-setup -%endif - - -# -# List the packages used during the kernel build -# -BuildRequires: kmod, patch, bash, tar, git-core -BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk -BuildRequires: binutils, redhat-rpm-config, hmaccalc, bison, flex -BuildRequires: net-tools, hostname, bc, elfutils-devel -%if 0%{?rhel} == 7 -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -BuildRequires: kernel-headers -%endif -%if 0%{?fedora} || 0%{?rhel} >= 8 -BuildRequires: dwarves -%endif -# Used to mangle unversioned shebangs to be Python 3 -BuildRequires: python3-devel -%if %{with_headers} -BuildRequires: rsync -%endif -%if %{with_doc} -BuildRequires: xmlto, asciidoc, python3-sphinx -%endif -%if %{with_sparse} -BuildRequires: sparse -%endif -%if %{with_perf} -BuildRequires: zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex xz-devel -BuildRequires: audit-libs-devel -BuildRequires: java-devel -%ifnarch %{arm} s390x -BuildRequires: numactl-devel -%endif -%endif -%if %{with_tools} -BuildRequires: gettext ncurses-devel -%ifnarch s390x -BuildRequires: pciutils-devel -%endif -%endif -%if %{with_bpftool} -%if 0%{?rhel} == 7 -BuildRequires: python-docutils -%else -BuildRequires: python3-docutils -%endif -BuildRequires: zlib-devel binutils-devel -%endif -%if %{with_selftests} -%if 0%{?fedora} -BuildRequires: clang llvm -%else -%if 0%{?rhel} == 7 -BuildRequires: llvm-toolset-7.0 -%else -BuildRequires: llvm-toolset -%endif -%endif -%ifnarch %{arm} -BuildRequires: numactl-devel -%endif -BuildRequires: libcap-devel libcap-ng-devel rsync -%endif -BuildConflicts: rhbuildsys(DiskFree) < 500Mb -%if %{with_debuginfo} -BuildRequires: rpm-build, elfutils -BuildConflicts: rpm < 4.13.0.1-19 -%if 0%{?fedora} -BuildConflicts: dwarves < 1.13 -%endif -# Most of these should be enabled after more investigation -%undefine _include_minidebuginfo -%undefine _find_debuginfo_dwz_opts -%undefine _unique_build_ids -%undefine _unique_debug_names -%undefine _unique_debug_srcs -%undefine _debugsource_packages -%undefine _debuginfo_subpackages -%global _find_debuginfo_opts -r -%global _missing_build_ids_terminate_build 1 -%global _no_recompute_build_ids 1 -%endif -%if %{with_kabidwchk} || %{with_kabidw_base} -BuildRequires: kabi-dw -%endif - -%if %{signkernel}%{signmodules} -BuildRequires: openssl openssl-devel -%if %{signkernel} -%ifarch x86_64 aarch64 -BuildRequires: nss-tools -BuildRequires: pesign >= 0.10-4 -%endif -%endif -%endif - -%if %{with_cross} -BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu -%define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu- -%endif - -# These below are required to build man pages -%if %{with_perf} -BuildRequires: xmlto -%endif -%if %{with_perf} || %{with_tools} -BuildRequires: asciidoc -%endif -%if %{with_tools} -BuildRequires: libcap-devel -%endif - -Source0: %{name}-%{version}.tar.gz - -# Name of the packaged file containing signing key -%ifarch ppc64le -%define signing_key_filename kernel-signing-ppc.cer -%endif -%ifarch s390x -%define signing_key_filename kernel-signing-s390.cer -%endif - -Source11: x509.genkey -%if %{?released_kernel} - -Source12: centossecurebootca2.der -Source13: centos-ca-secureboot.der -Source14: centossecureboot201.der -Source15: centossecureboot001.der - -%define secureboot_ca_1 %{SOURCE12} -%define secureboot_ca_0 %{SOURCE13} -%ifarch x86_64 aarch64 -%define secureboot_key_1 %{SOURCE14} -%define pesign_name_1 centossecureboot201 -%define secureboot_key_0 %{SOURCE15} -%define pesign_name_0 centossecureboot001 -%endif - -# released_kernel -%else - -Source12: centossecurebootca2.der -Source13: centos-ca-secureboot.der -Source14: centossecureboot201.der -Source15: centossecureboot001.der - -%define secureboot_ca_1 %{SOURCE12} -%define secureboot_ca_0 %{SOURCE13} -%define secureboot_key_1 %{SOURCE14} -%define pesign_name_1 centossecureboot201 -%define secureboot_key_0 %{SOURCE15} -%define pesign_name_0 centossecureboot001 - -# released_kernel -%endif - -Source22: mod-extra.list -Source24: mod-extra.sh -Source18: mod-sign.sh -Source19: mod-extra-blacklist.sh -Source79: parallel_xz.sh - -Source80: filter-x86_64.sh -Source89: filter-modules.sh - -%define modsign_cmd %{SOURCE18} - -#Source20: kernel-aarch64-rhel.config -#Source21: kernel-aarch64-debug-rhel.config -#Source30: kernel-ppc64le-rhel.config -#Source31: kernel-ppc64le-debug-rhel.config -#Source32: kernel-s390x-rhel.config -#Source33: kernel-s390x-debug-rhel.config -#Source34: kernel-s390x-zfcpdump-rhel.config -#Source35: kernel-x86_64-rhel.config -#Source36: kernel-x86_64-debug-rhel.config -# -#Source37: kernel-aarch64-fedora.config -#Source38: kernel-aarch64-debug-fedora.config -#Source39: kernel-armv7hl-fedora.config -#Source40: kernel-armv7hl-debug-fedora.config -#Source41: kernel-armv7hl-lpae-fedora.config -#Source42: kernel-armv7hl-lpae-debug-fedora.config -#Source43: kernel-i686-fedora.config -#Source44: kernel-i686-debug-fedora.config -#Source45: kernel-ppc64le-fedora.config -#Source46: kernel-ppc64le-debug-fedora.config -#Source47: kernel-s390x-fedora.config -#Source48: kernel-s390x-debug-fedora.config -Source49: kernel-x86_64.config -Source50: kernel-x86_64-debug.config - - -Source51: generate_all_configs.sh - -Source52: process_configs.sh -Source53: generate_bls_conf.sh - -Source54: mod-internal.list -Source55: merge.pl - -Source200: check-kabi - -Source204: Module.kabi_x86_64 - -Source213: Module.kabi_dup_x86_64 - -# Source300: kernel-abi-whitelists-%{rpmversion}-%{distro_build}.tar.bz2 -# Source301: kernel-kabi-dw-%{rpmversion}-%{distro_build}.tar.bz2 - -# Sources for kernel-rt-tools -Source2000: cpupower.service -Source2001: cpupower.config - -Source9000: centos.pem -Source3000: ima_signing_key.pub - -## Patches needed for building this package - -# Patch1: patch-%{rpmversion}-redhat.patch - -# empty final patch to facilitate testing of kernel patches -# Patch999999: linux-kernel-test.patch - -# This file is intentionally left empty in the stock kernel. Its a nicety -# added for those wanting to do custom rebuilds with altered config opts. -Source1000: kernel-x86_64-rt.config.tis_extra - -# Here should be only the patches up to the upstream canonical Linus tree. - -# For a stable release kernel -%if 0%{?stable_update} -%if 0%{?stable_base} -#%define stable_patch_00 https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.%{base_sublevel}.%{stable_base}.xz -#Source5000: %{stable_patch_00} -%endif - -# non-released_kernel case -# These are automagically defined by the rcrev and gitrev values set up -# near the top of this spec file. -%else -%if 0%{?rcrev} -#Source5000: patch-5.%{upstream_sublevel}-rc%{rcrev}.xz -%if 0%{?gitrev} -#Source5001: patch-5.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz -%endif -%else -# pre-{base_sublevel+1}-rc1 case -%if 0%{?gitrev} -#Source5000: patch-5.%{base_sublevel}-git%{gitrev}.xz -%endif -%endif -%endif - -## Patches needed for building this package - -## compile fixes - -%if !%{nopatches} - -Patch0: 0001-Notification-of-death-of-arbitrary-processes.patch -Patch1: 0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch -Patch2: 0003-affine-compute-kernel-threads.patch -Patch3: 0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch -Patch4: 0005-Make-kernel-start-eth-devices-at-offset.patch -Patch5: 0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch -Patch6: 0007-turn-off-write-same-in-smartqpi-driver.patch -Patch7: 0008-Allow-dmar-quirks-for-broken-bioses.patch -Patch8: 0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch -Patch9: 0010-restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch -Patch10: 0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch -Patch11: 0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch -Patch14: 0015-Revert-scsi-sd-Inline-sd_probe_part2.patch -Patch15: 0016-Revert-commit-f049cf1a7b.patch -Patch16: 0017-genirq-Export-affinity-setter-for-modules.patch -Patch17: 0018-genirq-Provide-new-interfaces-for-affinity-hints.patch -Patch18: 0019-ixgbe-Use-irq_update_affinity_hint.patch -Patch19: 0020-Add-auxiliary-bus-support.patch -Patch20: 0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch -Patch21: 0022-driver-core-auxiliary-bus-make-remove-function-retur.patch -Patch22: 0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch -Patch23: 0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch -Patch24: 0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch -Patch25: 0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch -Patch26: 0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch -Patch27: 0028-driver-core-auxiliary-bus-Enable-by-default.patch -Patch28: 0029-Enable-CONFIG_PAGE_POOL-by-default.patch -Patch29: 0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch -Patch30: 0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch -Patch31: 0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch -Patch32: 0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch -Patch33: 0034-xfs-use-current-journal_info-for-detecting-transacti.patch -Patch34: 0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch -Patch35: 0036-xfs-open-code-ioend-needs-workqueue-helper.patch -Patch36: 0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch -Patch37: 0038-xfs-drop-unnecessary-setfilesize-helper.patch - -# END OF PATCH DEFINITIONS -%endif - - -%description -The kernel meta package - -# -# This macro does requires, provides, conflicts, obsoletes for a kernel package. -# %%kernel_reqprovconf -# It uses any kernel__conflicts and kernel__obsoletes -# macros defined above. -# -%define kernel_reqprovconf \ -Provides: kernel = %{rpmversion}-%{pkg_release}\ -Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:+%{1}}\ -Provides: kernel-drm-nouveau = 16\ -Provides: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires(pre): %{kernel_prereq}\ -Requires(pre): %{initrd_prereq}\ -Requires(pre): linux-firmware >= 20150904-56.git6ebf5d57\ -Requires(preun): systemd >= 200\ -Conflicts: xfsprogs < 4.3.0-1\ -Conflicts: xorg-x11-drv-vmmouse < 13.0.99\ -%{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\ -%{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\ -%{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\ -# We can't let RPM do the dependencies automatic because it'll then pick up\ -# a correct but undesirable perl dependency from the module headers which\ -# isn't required for the kernel proper to function\ -AutoReq: no\ -AutoProv: yes\ -%{nil} - - -%package doc -Summary: Various documentation bits found in the kernel source -Group: Documentation -%description doc -This package contains documentation files from the kernel -source. Various bits of information about the Linux kernel and the -device drivers shipped with it are documented in these files. - -You'll want to install this package if you need a reference to the -options that can be passed to Linux kernel modules at load time. - - -%package headers -Summary: Header files for the Linux kernel for use by glibc -Obsoletes: glibc-kernheaders < 3.0-46 -Provides: glibc-kernheaders = 3.0-46 -Obsoletes: kernel-headers < %{rpmversion} -Provides: kernel-headers = %{rpmversion}-%{pkg_release} -%description headers -Kernel-headers includes the C header files that specify the interface -between the Linux kernel and userspace libraries and programs. The -header files define structures and constants that are needed for -building most standard programs and are also needed for rebuilding the -glibc package. - -%package cross-headers -Summary: Header files for the Linux kernel for use by cross-glibc -%description cross-headers -Kernel-cross-headers includes the C header files that specify the interface -between the Linux kernel and userspace libraries and programs. The -header files define structures and constants that are needed for -building most standard programs and are also needed for rebuilding the -cross-glibc package. - - -%package debuginfo-common-%{_target_cpu} -Summary: Kernel source files used by %{name}-debuginfo packages -Provides: installonlypkg(kernel) -%description debuginfo-common-%{_target_cpu} -This package is required by %{name}-debuginfo subpackages. -It provides the kernel source files common to all builds. - -%if %{with_perf} -%package -n perf -Summary: Performance monitoring for the Linux kernel -License: GPLv2 -%description -n perf -This package contains the perf tool, which enables performance monitoring -of the Linux kernel. - -%package -n perf-debuginfo -Summary: Debug information for package perf -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n perf-debuginfo -This package provides debug information for the perf package. - -# Note that this pattern only works right to match the .build-id -# symlinks because of the trailing nonmatching alternation and -# the leading .*, because of find-debuginfo.sh's buggy handling -# of matching the pattern against the symlinks file. -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_libdir}/traceevent/plugins/.*|.*%%{_libdir}/libperf-jvmti.so(\.debug)?|XXX' -o perf-debuginfo.list} - -%package -n python3-perf -Summary: Python bindings for apps which will manipulate perf events -%description -n python3-perf -The python3-perf package contains a module that permits applications -written in the Python programming language to use the interface -to manipulate perf events. - -%package -n python3-perf-debuginfo -Summary: Debug information for package perf python bindings -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n python3-perf-debuginfo -This package provides debug information for the perf python bindings. - -# the python_sitearch macro should already be defined from above -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{python3_sitearch}/perf.*so(\.debug)?|XXX' -o python3-perf-debuginfo.list} - -# with_perf -%endif - -%if %{with_tools} -%package -n kernel-rt-tools -Summary: Assortment of tools for the Linux kernel -License: GPLv2 -%ifarch %{cpupowerarchs} -Provides: cpupowerutils = 1:009-0.6.p1 -Obsoletes: cpupowerutils < 1:009-0.6.p1 -Provides: cpufreq-utils = 1:009-0.6.p1 -Provides: cpufrequtils = 1:009-0.6.p1 -Obsoletes: cpufreq-utils < 1:009-0.6.p1 -Obsoletes: cpufrequtils < 1:009-0.6.p1 -Obsoletes: cpuspeed < 1:1.5-16 -Requires: kernel-rt-tools-libs = %{version}-%{release} -%endif -%define __requires_exclude ^%{_bindir}/python -%description -n kernel-rt-tools -This package contains the tools/ directory from the kernel source -and the supporting documentation. - -%package -n kernel-rt-tools-libs -Summary: Libraries for the kernels-tools -License: GPLv2 -%description -n kernel-rt-tools-libs -This package contains the libraries built from the tools/ directory -from the kernel source. - -%package -n kernel-rt-tools-libs-devel -Summary: Assortment of tools for the Linux kernel -License: GPLv2 -Requires: kernel-rt-tools = %{version}-%{release} -%ifarch %{cpupowerarchs} -Provides: cpupowerutils-devel = 1:009-0.6.p1 -Obsoletes: cpupowerutils-devel < 1:009-0.6.p1 -%endif -Requires: kernel-rt-tools-libs = %{version}-%{release} -Provides: kernel-rt-tools-devel -%description -n kernel-rt-tools-libs-devel -This package contains the development files for the tools/ directory from -the kernel source. - -%package -n kernel-rt-tools-debuginfo -Summary: Debug information for package kernel-rt-tools -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n kernel-rt-tools-debuginfo -This package provides debug information for package kernel-rt-tools. - -# Note that this pattern only works right to match the .build-id -# symlinks because of the trailing nonmatching alternation and -# the leading .*, because of find-debuginfo.sh's buggy handling -# of matching the pattern against the symlinks file. -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/centrino-decode(\.debug)?|.*%%{_bindir}/powernow-k8-decode(\.debug)?|.*%%{_bindir}/cpupower(\.debug)?|.*%%{_libdir}/libcpupower.*|.*%%{_bindir}/turbostat(\.debug)?|.*%%{_bindir}/x86_energy_perf_policy(\.debug)?|.*%%{_bindir}/tmon(\.debug)?|.*%%{_bindir}/lsgpio(\.debug)?|.*%%{_bindir}/gpio-hammer(\.debug)?|.*%%{_bindir}/gpio-event-mon(\.debug)?|.*%%{_bindir}/iio_event_monitor(\.debug)?|.*%%{_bindir}/iio_generic_buffer(\.debug)?|.*%%{_bindir}/lsiio(\.debug)?|XXX' -o kernel-rt-tools-debuginfo.list} - -# with_tools -%endif - -%if %{with_bpftool} - -%package -n bpftool -Summary: Inspection and simple manipulation of eBPF programs and maps -License: GPLv2 -%description -n bpftool -This package contains the bpftool, which allows inspection and simple -manipulation of eBPF programs and maps. - -%package -n bpftool-debuginfo -Summary: Debug information for package bpftool -Group: Development/Debug -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n bpftool-debuginfo -This package provides debug information for the bpftool package. - -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_sbindir}/bpftool(\.debug)?|XXX' -o bpftool-debuginfo.list} - -# with_bpftool -%endif - -%if %{with_selftests} - -%package selftests-internal -Summary: Kernel samples and selftests -License: GPLv2 -Requires: binutils, bpftool, iproute-tc, nmap-ncat -Requires: kernel-modules-internal = %{version}-%{release} -%description selftests-internal -Kernel sample programs and selftests. - -# Note that this pattern only works right to match the .build-id -# symlinks because of the trailing nonmatching alternation and -# the leading .*, because of find-debuginfo.sh's buggy handling -# of matching the pattern against the symlinks file. -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_libexecdir}/(ksamples|kselftests)/.*|XXX' -o selftests-debuginfo.list} - -# with_selftests -%endif - -%ifarch x86_64 -%package unsigned -Summary: Unsigned build of the Linux kernel -%description unsigned -Contains an unsigned version of the Linux kernel -%endif # x86_64 - -%if %{with_gcov} -%package gcov -Summary: gcov graph and source files for coverage data collection. -%description gcov -kernel-gcov includes the gcov graph and source files for gcov coverage collection. -%endif - -%package -n kernel-abi-whitelists -Summary: The Red Hat Enterprise Linux kernel ABI symbol whitelists -AutoReqProv: no -%description -n kernel-abi-whitelists -The kABI package contains information pertaining to the Red Hat Enterprise -Linux kernel ABI, including lists of kernel symbols that are needed by -external Linux kernel modules, and a yum plugin to aid enforcement. - -%if %{with_kabidw_base} -%package kabidw-base -Summary: The baseline dataset for kABI verification using DWARF data -Group: System Environment/Kernel -AutoReqProv: no -%description kabidw-base -The kabidw-base package contains data describing the current ABI of the Red Hat -Enterprise Linux kernel, suitable for the kabi-dw tool. -%endif - -# -# This macro creates a kernel--debuginfo package. -# %%kernel_debuginfo_package -# -# Explanation of the find_debuginfo_opts: We build multiple kernels (debug -# pae etc.) so the regex filters those kernels appropriately. We also -# have to package several binaries as part of kernel-devel but getting -# unique build-ids is tricky for these userspace binaries. We don't really -# care about debugging those so we just filter those out and remove it. -%define kernel_debuginfo_package() \ -%package %{?1:%{1}-}debuginfo\ -Summary: Debug information for package %{name}%{?1:-%{1}}\ -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\ -Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\ -Provides: installonlypkg(kernel)\ -AutoReqProv: no\ -%description %{?1:%{1}-}debuginfo\ -This package provides debug information for package %{name}%{?1:-%{1}}.\ -This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\ -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*\/usr\/src\/kernels/.*|XXX' -o ignored-debuginfo.list -p '/.*/%%{KVERREL_RE}%{?1:[+]%{1}}/.*|/.*%%{KVERREL_RE}%{?1:\+%{1}}(\.debug)?' -o debuginfo%{?1}.list}\ - - -%{nil} - -# -# This macro creates a kernel--devel package. -# %%kernel_devel_package -# -%define kernel_devel_package() \ -%package %{?1:%{1}-}devel\ -Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\ -Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel-devel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Provides: installonlypkg(kernel)\ -AutoReqProv: no\ -Requires(pre): findutils\ -Requires: findutils\ -Requires: perl-interpreter\ -%description %{?1:%{1}-}devel\ -This package provides kernel headers and makefiles sufficient to build modules\ -against the %{?2:%{2} }kernel package.\ -%{nil} - -# -# This macro creates a kernel--devel-keys package. -# %%kernel_devel_keys_package -# -%define kernel_devel_keys_package() \ -%package %{?1:%{1}-}devel-keys\ -Summary: Development keys package for building signed kernel modules to match the %{?2:%{2} }kernel\ -Provides: kernel%{?1:-%{1}}-devel-keys-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel-devel-keys-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel-devel-keys-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Provides: installonlypkg(kernel)\ -AutoReqProv: no\ -Requires: kernel-devel-%{_target_cpu} = %{version}-%{release}\ -%description %{?1:%{1}-}devel-keys\ -This package provides kernel module signing keys\ -against the %{?2:%{2} }kernel package.\ -%{nil} - -# -# kernel--ipaclones-internal package -# -%define kernel_ipaclones_package() \ -%package %{?1:%{1}-}ipaclones-internal\ -Summary: *.ipa-clones files generated by -fdump-ipa-clones for kernel%{?1:-%{1}}\ -Group: System Environment/Kernel\ -AutoReqProv: no\ -%description %{?1:%{1}-}ipaclones-internal\ -This package provides *.ipa-clones files.\ -%{nil} - -# -# This macro creates a kernel--modules-internal package. -# %%kernel_modules_internal_package -# -%define kernel_modules_internal_package() \ -%package %{?1:%{1}-}modules-internal\ -Summary: Extra kernel modules to match the %{?2:%{2} }kernel\ -Group: System Environment/Kernel\ -Provides: kernel%{?1:-%{1}}-modules-internal-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel%{?1:-%{1}}-modules-internal-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel%{?1:-%{1}}-modules-internal = %{version}-%{release}%{?1:+%{1}}\ -Provides: installonlypkg(kernel-module)\ -Provides: kernel%{?1:-%{1}}-modules-internal-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -AutoReq: no\ -AutoProv: yes\ -%description %{?1:%{1}-}modules-internal\ -This package provides kernel modules for the %{?2:%{2} }kernel package for Red Hat internal usage.\ -%{nil} - -# -# This macro creates a kernel--modules-extra package. -# %%kernel_modules_extra_package -# -%define kernel_modules_extra_package() \ -%package %{?1:%{1}-}modules-extra\ -Summary: Extra kernel modules to match the %{?2:%{2} }kernel\ -Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel%{?1:-%{1}}-modules-extra = %{version}-%{release}%{?1:+%{1}}\ -Provides: installonlypkg(kernel-module)\ -Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -AutoReq: no\ -AutoProv: yes\ -%description %{?1:%{1}-}modules-extra\ -This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\ -%{nil} - -# -# This macro creates a kernel--modules package. -# %%kernel_modules_package -# -%define kernel_modules_package() \ -%package %{?1:%{1}-}modules\ -Summary: kernel modules to match the %{?2:%{2}-}core kernel\ -Provides: kernel%{?1:-%{1}}-modules-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel-modules-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel-modules = %{version}-%{release}%{?1:+%{1}}\ -Provides: installonlypkg(kernel-module)\ -Provides: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -AutoReq: no\ -AutoProv: yes\ -%description %{?1:%{1}-}modules\ -This package provides commonly used kernel modules for the %{?2:%{2}-}core kernel package.\ -%{nil} - -# -# this macro creates a kernel- meta package. -# %%kernel_meta_package -# -%define kernel_meta_package() \ -%package %{1}\ -summary: kernel meta-package for the %{1} kernel\ -Requires: kernel-%{1}-core-uname-r = %{KVERREL}%{?variant}+%{1}\ -Requires: kernel-%{1}-modules-uname-r = %{KVERREL}%{?variant}+%{1}\ -Provides: installonlypkg(kernel)\ -%description %{1}\ -The meta-package for the %{1} kernel\ -%{nil} - -# -# this macro creates a kernel-rt--kvm package -# %%kernel_kvm_package -# -%define kernel_kvm_package() \ -%package %{?1:%{1}-}kvm\ -Summary: KVM modules for package %{name}%{?1:-%{1}}\ -Group: System Environment/Kernel\ -Requires: %{name}%{?1:-%{1}} = %{version}-%{release}\ -Provides: installonlypkg(kernel-module)\ -Provides: %{name}%{?1:-%{1}}-kvm-%{_target_cpu} = %{version}-%{release}\ -AutoReq: no\ -%description -n %{name}%{?1:-%{1}}-kvm\ -This package provides KVM modules for package %{name}%{?1:-%{1}}.\ -%{nil} - -# -# This macro creates a kernel-rt--kvm-debuginfo package. -# %%kernel_kvm_debuginfo_package -# -%define kernel_kvm_debuginfo_package() \ -%package %{?1:%{1}-}kvm-debuginfo\ -Summary: Debug information for package %{name}%{?1:-%{1}}-kvm\ -Group: Development/Debug\ -Provides: %{name}%{?1:-%{1}}-kvm-debuginfo = %{version}-%{release}\ -AutoReqProv: no\ -%description -n %{name}%{?1:-%{1}}-kvm-debuginfo\ -This package provides debug information for package %{name}%{?1:-%{1}}.\ -This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\ -%{expand:%%global debuginfo_args %{?debuginfo_args} -p '/.*/%%{KVERREL}%{?1:\.%{1}}/.*|/.*%%{KVERREL}%{?1:\.%{1}}(\.debug)?' -o debuginfo%{?1}-kvm.list}\ -%{nil} - -# -# This macro creates a kernel- and its -devel and -debuginfo too. -# %%define variant_summary The Linux kernel compiled for -# %%kernel_variant_package [-n ] -# -%define kernel_variant_package(n:) \ -%package %{?1:%{1}-}core\ -Summary: %{variant_summary}\ -Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Provides: installonlypkg(kernel)\ -%ifarch ppc64le\ -Obsoletes: kernel-bootwrapper\ -%endif\ -%{expand:%%kernel_reqprovconf}\ -%if %{?1:1} %{!?1:0} \ -%{expand:%%kernel_meta_package %{?1:%{1}}}\ -%endif\ -%{expand:%%kernel_devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_devel_keys_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_modules_internal_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_debuginfo_package %{?1:%{1}}}\ -%{expand:%%kernel_kvm_package %{?1:%{1}}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_kvm_debuginfo_package %{?1:%{1}}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{nil} - -# Now, each variant package. - -%if %{with_pae} -%define variant_summary The Linux kernel compiled for Cortex-A15 -%kernel_variant_package lpae -%description lpae-core -This package includes a version of the Linux kernel with support for -Cortex-A15 devices with LPAE and HW virtualisation support -%endif - -%if %{with_zfcpdump} -%define variant_summary The Linux kernel compiled for zfcpdump usage -%kernel_variant_package zfcpdump -%description zfcpdump-core -The kernel package contains the Linux kernel (vmlinuz) for use by the -zfcpdump infrastructure. -# with_zfcpdump -%endif - -%define variant_summary The Linux kernel compiled with extra debugging enabled -%kernel_variant_package debug -%description debug-core -The kernel package contains the Linux kernel (vmlinuz), the core of any -Linux operating system. The kernel handles the basic functions -of the operating system: memory allocation, process allocation, device -input and output, etc. - -This variant of the kernel has numerous debugging options enabled. -It should only be installed when trying to gather additional information -on kernel bugs, as some of these options impact performance noticably. - -# And finally the main -core package - -%define variant_summary The Linux kernel -%kernel_variant_package -%description core -The kernel package contains the Linux kernel (vmlinuz), the core of any -Linux operating system. The kernel handles the basic functions -of the operating system: memory allocation, process allocation, device -input and output, etc. - -%if %{with_ipaclones} -%kernel_ipaclones_package -%endif - -%prep -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -source scl_source enable llvm-toolset-7.0 || : -%endif -# do a few sanity-checks for --with *only builds -%if %{with_baseonly} -%if !%{with_up}%{with_pae} -echo "Cannot build --with baseonly, up build is disabled" -exit 1 -%endif -%endif - -%if "%{baserelease}" == "0" -echo "baserelease must be greater than zero" -exit 1 -%endif - -# more sanity checking; do it quietly -if [ "%{patches}" != "%%{patches}" ] ; then - for patch in %{patches} ; do - if [ ! -f $patch ] ; then - echo "ERROR: Patch ${patch##/*/} listed in specfile but is missing" - exit 1 - fi - done -fi 2>/dev/null - -patch_command='patch -p1 -F1 -s' -ApplyPatch() -{ - local patch=$1 - shift - if [ ! -f $RPM_SOURCE_DIR/$patch ]; then - exit 1 - fi - if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME%%%%%{?variant}}.spec ; then - if [ "${patch:0:8}" != "patch-5." ] ; then - echo "ERROR: Patch $patch not listed as a source patch in specfile" - exit 1 - fi - fi 2>/dev/null - case "$patch" in - *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *.gz) gunzip < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *.xz) unxz < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;; - esac -} - -# don't apply patch if it's empty -ApplyOptionalPatch() -{ - local patch=$1 - shift - if [ ! -f $RPM_SOURCE_DIR/$patch ]; then - exit 1 - fi - local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}') - if [ "$C" -gt 9 ]; then - ApplyPatch $patch ${1+"$@"} - fi -} - -# First we unpack the kernel tarball. -# If this isn't the first make prep, we use links to the existing clean tarball -# which speeds things up quite a bit. - -# Update to latest upstream. -%if 0%{?released_kernel} -%define vanillaversion 5.%{base_sublevel} -# non-released_kernel case -%else -%if 0%{?rcrev} -%define vanillaversion 5.%{upstream_sublevel}-rc%{rcrev} -%if 0%{?gitrev} -%define vanillaversion 5.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev} -%endif -%else -# pre-{base_sublevel+1}-rc1 case -%if 0%{?gitrev} -%define vanillaversion 5.%{base_sublevel}-git%{gitrev} -%else -%define vanillaversion 5.%{base_sublevel} -%endif -%endif -%endif - -# %%{vanillaversion} : the full version name, e.g. 2.6.35-rc6-git3 -# %%{kversion} : the base version, e.g. 2.6.34 - -# Use kernel-%%{kversion}%%{?dist} as the top-level directory name -# so we can prep different trees within a single git directory. - -# Build a list of the other top-level kernel tree directories. -# This will be used to hardlink identical vanilla subdirs. -sharedirs=$(find "$PWD" -maxdepth 1 -type d -name 'kernel-5.*' \ - | grep -x -v "$PWD"/kernel-%{kversion}%{?dist}) ||: - -# Delete all old stale trees. -if [ -d kernel-%{kversion}%{?dist} ]; then - cd kernel-%{kversion}%{?dist} - for i in linux-* - do - if [ -d $i ]; then - # Just in case we ctrl-c'd a prep already - rm -rf deleteme.%{_target_cpu} - # Move away the stale away, and delete in background. - mv $i deleteme-$i - rm -rf deleteme* & - fi - done - cd .. -fi - -# Generate new tree -if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then - - if [ -d kernel-%{kversion}%{?dist}/vanilla-%{kversion} ]; then - - # The base vanilla version already exists. - cd kernel-%{kversion}%{?dist} - - # Any vanilla-* directories other than the base one are stale. - for dir in vanilla-*; do - [ "$dir" = vanilla-%{kversion} ] || rm -rf $dir & - done - - else - - rm -f pax_global_header - # Look for an identical base vanilla dir that can be hardlinked. - for sharedir in $sharedirs ; do - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{kversion} ]] ; then - break - fi - done - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{kversion} ]] ; then -%setup -q -n kernel-%{kversion}%{?dist} -c -T - cp -al $sharedir/vanilla-%{kversion} . - else -%setup -q -n kernel-%{kversion}%{?dist} -c - mv %{name}-%{version} vanilla-%{kversion} - fi - - fi - -%if "%{kversion}" != "%{vanillaversion}" - - for sharedir in $sharedirs ; do - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{vanillaversion} ]] ; then - break - fi - done - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{vanillaversion} ]] ; then - - cp -al $sharedir/vanilla-%{vanillaversion} . - - else - - # Need to apply patches to the base vanilla version. - cp -al vanilla-%{kversion} vanilla-%{vanillaversion} - cd vanilla-%{vanillaversion} - -cp %{SOURCE12} . - -# Update vanilla to the latest upstream. -# (non-released_kernel case only) -%if 0%{?rcrev} -# xzcat %{SOURCE5000} | patch -p1 -F1 -s -%if 0%{?gitrev} - xzcat %{SOURCE5001} | patch -p1 -F1 -s -%endif -%else -# pre-{base_sublevel+1}-rc1 case -%if 0%{?gitrev} - xzcat %{SOURCE5000} | patch -p1 -F1 -s -%endif -%endif - git init - git config user.email "kernel-team@starlingx.org" - git config user.name "Starlingx Kernel Team" - git config gc.auto 0 - git add . - git commit -a -q -m "baseline" - - cd .. - - fi - -%endif - -else - - # We already have all vanilla dirs, just change to the top-level directory. - cd kernel-%{kversion}%{?dist} - -fi - -# Now build the fedora kernel tree. -cp -al vanilla-%{vanillaversion} linux-%{KVERREL} -cp -v %{SOURCE9000} linux-%{KVERREL}/certs/rhel.pem -cp -v %{SOURCE3000} linux-%{KVERREL}/certs/ - -cd linux-%{KVERREL} -if [ ! -d .git ]; then - git init - git config user.email "kernel-team@starlingx.org" - git config user.name "Starlingx Kernel Team" - git config gc.auto 0 - git add . - git commit -a -q -m "baseline" -fi - - -# released_kernel with possible stable updates -%if 0%{?stable_base} -# This is special because the kernel spec is hell and nothing is consistent -#xzcat %{SOURCE5000} | patch -p1 -F1 -s -#git commit -a -m "Stable update" -%endif - -# Note: Even in the "nopatches" path some patches (build tweaks and compile -# fixes) will always get applied; see patch defition above for details - -git am %{patches} - -# END OF PATCH APPLICATIONS - -# Any further pre-build tree manipulations happen here. -%if %{with_realtime} -# remove the localversion-rt file since it screws around with -# the uname output -if [ -f localversion-rt ]; then - rm -f localversion-rt -fi -%endif - -chmod +x scripts/checkpatch.pl -mv COPYING COPYING-%{version}-%{release} - -# This Prevents scripts/setlocalversion from mucking with our version numbers. -touch .scmversion - -# Mangle /usr/bin/python shebangs to /usr/bin/python3 -# Mangle all Python shebangs to be Python 3 explicitly -# -p preserves timestamps -# -n prevents creating ~backup files -# -i specifies the interpreter for the shebang -# This fixes errors such as -# *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. Change it to python3 (or python2) explicitly. -# We patch all sources below for which we got a report/error. -pathfix.py -i "%{__python3} %{py3_shbang_opts}" -p -n \ - tools/kvm/kvm_stat/kvm_stat \ - scripts/show_delta \ - scripts/diffconfig \ - scripts/bloat-o-meter \ - scripts/jobserver-exec \ - tools/perf/tests/attr.py \ - tools/perf/scripts/python/stat-cpi.py \ - tools/perf/scripts/python/sched-migration.py \ - tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py \ - Documentation \ - scripts/clang-tools/*.py - -# only deal with configs if we are going to build for the arch -%ifnarch %nobuildarches - -if [ -L configs ]; then - rm -f configs -fi -# Deal with configs stuff -mkdir configs -cd configs - -# Drop some necessary files from the source dir into the buildroot -cp $RPM_SOURCE_DIR/kernel-*.config . -cp %{SOURCE1000} . -cp %{SOURCE55} . -cp %{SOURCE51} . -VERSION=%{version} ./generate_all_configs.sh %{debugbuildsenabled} - - -# Merge in any user-provided local config option changes -%ifnarch %nobuildarches -for i in %{all_arch_configs} -do - mv $i $i.tmp - ./merge.pl %{SOURCE1000} $i.tmp > $i - rm $i.tmp -done -%endif - -%if !%{debugbuildsenabled} -rm -f kernel-*debug.config -%endif - -# enable GCOV kernel config options if gcov is on -%if %{with_gcov} -for i in *.config -do - sed -i 's/# CONFIG_GCOV_KERNEL is not set/CONFIG_GCOV_KERNEL=y\nCONFIG_GCOV_PROFILE_ALL=y\n/' $i -done -%endif - -cp %{SOURCE52} . -OPTS="" -%if %{with_configchecks} - OPTS="$OPTS -w -n -c" -%endif -./process_configs.sh $OPTS kernel - -# end of kernel config -%endif - -cd .. -# # End of Configs stuff - -# get rid of unwanted files resulting from patch fuzz -find . \( -name "*.orig" -o -name "*~" \) -delete >/dev/null - -# remove unnecessary SCM files -find . -name .gitignore -delete >/dev/null - -cd .. - -### -### build -### -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -source scl_source enable llvm-toolset-7.0 || : -%endif - -%if %{with_sparse} -%define sparse_mflags C=1 -%endif - -cp_vmlinux() -{ - eu-strip --remove-comment -o "$2" "$1" -} - -# These are for host programs that get built as part of the kernel and -# are required to be packaged in kernel-devel for building external modules. -# Since they are userspace binaries, they are required to pickup the hardening -# flags defined in the macros. The --build-id=uuid is a trick to get around -# debuginfo limitations: Typically, find-debuginfo.sh will update the build -# id of all binaries to allow for parllel debuginfo installs. The kernel -# can't use this because it breaks debuginfo for the vDSO so we have to -# use a special mechanism for kernel and modules to be unique. Unfortunately, -# we still have userspace binaries which need unique debuginfo and because -# they come from the kernel package, we can't just use find-debuginfo.sh to -# rewrite only those binaries. The easiest option right now is just to have -# the build id be a uuid for the host programs. -# -# Note we need to disable these flags for cross builds because the flags -# from redhat-rpm-config assume that host == target so target arch -# flags cause issues with the host compiler. -%if !%{with_cross} -%define build_hostcflags %{?build_cflags} -%define build_hostldflags %{?build_ldflags} -%endif - -%define make make %{?cross_opts} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" - -BuildKernel() { - MakeTarget=$1 - KernelImage=$2 - Flavour=$4 - DoVDSO=$3 - Flav=${Flavour:++${Flavour}} - InstallName=${5:-vmlinuz} - - DoModules=1 - if [ "$Flavour" = "zfcpdump" ]; then - DoModules=0 - fi - - # Pick the right config file for the kernel we're building - Config=kernel-%{_target_cpu}${Flavour:+-${Flavour}}.config - DevelDir=/usr/src/kernels/%{KVERREL}${Flav} - - # When the bootable image is just the ELF kernel, strip it. - # We already copy the unstripped file into the debuginfo package. - if [ "$KernelImage" = vmlinux ]; then - CopyKernel=cp_vmlinux - else - CopyKernel=cp - fi - - KernelVer=%{version}-%{release}.%{_target_cpu}${Flav} - echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}... - - %if 0%{?stable_update} - # make sure SUBLEVEL is incremented on a stable release. Sigh 3.x. - perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{?stablerev}/" Makefile - %endif - - # make sure EXTRAVERSION says what we want it to say - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile - - # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme - %if !0%{?rcrev} - %if 0%{?gitrev} - perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile - %endif - %endif - - # and now to start the build process - - %{make} %{?_smp_mflags} mrproper - cp configs/$Config .config - - %if %{signkernel}%{signmodules} - cp $RPM_SOURCE_DIR/x509.genkey certs/. - %endif - - Arch=`head -1 .config | cut -b 3-` - echo USING ARCH=$Arch - - KCFLAGS="%{?kcflags}" - - # add kpatch flags for base kernel - if [ "$Flavour" == "" ]; then - KCFLAGS="$KCFLAGS %{?kpatch_kcflags}" - fi - - %{make} ARCH=$Arch olddefconfig >/dev/null - - # This ensures build-ids are unique to allow parallel debuginfo - perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config - %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags} - if [ $DoModules -eq 1 ]; then - %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" %{?_smp_mflags} modules %{?sparse_mflags} || exit 1 - fi - - mkdir -p $RPM_BUILD_ROOT/%{image_install_path} - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer -%if %{with_debuginfo} - mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path} -%endif - -%ifarch %{arm} aarch64 - %{make} ARCH=$Arch dtbs INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer - %{make} ARCH=$Arch dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer - cp -r $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/dtb - find arch/$Arch/boot/dts -name '*.dtb' -type f -delete -%endif - - # Start installing the results - install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer - install -m 644 .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/config - install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer - install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/System.map - - # We estimate the size of the initramfs because rpm needs to take this size - # into consideration when performing disk space calculations. (See bz #530778) - dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20 - - if [ -f arch/$Arch/boot/zImage.stub ]; then - cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || : - cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/lib/modules/$KernelVer/zImage.stub-$KernelVer || : - fi - -%ifarch x86_64 - $CopyKernel $KernelImage $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer.unsigned -%endif - - %if %{signkernel} - if [ "$KernelImage" = vmlinux ]; then - # We can't strip and sign $KernelImage in place, because - # we need to preserve original vmlinux for debuginfo. - # Use a copy for signing. - $CopyKernel $KernelImage $KernelImage.tosign - KernelImage=$KernelImage.tosign - CopyKernel=cp - fi - - # Sign the image if we're using EFI - # aarch64 kernels are gziped EFI images - KernelExtension=${KernelImage##*.} - if [ "$KernelExtension" == "gz" ]; then - SignImage=${KernelImage%.*} - else - SignImage=$KernelImage - fi - - %ifarch x86_64 aarch64 - %pesign -s -i $SignImage -o vmlinuz.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} - %pesign -s -i vmlinuz.tmp -o vmlinuz.signed -a %{secureboot_ca_1} -c %{secureboot_key_1} -n %{pesign_name_1} - rm vmlinuz.tmp - %endif - %ifarch s390x ppc64le - if [ -x /usr/bin/rpm-sign ]; then - rpm-sign --key "%{pesign_name_0}" --lkmsign $SignImage --output vmlinuz.signed - elif [ $DoModules -eq 1 ]; then - chmod +x scripts/sign-file - ./scripts/sign-file -p sha256 certs/signing_key.pem certs/signing_key.x509 $SignImage vmlinuz.signed - else - mv $SignImage vmlinuz.signed - fi - %endif - - if [ ! -s vmlinuz.signed ]; then - echo "pesigning failed" - exit 1 - fi - mv vmlinuz.signed $SignImage - if [ "$KernelExtension" == "gz" ]; then - gzip -f9 $SignImage - fi - # signkernel - %endif - - $CopyKernel $KernelImage \ - $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer - chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer - cp $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/$InstallName - - # hmac sign the kernel for FIPS - echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac" - ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer - sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac; - cp $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac $RPM_BUILD_ROOT/lib/modules/$KernelVer/.vmlinuz.hmac - - if [ $DoModules -eq 1 ]; then - # Override $(mod-fw) because we don't want it to install any firmware - # we'll get it from the linux-firmware package and we don't want conflicts - %{make} %{?_smp_mflags} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT %{?_smp_mflags} modules_install KERNELRELEASE=$KernelVer mod-fw= - fi - -%if %{with_gcov} - # install gcov-needed files to $BUILDROOT/$BUILD/...: - # gcov_info->filename is absolute path - # gcno references to sources can use absolute paths (e.g. in out-of-tree builds) - # sysfs symlink targets (set up at compile time) use absolute paths to BUILD dir - find . \( -name '*.gcno' -o -name '*.[chS]' \) -exec install -D '{}' "$RPM_BUILD_ROOT/$(pwd)/{}" \; -%endif - - # add an a noop %%defattr statement 'cause rpm doesn't like empty file list files - echo '%%defattr(-,-,-)' > ../kernel${Flavour:+-${Flavour}}-ldsoconf.list - if [ $DoVDSO -ne 0 ]; then - %{make} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer - if [ -s ldconfig-kernel.conf ]; then - install -D -m 444 ldconfig-kernel.conf \ - $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf - echo /etc/ld.so.conf.d/kernel-$KernelVer.conf >> ../kernel${Flavour:+-${Flavour}}-ldsoconf.list - fi - - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id - fi - - # And save the headers/makefiles etc for building modules against - # - # This all looks scary, but the end result is supposed to be: - # * all arch relevant include/ files - # * all Makefile/Kconfig files - # * all script/ files - - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source) - # dirs for additional modules per module-init-tools, kbuild/modules.txt - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/internal - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates -%if 0%{!?fedora:1} - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/weak-updates -%endif - # CONFIG_KERNEL_HEADER_TEST generates some extra files in the process of - # testing so just delete - find . -name *.h.s -delete - # first copy everything - cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - if [ -s Module.markers ]; then - cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - fi - - # create the kABI metadata for use in packaging - # NOTENOTE: the name symvers is used by the rpm backend - # NOTENOTE: to discover and run the /usr/lib/rpm/fileattrs/kabi.attr - # NOTENOTE: script which dynamically adds exported kernel symbol - # NOTENOTE: checksums to the rpm metadata provides list. - # NOTENOTE: if you change the symvers name, update the backend too - echo "**** GENERATING kernel ABI metadata ****" - gzip -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz - cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.gz - -%if %{with_kabichk} - echo "**** kABI checking is enabled in kernel SPEC file. ****" - chmod 0755 $RPM_SOURCE_DIR/check-kabi - if [ -e $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu}$Flavour ]; then - cp $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu}$Flavour $RPM_BUILD_ROOT/Module.kabi - $RPM_SOURCE_DIR/check-kabi -k $RPM_BUILD_ROOT/Module.kabi -s Module.symvers || exit 1 - # for now, don't keep it around. - rm $RPM_BUILD_ROOT/Module.kabi - else - echo "**** NOTE: Cannot find reference Module.kabi file. ****" - fi -%endif - -%if %{with_kabidupchk} - echo "**** kABI DUP checking is enabled in kernel SPEC file. ****" - if [ -e $RPM_SOURCE_DIR/Module.kabi_dup_%{_target_cpu}$Flavour ]; then - cp $RPM_SOURCE_DIR/Module.kabi_dup_%{_target_cpu}$Flavour $RPM_BUILD_ROOT/Module.kabi - $RPM_SOURCE_DIR/check-kabi -k $RPM_BUILD_ROOT/Module.kabi -s Module.symvers || exit 1 - # for now, don't keep it around. - rm $RPM_BUILD_ROOT/Module.kabi - else - echo "**** NOTE: Cannot find DUP reference Module.kabi file. ****" - fi -%endif - -%if %{with_kabidw_base} - # Don't build kabi base for debug kernels - if [ "$Flavour" != "kdump" -a "$Flavour" != "debug" ]; then - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf - tar xjvf %{SOURCE301} -C $RPM_BUILD_ROOT/kabi-dwarf - - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf/whitelists - tar xjvf %{SOURCE300} -C $RPM_BUILD_ROOT/kabi-dwarf/whitelists - - echo "**** GENERATING DWARF-based kABI baseline dataset ****" - chmod 0755 $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh - $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh generate \ - "$RPM_BUILD_ROOT/kabi-dwarf/whitelists/kabi-current/kabi_whitelist_%{_target_cpu}" \ - "$(pwd)" \ - "$RPM_BUILD_ROOT/kabidw-base/%{_target_cpu}${Flavour:+.${Flavour}}" || : - - rm -rf $RPM_BUILD_ROOT/kabi-dwarf - fi -%endif - -%if %{with_kabidwchk} - if [ "$Flavour" != "kdump" ]; then - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf - tar xjvf %{SOURCE301} -C $RPM_BUILD_ROOT/kabi-dwarf - if [ -d "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}" ]; then - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf/whitelists - tar xjvf %{SOURCE300} -C $RPM_BUILD_ROOT/kabi-dwarf/whitelists - - echo "**** GENERATING DWARF-based kABI dataset ****" - chmod 0755 $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh - $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh generate \ - "$RPM_BUILD_ROOT/kabi-dwarf/whitelists/kabi-current/kabi_whitelist_%{_target_cpu}" \ - "$(pwd)" \ - "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}.tmp" || : - - echo "**** kABI DWARF-based comparison report ****" - $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh compare \ - "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}" \ - "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}.tmp" || : - echo "**** End of kABI DWARF-based comparison report ****" - else - echo "**** Baseline dataset for kABI DWARF-BASED comparison report not found ****" - fi - - rm -rf $RPM_BUILD_ROOT/kabi-dwarf - fi -%endif - - # then drop all but the needed Makefiles/Kconfig files - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include - cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/tracing - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/spdxcheck.py - - # Files for 'make scripts' to succeed with kernel-devel. - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/security/selinux/include - cp -a --parents security/selinux/include/classmap.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp -a --parents security/selinux/include/initial_sid_to_string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/include/tools - cp -a --parents tools/include/tools/be_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - - if [ -f tools/objtool/objtool ]; then - cp -a tools/objtool/objtool $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/objtool/ || : - fi - if [ -d arch/$Arch/scripts ]; then - cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || : - fi - if [ -f arch/$Arch/*lds ]; then - cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || : - fi - if [ -f arch/%{asmarch}/kernel/module.lds ]; then - cp -a --parents arch/%{asmarch}/kernel/module.lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - fi - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o -%ifarch ppc64le - cp -a --parents arch/powerpc/lib/crtsavres.[So] $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ -%endif - if [ -d arch/%{asmarch}/include ]; then - cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - fi -%ifarch aarch64 - # arch/arm64/include/asm/xen references arch/arm - cp -a --parents arch/arm/include/asm/xen $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - # arch/arm64/include/asm/opcodes.h references arch/arm - cp -a --parents arch/arm/include/asm/opcodes.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ -%endif - # include the machine specific headers for ARM variants, if available. -%ifarch %{arm} - if [ -d arch/%{asmarch}/mach-${Flavour}/include ]; then - cp -a --parents arch/%{asmarch}/mach-${Flavour}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - fi - # include a few files for 'make prepare' - cp -a --parents arch/arm/tools/gen-mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/arm/tools/mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - -%endif - cp -a include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include -%ifarch i686 x86_64 - # files for 'make prepare' to succeed with kernel-devel - cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/entry/syscalls/syscalltbl.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/entry/syscalls/syscallhdr.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs_32.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs_64.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs_common.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/purgatory.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/stack.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/setup-x86_64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/entry64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/boot/string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/boot/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/boot/ctype.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ -%endif - # Make sure the Makefile and version.h have a matching timestamp so that - # external modules can be built - touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/generated/uapi/linux/version.h - - # Copy .config to include/config/auto.conf so "make prepare" is unnecessary. - cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf - -%if %{with_debuginfo} - eu-readelf -n vmlinux | grep "Build ID" | awk '{print $NF}' > vmlinux.id - cp vmlinux.id $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/vmlinux.id - - # - # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm - # - mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer - cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer -%endif - - find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames - - # mark modules executable so that strip-to-file can strip them - xargs --no-run-if-empty chmod u+x < modnames - - # Generate a list of modules for block and networking. - - grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA | - sed -n 's,^.*/\([^/]*\.ko\): *U \(.*\)$,\1 \2,p' > drivers.undef - - collect_modules_list() - { - sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef | - LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1 - if [ ! -z "$3" ]; then - sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1 - fi - } - - collect_modules_list networking \ - 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice' - collect_modules_list block \ - 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko' - collect_modules_list drm \ - 'drm_open|drm_init' - collect_modules_list modesetting \ - 'drm_crtc_init' -%if %{with_realtime} - collect_modules_list kvm \ - 'kvm_init|kvmgt_init' -%endif - - # detect missing or incorrect license tags - ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \ - grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1 - - # remove files that will be auto generated by depmod at rpm -i time - pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ - rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep} - popd - - # Call the modules-extra script to move things around - %{SOURCE24} $RPM_BUILD_ROOT/lib/modules/$KernelVer $RPM_SOURCE_DIR/mod-extra.list - # Blacklist net autoloadable modules in modules-extra - %{SOURCE19} $RPM_BUILD_ROOT lib/modules/$KernelVer - # Call the modules-extra script for internal modules - %{SOURCE24} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE54} internal - - # - # Generate the kernel-core and kernel-modules files lists - # - - # Copy the System.map file for depmod to use, and create a backup of the - # full module tree so we can restore it after we're done filtering - cp System.map $RPM_BUILD_ROOT/. - pushd $RPM_BUILD_ROOT - mkdir restore - cp -r lib/modules/$KernelVer/* restore/. - - # don't include anything going into k-m-e and k-m-i in the file lists - rm -rf lib/modules/$KernelVer/{extra,internal} - - if [ $DoModules -eq 1 ]; then - # Find all the module files and filter them out into the core and - # modules lists. This actually removes anything going into -modules - # from the dir. - find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list - cp $RPM_SOURCE_DIR/filter-*.sh . - ./filter-modules.sh modules.list %{_target_cpu} - rm filter-*.sh - - # Run depmod on the resulting module tree and make sure it isn't broken - depmod -b . -aeF ./System.map $KernelVer &> depmod.out - if [ -s depmod.out ]; then - echo "Depmod failure" - cat depmod.out - exit 1 - else - rm depmod.out - fi - else - # Ensure important files/directories exist to let the packaging succeed - echo '%%defattr(-,-,-)' > modules.list - echo '%%defattr(-,-,-)' > k-d.list - mkdir -p lib/modules/$KernelVer/kernel - # Add files usually created by make modules, needed to prevent errors - # thrown by depmod during package installation - touch lib/modules/$KernelVer/modules.order - touch lib/modules/$KernelVer/modules.builtin - fi - - # remove files that will be auto generated by depmod at rpm -i time - pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ - rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep} - popd - - # Go back and find all of the various directories in the tree. We use this - # for the dir lists in kernel-core - find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n > module-dirs.list - - # Cleanup - rm System.map - cp -r restore/* lib/modules/$KernelVer/. - rm -rf restore - popd - - # Make sure the files lists start with absolute paths or rpmbuild fails. - # Also add in the dir entries - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/k-d.list > ../kernel${Flavour:+-${Flavour}}-modules.list - sed -e 's/^lib*/%dir \/lib/' %{?zipsed} $RPM_BUILD_ROOT/module-dirs.list > ../kernel${Flavour:+-${Flavour}}-core.list - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/modules.list >> ../kernel${Flavour:+-${Flavour}}-core.list - - # Cleanup - rm -f $RPM_BUILD_ROOT/k-d.list - rm -f $RPM_BUILD_ROOT/modules.list - rm -f $RPM_BUILD_ROOT/module-dirs.list - -%if %{signmodules} - if [ $DoModules -eq 1 ]; then - # Save the signing keys so we can sign the modules in __modsign_install_post - cp certs/signing_key.pem certs/signing_key.pem.sign${Flav} - cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav} - # STX: Copy these keys as part of the devel package - # The Module signing keys are to ensure that only Out-of-tree - # built against the StarlingX Kernel get signed and loaded sans warnings - cp certs/signing_key.pem ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/ - chmod 755 ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/signing_key.pem - cp certs/signing_key.x509 ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/ - fi -%endif - - # Move the devel headers out of the root file system - mkdir -p $RPM_BUILD_ROOT/usr/src/kernels - mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir - - # This is going to create a broken link during the build, but we don't use - # it after this point. We need the link to actually point to something - # when kernel-devel is installed, and a relative link doesn't work across - # the F17 UsrMove feature. - ln -sf $DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - - # prune junk from kernel-devel - find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -delete - - # build a BLS config for this kernel - %{SOURCE53} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}" - - # Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel - mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer - %ifarch x86_64 aarch64 - install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20200609.cer - install -m 0644 %{secureboot_ca_1} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20140212.cer - ln -s kernel-signing-ca-20200609.cer $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - %else - install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - %endif - %ifarch s390x ppc64le - if [ $DoModules -eq 1 ]; then - if [ -x /usr/bin/rpm-sign ]; then - install -m 0644 %{secureboot_key_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - else - install -m 0644 certs/signing_key.x509.sign${Flav} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - openssl x509 -in certs/signing_key.pem.sign${Flav} -outform der -out $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - chmod 0644 $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - fi - fi - %endif - -%if %{with_ipaclones} - MAXPROCS=$(echo %{?_smp_mflags} | sed -n 's/-j\s*\([0-9]\+\)/\1/p') - if [ -z "$MAXPROCS" ]; then - MAXPROCS=1 - fi - if [ "$Flavour" == "" ]; then - mkdir -p $RPM_BUILD_ROOT/$DevelDir-ipaclones - find . -name '*.ipa-clones' | xargs -i{} -r -n 1 -P $MAXPROCS install -m 644 -D "{}" "$RPM_BUILD_ROOT/$DevelDir-ipaclones/{}" - fi -%endif - -} - -### -# DO it... -### - -# prepare directories -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/boot -mkdir -p $RPM_BUILD_ROOT%{_libexecdir} - -cd linux-%{KVERREL} - - -%if %{with_debug} -BuildKernel %make_target %kernel_image %{_use_vdso} debug -%endif - -%if %{with_zfcpdump} -BuildKernel %make_target %kernel_image %{_use_vdso} zfcpdump -%endif - -%if %{with_pae} -BuildKernel %make_target %kernel_image %{use_vdso} lpae -%endif - -%if %{with_up} -BuildKernel %make_target %kernel_image %{_use_vdso} -%endif - -%global perf_make \ - make -s EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 prefix=%{_prefix} PYTHON=%{__python3} -%if %{with_perf} -# perf -# make sure check-headers.sh is executable -chmod +x tools/perf/check-headers.sh -%{perf_make} DESTDIR=$RPM_BUILD_ROOT all -%endif - -%global tools_make \ - %{make} CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" V=1 - -%if %{with_tools} -%ifarch %{cpupowerarchs} -# cpupower -# make sure version-gen.sh is executable. -chmod +x tools/power/cpupower/utils/version-gen.sh -%{tools_make} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false -%ifarch x86_64 - pushd tools/power/cpupower/debug/x86_64 - %{tools_make} %{?_smp_mflags} centrino-decode powernow-k8-decode - popd -%endif -%ifarch x86_64 - pushd tools/power/x86/x86_energy_perf_policy/ - %{tools_make} - popd - pushd tools/power/x86/turbostat - %{tools_make} - popd - pushd tools/power/x86/intel-speed-select - %{make} - popd -%endif -%endif -pushd tools/thermal/tmon/ -%{tools_make} -popd -pushd tools/iio/ -%{make} -popd -pushd tools/gpio/ -%{make} -popd -%endif - -%global bpftool_make \ - make EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT V=1 -%if %{with_bpftool} -pushd tools/bpf/bpftool -%{bpftool_make} -popd -%endif - -%if %{with_selftests} -%{make} -s ARCH=$Arch V=1 samples/bpf/ -pushd tools/testing/selftests -# We need to install here because we need to call make with ARCH set which -# doesn't seem possible to do in the install section. -%{make} -s ARCH=$Arch V=1 TARGETS="bpf livepatch net" INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests install -popd -%endif - -%if %{with_doc} -# Make the HTML pages. -make PYTHON=/usr/bin/python3 htmldocs || %{doc_build_fail} - -# sometimes non-world-readable files sneak into the kernel source tree -chmod -R a=rX Documentation -find Documentation -type d | xargs chmod u+w -%endif - -# In the modsign case, we do 3 things. 1) We check the "flavour" and hard -# code the value in the following invocations. This is somewhat sub-optimal -# but we're doing this inside of an RPM macro and it isn't as easy as it -# could be because of that. 2) We restore the .tmp_versions/ directory from -# the one we saved off in BuildKernel above. This is to make sure we're -# signing the modules we actually built/installed in that flavour. 3) We -# grab the arch and invoke mod-sign.sh command to actually sign the modules. -# -# We have to do all of those things _after_ find-debuginfo runs, otherwise -# that will strip the signature off of the modules. -# -# Don't sign modules for the zfcpdump flavour as it is monolithic. - -%define __modsign_install_post \ - if [ "%{signmodules}" -eq "1" ]; then \ - if [ "%{with_pae}" -ne "0" ]; then \ - %{modsign_cmd} certs/signing_key.pem.sign+lpae certs/signing_key.x509.sign+lpae $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+lpae/ \ - fi \ - if [ "%{with_debug}" -ne "0" ]; then \ - %{modsign_cmd} certs/signing_key.pem.sign+debug certs/signing_key.x509.sign+debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+debug/ \ - fi \ - if [ "%{with_up}" -ne "0" ]; then \ - %{modsign_cmd} certs/signing_key.pem.sign certs/signing_key.x509.sign $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/ \ - fi \ - fi \ - if [ "%{zipmodules}" -eq "1" ]; then \ - find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -P%{zcpu} xz; \ - fi \ -%{nil} - -### -### Special hacks for debuginfo subpackages. -### - -# This macro is used by %%install, so we must redefine it before that. -%define debug_package %{nil} - -%if %{with_debuginfo} - -%ifnarch noarch -%global __debug_package 1 -%files -f debugfiles.list debuginfo-common-%{_target_cpu} -%endif - -%endif - -# We don't want to package debuginfo for self-tests and samples but -# we have to delete them to avoid an error messages about unpackaged -# files. -# Delete the debuginfo for for kernel-devel files -%define __remove_unwanted_dbginfo_install_post \ - if [ "%{with_selftests}" -ne "0" ]; then \ - rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/libexec/ksamples; \ - rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/libexec/kselftests; \ - fi \ - rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/src; \ -%{nil} - -# -# Disgusting hack alert! We need to ensure we sign modules *after* all -# invocations of strip occur, which is in __debug_install_post if -# find-debuginfo.sh runs, and __os_install_post if not. -# -%define __spec_install_post \ - %{?__debug_package:%{__debug_install_post}}\ - %{__arch_install_post}\ - %{__os_install_post}\ - %{__remove_unwanted_dbginfo_install_post}\ - %{__modsign_install_post} - -### -### install -### - -%install -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -source scl_source enable llvm-toolset-7.0 || : -%endif - -cd linux-%{KVERREL} - -%if %{with_doc} -docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{rpmversion} - -# copy the source over -mkdir -p $docdir -tar -h -f - --exclude=man --exclude='.*' -c Documentation | tar xf - -C $docdir - -# with_doc -%endif - -# We have to do the headers install before the tools install because the -# kernel headers_install will remove any header files in /usr/include that -# it doesn't install itself. - -%if %{with_headers} -# Install kernel headers -make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install - -find $RPM_BUILD_ROOT/usr/include \ - \( -name .install -o -name .check -o \ - -name ..install.cmd -o -name ..check.cmd \) -delete - -%endif - -%if %{with_cross_headers} -%if 0%{?fedora} -HDR_ARCH_LIST='arm arm64 powerpc s390 x86' -%else -HDR_ARCH_LIST='arm64 powerpc s390 x86' -%endif -mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers - -for arch in $HDR_ARCH_LIST; do - mkdir $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} - make ARCH=${arch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} headers_install -done - -find $RPM_BUILD_ROOT/usr/tmp-headers \ - \( -name .install -o -name .check -o \ - -name ..install.cmd -o -name ..check.cmd \) -delete - -# Copy all the architectures we care about to their respective asm directories -for arch in $HDR_ARCH_LIST ; do - mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include - mv $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch}/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/ -done - -rm -rf $RPM_BUILD_ROOT/usr/tmp-headers -%endif - -%if %{with_kernel_abi_whitelists} -# kabi directory -INSTALL_KABI_PATH=$RPM_BUILD_ROOT/lib/modules/ -mkdir -p $INSTALL_KABI_PATH - -# install kabi releases directories -tar xjvf %{SOURCE300} -C $INSTALL_KABI_PATH -# with_kernel_abi_whitelists -%endif - -%if %{with_perf} -# perf tool binary and supporting scripts/binaries -%{perf_make} DESTDIR=$RPM_BUILD_ROOT lib=%{_lib} install-bin install-traceevent-plugins -# remove the 'trace' symlink. -rm -f %{buildroot}%{_bindir}/trace - -# For both of the below, yes, this should be using a macro but right now -# it's hard coded and we don't actually want it anyway right now. -# Whoever wants examples can fix it up! - -# remove examples -rm -rf %{buildroot}/usr/lib/perf/examples -# remove the stray files that somehow got packaged -rm -rf %{buildroot}/usr/lib/perf/include/bpf/bpf.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/stdio.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/linux/socket.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/pid_filter.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/unistd.h - -# python-perf extension -%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext - -# perf man pages (note: implicit rpm magic compresses them later) -mkdir -p %{buildroot}/%{_mandir}/man1 -%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man -%endif - -%if %{with_tools} -%ifarch %{cpupowerarchs} -%{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install -rm -f %{buildroot}%{_libdir}/*.{a,la} -%find_lang cpupower -mv cpupower.lang ../ -%ifarch x86_64 - pushd tools/power/cpupower/debug/x86_64 - install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode - install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode - popd -%endif -chmod 0755 %{buildroot}%{_libdir}/libcpupower.so* -mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig -install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service -install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower -%endif -%ifarch x86_64 - mkdir -p %{buildroot}%{_mandir}/man8 - pushd tools/power/x86/x86_energy_perf_policy - %{tools_make} DESTDIR=%{buildroot} install - popd - pushd tools/power/x86/turbostat - %{tools_make} DESTDIR=%{buildroot} install - popd - pushd tools/power/x86/intel-speed-select - %{tools_make} CFLAGS+="-D_GNU_SOURCE -Iinclude" DESTDIR=%{buildroot} install - popd -%endif -pushd tools/thermal/tmon -%{tools_make} INSTALL_ROOT=%{buildroot} install -popd -pushd tools/iio -make DESTDIR=%{buildroot} install -popd -pushd tools/gpio -make DESTDIR=%{buildroot} install -popd -pushd tools/kvm/kvm_stat -make INSTALL_ROOT=%{buildroot} install-tools -make INSTALL_ROOT=%{buildroot} install-man -popd -%endif - -%if %{with_bpftool} -pushd tools/bpf/bpftool -%{bpftool_make} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install -popd -%endif - -%if %{with_selftests} -pushd samples -install -d %{buildroot}%{_libexecdir}/ksamples -# install bpf samples -pushd bpf -install -d %{buildroot}%{_libexecdir}/ksamples/bpf -find -type f -executable -exec install -m755 {} %{buildroot}%{_libexecdir}/ksamples/bpf \; -install -m755 *.sh %{buildroot}%{_libexecdir}/ksamples/bpf -# test_lwt_bpf.sh compiles test_lwt_bpf.c when run; this works only from the -# kernel tree. Just remove it. -rm %{buildroot}%{_libexecdir}/ksamples/bpf/test_lwt_bpf.sh -install -m644 tcp_bpf.readme %{buildroot}%{_libexecdir}/ksamples/bpf -popd -# install pktgen samples -pushd pktgen -install -d %{buildroot}%{_libexecdir}/ksamples/pktgen -find . -type f -executable -exec install -m755 {} %{buildroot}%{_libexecdir}/ksamples/pktgen/{} \; -find . -type f ! -executable -exec install -m644 {} %{buildroot}%{_libexecdir}/ksamples/pktgen/{} \; -popd -popd -# install drivers/net/mlxsw selftests -pushd tools/testing/selftests/drivers/net/mlxsw -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \; -popd -# install net/forwarding selftests -pushd tools/testing/selftests/net/forwarding -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \; -popd -# install tc-testing selftests -pushd tools/testing/selftests/tc-testing -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \; -popd -# install livepatch selftests -pushd tools/testing/selftests/livepatch -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \; -popd -%endif - -# We have to do the headers checksum calculation after the tools install because -# these might end up installing their own set of headers on top of kernel's -%if %{with_headers} -# compute a content hash to export as Provides: kernel-headers-checksum -HEADERS_CHKSUM=$(export LC_ALL=C; find $RPM_BUILD_ROOT/usr/include -type f -name "*.h" \ - ! -path $RPM_BUILD_ROOT/usr/include/linux/version.h | \ - sort | xargs cat | sha1sum - | cut -f 1 -d ' '); -# export the checksum via usr/include/linux/version.h, so the dynamic -# find-provides can grab the hash to update it accordingly -echo "#define KERNEL_HEADERS_CHECKSUM \"$HEADERS_CHKSUM\"" >> $RPM_BUILD_ROOT/usr/include/linux/version.h -%endif - -### -### clean -### - -### -### scripts -### -%transfiletriggerpostun -- /lib/modules/%{KVERREL}%{?1:+%{1}}/ -# No file list is provided via standard input, according to the -# documentation, so we do not need to flush standard input. - -# This script will not run if the patch includes kernel. - -echo "Updating initramfs with dracut..." -if dracut --force ; then - echo "Successfully updated initramfs." -else - echo "Failed to update initramfs." - echo "You must update your initramfs image for changes to take place." - exit -1 -fi - -%transfiletriggerin -- /lib/modules/%{KVERREL}%{?1:+%{1}}/ -# Need to flush the standard input, because a list of files that caused -# this trigger to fire is provided by RPM via standard input. If needed, -# we can check if there are specific files we are interested in and only -# re-generate initramfs in that case, but in our use case, this is not -# necessary -- we always want to regenerate the initramfs. - -# Regardless of which files fire the trigger, we would like to regenerate -# the initramfs, so flush the standard input. -cat >/dev/null -# There will be one left-over initramfs after upgrade or downgrade if the -# patch includes kernel. To solve this problem, we added a judgment, if -# the kernel is upgrading, initramfs will not be generated. - -# For example, we will downgrade kernel from 5.10.112-200.49 to 5.10.112-200.48. -# There will be two initramfs in /boot after downgrade. -# initramfs-5.10.112-200.48.tis.el7.x86_64.img -# initramfs-5.10.112-200.49.tis.el7.x86_64.img(left-over one) -# The running kernel verion is 5.10.112-200.49 when this script run, so -# initramfs-5.10.112-200.49.tis.el7.x86_64.img is generated. -# The running kernel version is different with the one that we will -# upgrade or downgrade. -if [ "$(uname -r)" == "%{KVERREL}%{?1:+%{1}}" ]; then - echo "Updating initramfs with dracut..." - if dracut --force ; then - echo "Successfully updated initramfs." - else - echo "Failed to update initramfs." - echo "You must update your initramfs image for changes to take place." - exit -1 - fi -fi - -%if %{with_tools} -%post -n kernel-rt-tools-libs -/sbin/ldconfig - -%postun -n kernel-rt-tools-libs -/sbin/ldconfig -%endif - -# -# This macro defines a %%post script for a kernel*-devel package. -# %%kernel_devel_post [] -# Note we don't run hardlink if ostree is in use, as ostree is -# a far more sophisticated hardlink implementation. -# https://github.com/projectatomic/rpm-ostree/commit/58a79056a889be8814aa51f507b2c7a4dccee526 -# -%define kernel_devel_post() \ -%{expand:%%post %{?1:%{1}-}devel}\ -if [ -f /etc/sysconfig/kernel ]\ -then\ - . /etc/sysconfig/kernel || exit $?\ -fi\ -if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink -a ! -e /run/ostree-booted ] \ -then\ - (cd /usr/src/kernels/%{KVERREL}%{?1:+%{1}} &&\ - /usr/bin/find . -type f | while read f; do\ - hardlink -c /usr/src/kernels/*%{?dist}.*/$f $f\ - done)\ -fi\ -%{nil} - -# -# This macro defines a %%post script for a kernel*-modules-extra package. -# It also defines a %%postun script that does the same thing. -# %%kernel_modules_extra_post [] -# -%define kernel_modules_extra_post() \ -%{expand:%%post %{?1:%{1}-}modules-extra}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil}\ -%{expand:%%postun %{?1:%{1}-}modules-extra}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil} - -# -# This macro defines a %%post script for a kernel*-modules-internal package. -# It also defines a %%postun script that does the same thing. -# %%kernel_modules_internal_post [] -# -%define kernel_modules_internal_post() \ -%{expand:%%post %{?1:%{1}-}modules-internal}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil}\ -%{expand:%%postun %{?1:%{1}-}modules-internal}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil} - -# -# This macro defines a %%post script for a kernel*-modules package. -# It also defines a %%postun script that does the same thing. -# %%kernel_modules_post [] -# -%define kernel_modules_post() \ -%{expand:%%post %{?1:%{1}-}modules}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil}\ -%{expand:%%postun %{?1:%{1}-}modules}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil} - -# This macro defines a %%posttrans script for a kernel package. -# %%kernel_variant_posttrans [] -# More text can follow to go at the end of this variant's %%post. -# -%define kernel_variant_posttrans() \ -%{expand:%%posttrans %{?1:%{1}-}core}\ -%if 0%{!?fedora:1}\ -%if !%{with_realtime}\ -if [ -x %{_sbindir}/weak-modules ]\ -then\ - %{_sbindir}/weak-modules --add-kernel %{KVERREL}%{?1:+%{1}} || exit $?\ -fi\ -%endif\ -%endif\ -/bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ -/usr/sbin/grub2-set-default 0 || :\ -%{nil} - -# -# This macro defines a %%post script for a kernel package and its devel package. -# %%kernel_variant_post [-v ] [-r ] -# More text can follow to go at the end of this variant's %%post. -# -%define kernel_variant_post(v:r:) \ -%{expand:%%kernel_devel_post %{?-v*}}\ -%{expand:%%kernel_modules_post %{?-v*}}\ -%{expand:%%kernel_modules_extra_post %{?-v*}}\ -%{expand:%%kernel_modules_internal_post %{?-v*}}\ -%{expand:%%kernel_variant_posttrans %{?-v*}}\ -%{expand:%%post %{?-v*:%{-v*}-}core}\ -%{-r:\ -if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ] &&\ - [ -f /etc/sysconfig/kernel ]; then\ - /bin/sed -r -i -e 's/^DEFAULTKERNEL=%{-r*}$/DEFAULTKERNEL=kernel%{?-v:-%{-v*}}/' /etc/sysconfig/kernel || exit $?\ -fi}\ -%{nil} - -%if %{with_realtime} -# This macro defines a %%post script for a kernel-rt-kvm package. -# %%kernel_kvm_variant_post -# -%define kernel_kvm_variant_post() \ -%{expand:%%post %{?1:%{1}-}kvm}\ -depmod %{KVERREL}%{?1:+%{1}} || exit $?\ -%{nil} -%endif - -# -# This macro defines a %%preun script for a kernel package. -# %%kernel_variant_preun -# -%define kernel_variant_preun() \ -%{expand:%%preun %{?1:%{1}-}core}\ -/bin/kernel-install remove %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ -%if 0%{!?fedora:1}\ -%if !%{with_realtime}\ -if [ -x %{_sbindir}/weak-modules ]\ -then\ - %{_sbindir}/weak-modules --remove-kernel %{KVERREL}%{?1:+%{1}} || exit $?\ -fi\ -%endif\ -%endif\ -%{nil} - -%if %{with_realtime} -# This macro defines a %%postun script for a kernel-rt-kvm package. -# %%kernel_kvm_variant_postun -# -%define kernel_kvm_variant_postun() \ -%{expand:%%postun %{?1:%{1}-}kvm}\ -depmod %{KVERREL}%{?1:+%{1}} || exit $?\ -%{nil} -%endif - -%kernel_variant_preun -%kernel_variant_post -r kernel-smp -%if %{with_realtime} -%kernel_kvm_variant_post -%kernel_kvm_variant_postun -%endif - -%if %{with_pae} -%kernel_variant_preun lpae -%kernel_variant_post -v lpae -r (kernel|kernel-smp) -%endif - -%kernel_variant_preun debug -%kernel_variant_post -v debug -%if %{with_realtime} -%kernel_kvm_variant_post debug -%kernel_kvm_variant_postun debug -%endif - -%if %{with_zfcpdump} -%kernel_variant_preun zfcpdump -%kernel_variant_post -v zfcpdump -%endif - -if [ -x /sbin/ldconfig ] -then - /sbin/ldconfig -X || exit $? -fi - -### -### file lists -### - -%if %{with_headers} -%files headers -/usr/include/* -%endif - -%if %{with_cross_headers} -%files cross-headers -/usr/*-linux-gnu/include/* -%endif - -%if %{with_kernel_abi_whitelists} -%files -n kernel-abi-whitelists -/lib/modules/kabi-* -%endif - -%if %{with_kabidw_base} -%ifarch x86_64 s390x ppc64 ppc64le aarch64 -%files kabidw-base -%defattr(-,root,root) -/kabidw-base/%{_target_cpu}/* -%endif -%endif - -# only some architecture builds need kernel-doc -%if %{with_doc} -%files doc -%defattr(-,root,root) -%{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation/* -%dir %{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation -%dir %{_datadir}/doc/kernel-doc-%{rpmversion} -%endif - -%if %{with_perf} -%files -n perf -%{_bindir}/perf -%{_libdir}/libperf-jvmti.so -%dir %{_libdir}/traceevent/plugins -%{_libdir}/traceevent/plugins/* -%dir %{_libexecdir}/perf-core -%{_libexecdir}/perf-core/* -%{_datadir}/perf-core/* -%{_mandir}/man[1-8]/perf* -%{_sysconfdir}/bash_completion.d/perf -%doc linux-%{KVERREL}/tools/perf/Documentation/examples.txt -%{_docdir}/perf-tip/tips.txt - -%files -n python3-perf -%{python3_sitearch}/* - -%if %{with_debuginfo} -%files -f perf-debuginfo.list -n perf-debuginfo - -%files -f python3-perf-debuginfo.list -n python3-perf-debuginfo -%endif -# with_perf -%endif - -%if %{with_tools} -%ifnarch %{cpupowerarchs} -%files -n kernel-rt-tools -%else -%files -n kernel-rt-tools -f cpupower.lang -%{_bindir}/cpupower -%{_datadir}/bash-completion/completions/cpupower -%ifarch x86_64 -%{_bindir}/centrino-decode -%{_bindir}/powernow-k8-decode -%endif -%{_unitdir}/cpupower.service -%{_mandir}/man[1-8]/cpupower* -%config(noreplace) %{_sysconfdir}/sysconfig/cpupower -%ifarch x86_64 -%{_bindir}/x86_energy_perf_policy -%{_mandir}/man8/x86_energy_perf_policy* -%{_bindir}/turbostat -%{_mandir}/man8/turbostat* -%{_bindir}/intel-speed-select -%endif -# cpupowerarchs -%endif -%{_bindir}/tmon -%{_bindir}/iio_event_monitor -%{_bindir}/iio_generic_buffer -%{_bindir}/lsiio -%{_bindir}/lsgpio -%{_bindir}/gpio-hammer -%{_bindir}/gpio-event-mon -%{_bindir}/gpio-watch -%{_mandir}/man1/kvm_stat* -%{_bindir}/kvm_stat - -%if %{with_debuginfo} -%files -f kernel-rt-tools-debuginfo.list -n kernel-rt-tools-debuginfo -%endif - -%ifarch %{cpupowerarchs} -%files -n kernel-rt-tools-libs -%{_libdir}/libcpupower.so.0 -%{_libdir}/libcpupower.so.0.0.1 - -%files -n kernel-rt-tools-libs-devel -%{_libdir}/libcpupower.so -%{_includedir}/cpufreq.h -%endif -# with_tools -%endif - -%if %{with_bpftool} -%files -n bpftool -%{_sbindir}/bpftool -%{_sysconfdir}/bash_completion.d/bpftool -%{_mandir}/man8/bpftool-cgroup.8.gz -%{_mandir}/man8/bpftool-gen.8.gz -%{_mandir}/man8/bpftool-iter.8.gz -%{_mandir}/man8/bpftool-link.8.gz -%{_mandir}/man8/bpftool-map.8.gz -%{_mandir}/man8/bpftool-prog.8.gz -%{_mandir}/man8/bpftool-perf.8.gz -%{_mandir}/man8/bpftool.8.gz -%{_mandir}/man7/bpf-helpers.7.gz -%{_mandir}/man8/bpftool-net.8.gz -%{_mandir}/man8/bpftool-feature.8.gz -%{_mandir}/man8/bpftool-btf.8.gz -%{_mandir}/man8/bpftool-struct_ops.8.gz - -%if %{with_debuginfo} -%files -f bpftool-debuginfo.list -n bpftool-debuginfo -%defattr(-,root,root) -%endif -%endif - -%if %{with_selftests} -%files selftests-internal -%{_libexecdir}/ksamples -%{_libexecdir}/kselftests -%endif - -# empty meta-package -%ifnarch %nobuildarches noarch -%files -%endif - -%if %{with_gcov} -%ifarch x86_64 s390x ppc64le aarch64 -%files gcov -%{_builddir} -%endif -%endif - -# This is %%{image_install_path} on an arch where that includes ELF files, -# or empty otherwise. -%define elf_image_install_path %{?kernel_image_elf:%{image_install_path}} - -# -# This macro defines the %%files sections for a kernel package -# and its devel and debuginfo packages. -# %%kernel_variant_files [-k vmlinux] -# -%define kernel_variant_files(k:) \ -%if %{2}\ -%{expand:%%files -f kernel-%{?3:%{3}-}core.list %{?1:-f kernel-%{?3:%{3}-}ldsoconf.list} %{?3:%{3}-}core}\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/arch/x86/kvm\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/drivers/gpu/drm/i915/gvt\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/modules.kvm\ -%{!?_licensedir:%global license %%doc}\ -%license linux-%{KVERREL}/COPYING-%{version}-%{release}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}\ -%ghost /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/.vmlinuz.hmac \ -%ghost /%{image_install_path}/.vmlinuz-%{KVERREL}%{?3:+%{3}}.hmac \ -%ifarch %{arm} aarch64\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/dtb \ -%ghost /%{image_install_path}/dtb-%{KVERREL}%{?3:+%{3}} \ -%endif\ -%attr(600,root,root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\ -%ghost /boot/System.map-%{KVERREL}%{?3:+%{3}}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.gz\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/config\ -%if 0%{?rhel} == 7\ -/boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ -%else\ -%ghost /boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ -%endif\ -%ghost /boot/config-%{KVERREL}%{?3:+%{3}}\ -%ghost /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ -%dir /lib/modules\ -%dir /lib/modules/%{KVERREL}%{?3:+%{3}}\ -%dir /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/build\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/source\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/updates\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/bls.conf\ -%if 0%{!?fedora:1}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/weak-updates\ -%endif\ -%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/kernel-signing-ca*.cer\ -%ifarch s390x ppc64le\ -%if 0%{!?4:1}\ -%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/%{signing_key_filename} \ -%endif\ -%endif\ -%if %{1}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/vdso\ -%endif\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/modules.*\ -%{expand:%%files -f kernel-%{?3:%{3}-}modules.list %{?3:%{3}-}modules}\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/arch/x86/kvm\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/drivers/gpu/drm/i915/gvt\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/modules.kvm\ -%{expand:%%files %{?3:%{3}-}devel}\ -%defverify(not mtime)\ -/usr/src/kernels/%{KVERREL}%{?3:+%{3}}\ -%exclude /usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.x509\ -%exclude /usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.pem\ -%{expand:%%files %{?3:%{3}-}devel-keys}\ -/usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.x509\ -/usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.pem\ -%{expand:%%files %{?3:%{3}-}modules-extra}\ -%config(noreplace) /etc/modprobe.d/*-blacklist.conf\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/extra\ -%{expand:%%files %{?3:%{3}-}modules-internal}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/internal\ -%if %{with_debuginfo}\ -%ifnarch noarch\ -%{expand:%%files -f debuginfo%{?3}.list %{?3:%{3}-}debuginfo}\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/arch/x86/kvm\ -%exclude /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/drivers/gpu/drm/i915/gvt\ -%endif\ -%endif\ -%ifarch x86_64\ -%{expand:%%files %{?3:%{3}-}unsigned}\ -/%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}.unsigned\ -%endif\ -%if %{?3:1} %{!?3:0}\ -%{expand:%%files %{3}}\ -%endif\ -%endif\ -%{expand:%%files %{?3:%{3}-}kvm}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/modules.kvm\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/arch/x86/kvm\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/drivers/gpu/drm/i915/gvt/kvmgt.ko*\ -%if %{with_debuginfo}\ -%{expand:%%files %{?3:%{3}-}kvm-debuginfo}\ -%dir %{debuginfodir}/lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/arch/x86/kvm\ -%{debuginfodir}/lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/arch/x86/kvm\ -%{debuginfodir}/lib/modules/%{KVERREL}%{?3:+%{3}}/kernel/drivers/gpu/drm/i915/gvt\ -%endif\ -%{nil} - -%kernel_variant_files %{_use_vdso} %{with_up} -%if %{with_debug} -%kernel_variant_files %{_use_vdso} %{with_debug} debug -%endif -%if %{with_pae} -%kernel_variant_files %{use_vdso} %{with_pae} lpae -%endif -%if %{with_zfcpdump} -%kernel_variant_files %{_use_vdso} %{with_zfcpdump} zfcpdump 1 -%endif - -%define kernel_variant_ipaclones(k:) \ -%if %{1}\ -%if %{with_ipaclones}\ -%{expand:%%files %{?2:%{2}-}ipaclones-internal}\ -%defattr(-,root,root)\ -%defverify(not mtime)\ -/usr/src/kernels/%{KVERREL}%{?2:+%{2}}-ipaclones\ -%endif\ -%endif\ -%{nil} - -%kernel_variant_ipaclones %{with_up} - -# plz don't put in a version string unless you're going to tag -# and build. -# -# -%changelog -* Tue Aug 30 2022 Jiping Ma - 5.10.112 -- Place module signing keys in a separate package kernel-rt-devel-keys. - -* Mon Jul 05 2021 Jiping Ma - 5.10.30 -- This spec file is based on the spec file of std kernel. -- Added STX patches. -- Support linux-yocto git source. -- Copy keys as part of the devel package. -- kernel-5.10.30-x86_64-rt.config.tis_extra repace of kernel-local. -- Add a dist field to avoid undesired rebuilds. -- Ensure unsigned package is populated. -- Build out kernel-rt-tools rather than kernel-tools. -- Build out package kernel-rt-kvm. - -* Thu Mar 11 2021 Justin M. Forbes - 5.10.23-200 -- Linux v5.10.23 - diff --git a/kernel-rt/centos/patches/0001-Notification-of-death-of-arbitrary-processes.patch b/kernel-rt/centos/patches/0001-Notification-of-death-of-arbitrary-processes.patch deleted file mode 100644 index f3472a16..00000000 --- a/kernel-rt/centos/patches/0001-Notification-of-death-of-arbitrary-processes.patch +++ /dev/null @@ -1,545 +0,0 @@ -From 33efb73059c7e1f2facc7bb04f60d706c07f640d Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Thu, 17 Jun 2021 01:28:11 -0700 -Subject: [PATCH] Notification of death of arbitrary processes - -Note: this commit was copied from Titanium Cloud Rel2 - -This exposes a new feature which may be called to request -notification when an arbitrary process changes state. The -caller specifies a pid, signal number, and event mask, and -when that pid dies, or is stopped, or anything else that -would normally cause a SIGCHLD, the kernel will send the -specified signal to the caller if the event is in the event -mask originally passed down. The siginfo_t struct will -contain the same information as would be included with SIGCHLD. - -This is exposed to userspace via the prctl() call with the -PR_DO_NOTIFY_TASK_STATE option. - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Shuicheng Lin -[jm: Adapted the patch for context changes.] -Signed-off-by: Jiping Ma ---- - include/linux/init_task.h | 9 ++ - include/linux/sched.h | 6 + - include/uapi/linux/prctl.h | 16 +++ - init/Kconfig | 15 +++ - init/init_task.c | 1 + - kernel/Makefile | 1 + - kernel/death_notify.c | 228 +++++++++++++++++++++++++++++++++++++ - kernel/death_notify.h | 46 ++++++++ - kernel/exit.c | 6 + - kernel/fork.c | 4 + - kernel/signal.c | 11 ++ - kernel/sys.c | 8 ++ - 12 files changed, 351 insertions(+) - create mode 100644 kernel/death_notify.c - create mode 100644 kernel/death_notify.h - -diff --git a/include/linux/init_task.h b/include/linux/init_task.h -index b2412b4d4c20..7a0828daf59c 100644 ---- a/include/linux/init_task.h -+++ b/include/linux/init_task.h -@@ -25,6 +25,15 @@ - extern struct files_struct init_files; - extern struct fs_struct init_fs; - extern struct nsproxy init_nsproxy; -+ -+#ifdef CONFIG_SIGEXIT -+#define INIT_SIGEXIT(tsk) \ -+ .notify = LIST_HEAD_INIT(tsk.notify), \ -+ .monitor = LIST_HEAD_INIT(tsk.monitor), -+#else -+#define INIT_SIGEXIT(tsk) -+#endif -+ - extern struct group_info init_groups; - extern struct cred init_cred; - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index e688e9307a21..c4b43b5d439f 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -1145,6 +1145,12 @@ struct task_struct { - short il_prev; - short pref_node_fork; - #endif -+#ifdef CONFIG_SIGEXIT -+ /* list of processes to notify on death */ -+ struct list_head notify; -+ /* list of outstanding monitor requests */ -+ struct list_head monitor; -+#endif - #ifdef CONFIG_NUMA_BALANCING - int numa_scan_seq; - unsigned int numa_scan_period; -diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h -index 7f0827705c9a..dbd5a8b6e002 100644 ---- a/include/uapi/linux/prctl.h -+++ b/include/uapi/linux/prctl.h -@@ -63,6 +63,22 @@ - # define PR_ENDIAN_LITTLE 1 /* True little endian mode */ - # define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ - -+#define PR_DO_NOTIFY_TASK_STATE 17 /* Set/get notification for task -+ state changes */ -+ -+/* This is the data structure for requestion process death -+ * (and other state change) information. Sig of -1 means -+ * query, sig of 0 means deregistration, positive sig means -+ * that you want to set it. sig and events are value-result -+ * and will be updated with the previous values on every -+ * successful call. -+ */ -+struct task_state_notify_info { -+ int pid; -+ int sig; -+ unsigned int events; -+}; -+ - /* Get/set process seccomp mode */ - #define PR_GET_SECCOMP 21 - #define PR_SET_SECCOMP 22 -diff --git a/init/Kconfig b/init/Kconfig -index 7ba2b602b707..5a5f38706715 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1852,6 +1852,21 @@ config VM_EVENT_COUNTERS - on EXPERT systems. /proc/vmstat will only show page counts - if VM event counters are disabled. - -+config SIGEXIT -+ bool "Notification of death of arbitrary processes" -+ default n -+ help -+ When enabled this exposes a new feature which may be called to request -+ notification when an arbitrary process changes state. The caller specifies -+ a pid, signal number, and event mask, and when that pid dies, or is -+ stopped, or anything else that would normally cause a SIGCHLD, the -+ kernel will send the specified signal to the caller if the event is in -+ the event mask originally passed down. The siginfo_t struct will -+ contain the same information as would be included with SIGCHLD. -+ -+ This is exposed to userspace via the prctl() -+ call with the PR_DO_NOTIFY_TASK_STATE option -+ - config SLUB_DEBUG - default y - bool "Enable SLUB debugging support" if EXPERT -diff --git a/init/init_task.c b/init/init_task.c -index 5fa18ed59d33..e1a245782828 100644 ---- a/init/init_task.c -+++ b/init/init_task.c -@@ -128,6 +128,7 @@ struct task_struct init_task - .alloc_lock = __SPIN_LOCK_UNLOCKED(init_task.alloc_lock), - .journal_info = NULL, - INIT_CPU_TIMERS(init_task) -+ INIT_SIGEXIT(init_task) - .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(init_task.pi_lock), - .timer_slack_ns = 50000, /* 50 usec default slack */ - .thread_pid = &init_struct_pid, -diff --git a/kernel/Makefile b/kernel/Makefile -index e7905bdf6e97..ba9997c7a59c 100644 ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -108,6 +108,7 @@ obj-$(CONFIG_BPF) += bpf/ - obj-$(CONFIG_KCSAN) += kcsan/ - obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o - obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o -+obj-$(CONFIG_SIGEXIT) += death_notify.o - - obj-$(CONFIG_PERF_EVENTS) += events/ - -diff --git a/kernel/death_notify.c b/kernel/death_notify.c -new file mode 100644 -index 000000000000..5819d35a2564 ---- /dev/null -+++ b/kernel/death_notify.c -@@ -0,0 +1,228 @@ -+/* -+ * kernel/death_notify.c, Process death notification support -+ * -+ * Copyright (c) 2006-2014 Wind River Systems, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "death_notify.h" -+ -+static void unlink_status_notifier(struct signotifier *n) -+{ -+ list_del(&n->monitor_list); -+ list_del(&n->notify_list); -+ kfree(n); -+} -+ -+static void handle_already_monitoring(struct signotifier *node, -+ struct task_state_notify_info *args, -+ struct task_state_notify_info *oldargs) -+{ -+ /* Store the old values */ -+ oldargs->sig = node->sig; -+ oldargs->events = node->events; -+ -+ /* We know that args->sig is 0 or a valid signal. */ -+ if (args->sig > 0) { -+ /* Update the new values */ -+ node->sig = args->sig; -+ node->events = args->events; -+ } else if (!args->sig) { -+ /* args->sig of 0 means to deregister */ -+ unlink_status_notifier(node); -+ } -+} -+ -+static void setup_new_node(struct task_struct *p, -+ struct signotifier *node, -+ struct task_state_notify_info *args) -+{ -+ node->notify_tsk = current; -+ node->sig = args->sig; -+ node->events = args->events; -+ -+ /* Add this node to the list of notification requests -+ * for the specified process. -+ */ -+ list_add_tail(&node->notify_list, &p->notify); -+ -+ /* Also add this node to the list of monitor requests -+ * for the current process. -+ */ -+ list_add_tail(&node->monitor_list, ¤t->monitor); -+} -+ -+/* Returns 0 if arguments are valid, 1 if they are not. */ -+static int invalid_args(struct task_state_notify_info *args) -+{ -+ int ret = 1; -+ -+ if (args->pid <= 0) -+ goto out; -+ -+ /* Sig of -1 implies query, sig of 0 implies deregistration. -+ * Otherwise sig must be positive and within range. -+ */ -+ if ((args->sig < -1) || (args->sig > _NSIG)) -+ goto out; -+ -+ /* If positive sig, must have valid events. */ -+ if (args->sig > 0) { -+ if (!args->events || (args->events >= (1 << (NSIGCHLD+1)))) -+ goto out; -+ } -+ -+ ret = 0; -+out: -+ return ret; -+} -+ -+/* Notify those registered for process state updates via do_notify_task_state(). -+ * If "del" is nonzero, the process is dying and we want to free -+ * the nodes in the list as we go. -+ * -+ * Note: we only notify processes for events in which they have registered -+ * interest. -+ * -+ * Must be called holding a lock on tasklist_lock. -+ */ -+void do_notify_others(struct task_struct *tsk, struct kernel_siginfo *info) -+{ -+ struct signotifier *node; -+ unsigned int events; -+ -+ /* This method of generating the event bit must be -+ * matched in the userspace library. -+ */ -+ events = 1 << (info->si_code & 0xFF); -+ -+ list_for_each_entry(node, &tsk->notify, notify_list) { -+ if (events & node->events) { -+ info->si_signo = node->sig; -+ group_send_sig_info(node->sig, info, node->notify_tsk, PIDTYPE_TGID); -+ } -+ } -+} -+ -+void release_notify_others(struct task_struct *p) -+{ -+ struct signotifier *n, *t; -+ -+ /* Need to clean up any outstanding requests where we -+ * wanted to be notified when others died. -+ */ -+ list_for_each_entry_safe(n, t, &p->monitor, monitor_list) { -+ unlink_status_notifier(n); -+ } -+ -+ /* Also need to clean up any outstanding requests where others -+ * wanted to be notified when we died. -+ */ -+ list_for_each_entry_safe(n, t, &p->notify, notify_list) { -+ unlink_status_notifier(n); -+ } -+} -+ -+/* If the config is defined, then processes can call this routine -+ * to request notification when the specified task's state changes. -+ * On the death (or other state change) of the specified process, -+ * we will send them the specified signal if the event is listed -+ * in their event bitfield. -+ * -+ * A sig of 0 means that we want to deregister. -+ * -+ * The sig/events fields are value/result. On success we update them -+ * to reflect what they were before the call. -+ * -+ * Returns error code on error, on success we return 0. -+ */ -+int do_notify_task_state(unsigned long arg) -+{ -+ int err; -+ struct task_struct *p; -+ struct signotifier *node, *tmp; -+ struct task_state_notify_info args, oldargs; -+ -+ if (copy_from_user(&args, (struct task_state_notify_info __user *)arg, -+ sizeof(args))) -+ return -EFAULT; -+ oldargs.pid = args.pid; -+ -+ /* Validate the arguments passed in. */ -+ err = -EINVAL; -+ if (invalid_args(&args)) -+ goto out; -+ -+ /* We must hold a write lock on tasklist_lock to add the notification -+ * later on, and we need some lock on tasklist_lock for -+ * find_task_by_pid(), so may as well take the write lock now. -+ * Must use write_lock_irq(). -+ */ -+ write_lock_irq(&tasklist_lock); -+ -+ err = -ESRCH; -+ p = find_task_by_vpid(args.pid); -+ if (!p) -+ goto unlock_out; -+ -+ /* Now we know pid exists, unlikely to fail. */ -+ err = 0; -+ -+ /* Check if we're already monitoring the specified pid. If so, update -+ * the monitoring parameters and return the old ones. -+ */ -+ list_for_each_entry(tmp, &p->notify, notify_list) { -+ if (tmp->notify_tsk == current) { -+ handle_already_monitoring(tmp, &args, &oldargs); -+ goto unlock_out; -+ } -+ } -+ -+ /* If we get here, we're not currently monitoring the process. */ -+ oldargs.sig = 0; -+ oldargs.events = 0; -+ -+ /* If we wanted to set up a new monitor, do it now. If we didn't -+ * manage to allocate memory for the new node, then we return -+ * an appropriate error. -+ */ -+ if (args.sig > 0) { -+ node = kmalloc(sizeof(*node), GFP_ATOMIC); -+ if (node) -+ setup_new_node(p, node, &args); -+ else -+ err = -ENOMEM; -+ } -+ -+unlock_out: -+ write_unlock_irq(&tasklist_lock); -+ -+ /* Copy the old values back to caller. */ -+ if (copy_to_user((struct task_state_notify_info __user *)arg, -+ &oldargs, sizeof(oldargs))) -+ err = -EFAULT; -+ -+out: -+ return err; -+} -+ -diff --git a/kernel/death_notify.h b/kernel/death_notify.h -new file mode 100644 -index 000000000000..14a0995b79af ---- /dev/null -+++ b/kernel/death_notify.h -@@ -0,0 +1,46 @@ -+/* -+ * kernel/death_notify.h, Process death notification support -+ * -+ * Copyright (c) 2006-2014 Wind River Systems, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+#ifndef _KERNEL_DEATH_NOTIFY_H -+#define _KERNEL_DEATH_NOTIFY_H -+ -+#ifdef CONFIG_SIGEXIT -+ -+struct signotifier { -+ struct task_struct *notify_tsk; -+ struct list_head notify_list; -+ struct list_head monitor_list; -+ int sig; -+ unsigned int events; -+}; -+ -+extern int do_notify_task_state(unsigned long arg); -+extern void do_notify_others(struct task_struct *tsk, -+ struct kernel_siginfo *info); -+extern void release_notify_others(struct task_struct *p); -+ -+#else /* !CONFIG_SIGEXIT */ -+ -+static inline void do_notify_others(struct task_struct *tsk, -+ struct kernel_siginfo *info) {} -+static inline void release_notify_others(struct task_struct *p) {} -+ -+#endif /* CONFIG_SIGEXIT */ -+#endif -+ -diff --git a/kernel/exit.c b/kernel/exit.c -index f5933bd07932..3c328a630257 100644 ---- a/kernel/exit.c -+++ b/kernel/exit.c -@@ -68,6 +68,9 @@ - #include - #include - #include -+#ifdef CONFIG_SIGEXIT -+#include "death_notify.h" -+#endif - - static void __unhash_process(struct task_struct *p, bool group_dead) - { -@@ -194,6 +197,9 @@ void release_task(struct task_struct *p) - cgroup_release(p); - - write_lock_irq(&tasklist_lock); -+#ifdef CONFIG_SIGEXIT -+ release_notify_others(p); -+#endif - ptrace_release_task(p); - thread_pid = get_pid(p->thread_pid); - __exit_signal(p); -diff --git a/kernel/fork.c b/kernel/fork.c -index fb3fbfd44b25..94769fcf71ac 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -2095,6 +2095,10 @@ static __latent_entropy struct task_struct *copy_process( - p->sequential_io = 0; - p->sequential_io_avg = 0; - #endif -+#ifdef CONFIG_SIGEXIT -+ INIT_LIST_HEAD(&p->notify); -+ INIT_LIST_HEAD(&p->monitor); -+#endif - - /* Perform scheduler related setup. Assign this task to a CPU. */ - retval = sched_fork(clone_flags, p); -diff --git a/kernel/signal.c b/kernel/signal.c -index 0be3c40c5662..1581b2a76823 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -56,6 +56,9 @@ - #include - #include - #include -+#ifdef CONFIG_SIGEXIT -+#include "death_notify.h" -+#endif - - /* - * SLAB caches for signal bits. -@@ -2088,6 +2091,10 @@ bool do_notify_parent(struct task_struct *tsk, int sig) - __wake_up_parent(tsk, tsk->parent); - spin_unlock_irqrestore(&psig->siglock, flags); - -+#ifdef CONFIG_SIGEXIT -+ do_notify_others(tsk, &info); -+#endif -+ - return autoreap; - } - -@@ -2160,6 +2167,10 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, - */ - __wake_up_parent(tsk, parent); - spin_unlock_irqrestore(&sighand->siglock, flags); -+ -+#ifdef CONFIG_SIGEXIT -+ do_notify_others(tsk, &info); -+#endif - } - - static inline bool may_ptrace_stop(void) -diff --git a/kernel/sys.c b/kernel/sys.c -index a730c03ee607..0f8decf763f1 100644 ---- a/kernel/sys.c -+++ b/kernel/sys.c -@@ -73,6 +73,9 @@ - #include - - #include "uid16.h" -+#ifdef CONFIG_SIGEXIT -+#include "death_notify.h" -+#endif - - #ifndef SET_UNALIGN_CTL - # define SET_UNALIGN_CTL(a, b) (-EINVAL) -@@ -2423,6 +2426,11 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, - else - error = PR_MCE_KILL_DEFAULT; - break; -+#ifdef CONFIG_SIGEXIT -+ case PR_DO_NOTIFY_TASK_STATE: -+ error = do_notify_task_state(arg2); -+ break; -+#endif - case PR_SET_MM: - error = prctl_set_mm(arg2, arg3, arg4, arg5); - break; --- -2.31.1 - diff --git a/kernel-rt/centos/patches/0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch b/kernel-rt/centos/patches/0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch deleted file mode 100644 index 3fde6a06..00000000 --- a/kernel-rt/centos/patches/0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9317be15490c339cd587292722efac013a2fb880 Mon Sep 17 00:00:00 2001 -From: Dahir Osman -Date: Wed, 13 Jan 2016 10:01:11 -0500 -Subject: [PATCH 02/10] PCI: Add ACS quirk for Intel Fortville NICs - -Use quirks to determine isolation for now until a later kernel can -properly read the Fortville ACS capabilities. - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - drivers/pci/quirks.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index b570f297e3ec..910026923549 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -4740,6 +4740,10 @@ static const struct pci_dev_acs_enabled { - { PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs }, - { PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs }, - { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_rciep_acs }, -+ /* I40 */ -+ { PCI_VENDOR_ID_INTEL, 0x1572, pci_quirk_mf_endpoint_acs }, -+ { PCI_VENDOR_ID_INTEL, 0x1586, pci_quirk_mf_endpoint_acs }, -+ { PCI_VENDOR_ID_INTEL, 0x1583, pci_quirk_mf_endpoint_acs }, - /* QCOM QDF2xxx root ports */ - { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, - { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs }, --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0003-affine-compute-kernel-threads.patch b/kernel-rt/centos/patches/0003-affine-compute-kernel-threads.patch deleted file mode 100644 index bf19fc1c..00000000 --- a/kernel-rt/centos/patches/0003-affine-compute-kernel-threads.patch +++ /dev/null @@ -1,173 +0,0 @@ -From 5fba1536bd24bc77ef0d6b2516fefcff69d7cf59 Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Tue, 24 Nov 2015 16:27:28 -0500 -Subject: [PATCH] affine compute kernel threads - -This is a kernel enhancement to configure the cpu affinity of kernel -threads via kernel boot option kthread_cpus=. The compute -kickstart file and compute-huge.sh scripts will update grub with the -new option. - -With kthread_cpus specified, the cpumask is immediately applied upon -thread launch. This does not affect kernel threads that specify cpu -and node. - -Note: this is based off of Christoph Lameter's patch at -https://lwn.net/Articles/565932/ with the only difference being -the kernel parameter changed from kthread to kthread_cpus. - -Signed-off-by: Christoph Lameter -Signed-off-by: Chris Friesen -[VT: The existing "isolcpus" - kernel bootarg, cgroup/cpuset, and taskset might provide the some - way to have cpu isolation. However none of them satisfies the requirements. - Replacing spaces with tabs. Combine two calls of set_cpus_allowed_ptr() - in kernel_init_freeable() in init/main.c into one. Performed tests] -Signed-off-by: Vu Tran - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Vefa Bicakci -[jm: Adapted the patch for context changes.] -Signed-off-by: Jiping Ma ---- - .../admin-guide/kernel-parameters.txt | 10 ++++++++ - include/linux/cpumask.h | 3 +++ - init/main.c | 2 ++ - kernel/cpu.c | 23 +++++++++++++++++++ - kernel/kthread.c | 4 ++-- - kernel/umh.c | 3 +++ - 6 files changed, 43 insertions(+), 2 deletions(-) - -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index a19a3005b545..6f79c718ae4f 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -2223,6 +2223,16 @@ - See also Documentation/trace/kprobetrace.rst "Kernel - Boot Parameter" section. - -+ kthread_cpus= [KNL, SMP] Only run kernel threads on the specified -+ list of processors. The kernel will start threads -+ on the indicated processors only (unless there -+ are specific reasons to run a thread with -+ different affinities). This can be used to make -+ init start on certain processors and also to -+ control where kmod and other user space threads -+ are being spawned. Allows to keep kernel threads -+ away from certain cores unless absoluteluy necessary. -+ - kpti= [ARM64] Control page table isolation of user - and kernel address spaces. - Default: enabled on cores which need mitigation. -diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h -index 383684e30f12..8fcc67ea3d8c 100644 ---- a/include/linux/cpumask.h -+++ b/include/linux/cpumask.h -@@ -55,6 +55,7 @@ extern unsigned int nr_cpu_ids; - * cpu_present_mask - has bit 'cpu' set iff cpu is populated - * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler - * cpu_active_mask - has bit 'cpu' set iff cpu available to migration -+ * cpu_kthread_mask - has bit 'cpu' set iff general kernel threads allowed - * - * If !CONFIG_HOTPLUG_CPU, present == possible, and active == online. - * -@@ -91,10 +92,12 @@ extern struct cpumask __cpu_possible_mask; - extern struct cpumask __cpu_online_mask; - extern struct cpumask __cpu_present_mask; - extern struct cpumask __cpu_active_mask; -+extern struct cpumask __cpu_kthread_mask; - #define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask) - #define cpu_online_mask ((const struct cpumask *)&__cpu_online_mask) - #define cpu_present_mask ((const struct cpumask *)&__cpu_present_mask) - #define cpu_active_mask ((const struct cpumask *)&__cpu_active_mask) -+#define cpu_kthread_mask ((const struct cpumask *)&__cpu_kthread_mask) - - extern atomic_t __num_online_cpus; - -diff --git a/init/main.c b/init/main.c -index db693781a12f..4e7777bdab6e 100644 ---- a/init/main.c -+++ b/init/main.c -@@ -1536,6 +1536,8 @@ static noinline void __init kernel_init_freeable(void) - - do_basic_setup(); - -+ set_cpus_allowed_ptr(current, cpu_kthread_mask); -+ - kunit_run_all_tests(); - - console_on_rootfs(); -diff --git a/kernel/cpu.c b/kernel/cpu.c -index 016f2d0686b6..6783db02e9ae 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -2505,6 +2505,29 @@ EXPORT_SYMBOL(__cpu_active_mask); - atomic_t __num_online_cpus __read_mostly; - EXPORT_SYMBOL(__num_online_cpus); - -+struct cpumask __cpu_kthread_mask __read_mostly -+ = {CPU_BITS_ALL}; -+EXPORT_SYMBOL(__cpu_kthread_mask); -+ -+static int __init kthread_setup(char *str) -+{ -+ cpumask_var_t tmp_mask; -+ int err; -+ -+ alloc_bootmem_cpumask_var(&tmp_mask); -+ -+ err = cpulist_parse(str, tmp_mask); -+ if (!err) -+ cpumask_copy(&__cpu_kthread_mask, tmp_mask); -+ else -+ pr_err("Cannot parse 'kthread_cpus=%s'; error %d\n", str, err); -+ -+ free_bootmem_cpumask_var(tmp_mask); -+ -+ return 1; -+} -+__setup("kthread_cpus=", kthread_setup); -+ - void init_cpu_present(const struct cpumask *src) - { - cpumask_copy(&__cpu_present_mask, src); -diff --git a/kernel/kthread.c b/kernel/kthread.c -index 3ce6a31db7b4..683008e94fd4 100644 ---- a/kernel/kthread.c -+++ b/kernel/kthread.c -@@ -300,7 +300,7 @@ static int kthread(void *_create) - * back to default in case they have been changed. - */ - sched_setscheduler_nocheck(current, SCHED_NORMAL, ¶m); -- set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_KTHREAD)); -+ set_cpus_allowed_ptr(current, cpu_kthread_mask); - - /* OK, tell user we're spawned, wait for stop or wakeup */ - __set_current_state(TASK_UNINTERRUPTIBLE); -@@ -655,7 +655,7 @@ int kthreadd(void *unused) - /* Setup a clean context for our children to inherit. */ - set_task_comm(tsk, "kthreadd"); - ignore_signals(tsk); -- set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_FLAG_KTHREAD)); -+ set_cpus_allowed_ptr(tsk, cpu_kthread_mask); - set_mems_allowed(node_states[N_MEMORY]); - - current->flags |= PF_NOFREEZE; -diff --git a/kernel/umh.c b/kernel/umh.c -index 3f646613a9d3..e5027cee43f7 100644 ---- a/kernel/umh.c -+++ b/kernel/umh.c -@@ -80,6 +80,9 @@ static int call_usermodehelper_exec_async(void *data) - */ - current->fs->umask = 0022; - -+ /* We can run only where init is allowed to run. */ -+ set_cpus_allowed_ptr(current, cpu_kthread_mask); -+ - /* - * Our parent (unbound workqueue) runs with elevated scheduling - * priority. Avoid propagating that into the userspace child. --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch b/kernel-rt/centos/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch deleted file mode 100644 index da5607d7..00000000 --- a/kernel-rt/centos/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 36d1eeee008939d77f015d051970bd417ac6fcf1 Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Tue, 24 Nov 2015 16:27:29 -0500 -Subject: [PATCH 04/10] Affine irqs and workqueues with kthread_cpus - -If the kthread_cpus boot arg is set it means we want to affine -kernel threads to the specified CPU mask as much as possible -in order to avoid doing work on other CPUs. - -In this commit we extend the meaning of that boot arg to also -apply to the CPU affinity of unbound and ordered workqueues. - -We also use the kthread_cpus value to determine the default irq -affinity. Specifically, as long as the previously-calculated -irq affinity intersects with the kthread_cpus affinity then we'll -use the intersection of the two as the default irq affinity. - -Signed-off-by: Chris Friesen -[VT: replacing spaces with tabs. Performed tests] -Signed-off-by: Vu Tran - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - kernel/irq/manage.c | 7 +++++++ - kernel/workqueue.c | 4 ++++ - 2 files changed, 11 insertions(+) - -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index de00a0599afe..84a120d3abef 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -515,6 +515,13 @@ int irq_setup_affinity(struct irq_desc *desc) - if (cpumask_intersects(&mask, nodemask)) - cpumask_and(&mask, &mask, nodemask); - } -+ -+ /* This will narrow down the affinity further if we've specified -+ * a reduced cpu_kthread_mask in the boot args. -+ */ -+ if (cpumask_intersects(&mask, cpu_kthread_mask)) -+ cpumask_and(&mask, &mask, cpu_kthread_mask); -+ - ret = irq_do_set_affinity(&desc->irq_data, &mask, false); - raw_spin_unlock(&mask_lock); - return ret; -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index c9a0c961d6e0..f69f10a220b6 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -5960,6 +5960,8 @@ void __init workqueue_init_early(void) - - BUG_ON(!(attrs = alloc_workqueue_attrs())); - attrs->nice = std_nice[i]; -+ /* If we've specified a kthread mask apply it here too. */ -+ cpumask_copy(attrs->cpumask, cpu_kthread_mask); - unbound_std_wq_attrs[i] = attrs; - - /* -@@ -5970,6 +5972,8 @@ void __init workqueue_init_early(void) - BUG_ON(!(attrs = alloc_workqueue_attrs())); - attrs->nice = std_nice[i]; - attrs->no_numa = true; -+ /* If we've specified a kthread mask apply it here too. */ -+ cpumask_copy(attrs->cpumask, cpu_kthread_mask); - ordered_wq_attrs[i] = attrs; - } - --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0005-Make-kernel-start-eth-devices-at-offset.patch b/kernel-rt/centos/patches/0005-Make-kernel-start-eth-devices-at-offset.patch deleted file mode 100644 index 15daf3d3..00000000 --- a/kernel-rt/centos/patches/0005-Make-kernel-start-eth-devices-at-offset.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 4a72347e026f8a82c9e8d748daf59b74345c47f1 Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Thu, 12 May 2016 18:00:00 -0400 -Subject: [PATCH 05/10] Make kernel start eth devices at offset - -In order to avoid naming collisions, we want to make the kernel -start naming its "ethX" devices at eth1000 instead of eth0. This -will let us rename to a range starting at eth0. - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - net/core/dev.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/net/core/dev.c b/net/core/dev.c -index 623d2622f6be..e85cddf2fc83 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -1218,6 +1218,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf) - set_bit(i, inuse); - } - -+ /* STX extension, want kernel to start at eth1000 */ -+ if (strcmp(name, "eth%d") == 0) { -+ for (i=0; i < 1000; i++) -+ set_bit(i, inuse); -+ } -+ - i = find_first_zero_bit(inuse, max_netdevices); - free_page((unsigned long) inuse); - } --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch b/kernel-rt/centos/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch deleted file mode 100644 index 01ffc6da..00000000 --- a/kernel-rt/centos/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch +++ /dev/null @@ -1,125 +0,0 @@ -From c35ee3034b61e72bf9fef888a3c4702049a77bcc Mon Sep 17 00:00:00 2001 -From: Matt Peters -Date: Mon, 30 May 2016 10:51:02 -0400 -Subject: [PATCH] intel-iommu: allow ignoring Ethernet device RMRR with IOMMU - passthrough - -Some BIOS's are reporting DMAR RMRR entries for Ethernet devices -which is causing problems when PCI passthrough is enabled. These -devices should be able to use the static identity map since the -host should not be enforcing specific address ranges when IOMMU -passthrough is enabled. - -Originally-by: Matt Peters -[PG: Added bootarg wrapper and documentation entries.] -Signed-off-by: Paul Gortmaker -Signed-off-by: Nam Ninh -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Dongqi Chen -[lz: Adapted the patch for context changes.] -Signed-off-by: Li Zhou -[jp: fix warning: this 'else' clause does not guard] -Signed-off-by: Jiping Ma ---- - .../admin-guide/kernel-parameters.txt | 5 +++++ - Documentation/x86/intel-iommu.rst | 18 +++++++++++++++ - drivers/iommu/intel/iommu.c | 22 ++++++++++++++++++- - 3 files changed, 44 insertions(+), 1 deletion(-) - -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index 78a923d087c1..e7639eaa41b8 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -1861,6 +1861,11 @@ - than 32-bit addressing. The default is to look - for translation below 32-bit and if not available - then look in the higher range. -+ eth_no_rmrr [Default Off] -+ With this option provided, the kernel will ignore -+ any specified RMRR regions specified by the BIOS -+ for PCI ethernet devices. Confirm with your hardware -+ vendor the RMRR regions are indeed invalid first. - strict [Default Off] - With this option on every unmap_single operation will - result in a hardware IOTLB flush operation as opposed -diff --git a/Documentation/x86/intel-iommu.rst b/Documentation/x86/intel-iommu.rst -index 099f13d51d5f..18e6a8d8b1ee 100644 ---- a/Documentation/x86/intel-iommu.rst -+++ b/Documentation/x86/intel-iommu.rst -@@ -33,6 +33,24 @@ regions will fail. Hence BIOS uses RMRR to specify these regions along with - devices that need to access these regions. OS is expected to setup - unity mappings for these regions for these devices to access these regions. - -+RMRR for other devices? -+----------------------- -+ -+There are reports of BIOS out there that indicate RMRR regions for things -+like ethernet devices. As per mainline commit c875d2c1b8083 ("iommu/vt-d: -+Exclude devices using RMRRs from IOMMU API domains") such a device is -+"fundamentally incompatible" with the IOMMU API and "we must prevent such -+devices from being used by the IOMMU API." However, in the event that -+the RMRR indicated by the BIOS is assumed to be just a reporting error, -+there is an additional iommu boot arg that can be used to ignore RMRR -+settings for ethernet, i.e. "intel_iommu=on,eth_no_rmrr iommu=pt". -+Note that iommu=pt is required in order to eth_no_rmrr to have effect. -+ -+If you use this setting, you should consult with your hardware vendor to -+confirm that it is just a reporting error, and that it truly is not -+actively using any DMA to/from RMRR, as otherwise system instability -+may result. -+ - How is IOVA generated? - ---------------------- - -diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c -index db9bf5ac0722..f30df770243d 100644 ---- a/drivers/iommu/intel/iommu.c -+++ b/drivers/iommu/intel/iommu.c -@@ -354,6 +354,7 @@ static int dmar_map_gfx = 1; - static int dmar_forcedac; - static int intel_iommu_strict; - static int intel_iommu_superpage = 1; -+static int intel_iommu_ethrmrr = 1; - static int iommu_identity_mapping; - static int intel_no_bounce; - static int iommu_skip_te_disable; -@@ -448,6 +449,15 @@ static int __init intel_iommu_setup(char *str) - } else if (!strncmp(str, "forcedac", 8)) { - pr_info("Forcing DAC for PCI devices\n"); - dmar_forcedac = 1; -+ } else if (!strncmp(str, "eth_no_rmrr", 11)) { -+ if (!iommu_default_passthrough()) { -+ printk(KERN_WARNING -+ "Intel-IOMMU: error - eth_no_rmrr requires iommu=pt\n"); -+ } else { -+ printk(KERN_INFO -+ "Intel-IOMMU: ignoring ethernet RMRR values\n"); -+ intel_iommu_ethrmrr = 0; -+ } - } else if (!strncmp(str, "strict", 6)) { - pr_info("Disable batched IOTLB flush\n"); - intel_iommu_strict = 1; -@@ -2907,8 +2917,18 @@ static bool device_rmrr_is_relaxable(struct device *dev) - pdev = to_pci_dev(dev); - if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev)) - return true; -- else -+ else { -+ /* As a temporary workaround for issues seen on ProLiant DL380p, -+ * allow the operator to ignore the RMRR settings for ethernet -+ * devices. Ideally the end user should contact their vendor -+ * regarding why there are RMRR, as per mainline c875d2c1b8083 -+ * ("iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains") -+ * it seems that these make no sense at all. -+ */ -+ if ((pdev->class >> 8) == PCI_CLASS_NETWORK_ETHERNET && !intel_iommu_ethrmrr) -+ return true; - return false; -+ } - } - - /* --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0007-turn-off-write-same-in-smartqpi-driver.patch b/kernel-rt/centos/patches/0007-turn-off-write-same-in-smartqpi-driver.patch deleted file mode 100644 index 93cf5302..00000000 --- a/kernel-rt/centos/patches/0007-turn-off-write-same-in-smartqpi-driver.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ecb3070f30a3328bca8844ba2a427e67bf9268ba Mon Sep 17 00:00:00 2001 -From: Jim Somerville -Date: Tue, 6 Mar 2018 12:54:40 -0500 -Subject: [PATCH 06/10] turn off write same in smartqpi driver - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - drivers/scsi/smartpqi/smartpqi_init.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c -index 5083e5d2b467..cb1280d0ea75 100644 ---- a/drivers/scsi/smartpqi/smartpqi_init.c -+++ b/drivers/scsi/smartpqi/smartpqi_init.c -@@ -6575,6 +6575,7 @@ static struct scsi_host_template pqi_driver_template = { - .map_queues = pqi_map_queues, - .sdev_attrs = pqi_sdev_attrs, - .shost_attrs = pqi_shost_attrs, -+ .no_write_same = 1, - }; - - static int pqi_register_scsi(struct pqi_ctrl_info *ctrl_info) --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0008-Allow-dmar-quirks-for-broken-bioses.patch b/kernel-rt/centos/patches/0008-Allow-dmar-quirks-for-broken-bioses.patch deleted file mode 100644 index c03f8be2..00000000 --- a/kernel-rt/centos/patches/0008-Allow-dmar-quirks-for-broken-bioses.patch +++ /dev/null @@ -1,79 +0,0 @@ -From ad3d09f2052d053ebe13220b5acb496a07fcf0da Mon Sep 17 00:00:00 2001 -From: Jim Somerville -Date: Wed, 29 Jan 2020 14:19:22 -0500 -Subject: [PATCH 07/10] Allow dmar quirks for broken bioses - -Problem: -Broken bios creates inaccurate DMAR tables, -reporting some bridges as having endpoint types. -This causes IOMMU initialization to bail -out early with an error code, the result of -which is vfio not working correctly. -This is seen on some Skylake based Wolfpass -server platforms with up-to-date bios installed. - -Solution: -Instead of just bailing out of IOMMU -initialization when such a condition is found, -we report it and continue. The IOMMU ends -up successfully initialized anyway. We do this -only on platforms that have the Skylake bridges -where this issue has been seen. - -This change is inspired by a similar one posted by -Lu Baolu of Intel Corp to lkml - -https://lkml.org/lkml/2019/12/24/15 - -Signed-off-by: Jim Somerville -Signed-off-by: Jiping Ma ---- - drivers/iommu/intel/dmar.c | 25 ++++++++++++++++++++++++- - 1 file changed, 24 insertions(+), 1 deletion(-) - -diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c -index 02e7c10a4224..7d423ac36a44 100644 ---- a/drivers/iommu/intel/dmar.c -+++ b/drivers/iommu/intel/dmar.c -@@ -66,6 +66,26 @@ static void free_iommu(struct intel_iommu *iommu); - - extern const struct iommu_ops intel_iommu_ops; - -+static int scope_mismatch_quirk; -+static void quirk_dmar_scope_mismatch(struct pci_dev *dev) -+{ -+ pci_info(dev, "scope mismatch ignored\n"); -+ scope_mismatch_quirk = 1; -+} -+ -+/* -+ * We expect devices with endpoint scope to have normal PCI -+ * headers, and devices with bridge scope to have bridge PCI -+ * headers. However some PCI devices may be listed in the -+ * DMAR table with bridge scope, even though they have a -+ * normal PCI header and vice versa. We don't declare a -+ * scope mismatch for the special cases below, even though -+ * the bios creates broken tables. -+ */ -+/* Sky Lake-E PCI Express Root Port A */ -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2030, -+ quirk_dmar_scope_mismatch); -+ - static void dmar_register_drhd_unit(struct dmar_drhd_unit *drhd) - { - /* -@@ -255,7 +275,10 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info, - info->dev->class >> 16 != PCI_BASE_CLASS_BRIDGE))) { - pr_warn("Device scope type does not match for %s\n", - pci_name(info->dev)); -- return -EINVAL; -+ if (!scope_mismatch_quirk) -+ return -EINVAL; -+ else -+ pr_warn("but continuing anyway\n"); - } - - for_each_dev_scope(devices, devices_cnt, i, tmp) --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch b/kernel-rt/centos/patches/0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch deleted file mode 100644 index e8630c0d..00000000 --- a/kernel-rt/centos/patches/0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 7240ac0b8c98c99adc09a46d577c7dd1e8ca46dd Mon Sep 17 00:00:00 2001 -From: Nayna Jain -Date: Fri, 10 Nov 2017 17:16:35 -0500 -Subject: [PATCH 08/10] tpm: ignore burstcount to improve tpm_tis send() - performance -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The TPM burstcount status indicates the number of bytes that can -be sent to the TPM without causing bus wait states.  Effectively, -it is the number of empty bytes in the command FIFO. - -This patch optimizes the tpm_tis_send_data() function by checking -the burstcount only once. And if the burstcount is valid, it writes -all the bytes at once, permitting wait state. - -After this change, performance on a TPM 1.2 with an 8 byte -burstcount for 1000 extends improved from ~41sec to ~14sec. - -Suggested-by: Ken Goldman in -conjunction with the TPM Device Driver work group. -Signed-off-by: Nayna Jain -Acked-by: Mimi Zohar -Reviewed-by: Jarkko Sakkinen -Tested-by: Jarkko Sakkinen -Signed-off-by: Jarkko Sakkinen -Signed-off-by: Dongqi Chen -Signed-off-by: Jiping Ma ---- - drivers/char/tpm/tpm_tis_core.c | 43 ++++++++++++--------------------- - 1 file changed, 15 insertions(+), 28 deletions(-) - -diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c -index a2e0395cbe61..2c69fde1e4e5 100644 ---- a/drivers/char/tpm/tpm_tis_core.c -+++ b/drivers/char/tpm/tpm_tis_core.c -@@ -330,7 +330,6 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len) - { - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc, status, burstcnt; -- size_t count = 0; - bool itpm = priv->flags & TPM_TIS_ITPM_WORKAROUND; - - status = tpm_tis_status(chip); -@@ -343,36 +342,24 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len) - goto out_err; - } - } -- -- while (count < len - 1) { -- burstcnt = get_burstcount(chip); -- if (burstcnt < 0) { -- dev_err(&chip->dev, "Unable to read burstcount\n"); -- rc = burstcnt; -- goto out_err; -- } -- burstcnt = min_t(int, burstcnt, len - count - 1); -- rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality), -- burstcnt, buf + count); -- if (rc < 0) -- goto out_err; -- -- count += burstcnt; -- -- if (wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c, -- &priv->int_queue, false) < 0) { -- rc = -ETIME; -- goto out_err; -- } -- status = tpm_tis_status(chip); -- if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) { -- rc = -EIO; -- goto out_err; -- } -+ /* -+ * Get the initial burstcount to ensure TPM is ready to -+ * accept data, even when waiting for burstcount is disabled. -+ */ -+ burstcnt = get_burstcount(chip); -+ if (burstcnt < 0) { -+ dev_err(&chip->dev, "Unable to read burstcount\n"); -+ rc = burstcnt; -+ goto out_err; - } - -+ rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality), -+ len -1, buf); -+ if (rc < 0) -+ goto out_err; -+ - /* write last byte */ -- rc = tpm_tis_write8(priv, TPM_DATA_FIFO(priv->locality), buf[count]); -+ rc = tpm_tis_write8(priv, TPM_DATA_FIFO(priv->locality), buf[len-1]); - if (rc < 0) - goto out_err; - --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0010-restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch b/kernel-rt/centos/patches/0010-restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch deleted file mode 100644 index 53e17725..00000000 --- a/kernel-rt/centos/patches/0010-restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 496b91a31568c382c50dd2fe7ce190142913eaf5 Mon Sep 17 00:00:00 2001 -From: Alex Kozyrev -Date: Fri, 16 Mar 2018 15:50:57 -0400 -Subject: [PATCH 09/10] restrict iSCSI kthreads to CPUs in cpu_kthread_mask - -Do not allow them to run on other CPUs to prevent interference with VMs. - -Signed-off-by: Alex Kozyrev -Signed-off-by: Jim Somerville -Signed-off-by: Austin Sun -Signed-off-by: Jiping Ma ---- - drivers/target/iscsi/iscsi_target.c | 4 ++-- - include/linux/cpumask.h | 1 + - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index a237f1cf9bd6..e00365a0538f 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -3593,8 +3593,8 @@ void iscsit_thread_get_cpumask(struct iscsi_conn *conn) - * iSCSI connection's RX/TX threads will be scheduled to - * execute upon. - */ -- ord = conn->bitmap_id % cpumask_weight(cpu_online_mask); -- for_each_online_cpu(cpu) { -+ ord = conn->bitmap_id % cpumask_weight(cpu_kthread_mask); -+ for_each_kthread_cpu(cpu) { - if (ord-- == 0) { - cpumask_set_cpu(cpu, conn->conn_cpumask); - return; -diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h -index 8fcc67ea3d8c..b24159c028ac 100644 ---- a/include/linux/cpumask.h -+++ b/include/linux/cpumask.h -@@ -820,6 +820,7 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); - #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) - #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) - #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) -+#define for_each_kthread_cpu(cpu) for_each_cpu((cpu), cpu_kthread_mask) - - /* Wrappers for arch boot code to manipulate normally-constant masks */ - void init_cpu_present(const struct cpumask *src); --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch b/kernel-rt/centos/patches/0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch deleted file mode 100644 index 202ddafd..00000000 --- a/kernel-rt/centos/patches/0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2a32d5bc7e385fbf40f22cc413354e17a24d4de9 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sun, 10 Oct 2021 18:56:26 -0700 -Subject: [PATCH] scsi: smartpqi: Enable sas_address sysfs for SATA device - type. - -We met the issue DM complains that it can't find the disk specified -in the deployment config file after we updated the Linux kernel to 5.10. -The error is "failed to find disk for path /dev/disk/by-path/ -pci-0000:3b:00.0-sas-0x31402ec001d92983-lun-0" - -This happens because device type SATA is excluded from being -processed with the function pqi_is_device_with_sas_address. -which causes all SATA type disk drives to appear the same, having -zeroes in the lun name. /dev/disk/by-path/ -pci-0000:3b:00.0-sas-0x0000000000000000-lun-0 - -We can add type SA_DEVICE_TYPE_SATA to class device_with_sas_address, -since it will also get the sas_address from wwid. and works transparently -with the old kernel without gaps. - -Signed-off-by: Jiping Ma ---- - drivers/scsi/smartpqi/smartpqi_init.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c -index ecb2af3f43ca..df16e0a27a41 100644 ---- a/drivers/scsi/smartpqi/smartpqi_init.c -+++ b/drivers/scsi/smartpqi/smartpqi_init.c -@@ -2101,6 +2101,7 @@ static inline void pqi_mask_device(u8 *scsi3addr) - static inline bool pqi_is_device_with_sas_address(struct pqi_scsi_dev *device) - { - switch (device->device_type) { -+ case SA_DEVICE_TYPE_SATA: - case SA_DEVICE_TYPE_SAS: - case SA_DEVICE_TYPE_EXPANDER_SMP: - case SA_DEVICE_TYPE_SES: --- -2.31.1 - diff --git a/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch b/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch deleted file mode 100644 index 6040c81d..00000000 --- a/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 6039b821dbe26c7708537e07276316dca36c1c0f Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 9 Sep 2021 04:56:46 -0400 -Subject: [PATCH] workqueue: Affine rescuer threads and unbound wqs - -This commit ensures that workqueue rescuer threads are affined to the -platform CPUs specified by the "kthread_cpus" kernel argument. Prior to -this commit, rescuer threads could be bound to any CPU. Rescuer threads -are described in "kernel/workqueue.c" as follows: - -"Regular work processing on a pool may block trying to create a new -worker which uses GFP_KERNEL allocation which has slight chance of -developing into deadlock if some works currently on the same queue -need to be processed to satisfy the GFP_KERNEL allocation. This is -the problem rescuer solves. - -When such condition is possible, the pool summons rescuers of all -workqueues which have works queued on the pool and let them process -those works so that forward progress can be guaranteed." - -This commit also affines unbound workqueues to the platform CPUs instead -of the housekeeping CPUs, because the latter can be a superset of the -former. - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - kernel/workqueue.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 1a4151c6faa6..3e3bd8d75f3c 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -4242,7 +4242,7 @@ static int init_rescuer(struct workqueue_struct *wq) - } - - wq->rescuer = rescuer; -- kthread_bind_mask(rescuer->task, cpu_possible_mask); -+ kthread_bind_mask(rescuer->task, cpu_kthread_mask); - wake_up_process(rescuer->task); - - return 0; -@@ -5941,13 +5941,12 @@ static void __init wq_numa_init(void) - void __init workqueue_init_early(void) - { - int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL }; -- int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; - int i, cpu; - - BUILD_BUG_ON(__alignof__(struct pool_workqueue) < __alignof__(long long)); - - BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL)); -- cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(hk_flags)); -+ cpumask_copy(wq_unbound_cpumask, cpu_kthread_mask); - - pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC); - --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0015-Revert-scsi-sd-Inline-sd_probe_part2.patch b/kernel-rt/centos/patches/0015-Revert-scsi-sd-Inline-sd_probe_part2.patch deleted file mode 100644 index b5fb9260..00000000 --- a/kernel-rt/centos/patches/0015-Revert-scsi-sd-Inline-sd_probe_part2.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 42f1ccc21f873a27c125a4e1aa3cb70a2336aa14 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Wed, 8 Dec 2021 17:49:56 -0800 -Subject: [PATCH] Revert "scsi: sd: Inline sd_probe_part2()" - -This reverts commit 82a54da641f3cacfa31db36fc58a5e903f804c22. - -Merge conflicts were encountered when reverting this commit, which -inlines sd_probe_part2() into sd_probe(). However, the inlined parts -of sd_probe_part2() have since been modified. To avoid a difference -in behaviour, the updated code was relocated to sd_probe_part2(). - -The inlined code has been modified as follows since the inlining -happened: -The following code was added - if (sdp->rpm_autosuspend) { - pm_runtime_set_autosuspend_delay(dev, - sdp->host->hostt->rpm_autosuspend_delay); - } -between the following line - blk_pm_runtime_init(sdp->request_queue, dev); -and the following line - device_add_disk(dev, gd, NULL); - -In addition, init_opal_dev() is now passed the pointer "sdkp" -instead of "sdp" as the first argument. This commit ensures that -these two changes were accounted for when reverting the inlining -of sd_probe_part2(). - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - drivers/scsi/sd.c | 111 ++++++++++++++++++++++++++-------------------- - 1 file changed, 63 insertions(+), 48 deletions(-) - -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index 56e291708587..d1d27516fc6a 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -3364,6 +3364,68 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) - return 0; - } - -+static void sd_probe_part2(struct scsi_disk *sdkp) -+{ -+ struct scsi_device *sdp; -+ struct gendisk *gd; -+ u32 index; -+ struct device *dev; -+ -+ sdp = sdkp->device; -+ gd = sdkp->disk; -+ index = sdkp->index; -+ dev = &sdp->sdev_gendev; -+ -+ gd->major = sd_major((index & 0xf0) >> 4); -+ gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); -+ -+ gd->fops = &sd_fops; -+ gd->private_data = &sdkp->driver; -+ gd->queue = sdkp->device->request_queue; -+ -+ /* defaults, until the device tells us otherwise */ -+ sdp->sector_size = 512; -+ sdkp->capacity = 0; -+ sdkp->media_present = 1; -+ sdkp->write_prot = 0; -+ sdkp->cache_override = 0; -+ sdkp->WCE = 0; -+ sdkp->RCD = 0; -+ sdkp->ATO = 0; -+ sdkp->first_scan = 1; -+ sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; -+ -+ sd_revalidate_disk(gd); -+ -+ gd->flags = GENHD_FL_EXT_DEVT; -+ if (sdp->removable) { -+ gd->flags |= GENHD_FL_REMOVABLE; -+ gd->events |= DISK_EVENT_MEDIA_CHANGE; -+ gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT; -+ } -+ -+ blk_pm_runtime_init(sdp->request_queue, dev); -+ if (sdp->rpm_autosuspend) { -+ pm_runtime_set_autosuspend_delay(dev, -+ sdp->host->hostt->rpm_autosuspend_delay); -+ } -+ device_add_disk(dev, gd, NULL); -+ if (sdkp->capacity) -+ sd_dif_config_host(sdkp); -+ -+ sd_revalidate_disk(gd); -+ -+ if (sdkp->security) { -+ sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit); -+ if (sdkp->opal_dev) -+ sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); -+ } -+ -+ sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", -+ sdp->removable ? "removable " : ""); -+ scsi_autopm_put_device(sdp); -+} -+ - /** - * sd_probe - called during driver initialization and whenever a - * new scsi device is attached to the system. It is called once -@@ -3455,54 +3517,7 @@ static int sd_probe(struct device *dev) - - dev_set_drvdata(dev, sdkp); - -- gd->major = sd_major((index & 0xf0) >> 4); -- gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); -- -- gd->fops = &sd_fops; -- gd->private_data = &sdkp->driver; -- gd->queue = sdkp->device->request_queue; -- -- /* defaults, until the device tells us otherwise */ -- sdp->sector_size = 512; -- sdkp->capacity = 0; -- sdkp->media_present = 1; -- sdkp->write_prot = 0; -- sdkp->cache_override = 0; -- sdkp->WCE = 0; -- sdkp->RCD = 0; -- sdkp->ATO = 0; -- sdkp->first_scan = 1; -- sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; -- -- sd_revalidate_disk(gd); -- -- gd->flags = GENHD_FL_EXT_DEVT; -- if (sdp->removable) { -- gd->flags |= GENHD_FL_REMOVABLE; -- gd->events |= DISK_EVENT_MEDIA_CHANGE; -- gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT; -- } -- -- blk_pm_runtime_init(sdp->request_queue, dev); -- if (sdp->rpm_autosuspend) { -- pm_runtime_set_autosuspend_delay(dev, -- sdp->host->hostt->rpm_autosuspend_delay); -- } -- device_add_disk(dev, gd, NULL); -- if (sdkp->capacity) -- sd_dif_config_host(sdkp); -- -- sd_revalidate_disk(gd); -- -- if (sdkp->security) { -- sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit); -- if (sdkp->opal_dev) -- sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); -- } -- -- sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", -- sdp->removable ? "removable " : ""); -- scsi_autopm_put_device(sdp); -+ sd_probe_part2(sdkp); - - return 0; - --- -2.31.1 - diff --git a/kernel-rt/centos/patches/0016-Revert-commit-f049cf1a7b.patch b/kernel-rt/centos/patches/0016-Revert-commit-f049cf1a7b.patch deleted file mode 100644 index 55e6ccaa..00000000 --- a/kernel-rt/centos/patches/0016-Revert-commit-f049cf1a7b.patch +++ /dev/null @@ -1,135 +0,0 @@ -From b5dad6e67f9704968ca7d4daf1715667cddafa3d Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Wed, 8 Dec 2021 18:34:59 -0800 -Subject: [PATCH 2/2] Revert commit f049cf1a7b - -commit f049cf1a7b "scsi: sd: Rely on the driver core for asynchronous -probing" - -This reverts commit f049cf1a7b6737c75884247c3f6383ef104d255a, -and it is a clean revert, there is not any conflict. - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - drivers/scsi/scsi.c | 12 +++++++++--- - drivers/scsi/scsi_pm.c | 6 +++++- - drivers/scsi/scsi_priv.h | 1 + - drivers/scsi/sd.c | 12 +++++++++--- - 4 files changed, 24 insertions(+), 7 deletions(-) - -diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c -index 24619c3bebd5..3080292a16cd 100644 ---- a/drivers/scsi/scsi.c -+++ b/drivers/scsi/scsi.c -@@ -86,10 +86,15 @@ unsigned int scsi_logging_level; - EXPORT_SYMBOL(scsi_logging_level); - #endif - -+/* sd, scsi core and power management need to coordinate flushing async actions */ -+ASYNC_DOMAIN(scsi_sd_probe_domain); -+EXPORT_SYMBOL(scsi_sd_probe_domain); -+ - /* -- * Domain for asynchronous system resume operations. It is marked 'exclusive' -- * to avoid being included in the async_synchronize_full() that is invoked by -- * dpm_resume(). -+ * Separate domain (from scsi_sd_probe_domain) to maximize the benefit of -+ * asynchronous system resume operations. It is marked 'exclusive' to avoid -+ * being included in the async_synchronize_full() that is invoked by -+ * dpm_resume() - */ - ASYNC_DOMAIN_EXCLUSIVE(scsi_sd_pm_domain); - EXPORT_SYMBOL(scsi_sd_pm_domain); -@@ -799,6 +804,7 @@ static void __exit exit_scsi(void) - scsi_exit_devinfo(); - scsi_exit_procfs(); - scsi_exit_queue(); -+ async_unregister_domain(&scsi_sd_probe_domain); - } - - subsys_initcall(init_scsi); -diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c -index 3717eea37ecb..b3d71b516213 100644 ---- a/drivers/scsi/scsi_pm.c -+++ b/drivers/scsi/scsi_pm.c -@@ -175,7 +175,11 @@ static int scsi_bus_resume_common(struct device *dev, - - static int scsi_bus_prepare(struct device *dev) - { -- if (scsi_is_host_device(dev)) { -+ if (scsi_is_sdev_device(dev)) { -+ /* sd probing uses async_schedule. Wait until it finishes. */ -+ async_synchronize_full_domain(&scsi_sd_probe_domain); -+ -+ } else if (scsi_is_host_device(dev)) { - /* Wait until async scanning is finished */ - scsi_complete_async_scans(); - } -diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h -index 180636d54982..c43456f0870c 100644 ---- a/drivers/scsi/scsi_priv.h -+++ b/drivers/scsi/scsi_priv.h -@@ -172,6 +172,7 @@ static inline void scsi_autopm_put_host(struct Scsi_Host *h) {} - #endif /* CONFIG_PM */ - - extern struct async_domain scsi_sd_pm_domain; -+extern struct async_domain scsi_sd_probe_domain; - - /* scsi_dh.c */ - #ifdef CONFIG_SCSI_DH -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index 2e22ee4501e7..e6c70475f084 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -616,7 +616,6 @@ static struct scsi_driver sd_template = { - .name = "sd", - .owner = THIS_MODULE, - .probe = sd_probe, -- .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .remove = sd_remove, - .shutdown = sd_shutdown, - .pm = &sd_pm_ops, -@@ -3364,8 +3363,12 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) - return 0; - } - --static void sd_probe_part2(struct scsi_disk *sdkp) -+/* -+ * The asynchronous part of sd_probe -+ */ -+static void sd_probe_async(void *data, async_cookie_t cookie) - { -+ struct scsi_disk *sdkp = data; - struct scsi_device *sdp; - struct gendisk *gd; - u32 index; -@@ -3424,6 +3427,7 @@ static void sd_probe_part2(struct scsi_disk *sdkp) - sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", - sdp->removable ? "removable " : ""); - scsi_autopm_put_device(sdp); -+ put_device(&sdkp->dev); - } - - /** -@@ -3517,7 +3521,8 @@ static int sd_probe(struct device *dev) - - dev_set_drvdata(dev, sdkp); - -- sd_probe_part2(sdkp); -+ get_device(&sdkp->dev); /* prevent release before async_schedule */ -+ async_schedule_domain(sd_probe_async, sdkp, &scsi_sd_probe_domain); - - return 0; - -@@ -3554,6 +3559,7 @@ static int sd_remove(struct device *dev) - scsi_autopm_get_device(sdkp->device); - - async_synchronize_full_domain(&scsi_sd_pm_domain); -+ async_synchronize_full_domain(&scsi_sd_probe_domain); - device_del(&sdkp->dev); - del_gendisk(sdkp->disk); - sd_shutdown(dev); --- -2.31.1 - diff --git a/kernel-rt/centos/patches/0017-genirq-Export-affinity-setter-for-modules.patch b/kernel-rt/centos/patches/0017-genirq-Export-affinity-setter-for-modules.patch deleted file mode 100644 index 8a8bd275..00000000 --- a/kernel-rt/centos/patches/0017-genirq-Export-affinity-setter-for-modules.patch +++ /dev/null @@ -1,124 +0,0 @@ -From f53c29e1392a5f67bc937227417bd786e7594e22 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Tue, 18 May 2021 11:17:26 +0200 -Subject: [PATCH] genirq: Export affinity setter for modules - -Perf modules abuse irq_set_affinity_hint() to set the affinity of system -PMU interrupts just because irq_set_affinity() was not exported. - -The fact that irq_set_affinity_hint() actually sets the affinity is a -non-documented side effect and the name is clearly saying it's a hint. - -To clean this up, export the real affinity setter. - -Signed-off-by: Thomas Gleixner -Acked-by: Mark Rutland -Link: https://lore.kernel.org/r/20210518093117.968251441@linutronix.de -(cherry picked from commit 4d80d6ca5d77fde9880da8466e5b64f250e5bf82) -[mvb: Adjust context for a function that does not exist in v5.10.] -Signed-off-by: M. Vefa Bicakci ---- - include/linux/interrupt.h | 35 ++--------------------------------- - kernel/irq/manage.c | 33 ++++++++++++++++++++++++++++++++- - 2 files changed, 34 insertions(+), 34 deletions(-) - -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index 7545a2f18560..10319f8da486 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -314,39 +314,8 @@ struct irq_affinity_desc { - - extern cpumask_var_t irq_default_affinity; - --/* Internal implementation. Use the helpers below */ --extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask, -- bool force); -- --/** -- * irq_set_affinity - Set the irq affinity of a given irq -- * @irq: Interrupt to set affinity -- * @cpumask: cpumask -- * -- * Fails if cpumask does not contain an online CPU -- */ --static inline int --irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) --{ -- return __irq_set_affinity(irq, cpumask, false); --} -- --/** -- * irq_force_affinity - Force the irq affinity of a given irq -- * @irq: Interrupt to set affinity -- * @cpumask: cpumask -- * -- * Same as irq_set_affinity, but without checking the mask against -- * online cpus. -- * -- * Solely for low level cpu hotplug code, where we need to make per -- * cpu interrupts affine before the cpu becomes online. -- */ --static inline int --irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) --{ -- return __irq_set_affinity(irq, cpumask, true); --} -+extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); -+extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask); - - extern int irq_can_set_affinity(unsigned int irq); - extern int irq_select_affinity(unsigned int irq); -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index 84a120d3abef..d7974de65659 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -371,7 +371,8 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, - return ret; - } - --int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) -+static int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, -+ bool force) - { - struct irq_desc *desc = irq_to_desc(irq); - unsigned long flags; -@@ -386,6 +387,36 @@ int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) - return ret; - } - -+/** -+ * irq_set_affinity - Set the irq affinity of a given irq -+ * @irq: Interrupt to set affinity -+ * @cpumask: cpumask -+ * -+ * Fails if cpumask does not contain an online CPU -+ */ -+int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) -+{ -+ return __irq_set_affinity(irq, cpumask, false); -+} -+EXPORT_SYMBOL_GPL(irq_set_affinity); -+ -+/** -+ * irq_force_affinity - Force the irq affinity of a given irq -+ * @irq: Interrupt to set affinity -+ * @cpumask: cpumask -+ * -+ * Same as irq_set_affinity, but without checking the mask against -+ * online cpus. -+ * -+ * Solely for low level cpu hotplug code, where we need to make per -+ * cpu interrupts affine before the cpu becomes online. -+ */ -+int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) -+{ -+ return __irq_set_affinity(irq, cpumask, true); -+} -+EXPORT_SYMBOL_GPL(irq_force_affinity); -+ - int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) - { - unsigned long flags; --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0018-genirq-Provide-new-interfaces-for-affinity-hints.patch b/kernel-rt/centos/patches/0018-genirq-Provide-new-interfaces-for-affinity-hints.patch deleted file mode 100644 index cf3337f1..00000000 --- a/kernel-rt/centos/patches/0018-genirq-Provide-new-interfaces-for-affinity-hints.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 65d6ca9e8f41d14239e3e7618126f65df9982f92 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Fri, 3 Sep 2021 11:24:17 -0400 -Subject: [PATCH] genirq: Provide new interfaces for affinity hints - -The discussion about removing the side effect of irq_set_affinity_hint() of -actually applying the cpumask (if not NULL) as affinity to the interrupt, -unearthed a few unpleasantries: - - 1) The modular perf drivers rely on the current behaviour for the very - wrong reasons. - - 2) While none of the other drivers prevents user space from changing - the affinity, a cursorily inspection shows that there are at least - expectations in some drivers. - - #1 needs to be cleaned up anyway, so that's not a problem - - #2 might result in subtle regressions especially when irqbalanced (which - nowadays ignores the affinity hint) is disabled. - -Provide new interfaces: - - irq_update_affinity_hint() - Only sets the affinity hint pointer - irq_set_affinity_and_hint() - Set the pointer and apply the affinity to - the interrupt - -Make irq_set_affinity_hint() a wrapper around irq_apply_affinity_hint() and -document it to be phased out. - -Signed-off-by: Thomas Gleixner -Signed-off-by: Nitesh Narayan Lal -Signed-off-by: Thomas Gleixner -Reviewed-by: Ming Lei -Link: https://lore.kernel.org/r/20210501021832.743094-1-jesse.brandeburg@intel.com -Link: https://lore.kernel.org/r/20210903152430.244937-2-nitesh@redhat.com -(cherry picked from commit 65c7cdedeb3026fabcc967a7aae2f755ad4d0783) -[mvb: Adapt to v5.10 by resolving a minor merge conflict.] -Signed-off-by: M. Vefa Bicakci ---- - include/linux/interrupt.h | 52 ++++++++++++++++++++++++++++++++++++++- - kernel/irq/manage.c | 8 +++--- - 2 files changed, 55 insertions(+), 5 deletions(-) - -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index 10319f8da486..c1520fa7e843 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -320,7 +320,45 @@ extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask); - extern int irq_can_set_affinity(unsigned int irq); - extern int irq_select_affinity(unsigned int irq); - --extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); -+extern int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, -+ bool setaffinity); -+ -+/** -+ * irq_update_affinity_hint - Update the affinity hint -+ * @irq: Interrupt to update -+ * @m: cpumask pointer (NULL to clear the hint) -+ * -+ * Updates the affinity hint, but does not change the affinity of the interrupt. -+ */ -+static inline int -+irq_update_affinity_hint(unsigned int irq, const struct cpumask *m) -+{ -+ return __irq_apply_affinity_hint(irq, m, false); -+} -+ -+/** -+ * irq_set_affinity_and_hint - Update the affinity hint and apply the provided -+ * cpumask to the interrupt -+ * @irq: Interrupt to update -+ * @m: cpumask pointer (NULL to clear the hint) -+ * -+ * Updates the affinity hint and if @m is not NULL it applies it as the -+ * affinity of that interrupt. -+ */ -+static inline int -+irq_set_affinity_and_hint(unsigned int irq, const struct cpumask *m) -+{ -+ return __irq_apply_affinity_hint(irq, m, true); -+} -+ -+/* -+ * Deprecated. Use irq_update_affinity_hint() or irq_set_affinity_and_hint() -+ * instead. -+ */ -+static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) -+{ -+ return irq_set_affinity_and_hint(irq, m); -+} - - extern int - irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); -@@ -350,6 +388,18 @@ static inline int irq_can_set_affinity(unsigned int irq) - - static inline int irq_select_affinity(unsigned int irq) { return 0; } - -+static inline int irq_update_affinity_hint(unsigned int irq, -+ const struct cpumask *m) -+{ -+ return -EINVAL; -+} -+ -+static inline int irq_set_affinity_and_hint(unsigned int irq, -+ const struct cpumask *m) -+{ -+ return -EINVAL; -+} -+ - static inline int irq_set_affinity_hint(unsigned int irq, - const struct cpumask *m) - { -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index d7974de65659..836e7111b584 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -417,7 +417,8 @@ int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) - } - EXPORT_SYMBOL_GPL(irq_force_affinity); - --int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) -+int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, -+ bool setaffinity) - { - unsigned long flags; - struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); -@@ -426,12 +427,11 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) - return -EINVAL; - desc->affinity_hint = m; - irq_put_desc_unlock(desc, flags); -- /* set the initial affinity to prevent every interrupt being on CPU0 */ -- if (m) -+ if (m && setaffinity) - __irq_set_affinity(irq, m, false); - return 0; - } --EXPORT_SYMBOL_GPL(irq_set_affinity_hint); -+EXPORT_SYMBOL_GPL(__irq_apply_affinity_hint); - - static void irq_affinity_notify(struct work_struct *work) - { --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch b/kernel-rt/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch deleted file mode 100644 index 0cfd17cd..00000000 --- a/kernel-rt/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ec3682a03a0be93ec7e6c8706ab89846cfad4232 Mon Sep 17 00:00:00 2001 -From: Nitesh Narayan Lal -Date: Fri, 3 Sep 2021 11:24:25 -0400 -Subject: [PATCH] ixgbe: Use irq_update_affinity_hint() - -The driver uses irq_set_affinity_hint() to update the affinity_hint mask -that is consumed by the userspace to distribute the interrupts. However, -under the hood irq_set_affinity_hint() also applies the provided cpumask -(if not NULL) as the affinity for the given interrupt which is an -undocumented side effect. - -To remove this side effect irq_set_affinity_hint() has been marked -as deprecated and new interfaces have been introduced. Hence, replace the -irq_set_affinity_hint() with the new interface irq_update_affinity_hint() -that only updates the affinity_hint pointer. - -Signed-off-by: Nitesh Narayan Lal -Signed-off-by: Thomas Gleixner -Acked-by: Jesse Brandeburg -Link: https://lore.kernel.org/r/20210903152430.244937-10-nitesh@redhat.com -(cherry picked from commit cc493264c01d055742a34cfbaecaffb258dcc58c) -Signed-off-by: M. Vefa Bicakci ---- - drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -index ffe322136c58..fe10776d8479 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -@@ -3250,8 +3250,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) - /* If Flow Director is enabled, set interrupt affinity */ - if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { - /* assign the mask for this irq */ -- irq_set_affinity_hint(entry->vector, -- &q_vector->affinity_mask); -+ irq_update_affinity_hint(entry->vector, -+ &q_vector->affinity_mask); - } - } - -@@ -3267,8 +3267,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) - free_queue_irqs: - while (vector) { - vector--; -- irq_set_affinity_hint(adapter->msix_entries[vector].vector, -- NULL); -+ irq_update_affinity_hint(adapter->msix_entries[vector].vector, -+ NULL); - free_irq(adapter->msix_entries[vector].vector, - adapter->q_vector[vector]); - } -@@ -3401,7 +3401,7 @@ static void ixgbe_free_irq(struct ixgbe_adapter *adapter) - continue; - - /* clear the affinity_mask in the IRQ descriptor */ -- irq_set_affinity_hint(entry->vector, NULL); -+ irq_update_affinity_hint(entry->vector, NULL); - - free_irq(entry->vector, q_vector); - } --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0020-Add-auxiliary-bus-support.patch b/kernel-rt/centos/patches/0020-Add-auxiliary-bus-support.patch deleted file mode 100644 index f781be1c..00000000 --- a/kernel-rt/centos/patches/0020-Add-auxiliary-bus-support.patch +++ /dev/null @@ -1,743 +0,0 @@ -From f7fadaaf14372fcc39555b1e3a1a0efa62472dfd Mon Sep 17 00:00:00 2001 -From: Dave Ertman -Date: Wed, 2 Dec 2020 16:54:24 -0800 -Subject: [PATCH] Add auxiliary bus support - -Add support for the Auxiliary Bus, auxiliary_device and auxiliary_driver. -It enables drivers to create an auxiliary_device and bind an -auxiliary_driver to it. - -The bus supports probe/remove shutdown and suspend/resume callbacks. -Each auxiliary_device has a unique string based id; driver binds to -an auxiliary_device based on this id through the bus. - -Co-developed-by: Kiran Patil -Co-developed-by: Ranjani Sridharan -Co-developed-by: Fred Oh -Co-developed-by: Leon Romanovsky -Signed-off-by: Kiran Patil -Signed-off-by: Ranjani Sridharan -Signed-off-by: Fred Oh -Signed-off-by: Leon Romanovsky -Signed-off-by: Dave Ertman -Reviewed-by: Pierre-Louis Bossart -Reviewed-by: Shiraz Saleem -Reviewed-by: Parav Pandit -Reviewed-by: Dan Williams -Reviewed-by: Martin Habets -Link: https://lore.kernel.org/r/20201113161859.1775473-2-david.m.ertman@intel.com -Signed-off-by: Dan Williams -Link: https://lore.kernel.org/r/160695681289.505290.8978295443574440604.stgit@dwillia2-desk3.amr.corp.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 7de3697e9cbd4bd3d62bafa249d57990e1b8f294) -Signed-off-by: M. Vefa Bicakci ---- - Documentation/driver-api/auxiliary_bus.rst | 234 ++++++++++++++++++ - Documentation/driver-api/index.rst | 1 + - drivers/base/Kconfig | 3 + - drivers/base/Makefile | 1 + - drivers/base/auxiliary.c | 268 +++++++++++++++++++++ - include/linux/auxiliary_bus.h | 78 ++++++ - include/linux/mod_devicetable.h | 8 + - scripts/mod/devicetable-offsets.c | 3 + - scripts/mod/file2alias.c | 8 + - 9 files changed, 604 insertions(+) - create mode 100644 Documentation/driver-api/auxiliary_bus.rst - create mode 100644 drivers/base/auxiliary.c - create mode 100644 include/linux/auxiliary_bus.h - -diff --git a/Documentation/driver-api/auxiliary_bus.rst b/Documentation/driver-api/auxiliary_bus.rst -new file mode 100644 -index 000000000000..5dd7804631ef ---- /dev/null -+++ b/Documentation/driver-api/auxiliary_bus.rst -@@ -0,0 +1,234 @@ -+.. SPDX-License-Identifier: GPL-2.0-only -+ -+============= -+Auxiliary Bus -+============= -+ -+In some subsystems, the functionality of the core device (PCI/ACPI/other) is -+too complex for a single device to be managed by a monolithic driver -+(e.g. Sound Open Firmware), multiple devices might implement a common -+intersection of functionality (e.g. NICs + RDMA), or a driver may want to -+export an interface for another subsystem to drive (e.g. SIOV Physical Function -+export Virtual Function management). A split of the functinoality into child- -+devices representing sub-domains of functionality makes it possible to -+compartmentalize, layer, and distribute domain-specific concerns via a Linux -+device-driver model. -+ -+An example for this kind of requirement is the audio subsystem where a single -+IP is handling multiple entities such as HDMI, Soundwire, local devices such as -+mics/speakers etc. The split for the core's functionality can be arbitrary or -+be defined by the DSP firmware topology and include hooks for test/debug. This -+allows for the audio core device to be minimal and focused on hardware-specific -+control and communication. -+ -+Each auxiliary_device represents a part of its parent functionality. The -+generic behavior can be extended and specialized as needed by encapsulating an -+auxiliary_device within other domain-specific structures and the use of .ops -+callbacks. Devices on the auxiliary bus do not share any structures and the use -+of a communication channel with the parent is domain-specific. -+ -+Note that ops are intended as a way to augment instance behavior within a class -+of auxiliary devices, it is not the mechanism for exporting common -+infrastructure from the parent. Consider EXPORT_SYMBOL_NS() to convey -+infrastructure from the parent module to the auxiliary module(s). -+ -+ -+When Should the Auxiliary Bus Be Used -+===================================== -+ -+The auxiliary bus is to be used when a driver and one or more kernel modules, -+who share a common header file with the driver, need a mechanism to connect and -+provide access to a shared object allocated by the auxiliary_device's -+registering driver. The registering driver for the auxiliary_device(s) and the -+kernel module(s) registering auxiliary_drivers can be from the same subsystem, -+or from multiple subsystems. -+ -+The emphasis here is on a common generic interface that keeps subsystem -+customization out of the bus infrastructure. -+ -+One example is a PCI network device that is RDMA-capable and exports a child -+device to be driven by an auxiliary_driver in the RDMA subsystem. The PCI -+driver allocates and registers an auxiliary_device for each physical -+function on the NIC. The RDMA driver registers an auxiliary_driver that claims -+each of these auxiliary_devices. This conveys data/ops published by the parent -+PCI device/driver to the RDMA auxiliary_driver. -+ -+Another use case is for the PCI device to be split out into multiple sub -+functions. For each sub function an auxiliary_device is created. A PCI sub -+function driver binds to such devices that creates its own one or more class -+devices. A PCI sub function auxiliary device is likely to be contained in a -+struct with additional attributes such as user defined sub function number and -+optional attributes such as resources and a link to the parent device. These -+attributes could be used by systemd/udev; and hence should be initialized -+before a driver binds to an auxiliary_device. -+ -+A key requirement for utilizing the auxiliary bus is that there is no -+dependency on a physical bus, device, register accesses or regmap support. -+These individual devices split from the core cannot live on the platform bus as -+they are not physical devices that are controlled by DT/ACPI. The same -+argument applies for not using MFD in this scenario as MFD relies on individual -+function devices being physical devices. -+ -+Auxiliary Device -+================ -+ -+An auxiliary_device represents a part of its parent device's functionality. It -+is given a name that, combined with the registering drivers KBUILD_MODNAME, -+creates a match_name that is used for driver binding, and an id that combined -+with the match_name provide a unique name to register with the bus subsystem. -+ -+Registering an auxiliary_device is a two-step process. First call -+auxiliary_device_init(), which checks several aspects of the auxiliary_device -+struct and performs a device_initialize(). After this step completes, any -+error state must have a call to auxiliary_device_uninit() in its resolution path. -+The second step in registering an auxiliary_device is to perform a call to -+auxiliary_device_add(), which sets the name of the device and add the device to -+the bus. -+ -+Unregistering an auxiliary_device is also a two-step process to mirror the -+register process. First call auxiliary_device_delete(), then call -+auxiliary_device_uninit(). -+ -+.. code-block:: c -+ -+ struct auxiliary_device { -+ struct device dev; -+ const char *name; -+ u32 id; -+ }; -+ -+If two auxiliary_devices both with a match_name "mod.foo" are registered onto -+the bus, they must have unique id values (e.g. "x" and "y") so that the -+registered devices names are "mod.foo.x" and "mod.foo.y". If match_name + id -+are not unique, then the device_add fails and generates an error message. -+ -+The auxiliary_device.dev.type.release or auxiliary_device.dev.release must be -+populated with a non-NULL pointer to successfully register the auxiliary_device. -+ -+The auxiliary_device.dev.parent must also be populated. -+ -+Auxiliary Device Memory Model and Lifespan -+------------------------------------------ -+ -+The registering driver is the entity that allocates memory for the -+auxiliary_device and register it on the auxiliary bus. It is important to note -+that, as opposed to the platform bus, the registering driver is wholly -+responsible for the management for the memory used for the driver object. -+ -+A parent object, defined in the shared header file, contains the -+auxiliary_device. It also contains a pointer to the shared object(s), which -+also is defined in the shared header. Both the parent object and the shared -+object(s) are allocated by the registering driver. This layout allows the -+auxiliary_driver's registering module to perform a container_of() call to go -+from the pointer to the auxiliary_device, that is passed during the call to the -+auxiliary_driver's probe function, up to the parent object, and then have -+access to the shared object(s). -+ -+The memory for the auxiliary_device is freed only in its release() callback -+flow as defined by its registering driver. -+ -+The memory for the shared object(s) must have a lifespan equal to, or greater -+than, the lifespan of the memory for the auxiliary_device. The auxiliary_driver -+should only consider that this shared object is valid as long as the -+auxiliary_device is still registered on the auxiliary bus. It is up to the -+registering driver to manage (e.g. free or keep available) the memory for the -+shared object beyond the life of the auxiliary_device. -+ -+The registering driver must unregister all auxiliary devices before its own -+driver.remove() is completed. -+ -+Auxiliary Drivers -+================= -+ -+Auxiliary drivers follow the standard driver model convention, where -+discovery/enumeration is handled by the core, and drivers -+provide probe() and remove() methods. They support power management -+and shutdown notifications using the standard conventions. -+ -+.. code-block:: c -+ -+ struct auxiliary_driver { -+ int (*probe)(struct auxiliary_device *, -+ const struct auxiliary_device_id *id); -+ int (*remove)(struct auxiliary_device *); -+ void (*shutdown)(struct auxiliary_device *); -+ int (*suspend)(struct auxiliary_device *, pm_message_t); -+ int (*resume)(struct auxiliary_device *); -+ struct device_driver driver; -+ const struct auxiliary_device_id *id_table; -+ }; -+ -+Auxiliary drivers register themselves with the bus by calling -+auxiliary_driver_register(). The id_table contains the match_names of auxiliary -+devices that a driver can bind with. -+ -+Example Usage -+============= -+ -+Auxiliary devices are created and registered by a subsystem-level core device -+that needs to break up its functionality into smaller fragments. One way to -+extend the scope of an auxiliary_device is to encapsulate it within a domain- -+pecific structure defined by the parent device. This structure contains the -+auxiliary_device and any associated shared data/callbacks needed to establish -+the connection with the parent. -+ -+An example is: -+ -+.. code-block:: c -+ -+ struct foo { -+ struct auxiliary_device auxdev; -+ void (*connect)(struct auxiliary_device *auxdev); -+ void (*disconnect)(struct auxiliary_device *auxdev); -+ void *data; -+ }; -+ -+The parent device then registers the auxiliary_device by calling -+auxiliary_device_init(), and then auxiliary_device_add(), with the pointer to -+the auxdev member of the above structure. The parent provides a name for the -+auxiliary_device that, combined with the parent's KBUILD_MODNAME, creates a -+match_name that is be used for matching and binding with a driver. -+ -+Whenever an auxiliary_driver is registered, based on the match_name, the -+auxiliary_driver's probe() is invoked for the matching devices. The -+auxiliary_driver can also be encapsulated inside custom drivers that make the -+core device's functionality extensible by adding additional domain-specific ops -+as follows: -+ -+.. code-block:: c -+ -+ struct my_ops { -+ void (*send)(struct auxiliary_device *auxdev); -+ void (*receive)(struct auxiliary_device *auxdev); -+ }; -+ -+ -+ struct my_driver { -+ struct auxiliary_driver auxiliary_drv; -+ const struct my_ops ops; -+ }; -+ -+An example of this type of usage is: -+ -+.. code-block:: c -+ -+ const struct auxiliary_device_id my_auxiliary_id_table[] = { -+ { .name = "foo_mod.foo_dev" }, -+ { }, -+ }; -+ -+ const struct my_ops my_custom_ops = { -+ .send = my_tx, -+ .receive = my_rx, -+ }; -+ -+ const struct my_driver my_drv = { -+ .auxiliary_drv = { -+ .name = "myauxiliarydrv", -+ .id_table = my_auxiliary_id_table, -+ .probe = my_probe, -+ .remove = my_remove, -+ .shutdown = my_shutdown, -+ }, -+ .ops = my_custom_ops, -+ }; -diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst -index f357f3eb400c..86759a74b7f1 100644 ---- a/Documentation/driver-api/index.rst -+++ b/Documentation/driver-api/index.rst -@@ -72,6 +72,7 @@ available subsections can be seen below. - thermal/index - fpga/index - acpi/index -+ auxiliary_bus - backlight/lp855x-driver.rst - connector - console -diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig -index 8d7001712062..040be48ce046 100644 ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -1,6 +1,9 @@ - # SPDX-License-Identifier: GPL-2.0 - menu "Generic Driver Options" - -+config AUXILIARY_BUS -+ bool -+ - config UEVENT_HELPER - bool "Support for uevent helper" - help -diff --git a/drivers/base/Makefile b/drivers/base/Makefile -index 41369fc7004f..5e7bf9669a81 100644 ---- a/drivers/base/Makefile -+++ b/drivers/base/Makefile -@@ -7,6 +7,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ - attribute_container.o transport_class.o \ - topology.o container.o property.o cacheinfo.o \ - swnode.o -+obj-$(CONFIG_AUXILIARY_BUS) += auxiliary.o - obj-$(CONFIG_DEVTMPFS) += devtmpfs.o - obj-y += power/ - obj-$(CONFIG_ISA_BUS_API) += isa.o -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -new file mode 100644 -index 000000000000..ef2af417438b ---- /dev/null -+++ b/drivers/base/auxiliary.c -@@ -0,0 +1,268 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Copyright (c) 2019-2020 Intel Corporation -+ * -+ * Please see Documentation/driver-api/auxiliary_bus.rst for more information. -+ */ -+ -+#define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id, -+ const struct auxiliary_device *auxdev) -+{ -+ for (; id->name[0]; id++) { -+ const char *p = strrchr(dev_name(&auxdev->dev), '.'); -+ int match_size; -+ -+ if (!p) -+ continue; -+ match_size = p - dev_name(&auxdev->dev); -+ -+ /* use dev_name(&auxdev->dev) prefix before last '.' char to match to */ -+ if (strlen(id->name) == match_size && -+ !strncmp(dev_name(&auxdev->dev), id->name, match_size)) -+ return id; -+ } -+ return NULL; -+} -+ -+static int auxiliary_match(struct device *dev, struct device_driver *drv) -+{ -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv); -+ -+ return !!auxiliary_match_id(auxdrv->id_table, auxdev); -+} -+ -+static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) -+{ -+ const char *name, *p; -+ -+ name = dev_name(dev); -+ p = strrchr(name, '.'); -+ -+ return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, (int)(p - name), -+ name); -+} -+ -+static const struct dev_pm_ops auxiliary_dev_pm_ops = { -+ SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend, pm_generic_runtime_resume, NULL) -+ SET_SYSTEM_SLEEP_PM_OPS(pm_generic_suspend, pm_generic_resume) -+}; -+ -+static int auxiliary_bus_probe(struct device *dev) -+{ -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ int ret; -+ -+ ret = dev_pm_domain_attach(dev, true); -+ if (ret) { -+ dev_warn(dev, "Failed to attach to PM Domain : %d\n", ret); -+ return ret; -+ } -+ -+ ret = auxdrv->probe(auxdev, auxiliary_match_id(auxdrv->id_table, auxdev)); -+ if (ret) -+ dev_pm_domain_detach(dev, true); -+ -+ return ret; -+} -+ -+static int auxiliary_bus_remove(struct device *dev) -+{ -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ int ret = 0; -+ -+ if (auxdrv->remove) -+ ret = auxdrv->remove(auxdev); -+ dev_pm_domain_detach(dev, true); -+ -+ return ret; -+} -+ -+static void auxiliary_bus_shutdown(struct device *dev) -+{ -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ -+ if (auxdrv->shutdown) -+ auxdrv->shutdown(auxdev); -+} -+ -+static struct bus_type auxiliary_bus_type = { -+ .name = "auxiliary", -+ .probe = auxiliary_bus_probe, -+ .remove = auxiliary_bus_remove, -+ .shutdown = auxiliary_bus_shutdown, -+ .match = auxiliary_match, -+ .uevent = auxiliary_uevent, -+ .pm = &auxiliary_dev_pm_ops, -+}; -+ -+/** -+ * auxiliary_device_init - check auxiliary_device and initialize -+ * @auxdev: auxiliary device struct -+ * -+ * This is the first step in the two-step process to register an auxiliary_device. -+ * -+ * When this function returns an error code, then the device_initialize will *not* have -+ * been performed, and the caller will be responsible to free any memory allocated for the -+ * auxiliary_device in the error path directly. -+ * -+ * It returns 0 on success. On success, the device_initialize has been performed. After this -+ * point any error unwinding will need to include a call to auxiliary_device_uninit(). -+ * In this post-initialize error scenario, a call to the device's .release callback will be -+ * triggered, and all memory clean-up is expected to be handled there. -+ */ -+int auxiliary_device_init(struct auxiliary_device *auxdev) -+{ -+ struct device *dev = &auxdev->dev; -+ -+ if (!dev->parent) { -+ pr_err("auxiliary_device has a NULL dev->parent\n"); -+ return -EINVAL; -+ } -+ -+ if (!auxdev->name) { -+ pr_err("auxiliary_device has a NULL name\n"); -+ return -EINVAL; -+ } -+ -+ dev->bus = &auxiliary_bus_type; -+ device_initialize(&auxdev->dev); -+ return 0; -+} -+EXPORT_SYMBOL_GPL(auxiliary_device_init); -+ -+/** -+ * __auxiliary_device_add - add an auxiliary bus device -+ * @auxdev: auxiliary bus device to add to the bus -+ * @modname: name of the parent device's driver module -+ * -+ * This is the second step in the two-step process to register an auxiliary_device. -+ * -+ * This function must be called after a successful call to auxiliary_device_init(), which -+ * will perform the device_initialize. This means that if this returns an error code, then a -+ * call to auxiliary_device_uninit() must be performed so that the .release callback will -+ * be triggered to free the memory associated with the auxiliary_device. -+ * -+ * The expectation is that users will call the "auxiliary_device_add" macro so that the caller's -+ * KBUILD_MODNAME is automatically inserted for the modname parameter. Only if a user requires -+ * a custom name would this version be called directly. -+ */ -+int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname) -+{ -+ struct device *dev = &auxdev->dev; -+ int ret; -+ -+ if (!modname) { -+ pr_err("auxiliary device modname is NULL\n"); -+ return -EINVAL; -+ } -+ -+ ret = dev_set_name(dev, "%s.%s.%d", modname, auxdev->name, auxdev->id); -+ if (ret) { -+ pr_err("auxiliary device dev_set_name failed: %d\n", ret); -+ return ret; -+ } -+ -+ ret = device_add(dev); -+ if (ret) -+ dev_err(dev, "adding auxiliary device failed!: %d\n", ret); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(__auxiliary_device_add); -+ -+/** -+ * auxiliary_find_device - auxiliary device iterator for locating a particular device. -+ * @start: Device to begin with -+ * @data: Data to pass to match function -+ * @match: Callback function to check device -+ * -+ * This function returns a reference to a device that is 'found' -+ * for later use, as determined by the @match callback. -+ * -+ * The callback should return 0 if the device doesn't match and non-zero -+ * if it does. If the callback returns non-zero, this function will -+ * return to the caller and not iterate over any more devices. -+ */ -+struct auxiliary_device * -+auxiliary_find_device(struct device *start, const void *data, -+ int (*match)(struct device *dev, const void *data)) -+{ -+ struct device *dev; -+ -+ dev = bus_find_device(&auxiliary_bus_type, start, data, match); -+ if (!dev) -+ return NULL; -+ -+ return to_auxiliary_dev(dev); -+} -+EXPORT_SYMBOL_GPL(auxiliary_find_device); -+ -+/** -+ * __auxiliary_driver_register - register a driver for auxiliary bus devices -+ * @auxdrv: auxiliary_driver structure -+ * @owner: owning module/driver -+ * @modname: KBUILD_MODNAME for parent driver -+ */ -+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, -+ const char *modname) -+{ -+ if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) -+ return -EINVAL; -+ -+ if (auxdrv->name) -+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, auxdrv->name); -+ else -+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s", modname); -+ if (!auxdrv->driver.name) -+ return -ENOMEM; -+ -+ auxdrv->driver.owner = owner; -+ auxdrv->driver.bus = &auxiliary_bus_type; -+ auxdrv->driver.mod_name = modname; -+ -+ return driver_register(&auxdrv->driver); -+} -+EXPORT_SYMBOL_GPL(__auxiliary_driver_register); -+ -+/** -+ * auxiliary_driver_unregister - unregister a driver -+ * @auxdrv: auxiliary_driver structure -+ */ -+void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv) -+{ -+ driver_unregister(&auxdrv->driver); -+ kfree(auxdrv->driver.name); -+} -+EXPORT_SYMBOL_GPL(auxiliary_driver_unregister); -+ -+static int __init auxiliary_bus_init(void) -+{ -+ return bus_register(&auxiliary_bus_type); -+} -+ -+static void __exit auxiliary_bus_exit(void) -+{ -+ bus_unregister(&auxiliary_bus_type); -+} -+ -+module_init(auxiliary_bus_init); -+module_exit(auxiliary_bus_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Auxiliary Bus"); -+MODULE_AUTHOR("David Ertman "); -+MODULE_AUTHOR("Kiran Patil "); -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -new file mode 100644 -index 000000000000..282fbf7bf9af ---- /dev/null -+++ b/include/linux/auxiliary_bus.h -@@ -0,0 +1,78 @@ -+/* SPDX-License-Identifier: GPL-2.0-only */ -+/* -+ * Copyright (c) 2019-2020 Intel Corporation -+ * -+ * Please see Documentation/driver-api/auxiliary_bus.rst for more information. -+ */ -+ -+#ifndef _AUXILIARY_BUS_H_ -+#define _AUXILIARY_BUS_H_ -+ -+#include -+#include -+#include -+ -+struct auxiliary_device { -+ struct device dev; -+ const char *name; -+ u32 id; -+}; -+ -+struct auxiliary_driver { -+ int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id); -+ int (*remove)(struct auxiliary_device *auxdev); -+ void (*shutdown)(struct auxiliary_device *auxdev); -+ int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state); -+ int (*resume)(struct auxiliary_device *auxdev); -+ const char *name; -+ struct device_driver driver; -+ const struct auxiliary_device_id *id_table; -+}; -+ -+static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev) -+{ -+ return container_of(dev, struct auxiliary_device, dev); -+} -+ -+static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv) -+{ -+ return container_of(drv, struct auxiliary_driver, driver); -+} -+ -+int auxiliary_device_init(struct auxiliary_device *auxdev); -+int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname); -+#define auxiliary_device_add(auxdev) __auxiliary_device_add(auxdev, KBUILD_MODNAME) -+ -+static inline void auxiliary_device_uninit(struct auxiliary_device *auxdev) -+{ -+ put_device(&auxdev->dev); -+} -+ -+static inline void auxiliary_device_delete(struct auxiliary_device *auxdev) -+{ -+ device_del(&auxdev->dev); -+} -+ -+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, -+ const char *modname); -+#define auxiliary_driver_register(auxdrv) \ -+ __auxiliary_driver_register(auxdrv, THIS_MODULE, KBUILD_MODNAME) -+ -+void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv); -+ -+/** -+ * module_auxiliary_driver() - Helper macro for registering an auxiliary driver -+ * @__auxiliary_driver: auxiliary driver struct -+ * -+ * Helper macro for auxiliary drivers which do not do anything special in -+ * module init/exit. This eliminates a lot of boilerplate. Each module may only -+ * use this macro once, and calling it replaces module_init() and module_exit() -+ */ -+#define module_auxiliary_driver(__auxiliary_driver) \ -+ module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister) -+ -+struct auxiliary_device * -+auxiliary_find_device(struct device *start, const void *data, -+ int (*match)(struct device *dev, const void *data)); -+ -+#endif /* _AUXILIARY_BUS_H_ */ -diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h -index 5b08a473cdba..c425290b21e2 100644 ---- a/include/linux/mod_devicetable.h -+++ b/include/linux/mod_devicetable.h -@@ -838,4 +838,12 @@ struct mhi_device_id { - kernel_ulong_t driver_data; - }; - -+#define AUXILIARY_NAME_SIZE 32 -+#define AUXILIARY_MODULE_PREFIX "auxiliary:" -+ -+struct auxiliary_device_id { -+ char name[AUXILIARY_NAME_SIZE]; -+ kernel_ulong_t driver_data; -+}; -+ - #endif /* LINUX_MOD_DEVICETABLE_H */ -diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c -index 27007c18e754..e377f52dbfa3 100644 ---- a/scripts/mod/devicetable-offsets.c -+++ b/scripts/mod/devicetable-offsets.c -@@ -243,5 +243,8 @@ int main(void) - DEVID(mhi_device_id); - DEVID_FIELD(mhi_device_id, chan); - -+ DEVID(auxiliary_device_id); -+ DEVID_FIELD(auxiliary_device_id, name); -+ - return 0; - } -diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c -index 2417dd1dee33..fb4827027536 100644 ---- a/scripts/mod/file2alias.c -+++ b/scripts/mod/file2alias.c -@@ -1364,6 +1364,13 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias) - { - DEF_FIELD_ADDR(symval, mhi_device_id, chan); - sprintf(alias, MHI_DEVICE_MODALIAS_FMT, *chan); -+ return 1; -+} -+ -+static int do_auxiliary_entry(const char *filename, void *symval, char *alias) -+{ -+ DEF_FIELD_ADDR(symval, auxiliary_device_id, name); -+ sprintf(alias, AUXILIARY_MODULE_PREFIX "%s", *name); - - return 1; - } -@@ -1442,6 +1449,7 @@ static const struct devtable devtable[] = { - {"tee", SIZE_tee_client_device_id, do_tee_entry}, - {"wmi", SIZE_wmi_device_id, do_wmi_entry}, - {"mhi", SIZE_mhi_device_id, do_mhi_entry}, -+ {"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry}, - }; - - /* Create MODULE_ALIAS() statements. --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch b/kernel-rt/centos/patches/0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch deleted file mode 100644 index 3f65f9e7..00000000 --- a/kernel-rt/centos/patches/0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch +++ /dev/null @@ -1,54 +0,0 @@ -From e691ecf482fc75f7ed09aac3fa58436b56d5393b Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman -Date: Fri, 4 Dec 2020 12:43:47 +0100 -Subject: [PATCH] driver core: auxiliary bus: move slab.h from include file - -No need to include slab.h in include/linux/auxiliary_bus.h, as it is not -needed there. Move it to drivers/base/auxiliary.c instead. - -Cc: Dan Williams -Cc: Dave Ertman -Cc: Fred Oh -Cc: Kiran Patil -Cc: Leon Romanovsky -Cc: Martin Habets -Cc: Parav Pandit -Cc: Pierre-Louis Bossart -Cc: Ranjani Sridharan -Cc: Shiraz Saleem -Link: https://lore.kernel.org/r/X8og8xi3WkoYXet9@kroah.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 7bbb79ff5f7499e0c5d65987458410e8099207d8) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 1 + - include/linux/auxiliary_bus.h | 1 - - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index ef2af417438b..eca36d6284d0 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -9,6 +9,7 @@ - - #include - #include -+#include - #include - #include - #include -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -index 282fbf7bf9af..3580743d0e8d 100644 ---- a/include/linux/auxiliary_bus.h -+++ b/include/linux/auxiliary_bus.h -@@ -10,7 +10,6 @@ - - #include - #include --#include - - struct auxiliary_device { - struct device dev; --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0022-driver-core-auxiliary-bus-make-remove-function-retur.patch b/kernel-rt/centos/patches/0022-driver-core-auxiliary-bus-make-remove-function-retur.patch deleted file mode 100644 index d5ba51d4..00000000 --- a/kernel-rt/centos/patches/0022-driver-core-auxiliary-bus-make-remove-function-retur.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 3dd9d97b9329c10548b0376307bdda8e23310fa9 Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman -Date: Fri, 4 Dec 2020 12:44:07 +0100 -Subject: [PATCH] driver core: auxiliary bus: make remove function return void - -There's an effort to move the remove() callback in the driver core to -not return an int, as nothing can be done if this function fails. To -make that effort easier, make the aux bus remove function void to start -with so that no users have to be changed sometime in the future. - -Cc: Dan Williams -Cc: Dave Ertman -Cc: Fred Oh -Cc: Kiran Patil -Cc: Leon Romanovsky -Cc: Martin Habets -Cc: Parav Pandit -Cc: Pierre-Louis Bossart -Cc: Ranjani Sridharan -Cc: Shiraz Saleem -Link: https://lore.kernel.org/r/X8ohB1ks1NK7kPop@kroah.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 8142a46c50d2dd8160c42284e1044eed3bec0d18) -Signed-off-by: M. Vefa Bicakci ---- - Documentation/driver-api/auxiliary_bus.rst | 2 +- - drivers/base/auxiliary.c | 5 ++--- - include/linux/auxiliary_bus.h | 2 +- - 3 files changed, 4 insertions(+), 5 deletions(-) - -diff --git a/Documentation/driver-api/auxiliary_bus.rst b/Documentation/driver-api/auxiliary_bus.rst -index 5dd7804631ef..2312506b0674 100644 ---- a/Documentation/driver-api/auxiliary_bus.rst -+++ b/Documentation/driver-api/auxiliary_bus.rst -@@ -150,7 +150,7 @@ and shutdown notifications using the standard conventions. - struct auxiliary_driver { - int (*probe)(struct auxiliary_device *, - const struct auxiliary_device_id *id); -- int (*remove)(struct auxiliary_device *); -+ void (*remove)(struct auxiliary_device *); - void (*shutdown)(struct auxiliary_device *); - int (*suspend)(struct auxiliary_device *, pm_message_t); - int (*resume)(struct auxiliary_device *); -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index eca36d6284d0..c44e85802b43 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -82,13 +82,12 @@ static int auxiliary_bus_remove(struct device *dev) - { - struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); - struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -- int ret = 0; - - if (auxdrv->remove) -- ret = auxdrv->remove(auxdev); -+ auxdrv->remove(auxdev); - dev_pm_domain_detach(dev, true); - -- return ret; -+ return 0; - } - - static void auxiliary_bus_shutdown(struct device *dev) -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -index 3580743d0e8d..d67b17606210 100644 ---- a/include/linux/auxiliary_bus.h -+++ b/include/linux/auxiliary_bus.h -@@ -19,7 +19,7 @@ struct auxiliary_device { - - struct auxiliary_driver { - int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id); -- int (*remove)(struct auxiliary_device *auxdev); -+ void (*remove)(struct auxiliary_device *auxdev); - void (*shutdown)(struct auxiliary_device *auxdev); - int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state); - int (*resume)(struct auxiliary_device *auxdev); --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch b/kernel-rt/centos/patches/0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch deleted file mode 100644 index 8a6dc27c..00000000 --- a/kernel-rt/centos/patches/0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 140f2cd50e9a10afcf10e76719d2810c6f8354a2 Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman -Date: Fri, 4 Dec 2020 12:49:28 +0100 -Subject: [PATCH] driver core: auxiliary bus: minor coding style tweaks - -For some reason, the original aux bus patch had some really long lines -in a few places, probably due to it being a very long-lived patch in -development by many different people. Fix that up so that the two files -all have the same length lines and function formatting styles. - -Cc: Dan Williams -Cc: Dave Ertman -Cc: Fred Oh -Cc: Kiran Patil -Cc: Leon Romanovsky -Cc: Martin Habets -Cc: Parav Pandit -Cc: Pierre-Louis Bossart -Cc: Ranjani Sridharan -Cc: Shiraz Saleem -Link: https://lore.kernel.org/r/X8oiSFTpYHw1xE/o@kroah.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 0d2bf11a6b3e275a526b8d42d8d4a3a6067cf953) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 58 +++++++++++++++++++---------------- - include/linux/auxiliary_bus.h | 6 ++-- - 2 files changed, 35 insertions(+), 29 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index c44e85802b43..f303daadf843 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -50,8 +50,8 @@ static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) - name = dev_name(dev); - p = strrchr(name, '.'); - -- return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, (int)(p - name), -- name); -+ return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, -+ (int)(p - name), name); - } - - static const struct dev_pm_ops auxiliary_dev_pm_ops = { -@@ -113,16 +113,18 @@ static struct bus_type auxiliary_bus_type = { - * auxiliary_device_init - check auxiliary_device and initialize - * @auxdev: auxiliary device struct - * -- * This is the first step in the two-step process to register an auxiliary_device. -+ * This is the first step in the two-step process to register an -+ * auxiliary_device. - * -- * When this function returns an error code, then the device_initialize will *not* have -- * been performed, and the caller will be responsible to free any memory allocated for the -- * auxiliary_device in the error path directly. -+ * When this function returns an error code, then the device_initialize will -+ * *not* have been performed, and the caller will be responsible to free any -+ * memory allocated for the auxiliary_device in the error path directly. - * -- * It returns 0 on success. On success, the device_initialize has been performed. After this -- * point any error unwinding will need to include a call to auxiliary_device_uninit(). -- * In this post-initialize error scenario, a call to the device's .release callback will be -- * triggered, and all memory clean-up is expected to be handled there. -+ * It returns 0 on success. On success, the device_initialize has been -+ * performed. After this point any error unwinding will need to include a call -+ * to auxiliary_device_uninit(). In this post-initialize error scenario, a call -+ * to the device's .release callback will be triggered, and all memory clean-up -+ * is expected to be handled there. - */ - int auxiliary_device_init(struct auxiliary_device *auxdev) - { -@@ -149,16 +151,19 @@ EXPORT_SYMBOL_GPL(auxiliary_device_init); - * @auxdev: auxiliary bus device to add to the bus - * @modname: name of the parent device's driver module - * -- * This is the second step in the two-step process to register an auxiliary_device. -+ * This is the second step in the two-step process to register an -+ * auxiliary_device. - * -- * This function must be called after a successful call to auxiliary_device_init(), which -- * will perform the device_initialize. This means that if this returns an error code, then a -- * call to auxiliary_device_uninit() must be performed so that the .release callback will -- * be triggered to free the memory associated with the auxiliary_device. -+ * This function must be called after a successful call to -+ * auxiliary_device_init(), which will perform the device_initialize. This -+ * means that if this returns an error code, then a call to -+ * auxiliary_device_uninit() must be performed so that the .release callback -+ * will be triggered to free the memory associated with the auxiliary_device. - * -- * The expectation is that users will call the "auxiliary_device_add" macro so that the caller's -- * KBUILD_MODNAME is automatically inserted for the modname parameter. Only if a user requires -- * a custom name would this version be called directly. -+ * The expectation is that users will call the "auxiliary_device_add" macro so -+ * that the caller's KBUILD_MODNAME is automatically inserted for the modname -+ * parameter. Only if a user requires a custom name would this version be -+ * called directly. - */ - int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname) - { -@@ -166,13 +171,13 @@ int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname) - int ret; - - if (!modname) { -- pr_err("auxiliary device modname is NULL\n"); -+ dev_err(dev, "auxiliary device modname is NULL\n"); - return -EINVAL; - } - - ret = dev_set_name(dev, "%s.%s.%d", modname, auxdev->name, auxdev->id); - if (ret) { -- pr_err("auxiliary device dev_set_name failed: %d\n", ret); -+ dev_err(dev, "auxiliary device dev_set_name failed: %d\n", ret); - return ret; - } - -@@ -197,9 +202,9 @@ EXPORT_SYMBOL_GPL(__auxiliary_device_add); - * if it does. If the callback returns non-zero, this function will - * return to the caller and not iterate over any more devices. - */ --struct auxiliary_device * --auxiliary_find_device(struct device *start, const void *data, -- int (*match)(struct device *dev, const void *data)) -+struct auxiliary_device *auxiliary_find_device(struct device *start, -+ const void *data, -+ int (*match)(struct device *dev, const void *data)) - { - struct device *dev; - -@@ -217,14 +222,15 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device); - * @owner: owning module/driver - * @modname: KBUILD_MODNAME for parent driver - */ --int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, -- const char *modname) -+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, -+ struct module *owner, const char *modname) - { - if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) - return -EINVAL; - - if (auxdrv->name) -- auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, auxdrv->name); -+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, -+ auxdrv->name); - else - auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s", modname); - if (!auxdrv->driver.name) -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -index d67b17606210..fc51d45f106b 100644 ---- a/include/linux/auxiliary_bus.h -+++ b/include/linux/auxiliary_bus.h -@@ -70,8 +70,8 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv); - #define module_auxiliary_driver(__auxiliary_driver) \ - module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister) - --struct auxiliary_device * --auxiliary_find_device(struct device *start, const void *data, -- int (*match)(struct device *dev, const void *data)); -+struct auxiliary_device *auxiliary_find_device(struct device *start, -+ const void *data, -+ int (*match)(struct device *dev, const void *data)); - - #endif /* _AUXILIARY_BUS_H_ */ --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch b/kernel-rt/centos/patches/0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch deleted file mode 100644 index dbf5502f..00000000 --- a/kernel-rt/centos/patches/0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch +++ /dev/null @@ -1,49 +0,0 @@ -From fb056562367fc8e65b4b7c7a2e0fabf4543c3533 Mon Sep 17 00:00:00 2001 -From: Dave Jiang -Date: Fri, 4 Dec 2020 09:46:49 -0700 -Subject: [PATCH] driver core: auxiliary bus: Fix auxiliary bus shutdown null - auxdrv ptr - -If the probe of the auxdrv failed, the device->driver is set to NULL. -During kernel shutdown, the bus shutdown will call auxdrv->shutdown and -cause an invalid ptr dereference. Add check to make sure device->driver is -not NULL before we proceed. - -Fixes: 7de3697e9cbd ("Add auxiliary bus support") -Cc: Dave Ertman -Signed-off-by: Dave Jiang -Reviewed-by: Dan Williams -Link: https://lore.kernel.org/r/160710040926.1889434.8840329810698403478.stgit@djiang5-desk3.ch.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 784b2c48ac12dcee27db001fb1a3c58c39380cb6) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index f303daadf843..8336535f1e11 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -92,10 +92,15 @@ static int auxiliary_bus_remove(struct device *dev) - - static void auxiliary_bus_shutdown(struct device *dev) - { -- struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -- struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ struct auxiliary_driver *auxdrv = NULL; -+ struct auxiliary_device *auxdev; -+ -+ if (dev->driver) { -+ auxdrv = to_auxiliary_drv(dev->driver); -+ auxdev = to_auxiliary_dev(dev); -+ } - -- if (auxdrv->shutdown) -+ if (auxdrv && auxdrv->shutdown) - auxdrv->shutdown(auxdev); - } - --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch b/kernel-rt/centos/patches/0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch deleted file mode 100644 index 5f32835a..00000000 --- a/kernel-rt/centos/patches/0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 4e403070ed6ea6de90ef8e645dec23751018f504 Mon Sep 17 00:00:00 2001 -From: Dave Jiang -Date: Wed, 10 Feb 2021 13:16:11 -0700 -Subject: [PATCH] driver core: auxiliary bus: Fix calling stage for auxiliary - bus init - -When the auxiliary device code is built into the kernel, it can be executed -before the auxiliary bus is registered. This causes bus->p to be not -allocated and triggers a NULL pointer dereference when the auxiliary bus -device gets added with bus_add_device(). Call the auxiliary_bus_init() -under driver_init() so the bus is initialized before devices. - -Below is the kernel splat for the bug: -[ 1.948215] BUG: kernel NULL pointer dereference, address: 0000000000000060 -[ 1.950670] #PF: supervisor read access in kernel mode -[ 1.950670] #PF: error_code(0x0000) - not-present page -[ 1.950670] PGD 0 -[ 1.950670] Oops: 0000 1 SMP NOPTI -[ 1.950670] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-intel-nextsvmtest+ #2205 -[ 1.950670] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 -[ 1.950670] RIP: 0010:bus_add_device+0x64/0x140 -[ 1.950670] Code: 00 49 8b 75 20 48 89 df e8 59 a1 ff ff 41 89 c4 85 c0 75 7b 48 8b 53 50 48 85 d2 75 03 48 8b 13 49 8b 85 a0 00 00 00 48 89 de <48> 8 -78 60 48 83 c7 18 e8 ef d9 a9 ff 41 89 c4 85 c0 75 45 48 8b -[ 1.950670] RSP: 0000:ff46032ac001baf8 EFLAGS: 00010246 -[ 1.950670] RAX: 0000000000000000 RBX: ff4597f7414aa680 RCX: 0000000000000000 -[ 1.950670] RDX: ff4597f74142bbc0 RSI: ff4597f7414aa680 RDI: ff4597f7414aa680 -[ 1.950670] RBP: ff46032ac001bb10 R08: 0000000000000044 R09: 0000000000000228 -[ 1.950670] R10: ff4597f741141b30 R11: ff4597f740182a90 R12: 0000000000000000 -[ 1.950670] R13: ffffffffa5e936c0 R14: 0000000000000000 R15: 0000000000000000 -[ 1.950670] FS: 0000000000000000(0000) GS:ff4597f7bba00000(0000) knlGS:0000000000000000 -[ 1.950670] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 -[ 1.950670] CR2: 0000000000000060 CR3: 000000002140c001 CR4: 0000000000f71ef0 -[ 1.950670] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 -[ 1.950670] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 -[ 1.950670] PKRU: 55555554 -[ 1.950670] Call Trace: -[ 1.950670] device_add+0x3ee/0x850 -[ 1.950670] __auxiliary_device_add+0x47/0x60 -[ 1.950670] idxd_pci_probe+0xf77/0x1180 -[ 1.950670] local_pci_probe+0x4a/0x90 -[ 1.950670] pci_device_probe+0xff/0x1b0 -[ 1.950670] really_probe+0x1cf/0x440 -[ 1.950670] ? rdinit_setup+0x31/0x31 -[ 1.950670] driver_probe_device+0xe8/0x150 -[ 1.950670] device_driver_attach+0x58/0x60 -[ 1.950670] __driver_attach+0x8f/0x150 -[ 1.950670] ? device_driver_attach+0x60/0x60 -[ 1.950670] ? device_driver_attach+0x60/0x60 -[ 1.950670] bus_for_each_dev+0x79/0xc0 -[ 1.950670] ? kmem_cache_alloc_trace+0x323/0x430 -[ 1.950670] driver_attach+0x1e/0x20 -[ 1.950670] bus_add_driver+0x154/0x1f0 -[ 1.950670] driver_register+0x70/0xc0 -[ 1.950670] __pci_register_driver+0x54/0x60 -[ 1.950670] idxd_init_module+0xe2/0xfc -[ 1.950670] ? idma64_platform_driver_init+0x19/0x19 -[ 1.950670] do_one_initcall+0x4a/0x1e0 -[ 1.950670] kernel_init_freeable+0x1fc/0x25c -[ 1.950670] ? rest_init+0xba/0xba -[ 1.950670] kernel_init+0xe/0x116 -[ 1.950670] ret_from_fork+0x1f/0x30 -[ 1.950670] Modules linked in: -[ 1.950670] CR2: 0000000000000060 -[ 1.950670] --[ end trace cd7d1b226d3ca901 ]-- - -Fixes: 7de3697e9cbd ("Add auxiliary bus support") -Reported-by: Jacob Pan -Reviewed-by: Dan Williams -Acked-by: Dave Ertman -Signed-off-by: Dave Jiang -Link: https://lore.kernel.org/r/20210210201611.1611074-1-dave.jiang@intel.com -Cc: stable -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 471b12c43f376d5203dbff0e91316eea11f6f4df) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 13 +++---------- - drivers/base/base.h | 5 +++++ - drivers/base/init.c | 1 + - 3 files changed, 9 insertions(+), 10 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index 8336535f1e11..d8b314e7d0fd 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include "base.h" - - static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id, - const struct auxiliary_device *auxdev) -@@ -260,19 +261,11 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv) - } - EXPORT_SYMBOL_GPL(auxiliary_driver_unregister); - --static int __init auxiliary_bus_init(void) -+void __init auxiliary_bus_init(void) - { -- return bus_register(&auxiliary_bus_type); -+ WARN_ON(bus_register(&auxiliary_bus_type)); - } - --static void __exit auxiliary_bus_exit(void) --{ -- bus_unregister(&auxiliary_bus_type); --} -- --module_init(auxiliary_bus_init); --module_exit(auxiliary_bus_exit); -- - MODULE_LICENSE("GPL v2"); - MODULE_DESCRIPTION("Auxiliary Bus"); - MODULE_AUTHOR("David Ertman "); -diff --git a/drivers/base/base.h b/drivers/base/base.h -index 91cfb8405abd..7d97447460fa 100644 ---- a/drivers/base/base.h -+++ b/drivers/base/base.h -@@ -119,6 +119,11 @@ static inline int hypervisor_init(void) { return 0; } - extern int platform_bus_init(void); - extern void cpu_dev_init(void); - extern void container_dev_init(void); -+#ifdef CONFIG_AUXILIARY_BUS -+extern void auxiliary_bus_init(void); -+#else -+static inline void auxiliary_bus_init(void) { } -+#endif - - struct kobject *virtual_device_parent(struct device *dev); - -diff --git a/drivers/base/init.c b/drivers/base/init.c -index 908e6520e804..a9f57c22fb9e 100644 ---- a/drivers/base/init.c -+++ b/drivers/base/init.c -@@ -32,6 +32,7 @@ void __init driver_init(void) - */ - of_core_init(); - platform_bus_init(); -+ auxiliary_bus_init(); - cpu_dev_init(); - memory_dev_init(); - container_dev_init(); --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch b/kernel-rt/centos/patches/0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch deleted file mode 100644 index 5d62f4d7..00000000 --- a/kernel-rt/centos/patches/0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 7739d61db7ae6d01e06f8fbc0feb089cebe84ebe Mon Sep 17 00:00:00 2001 -From: Dave Jiang -Date: Thu, 11 Feb 2021 13:21:29 -0700 -Subject: [PATCH] driver core: auxiliary bus: Remove unneeded module bits - -Remove module bits in the auxiliary bus code since the auxiliary bus -cannot be built as a module and the relevant code is not needed. - -Cc: Dave Ertman -Suggested-by: Greg Kroah-Hartman -Signed-off-by: Dave Jiang -Link: https://lore.kernel.org/r/161307488980.1896017.15627190714413338196.stgit@djiang5-desk3.ch.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit bbf44abeeabfe05a124535e6c3a9fd7d682d42bf) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index d8b314e7d0fd..adc199dfba3c 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -265,8 +265,3 @@ void __init auxiliary_bus_init(void) - { - WARN_ON(bus_register(&auxiliary_bus_type)); - } -- --MODULE_LICENSE("GPL v2"); --MODULE_DESCRIPTION("Auxiliary Bus"); --MODULE_AUTHOR("David Ertman "); --MODULE_AUTHOR("Kiran Patil "); --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch b/kernel-rt/centos/patches/0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch deleted file mode 100644 index 58e76715..00000000 --- a/kernel-rt/centos/patches/0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch +++ /dev/null @@ -1,51 +0,0 @@ -From e4a05ae5a0d7fdaf8cfe7080640ce4a6057277c4 Mon Sep 17 00:00:00 2001 -From: Peter Ujfalusi -Date: Tue, 13 Jul 2021 12:34:38 +0300 -Subject: [PATCH] driver core: auxiliary bus: Fix memory leak when - driver_register() fail - -If driver_register() returns with error we need to free the memory -allocated for auxdrv->driver.name before returning from -__auxiliary_driver_register() - -Fixes: 7de3697e9cbd4 ("Add auxiliary bus support") -Reviewed-by: Dan Williams -Cc: stable -Signed-off-by: Peter Ujfalusi -Link: https://lore.kernel.org/r/20210713093438.3173-1-peter.ujfalusi@linux.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 4afa0c22eed33cfe0c590742387f0d16f32412f3) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index adc199dfba3c..6a30264ab2ba 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -231,6 +231,8 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device); - int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, - struct module *owner, const char *modname) - { -+ int ret; -+ - if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) - return -EINVAL; - -@@ -246,7 +248,11 @@ int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, - auxdrv->driver.bus = &auxiliary_bus_type; - auxdrv->driver.mod_name = modname; - -- return driver_register(&auxdrv->driver); -+ ret = driver_register(&auxdrv->driver); -+ if (ret) -+ kfree(auxdrv->driver.name); -+ -+ return ret; - } - EXPORT_SYMBOL_GPL(__auxiliary_driver_register); - --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0028-driver-core-auxiliary-bus-Enable-by-default.patch b/kernel-rt/centos/patches/0028-driver-core-auxiliary-bus-Enable-by-default.patch deleted file mode 100644 index 48f603a1..00000000 --- a/kernel-rt/centos/patches/0028-driver-core-auxiliary-bus-Enable-by-default.patch +++ /dev/null @@ -1,38 +0,0 @@ -From ccf9728c267d16dedb1b5d0ecd4518cac435fd02 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 17 Feb 2022 14:17:58 -0500 -Subject: [PATCH] driver core: auxiliary bus: Enable by default - -This commit enables CONFIG_AUXILIARY_BUS by default. This is necessary, -because StarlingX does not enable any kernel modules that 'select' -CONFIG_AUXILIARY_BUS, which causes the kernel's build system to -automatically disable this option. - -However, StarlingX has out-of-tree users of this functionality (such as -the 'ice' and 'mlnx-ofa_kernel' out-of-tree kernel driver packages), -hence the need for this change. Prior to this commit, the aforementioned -out-of-tree kernel drivers would use their embedded/bundled copy of the -same functionality, which would cause kernel symbol conflicts at -run-time when users attempted to load both ice and mlnx-ofa_kernel -drivers. - -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig -index 040be48ce046..a18ec49b9dac 100644 ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -3,6 +3,7 @@ menu "Generic Driver Options" - - config AUXILIARY_BUS - bool -+ default y - - config UEVENT_HELPER - bool "Support for uevent helper" --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0029-Enable-CONFIG_PAGE_POOL-by-default.patch b/kernel-rt/centos/patches/0029-Enable-CONFIG_PAGE_POOL-by-default.patch deleted file mode 100644 index 867f0ecd..00000000 --- a/kernel-rt/centos/patches/0029-Enable-CONFIG_PAGE_POOL-by-default.patch +++ /dev/null @@ -1,36 +0,0 @@ -From e469e34954dc8eb27b0f2fe521e18ac2e03dad61 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 3 Feb 2022 21:34:14 -0500 -Subject: [PATCH] Enable CONFIG_PAGE_POOL by default - -CONFIG_PAGE_POOL is a "hidden" configuration option, which causes it to -be enabled only when another kernel configuration option explicitly -selects it. Specifying CONFIG_PAGE_POOL=y in .config does not have any -effect. - -Given that StarlingX disables all in-tree device drivers that explicitly -select CONFIG_PAGE_POOL, and given that at least one out-of-tree kernel -module (mlnx-ofa_kernel) requires the features made available by -CONFIG_PAGE_POOL, this commit enables the configuration option in -question by default. - -Signed-off-by: M. Vefa Bicakci ---- - net/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/net/Kconfig b/net/Kconfig -index 05b0f041f039..62443980ba6b 100644 ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -437,6 +437,7 @@ config NET_DEVLINK - - config PAGE_POOL - bool -+ default y - - config FAILOVER - tristate "Generic failover module" --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch b/kernel-rt/centos/patches/0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch deleted file mode 100644 index 210790f3..00000000 --- a/kernel-rt/centos/patches/0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch +++ /dev/null @@ -1,60 +0,0 @@ -From b1d119de793160cd63748316025b68b1b2d50f31 Mon Sep 17 00:00:00 2001 -From: Kyung Min Park -Date: Mon, 7 Dec 2020 19:34:40 -0800 -Subject: [PATCH] x86: Enumerate AVX512 FP16 CPUID feature flag - -Enumerate AVX512 Half-precision floating point (FP16) CPUID feature -flag. Compared with using FP32, using FP16 cut the number of bits -required for storage in half, reducing the exponent from 8 bits to 5, -and the mantissa from 23 bits to 10. Using FP16 also enables developers -to train and run inference on deep learning models fast when all -precision or magnitude (FP32) is not needed. - -A processor supports AVX512 FP16 if CPUID.(EAX=7,ECX=0):EDX[bit 23] -is present. The AVX512 FP16 requires AVX512BW feature be implemented -since the instructions for manipulating 32bit masks are associated with -AVX512BW. - -The only in-kernel usage of this is kvm passthrough. The CPU feature -flag is shown as "avx512_fp16" in /proc/cpuinfo. - -Signed-off-by: Kyung Min Park -Acked-by: Dave Hansen -Reviewed-by: Tony Luck -Message-Id: <20201208033441.28207-2-kyung.min.park@intel.com> -Acked-by: Borislav Petkov -Signed-off-by: Paolo Bonzini -(cherry picked from commit e1b35da5e624f8b09d2e98845c2e4c84b179d9a4) -Signed-off-by: M. Vefa Bicakci ---- - arch/x86/include/asm/cpufeatures.h | 1 + - arch/x86/kernel/cpu/cpuid-deps.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h -index 3b407f46f1a0..b5252fd26682 100644 ---- a/arch/x86/include/asm/cpufeatures.h -+++ b/arch/x86/include/asm/cpufeatures.h -@@ -374,6 +374,7 @@ - #define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */ - #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ - #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */ -+#define X86_FEATURE_AVX512_FP16 (18*32+23) /* AVX512 FP16 */ - #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ - #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ - #define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */ -diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c -index d502241995a3..42af31b64c2c 100644 ---- a/arch/x86/kernel/cpu/cpuid-deps.c -+++ b/arch/x86/kernel/cpu/cpuid-deps.c -@@ -69,6 +69,7 @@ static const struct cpuid_dep cpuid_deps[] = { - { X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC }, - { X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC }, - { X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL }, -+ { X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW }, - { X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES }, - { X86_FEATURE_PER_THREAD_MBA, X86_FEATURE_MBA }, - {} --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch b/kernel-rt/centos/patches/0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch deleted file mode 100644 index 633a1ef1..00000000 --- a/kernel-rt/centos/patches/0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 5b18cff344fcd6906469a2849eff4ba71f42c436 Mon Sep 17 00:00:00 2001 -From: Cathy Zhang -Date: Mon, 7 Dec 2020 19:34:41 -0800 -Subject: [PATCH] KVM: x86: Expose AVX512_FP16 for supported CPUID - -AVX512_FP16 is supported by Intel processors, like Sapphire Rapids. -It could gain better performance for it's faster compared to FP32 -if the precision or magnitude requirements are met. It's availability -is indicated by CPUID.(EAX=7,ECX=0):EDX[bit 23]. - -Expose it in KVM supported CPUID, then guest could make use of it; no -new registers are used, only new instructions. - -Signed-off-by: Cathy Zhang -Signed-off-by: Kyung Min Park -Acked-by: Dave Hansen -Reviewed-by: Tony Luck -Message-Id: <20201208033441.28207-3-kyung.min.park@intel.com> -Signed-off-by: Paolo Bonzini -(cherry picked from commit 2224fc9efb2d6593fbfb57287e39ba4958b188ba) -Signed-off-by: M. Vefa Bicakci ---- - arch/x86/kvm/cpuid.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c -index 41b0dc37720e..61f10169fc16 100644 ---- a/arch/x86/kvm/cpuid.c -+++ b/arch/x86/kvm/cpuid.c -@@ -418,7 +418,7 @@ void kvm_set_cpu_caps(void) - F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) | - F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES) | F(INTEL_STIBP) | - F(MD_CLEAR) | F(AVX512_VP2INTERSECT) | F(FSRM) | -- F(SERIALIZE) | F(TSXLDTRK) -+ F(SERIALIZE) | F(TSXLDTRK) | F(AVX512_FP16) - ); - - /* TSC_ADJUST and ARCH_CAPABILITIES are emulated in software. */ --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch b/kernel-rt/centos/patches/0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch deleted file mode 100644 index 3bea9ebd..00000000 --- a/kernel-rt/centos/patches/0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 766051cc00679d0451710b8837750bb4a6b73f42 Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Mon, 21 Dec 2020 09:04:54 -0300 -Subject: [PATCH] tools headers cpufeatures: Sync with the kernel sources - -To pick the changes in: - - 69372cf01290b958 ("x86/cpu: Add VM page flush MSR availablility as a CPUID feature") - e1b35da5e624f8b0 ("x86: Enumerate AVX512 FP16 CPUID feature flag") - -That causes only these 'perf bench' objects to rebuild: - - CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o - CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o - -And addresses these perf build warnings: - - Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' - diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h - -Cc: Adrian Hunter -Cc: Ian Rogers -Cc: Jiri Olsa -Cc: Kyung Min Park -Cc: Namhyung Kim -Cc: Paolo Bonzini -Cc: Tom Lendacky -Signed-off-by: Arnaldo Carvalho de Melo -(cherry picked from commit 7f3905f00a2025591a6883ee6880f928029b4d96) -[mvb: Remove X86_FEATURE_VM_PAGE_FLUSH from this commit as that CPU - feature constant is not provided by StarlingX's v5.10 baseline.] -Signed-off-by: M. Vefa Bicakci ---- - tools/arch/x86/include/asm/cpufeatures.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h -index b58730cc12e8..d7accc927691 100644 ---- a/tools/arch/x86/include/asm/cpufeatures.h -+++ b/tools/arch/x86/include/asm/cpufeatures.h -@@ -374,6 +374,7 @@ - #define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */ - #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ - #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */ -+#define X86_FEATURE_AVX512_FP16 (18*32+23) /* AVX512 FP16 */ - #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ - #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ - #define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */ --- -2.29.2 - diff --git a/kernel-rt/centos/patches/0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch b/kernel-rt/centos/patches/0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch deleted file mode 100644 index 973f8c16..00000000 --- a/kernel-rt/centos/patches/0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 547921028c785f90e52adb7f54cc2f13103934de Mon Sep 17 00:00:00 2001 -Message-Id: <547921028c785f90e52adb7f54cc2f13103934de.1665174246.git.jim.somerville@windriver.com> -From: Zqiang -Date: Mon, 15 Nov 2021 13:15:46 +0800 -Subject: [PATCH] rcu: Avoid running boost kthreads on isolated CPUs - -When the boost kthreads are created on systems with nohz_full CPUs, -the cpus_allowed_ptr is set to housekeeping_cpumask(HK_FLAG_KTHREAD). -However, when the rcu_boost_kthread_setaffinity() is called, the original -affinity will be changed and these kthreads can subsequently run on -nohz_full CPUs. This commit makes rcu_boost_kthread_setaffinity() -restrict these boost kthreads to housekeeping CPUs. - -Signed-off-by: Zqiang -Signed-off-by: Paul E. McKenney -[ commit c2cf0767e98eb4487444e5c7ebba491a866811ce upstream ] -Signed-off-by: Jim Somerville ---- - kernel/rcu/tree_plugin.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h -index 9db906dcbdac..0a18fa5d27b3 100644 ---- a/kernel/rcu/tree_plugin.h -+++ b/kernel/rcu/tree_plugin.h -@@ -1185,8 +1185,9 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) - if ((mask & leaf_node_cpu_bit(rnp, cpu)) && - cpu != outgoingcpu) - cpumask_set_cpu(cpu, cm); -+ cpumask_and(cm, cm, housekeeping_cpumask(HK_FLAG_RCU)); - if (cpumask_weight(cm) == 0) -- cpumask_setall(cm); -+ cpumask_copy(cm, housekeeping_cpumask(HK_FLAG_RCU)); - set_cpus_allowed_ptr(t, cm); - free_cpumask_var(cm); - } --- -2.25.1 - diff --git a/kernel-rt/centos/patches/0034-xfs-use-current-journal_info-for-detecting-transacti.patch b/kernel-rt/centos/patches/0034-xfs-use-current-journal_info-for-detecting-transacti.patch deleted file mode 100644 index eea1a5e7..00000000 --- a/kernel-rt/centos/patches/0034-xfs-use-current-journal_info-for-detecting-transacti.patch +++ /dev/null @@ -1,269 +0,0 @@ -From aebe2063884ef5e8a969d73d75e1086ea67d8033 Mon Sep 17 00:00:00 2001 -From: Dave Chinner -Date: Sun, 3 Jul 2022 08:04:50 +0300 -Subject: [PATCH 1/5] xfs: use current->journal_info for detecting transaction - recursion - -commit 756b1c343333a5aefcc26b0409f3fd16f72281bf upstream. - -Because the iomap code using PF_MEMALLOC_NOFS to detect transaction -recursion in XFS is just wrong. Remove it from the iomap code and -replace it with XFS specific internal checks using -current->journal_info instead. - -[djwong: This change also realigns the lifetime of NOFS flag changes to -match the incore transaction, instead of the inconsistent scheme we have -now.] - -Fixes: 9070733b4efa ("xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS") -Signed-off-by: Dave Chinner -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -Reviewed-by: Christoph Hellwig -Signed-off-by: Amir Goldstein -Acked-by: Darrick J. Wong -Signed-off-by: Greg Kroah-Hartman -[commit b261cd005ab980c4018634a849f77e036bfd4f80 from - git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git - linux-5.10.y branch] -Signed-off-by: Zhixiong Chi ---- - fs/iomap/buffered-io.c | 7 ------- - fs/xfs/libxfs/xfs_btree.c | 12 ++++++++++-- - fs/xfs/xfs_aops.c | 17 +++++++++++++++-- - fs/xfs/xfs_trans.c | 20 +++++--------------- - fs/xfs/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ - 5 files changed, 60 insertions(+), 26 deletions(-) - -diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c -index cd9f7baa5..47279fe00 100644 ---- a/fs/iomap/buffered-io.c -+++ b/fs/iomap/buffered-io.c -@@ -1459,13 +1459,6 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data) - PF_MEMALLOC)) - goto redirty; - -- /* -- * Given that we do not allow direct reclaim to call us, we should -- * never be called in a recursive filesystem reclaim context. -- */ -- if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) -- goto redirty; -- - /* - * Is this page beyond the end of the file? - * -diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c -index 2d25bab68..fe87ecd76 100644 ---- a/fs/xfs/libxfs/xfs_btree.c -+++ b/fs/xfs/libxfs/xfs_btree.c -@@ -2814,7 +2814,7 @@ xfs_btree_split_worker( - struct xfs_btree_split_args *args = container_of(work, - struct xfs_btree_split_args, work); - unsigned long pflags; -- unsigned long new_pflags = PF_MEMALLOC_NOFS; -+ unsigned long new_pflags = 0; - - /* - * we are in a transaction context here, but may also be doing work -@@ -2826,12 +2826,20 @@ xfs_btree_split_worker( - new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; - - current_set_flags_nested(&pflags, new_pflags); -+ xfs_trans_set_context(args->cur->bc_tp); - - args->result = __xfs_btree_split(args->cur, args->level, args->ptrp, - args->key, args->curp, args->stat); -- complete(args->done); - -+ xfs_trans_clear_context(args->cur->bc_tp); - current_restore_flags_nested(&pflags, new_pflags); -+ -+ /* -+ * Do not access args after complete() has run here. We don't own args -+ * and the owner may run and free args before we return here. -+ */ -+ complete(args->done); -+ - } - - /* -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 4304c6416..b4186d666 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -62,7 +62,7 @@ xfs_setfilesize_trans_alloc( - * We hand off the transaction to the completion thread now, so - * clear the flag here. - */ -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -+ xfs_trans_clear_context(tp); - return 0; - } - -@@ -125,7 +125,7 @@ xfs_setfilesize_ioend( - * thus we need to mark ourselves as being in a transaction manually. - * Similarly for freeze protection. - */ -- current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -+ xfs_trans_set_context(tp); - __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS); - - /* we abort the update if there was an IO error */ -@@ -568,6 +568,12 @@ xfs_vm_writepage( - { - struct xfs_writepage_ctx wpc = { }; - -+ if (WARN_ON_ONCE(current->journal_info)) { -+ redirty_page_for_writepage(wbc, page); -+ unlock_page(page); -+ return 0; -+ } -+ - return iomap_writepage(page, wbc, &wpc.ctx, &xfs_writeback_ops); - } - -@@ -578,6 +584,13 @@ xfs_vm_writepages( - { - struct xfs_writepage_ctx wpc = { }; - -+ /* -+ * Writing back data in a transaction context can result in recursive -+ * transactions. This is bad, so issue a warning and get out of here. -+ */ -+ if (WARN_ON_ONCE(current->journal_info)) -+ return 0; -+ - xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); - return iomap_writepages(mapping, wbc, &wpc.ctx, &xfs_writeback_ops); - } -diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c -index c94e71f74..2d7deacea 100644 ---- a/fs/xfs/xfs_trans.c -+++ b/fs/xfs/xfs_trans.c -@@ -68,6 +68,7 @@ xfs_trans_free( - xfs_extent_busy_clear(tp->t_mountp, &tp->t_busy, false); - - trace_xfs_trans_free(tp, _RET_IP_); -+ xfs_trans_clear_context(tp); - if (!(tp->t_flags & XFS_TRANS_NO_WRITECOUNT)) - sb_end_intwrite(tp->t_mountp->m_super); - xfs_trans_free_dqinfo(tp); -@@ -119,7 +120,8 @@ xfs_trans_dup( - - ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; - tp->t_rtx_res = tp->t_rtx_res_used; -- ntp->t_pflags = tp->t_pflags; -+ -+ xfs_trans_switch_context(tp, ntp); - - /* move deferred ops over to the new tp */ - xfs_defer_move(ntp, tp); -@@ -153,9 +155,6 @@ xfs_trans_reserve( - int error = 0; - bool rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; - -- /* Mark this thread as being in a transaction */ -- current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -- - /* - * Attempt to reserve the needed disk blocks by decrementing - * the number needed from the number available. This will -@@ -163,10 +162,8 @@ xfs_trans_reserve( - */ - if (blocks > 0) { - error = xfs_mod_fdblocks(mp, -((int64_t)blocks), rsvd); -- if (error != 0) { -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -+ if (error != 0) - return -ENOSPC; -- } - tp->t_blk_res += blocks; - } - -@@ -240,9 +237,6 @@ xfs_trans_reserve( - xfs_mod_fdblocks(mp, (int64_t)blocks, rsvd); - tp->t_blk_res = 0; - } -- -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -- - return error; - } - -@@ -266,6 +260,7 @@ xfs_trans_alloc( - tp = kmem_cache_zalloc(xfs_trans_zone, GFP_KERNEL | __GFP_NOFAIL); - if (!(flags & XFS_TRANS_NO_WRITECOUNT)) - sb_start_intwrite(mp->m_super); -+ xfs_trans_set_context(tp); - - /* - * Zero-reservation ("empty") transactions can't modify anything, so -@@ -878,7 +873,6 @@ __xfs_trans_commit( - - xfs_log_commit_cil(mp, tp, &commit_lsn, regrant); - -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - xfs_trans_free(tp); - - /* -@@ -910,7 +904,6 @@ __xfs_trans_commit( - xfs_log_ticket_ungrant(mp->m_log, tp->t_ticket); - tp->t_ticket = NULL; - } -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - xfs_trans_free_items(tp, !!error); - xfs_trans_free(tp); - -@@ -970,9 +963,6 @@ xfs_trans_cancel( - tp->t_ticket = NULL; - } - -- /* mark this thread as no longer being in a transaction */ -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -- - xfs_trans_free_items(tp, dirty); - xfs_trans_free(tp); - } -diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h -index 084658946..075eeade4 100644 ---- a/fs/xfs/xfs_trans.h -+++ b/fs/xfs/xfs_trans.h -@@ -268,4 +268,34 @@ xfs_trans_item_relog( - return lip->li_ops->iop_relog(lip, tp); - } - -+static inline void -+xfs_trans_set_context( -+ struct xfs_trans *tp) -+{ -+ ASSERT(current->journal_info == NULL); -+ tp->t_pflags = memalloc_nofs_save(); -+ current->journal_info = tp; -+} -+ -+static inline void -+xfs_trans_clear_context( -+ struct xfs_trans *tp) -+{ -+ if (current->journal_info == tp) { -+ memalloc_nofs_restore(tp->t_pflags); -+ current->journal_info = NULL; -+ } -+} -+ -+static inline void -+xfs_trans_switch_context( -+ struct xfs_trans *old_tp, -+ struct xfs_trans *new_tp) -+{ -+ ASSERT(current->journal_info == old_tp); -+ new_tp->t_pflags = old_tp->t_pflags; -+ old_tp->t_pflags = 0; -+ current->journal_info = new_tp; -+} -+ - #endif /* __XFS_TRANS_H__ */ --- -2.34.1 - diff --git a/kernel-rt/centos/patches/0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch b/kernel-rt/centos/patches/0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch deleted file mode 100644 index 4a50e4cb..00000000 --- a/kernel-rt/centos/patches/0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 8182ec00803085354761bbadf0287cad7eac0e2f Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:43 -0700 -Subject: [PATCH 2/5] xfs: drop submit side trans alloc for append ioends - -Per-inode ioend completion batching has a log reservation deadlock -vector between preallocated append transactions and transactions -that are acquired at completion time for other purposes (i.e., -unwritten extent conversion or COW fork remaps). For example, if the -ioend completion workqueue task executes on a batch of ioends that -are sorted such that an append ioend sits at the tail, it's possible -for the outstanding append transaction reservation to block -allocation of transactions required to process preceding ioends in -the list. - -Append ioend completion is historically the common path for on-disk -inode size updates. While file extending writes may have completed -sometime earlier, the on-disk inode size is only updated after -successful writeback completion. These transactions are preallocated -serially from writeback context to mitigate concurrency and -associated log reservation pressure across completions processed by -multi-threaded workqueue tasks. - -However, now that delalloc blocks unconditionally map to unwritten -extents at physical block allocation time, size updates via append -ioends are relatively rare. This means that inode size updates most -commonly occur as part of the preexisting completion time -transaction to convert unwritten extents. As a result, there is no -longer a strong need to preallocate size update transactions. - -Remove the preallocation of inode size update transactions to avoid -the ioend completion processing log reservation deadlock. Instead, -continue to send all potential size extending ioends to workqueue -context for completion and allocate the transaction from that -context. This ensures that no outstanding log reservation is owned -by the ioend completion worker task when it begins to process -ioends. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit 7cd3099f4925d7c15887d1940ebd65acd66100f5 upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 45 +++------------------------------------------ - 1 file changed, 3 insertions(+), 42 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index b4186d666..60943b28f 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -39,33 +39,6 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) - XFS_I(ioend->io_inode)->i_d.di_size; - } - --STATIC int --xfs_setfilesize_trans_alloc( -- struct iomap_ioend *ioend) --{ -- struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount; -- struct xfs_trans *tp; -- int error; -- -- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); -- if (error) -- return error; -- -- ioend->io_private = tp; -- -- /* -- * We may pass freeze protection with a transaction. So tell lockdep -- * we released it. -- */ -- __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS); -- /* -- * We hand off the transaction to the completion thread now, so -- * clear the flag here. -- */ -- xfs_trans_clear_context(tp); -- return 0; --} -- - /* - * Update on-disk file size now that data has been written to disk. - */ -@@ -182,12 +155,10 @@ xfs_end_ioend( - error = xfs_reflink_end_cow(ip, offset, size); - else if (ioend->io_type == IOMAP_UNWRITTEN) - error = xfs_iomap_write_unwritten(ip, offset, size, false); -- else -- ASSERT(!xfs_ioend_is_append(ioend) || ioend->io_private); - -+ if (!error && xfs_ioend_is_append(ioend)) -+ error = xfs_setfilesize(ip, ioend->io_offset, ioend->io_size); - done: -- if (ioend->io_private) -- error = xfs_setfilesize_ioend(ioend, error); - iomap_finish_ioends(ioend, error); - memalloc_nofs_restore(nofs_flag); - } -@@ -237,7 +208,7 @@ xfs_end_io( - - static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend) - { -- return ioend->io_private || -+ return xfs_ioend_is_append(ioend) || - ioend->io_type == IOMAP_UNWRITTEN || - (ioend->io_flags & IOMAP_F_SHARED); - } -@@ -250,8 +221,6 @@ xfs_end_bio( - struct xfs_inode *ip = XFS_I(ioend->io_inode); - unsigned long flags; - -- ASSERT(xfs_ioend_needs_workqueue(ioend)); -- - spin_lock_irqsave(&ip->i_ioend_lock, flags); - if (list_empty(&ip->i_ioend_list)) - WARN_ON_ONCE(!queue_work(ip->i_mount->m_unwritten_workqueue, -@@ -501,14 +470,6 @@ xfs_prepare_ioend( - ioend->io_offset, ioend->io_size); - } - -- /* Reserve log space if we might write beyond the on-disk inode size. */ -- if (!status && -- ((ioend->io_flags & IOMAP_F_SHARED) || -- ioend->io_type != IOMAP_UNWRITTEN) && -- xfs_ioend_is_append(ioend) && -- !ioend->io_private) -- status = xfs_setfilesize_trans_alloc(ioend); -- - memalloc_nofs_restore(nofs_flag); - - if (xfs_ioend_needs_workqueue(ioend)) --- -2.34.1 - diff --git a/kernel-rt/centos/patches/0036-xfs-open-code-ioend-needs-workqueue-helper.patch b/kernel-rt/centos/patches/0036-xfs-open-code-ioend-needs-workqueue-helper.patch deleted file mode 100644 index 1be641cf..00000000 --- a/kernel-rt/centos/patches/0036-xfs-open-code-ioend-needs-workqueue-helper.patch +++ /dev/null @@ -1,51 +0,0 @@ -From edbf1eb9032b84631031d9b43570e262f3461c24 Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:55 -0700 -Subject: [PATCH 3/5] xfs: open code ioend needs workqueue helper - -Open code xfs_ioend_needs_workqueue() into the only remaining -caller. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit 7adb8f14e134d5f885d47c4ccd620836235f0b7f upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 60943b28f..a74a9ead5 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -206,13 +206,6 @@ xfs_end_io( - } - } - --static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend) --{ -- return xfs_ioend_is_append(ioend) || -- ioend->io_type == IOMAP_UNWRITTEN || -- (ioend->io_flags & IOMAP_F_SHARED); --} -- - STATIC void - xfs_end_bio( - struct bio *bio) -@@ -472,7 +465,9 @@ xfs_prepare_ioend( - - memalloc_nofs_restore(nofs_flag); - -- if (xfs_ioend_needs_workqueue(ioend)) -+ /* send ioends that might require a transaction to the completion wq */ -+ if (xfs_ioend_is_append(ioend) || ioend->io_type == IOMAP_UNWRITTEN || -+ (ioend->io_flags & IOMAP_F_SHARED)) - ioend->io_bio->bi_end_io = xfs_end_bio; - return status; - } --- -2.34.1 - diff --git a/kernel-rt/centos/patches/0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch b/kernel-rt/centos/patches/0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch deleted file mode 100644 index d87b3af7..00000000 --- a/kernel-rt/centos/patches/0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 170e31793806ce5e5a9647b6340954536244518e Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:55 -0700 -Subject: [PATCH 4/5] xfs: drop unused ioend private merge and setfilesize code - -XFS no longer attaches anthing to ioend->io_private. Remove the -unnecessary ->io_private merging code. This removes the only remaining -user of xfs_setfilesize_ioend() so remove that function as well. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit 044c6449f18f174ba8d86640936add3fc7582e49 upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 46 +--------------------------------------------- - 1 file changed, 1 insertion(+), 45 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index a74a9ead5..23a9bd9ff 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -85,31 +85,6 @@ xfs_setfilesize( - return __xfs_setfilesize(ip, tp, offset, size); - } - --STATIC int --xfs_setfilesize_ioend( -- struct iomap_ioend *ioend, -- int error) --{ -- struct xfs_inode *ip = XFS_I(ioend->io_inode); -- struct xfs_trans *tp = ioend->io_private; -- -- /* -- * The transaction may have been allocated in the I/O submission thread, -- * thus we need to mark ourselves as being in a transaction manually. -- * Similarly for freeze protection. -- */ -- xfs_trans_set_context(tp); -- __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS); -- -- /* we abort the update if there was an IO error */ -- if (error) { -- xfs_trans_cancel(tp); -- return error; -- } -- -- return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size); --} -- - /* - * IO write completion. - */ -@@ -163,25 +138,6 @@ xfs_end_ioend( - memalloc_nofs_restore(nofs_flag); - } - --/* -- * If the to be merged ioend has a preallocated transaction for file -- * size updates we need to ensure the ioend it is merged into also -- * has one. If it already has one we can simply cancel the transaction -- * as it is guaranteed to be clean. -- */ --static void --xfs_ioend_merge_private( -- struct iomap_ioend *ioend, -- struct iomap_ioend *next) --{ -- if (!ioend->io_private) { -- ioend->io_private = next->io_private; -- next->io_private = NULL; -- } else { -- xfs_setfilesize_ioend(next, -ECANCELED); -- } --} -- - /* Finish all pending io completions. */ - void - xfs_end_io( -@@ -201,7 +157,7 @@ xfs_end_io( - while ((ioend = list_first_entry_or_null(&tmp, struct iomap_ioend, - io_list))) { - list_del_init(&ioend->io_list); -- iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private); -+ iomap_ioend_try_merge(ioend, &tmp, NULL); - xfs_end_ioend(ioend); - } - } --- -2.34.1 - diff --git a/kernel-rt/centos/patches/0038-xfs-drop-unnecessary-setfilesize-helper.patch b/kernel-rt/centos/patches/0038-xfs-drop-unnecessary-setfilesize-helper.patch deleted file mode 100644 index 922aa59f..00000000 --- a/kernel-rt/centos/patches/0038-xfs-drop-unnecessary-setfilesize-helper.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 2fd609b6c90a88630a50fb317473b210759b3873 Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:56 -0700 -Subject: [PATCH 5/5] xfs: drop unnecessary setfilesize helper - -xfs_setfilesize() is the only remaining caller of the internal -__xfs_setfilesize() helper. Fold them into a single function. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit e7a3d7e792a5ad50583a2e6c35e72bd2ca6096f4 upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 29 +++++++++-------------------- - 1 file changed, 9 insertions(+), 20 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 23a9bd9ff..9e32d4135 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -42,14 +42,20 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) - /* - * Update on-disk file size now that data has been written to disk. - */ --STATIC int --__xfs_setfilesize( -+int -+xfs_setfilesize( - struct xfs_inode *ip, -- struct xfs_trans *tp, - xfs_off_t offset, - size_t size) - { -+ struct xfs_mount *mp = ip->i_mount; -+ struct xfs_trans *tp; - xfs_fsize_t isize; -+ int error; -+ -+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); -+ if (error) -+ return error; - - xfs_ilock(ip, XFS_ILOCK_EXCL); - isize = xfs_new_eof(ip, offset + size); -@@ -68,23 +74,6 @@ __xfs_setfilesize( - return xfs_trans_commit(tp); - } - --int --xfs_setfilesize( -- struct xfs_inode *ip, -- xfs_off_t offset, -- size_t size) --{ -- struct xfs_mount *mp = ip->i_mount; -- struct xfs_trans *tp; -- int error; -- -- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); -- if (error) -- return error; -- -- return __xfs_setfilesize(ip, tp, offset, size); --} -- - /* - * IO write completion. - */ --- -2.34.1 - diff --git a/kernel-std/centos/build_srpm b/kernel-std/centos/build_srpm deleted file mode 100755 index 63b81754..00000000 --- a/kernel-std/centos/build_srpm +++ /dev/null @@ -1,275 +0,0 @@ -#!/bin/bash -# set -x - -# -# Copyright (c) 2018-2021 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# Refer to build-tools/default_build_srpm and modify for git repo from linux-yocto. -# - -source "$SRC_BASE/build-tools/spec-utils" -source "$SRC_BASE/build-tools/srpm-utils" - -CUR_DIR=`pwd` -BUILD_DIR="$RPMBUILD_BASE" - -if [ "x$DATA" == "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): Environment variable 'DATA' not defined." - exit 1 -fi - -srpm_source_build_data "$DATA" "$SRC_BUILD_TYPE" "$SRPM_OR_SPEC_PATH" -if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): Failed to source build data from $DATA" - exit 1 -fi - -if [ "x$PBR_VERSION" != "x" ] && [ "x$PBR_VERSION" != "xNA" ]; then - VERSION=$PBR_VERSION -fi - -if [ "x$VERSION" == "x" ]; then - for SPEC in `find $SPECS_BASE -name '*.spec' | sort -V`; do - SPEC_PATH="$SPEC" - - VERSION_DERIVED=`spec_evaluate '%{version}' "$SPEC_PATH" 2>> /dev/null` - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): '%{version}' not found in '$PKG_BASE/$SPEC_PATH'" - VERSION_DERIVED="" - fi - - if [ "x$VERSION_DERIVED" != "x" ]; then - if [ "x$VERSION" == "x" ]; then - VERSION=$VERSION_DERIVED - else - if [ "x$SRC_DIR" != "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): multiple spec files found, can't set VERSION automatically" - exit 1 - fi - fi - fi - done - - if [ "x$VERSION" == "x" ]; then - if [ -f $SRC_DIR/PKG-INFO ]; then - VERSION=$(grep '^Version:' $SRC_DIR/PKG-INFO | awk -F ': ' '{print $2}' | sed -e 's/^[[:space:]]*//') - fi - fi - - if [ "x$VERSION" != "x" ]; then - echo "Derived VERSION=$VERSION" - else - echo "ERROR: kernel build_srpm (${LINENO}): Failed to derive a good VERSION from SPEC file, and none provided." - exit 1 - fi -fi - -if [ "x$TAR_NAME" == "x" ]; then - for SPEC in `find $SPECS_BASE -name '*.spec' | sort -V`; do - SPEC_PATH="$SPEC" - - SERVICE=`spec_find_global service "$SPEC_PATH" 2>> /dev/null` - if [ $? -eq 0 ]; then - if [ "x$TAR_NAME" == "x" ]; then - TAR_NAME=$SERVICE - else - if [ "x$SRC_DIR" != "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): multiple spec files found, can't set TAR_NAME automatically" - exit 1 - fi - fi - else - NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null` - if [ $? -eq 0 ]; then - if [ "x$TAR_NAME" == "x" ]; then - TAR_NAME=$NAME - else - if [ "x$SRC_DIR" != "x" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): multiple spec files found, can't set TAR_NAME automatically" - exit 1 - fi - fi - else - echo "WARNING: kernel build_srpm (${LINENO}): 'Name' not found in '$SPEC_PATH'" - NAME="" - fi - fi - done - - if [ "x$TAR_NAME" == "x" ]; then - if [ -f $SRC_DIR/PKG-INFO ]; then - TAR_NAME=$(grep '^Name:' $SRC_DIR/PKG-INFO | awk -F ': ' '{print $2}' | sed -e 's/^[[:space:]]*//') - fi - fi - - if [ "x$TAR_NAME" != "x" ]; then - echo "Derived TAR_NAME=$TAR_NAME" - else - echo "ERROR: kernel build_srpm (${LINENO}): Failed to derive a good TAR_NAME from SPEC file, and none provided." - exit 1 - fi -fi - -if [ "x$TAR" == "x" ]; then - TAR="$TAR_NAME-$VERSION.tar.gz" -fi - -SOURCE_PATH="$BUILD_DIR/SOURCES" -TAR_PATH="$SOURCE_PATH/$TAR" -STAGING="" - -if [ "x$COPY_LIST_TO_TAR" != "x" ] || [ "x$EXCLUDE_LIST_FROM_TAR" != "x" ]; then - STAGING="$BUILD_DIR/staging" - mkdir -p $STAGING -fi - -mkdir -p "$BUILD_DIR/SRPMS" -mkdir -p "$SOURCE_PATH" - -if [ "x$SRC_DIR" == "x" -a "x$COPY_LIST" == "x" -a "$ALLOW_EMPTY_RPM" != "true" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): '$PWD/$DATA' failed to provide at least one of 'SRC_DIR' or 'COPY_LIST'" - exit 1 -fi - -if [ "x$SRC_DIR" != "x" ]; then - if [ ! -d "$SRC_DIR" ]; then - echo "ERROR: kernel build_srpm (${LINENO}): directory not found: '$SRC_DIR'" - exit 1 - fi -fi - -if [ "x$COPY_LIST" != "x" ]; then - echo "COPY_LIST: $COPY_LIST" - for p in $COPY_LIST; do - # echo "COPY_LIST: $p" - \cp -L -u -r -v $p $SOURCE_PATH - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): COPY_LIST: file not found: '$p'" - exit 1 - fi - done -fi - -if [ "x$STAGING" != "x" ]; then - \cp -L -u -r -v $SRC_DIR $STAGING - echo "COPY_LIST_TO_TAR: $COPY_LIST_TO_TAR" - for p in $COPY_LIST_TO_TAR; do - # echo "COPY_LIST_TO_TAR: $p" - \cp -L -u -r -v $p $STAGING/$SRC_DIR - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): COPY_LIST_TO_TAR: file not found: '$p'" - exit 1 - fi - done - echo "EXCLUDE_LIST_FROM_TAR: $EXCLUDE_LIST_FROM_TAR" - for p in $EXCLUDE_LIST_FROM_TAR; do - # echo "EXCLUDE_LIST_FROM_TAR: $p" - echo "rm -rf $STAGING/$SRC_DIR/$p" - \rm -rf $STAGING/$SRC_DIR/$p - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): EXCLUDE_LIST_FROM_TAR: could not remove file: '$p'" - exit 1 - fi - done - -fi - -TRANSFORM=`echo "$SRC_DIR" | sed 's/^\./\\./' | sed 's:^/::' | sed 's#^.*/\.\./##'` - -if [ "x$STAGING" != "x" ]; then - pushd $STAGING -fi - -TAR_NEEDED=0 -if [ "x$SRC_DIR" != "x" ]; then - echo "SRC_DIR=$SRC_DIR" - if [ -f $TAR_PATH ]; then - n=`find . -cnewer $TAR_PATH -and ! -path './.git*' \ - -and ! -path './.pc/*' \ - -and ! -path './patches/*' \ - -and ! -path "./$DISTRO/*" \ - -and ! -path './pbr-*.egg/*' \ - | wc -l` - if [ $n -gt 0 ]; then - TAR_NEEDED=1 - fi - else - TAR_NEEDED=1 - fi -fi - -if [ $TAR_NEEDED -gt 0 ]; then - echo "Creating tar file: $TAR_PATH ..." - echo "tar --exclude '.git*' --exclude='.pc' --exclude='patches' --exclude='$SRC_DIR/$DISTRO' --exclude='pbr-*.egg' --transform 's,^$TRANSFORM,$TAR_NAME-$VERSION,' -czf $TAR_PATH $SRC_DIR" - tar --exclude '.git*' --exclude='.pc' --exclude='patches' --exclude="$SRC_DIR/$DISTRO" --exclude='pbr-*.egg' --transform "s,^$TRANSFORM,$TAR_NAME-$VERSION," -czf "$TAR_PATH" "$SRC_DIR" - if [ $? -ne 0 ]; then - if [ "x$STAGING" != "x" ]; then - popd - fi - - echo "ERROR: kernel build_srpm (${LINENO}): failed to create tar file, cmd: tar --exclude '.git*' --exclude='.pc' --exclude='patches' --exclude="$SRC_DIR/$DISTRO" --exclude='pbr-*.egg' --transform \"s,^$TRANSFORM,$TAR_NAME-$VERSION,\" -czf '$TAR_PATH' '$SRC_DIR'" - exit 1 - fi - echo "Created tar file: $TAR_PATH" -else - echo "Tar file not needed." -fi - -if [ "x$STAGING" != "x" ]; then - popd -fi - -if [ ! -d $BUILD_DIR/SPECS ]; then - echo "Spec directory '$BUILD_DIR/SPECS' does not exist" - exit 1 -fi - -if [ $(ls -1 $BUILD_DIR/SPECS/*.spec | wc -l) -eq 0 ]; then - echo "No spec files found in spec directory '$BUILD_DIR/SPECS'" - exit 1 -fi - -for SPEC in `ls -1 $BUILD_DIR/SPECS`; do - SPEC_PATH="$BUILD_DIR/SPECS/$SPEC" - RELEASE=`spec_find_tag Release "$SPEC_PATH" 2>> /dev/null` - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): 'Release' not found in '$SPEC_PATH'" - fi - NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null` - if [ $? -ne 0 ]; then - echo "ERROR: kernel build_srpm (${LINENO}): 'Name' not found in '$SPEC_PATH'" - fi - SRPM="$NAME-$VERSION-$RELEASE.src.rpm" - SRPM_PATH="$BUILD_DIR/SRPMS/$SRPM" - - spec_validate_tis_release $SPEC_PATH - if [ $? -ne 0 ]; then - echo "TIS Validation of $SPEC_PATH failed" - exit 1 - fi - - BUILD_NEEDED=0 - if [ -f $SRPM_PATH ]; then - n=`find . -cnewer $SRPM_PATH | wc -l` - if [ $n -gt 0 ]; then - BUILD_NEEDED=1 - fi - else - BUILD_NEEDED=1 - fi - - if [ $BUILD_NEEDED -gt 0 ]; then - echo "SPEC file: $SPEC_PATH" - echo "SRPM build directory: $BUILD_DIR" - echo "TIS_PATCH_VER: $TIS_PATCH_VER" - echo "PBR_VERSION: $PBR_VERSION" - - sed -i -e "1 i%define _tis_build_type $BUILD_TYPE" $SPEC_PATH - sed -i -e "1 i%define tis_patch_ver $TIS_PATCH_VER" $SPEC_PATH - sed -i -e "1 i%define pbr_version $PBR_VERSION" $SPEC_PATH - rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --undefine=dist --define="_tis_dist .tis" - else - echo "SRPM build not needed" - fi -done diff --git a/kernel-std/centos/build_srpm.data b/kernel-std/centos/build_srpm.data deleted file mode 100644 index 44fa14be..00000000 --- a/kernel-std/centos/build_srpm.data +++ /dev/null @@ -1,15 +0,0 @@ -SRC_DIR="$STX_BASE/git/linux-yocto-std" - -COPY_LIST=" \ - $PKG_BASE/files/* \ - $PKG_BASE/centos/patches/*" -BUILD_IS_BIG=21 -BUILD_IS_SLOW=16 - -# The base branch is: v5.10/standard/base -# commit 6cf7dea05b points to v5.10.112 in linux-yocto. -TIS_BASE_SRCREV=6cf7dea05bd756513cf58c5ced8c6bf1d1f23c15 - -PKG_BASE_SRCREV=4013790c6ef43fd9f936579b0cac50b8e0c4505a -TIS_PATCH_VER=GITREVCOUNT+PKG_GITREVCOUNT - diff --git a/kernel-std/centos/kernel.spec b/kernel-std/centos/kernel.spec deleted file mode 100644 index 6aa60196..00000000 --- a/kernel-std/centos/kernel.spec +++ /dev/null @@ -1,3087 +0,0 @@ -# We have to override the new %%install behavior because, well... the kernel is special. -%global __spec_install_pre %{___build_pre} - -# this should go away soon -%define _legacy_common_support 1 - -# At the time of this writing (2019-03), RHEL8 packages use w2.xzdio -# compression for rpms (xz, level 2). -# Kernel has several large (hundreds of mbytes) rpms, they take ~5 mins -# to compress by single-threaded xz. Switch to threaded compression, -# and from level 2 to 3 to keep compressed sizes close to "w2" results. -# -# NB: if default compression in /usr/lib/rpm/redhat/macros ever changes, -# this one might need tweaking (e.g. if default changes to w3.xzdio, -# change below to w4T.xzdio): -# -# This is disabled on i686 as it triggers oom errors - -%ifnarch i686 -%define _binary_payload w3T.xzdio -%endif - -Summary: The Linux kernel - -# For a kernel released for public testing, released_kernel should be 1. -# For internal testing builds during development, it should be 0. -# For rawhide and/or a kernel built from an rc or git snapshot, -# released_kernel should be 0. -# For a stable, released kernel, released_kernel should be 1. -%global released_kernel 1 - -%if 0%{?fedora} -%define secure_boot_arch x86_64 -%else -%define secure_boot_arch x86_64 aarch64 -%endif - -# Signing for secure boot authentication -%ifarch %{secure_boot_arch} -%global signkernel 1 -%else -%global signkernel 0 -%endif - -# Sign modules on all arches -%global signmodules 1 - -# Compress modules only for architectures that build modules -%ifarch noarch -%global zipmodules 0 -%else -%global zipmodules 1 -%endif - -%if %{zipmodules} -%global zipsed -e 's/\.ko$/\.ko.xz/' -# for parallel xz processes, replace with 1 to go back to single process -%global zcpu `nproc --all` -%endif - -%if 0%{?centos} -%define dist .el7 -%endif - -# This is the STX patch release -%define buildid .%{tis_patch_ver}.tis - -# baserelease defines which build revision of this kernel version we're -# building. We used to call this fedora_build, but the magical name -# baserelease is matched by the rpmdev-bumpspec tool, which you should use. -# -# We used to have some extra magic weirdness to bump this automatically, -# but now we don't. Just use: rpmdev-bumpspec -c 'comment for changelog' -# When changing base_sublevel below or going from rc to a final kernel, -# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec). -# scripts/rebase.sh should be made to do that for you, actually. -# -# NOTE: baserelease must be > 0 or bad things will happen if you switch -# to a released kernel (released version will be < rc version) -# -# For non-released -rc kernels, this will be appended after the rcX and -# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3" -# -%global baserelease 200 -%global fedora_build %{baserelease} - -# base_sublevel is the kernel version we're starting with and patching -# on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base, -# which yields a base_sublevel of 0. -%define base_sublevel 10 - -## If this is a released kernel ## -%if 0%{?released_kernel} - -# Do we have a -stable update to apply? -%define stable_update 112 -# Set rpm version accordingly -%if 0%{?stable_update} -%define stablerev %{stable_update} -%define stable_base %{stable_update} -%endif -%define rpmversion 5.%{base_sublevel}.%{stable_update} - -## The not-released-kernel case ## -%else -# The next upstream release sublevel (base_sublevel+1) -%define upstream_sublevel %(echo $((%{base_sublevel} + 1))) -# The rc snapshot level -%global rcrev 0 -# The git snapshot level -%define gitrev 0 -# Set rpm version accordingly -%define rpmversion 5.%{upstream_sublevel}.0 -%endif -# Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below. - -# What parts do we want to build? We must build at least one kernel. -# These are the kernels that are built IF the architecture allows it. -# All should default to 1 (enabled) and be flipped to 0 (disabled) -# by later arch-specific checks. - -# The following build options are enabled by default. -# Use either --without in your rpmbuild command or force values -# to 0 in here to disable them. -# -# standard kernel -%define with_up %{?_without_up: 0} %{?!_without_up: 1} -# kernel PAE (only valid for ARM (lpae)) -%define with_pae %{?_without_pae: 0} %{?!_without_pae: 1} -# kernel-debug -%define with_debug %{?_without_debug: 0} %{?!_without_debug: 1} -# kernel-doc -%define with_doc %{?_without_doc: 0} %{?!_without_doc: 1} -# kernel-headers -%define with_headers %{?_without_headers: 0} %{?!_without_headers: 1} -%define with_cross_headers %{?_without_cross_headers: 0} %{?!_without_cross_headers: 1} -# perf -%define with_perf %{?_without_perf: 0} %{?!_without_perf: 1} -# tools -%define with_tools %{?_without_tools: 0} %{?!_without_tools: 1} -# bpf tool -%define with_bpftool %{?_without_bpftool: 0} %{?!_without_bpftool: 1} -# kernel-debuginfo -%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1} -# Want to build a the vsdo directories installed -%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1} -# kernel-zfcpdump (s390 specific kernel for zfcpdump) -%define with_zfcpdump %{?_without_zfcpdump: 0} %{?!_without_zfcpdump: 1} -# kernel-abi-whitelists -%define with_kernel_abi_whitelists %{?_without_kernel_abi_whitelists: 0} %{?!_without_kernel_abi_whitelists: 1} -# internal samples and selftests -%define with_selftests %{?_without_selftests: 0} %{?!_without_selftests: 1} -# -# Additional options for user-friendly one-off kernel building: -# -# Only build the base kernel (--with baseonly): -%define with_baseonly %{?_with_baseonly: 1} %{?!_with_baseonly: 0} -# Only build the pae kernel (--with paeonly): -%define with_paeonly %{?_with_paeonly: 1} %{?!_with_paeonly: 0} -# Only build the debug kernel (--with dbgonly): -%define with_dbgonly %{?_with_dbgonly: 1} %{?!_with_dbgonly: 0} -# Control whether we perform a compat. check against published ABI. -%define with_kabichk %{?_without_kabichk: 0} %{?!_without_kabichk: 1} -# Temporarily disable kabi checks until RC. -%define with_kabichk 0 -# Control whether we perform a compat. check against DUP ABI. -%define with_kabidupchk %{?_with_kabidupchk: 1} %{?!_with_kabidupchk: 0} -# -# Control whether to run an extensive DWARF based kABI check. -# Note that this option needs to have baseline setup in SOURCE300. -%define with_kabidwchk %{?_without_kabidwchk: 0} %{?!_without_kabidwchk: 1} -%define with_kabidw_base %{?_with_kabidw_base: 1} %{?!_with_kabidw_base: 0} -# -# should we do C=1 builds with sparse -%define with_sparse %{?_with_sparse: 1} %{?!_with_sparse: 0} -# -# Cross compile requested? -%define with_cross %{?_with_cross: 1} %{?!_with_cross: 0} -# -# build a release kernel on rawhide -%define with_release %{?_with_release: 1} %{?!_with_release: 0} - -# verbose build, i.e. no silent rules and V=1 -%define with_verbose %{?_with_verbose: 1} %{?!_with_verbose: 0} - -# -# check for mismatched config options -%define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 1} - -# -# gcov support -%define with_gcov %{?_with_gcov:1}%{?!_with_gcov:0} - -# -# ipa_clone support -%define with_ipaclones %{?_without_ipaclones: 0} %{?!_without_ipaclones: 1} - -# Want to build a vanilla kernel build without any non-upstream patches? -%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0} - -# Set debugbuildsenabled to 1 for production (build separate debug kernels) -# and 0 for rawhide (all kernels are debug kernels). -# See also 'make debug' and 'make release'. -%define debugbuildsenabled 1 -%define with_debug 0 - -%if 0%{?fedora} -# Kernel headers are being split out into a separate package -%define with_headers 0 -%define with_cross_headers 0 -# no selftests for now -%define with_selftests 0 -# no ipa_clone for now -%define with_ipaclones 0 -# no whitelist -%define with_kernel_abi_whitelists 0 -# Fedora builds these separately -%define with_perf 0 -%define with_tools 0 -%define with_bpftool 0 -%endif - -%if 0%{?centos} -# no selftests for now -%define with_selftests 0 -# no ipa_clone for now -%define with_ipaclones 0 -# no whitelist -%define with_kernel_abi_whitelists 0 -%define with_kabidw_base 0 -%define with_kabidwchk 0 -%endif - -%if %{with_verbose} -%define make_opts V=1 -%else -%define make_opts -s -%endif - -# pkg_release is what we'll fill in for the rpm Release: field -%if 0%{?released_kernel} - -%define pkg_release %{fedora_build}%{?buildid}%{?dist} - -%else - -# non-released_kernel -%if 0%{?rcrev} -%define rctag .rc%rcrev -%else -%define rctag .rc0 -%endif -%if 0%{?gitrev} -%define gittag .git%gitrev -%else -%define gittag .git0 -%endif -%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}%{?dist} - -%endif - -# The kernel tarball/base version -%define kversion 5.%{base_sublevel} - - -# turn off debug kernel and kabichk for gcov builds -%if %{with_gcov} -%define with_debug 0 -%define with_kabichk 0 -%define with_kabidupchk 0 -%define with_kabidwchk 0 -%endif - -# turn off kABI DWARF-based check if we're generating the base dataset -%if %{with_kabidw_base} -%define with_kabidwchk 0 -%endif - -# kpatch_kcflags are extra compiler flags applied to base kernel -# -fdump-ipa-clones is enabled only for base kernels on selected arches -%if %{with_ipaclones} -%ifarch x86_64 ppc64le -%define kpatch_kcflags -fdump-ipa-clones -%else -%define with_ipaclones 0 -%endif -%endif - -%define make_target bzImage -%define image_install_path boot - -%define KVERREL %{version}-%{release}.%{_target_cpu} -%define KVERREL_RE %(echo %KVERREL | sed 's/+/[+]/g') -%define hdrarch %_target_cpu -%define asmarch %_target_cpu - -%if 0%{!?nopatches:1} -%define nopatches 0 -%endif - -%if %{with_vanilla} -%define nopatches 1 -%endif - -%if %{nopatches} -%define variant -vanilla -%endif - -%if !%{debugbuildsenabled} -%define with_debug 0 -%endif - -%if !%{with_debuginfo} -%define _enable_debug_packages 0 -%endif -%define debuginfodir /usr/lib/debug -# Needed because we override almost everything involving build-ids -# and debuginfo generation. Currently we rely on the old alldebug setting. -%global _build_id_links alldebug - -# kernel PAE is only built on ARMv7 -%ifnarch armv7hl -%define with_pae 0 -%endif - -# if requested, only build base kernel -%if %{with_baseonly} -%define with_pae 0 -%define with_debug 0 -%endif - -# if requested, only build pae kernel -%if %{with_paeonly} -%define with_up 0 -%define with_debug 0 -%endif - -# if requested, only build debug kernel -%if %{with_dbgonly} -%if %{debugbuildsenabled} -%define with_up 0 -%endif -%define with_pae 0 -%define with_tools 0 -%define with_perf 0 -%define with_bpftool 0 -%endif - -# turn off kABI DUP check and DWARF-based check if kABI check is disabled -%if !%{with_kabichk} -%define with_kabidupchk 0 -%define with_kabidwchk 0 -%endif - -%if %{with_vdso_install} -%define use_vdso 1 -%endif - - -%ifnarch noarch -%define with_kernel_abi_whitelists 0 -%endif - -# Overrides for generic default options - -# only package docs noarch -%ifnarch noarch -%define with_doc 0 -%define doc_build_fail true -%endif - -%if 0%{?fedora}%{?centos} -# don't do debug builds on anything but i686 and x86_64 -%ifnarch i686 x86_64 -%define with_debug 0 -%endif -%endif - -# don't build noarch kernels or headers (duh) -%ifarch noarch -%define with_up 0 -%define with_headers 0 -%define with_cross_headers 0 -%define with_tools 0 -%define with_perf 0 -%define with_bpftool 0 -%define with_selftests 0 -%define with_debug 0 -%define all_arch_configs kernel-%{version}-*.config -%endif - -# sparse blows up on ppc -%ifnarch ppc64le -%define with_sparse 0 -%endif -BuildRequires: util-linux - -# zfcpdump mechanism is s390 only -%ifnarch s390x -%define with_zfcpdump 0 -%endif - -%if 0%{?fedora} -# This is not for Fedora -%define with_zfcpdump 0 -%endif - -# Per-arch tweaks - -%ifarch i686 -%define asmarch x86 -%define hdrarch i386 -%define all_arch_configs kernel-%{version}-i?86*.config -%define kernel_image arch/x86/boot/bzImage -%endif - -%ifarch x86_64 -%define asmarch x86 -%define all_arch_configs kernel-x86_64*.config -%define kernel_image arch/x86/boot/bzImage -%endif - -%ifarch ppc64le -%define asmarch powerpc -%define hdrarch powerpc -%define make_target vmlinux -%define kernel_image vmlinux -%define kernel_image_elf 1 -%define all_arch_configs kernel-%{version}-ppc64le*.config -%define kcflags -O3 -%endif - -%ifarch s390x -%define asmarch s390 -%define hdrarch s390 -%define all_arch_configs kernel-%{version}-s390x.config -%define kernel_image arch/s390/boot/bzImage -%endif - -%ifarch %{arm} -%define all_arch_configs kernel-%{version}-arm*.config -%define skip_nonpae_vdso 1 -%define asmarch arm -%define hdrarch arm -%define make_target bzImage -%define kernel_image arch/arm/boot/zImage -# http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091404.html -%define kernel_mflags KALLSYMS_EXTRA_PASS=1 -# we only build headers/perf/tools on the base arm arches -# just like we used to only build them on i386 for x86 -%ifnarch armv7hl -%define with_headers 0 -%define with_cross_headers 0 -%endif -# These currently don't compile on armv7 -%define with_selftests 0 -%endif - -%ifarch aarch64 -%define all_arch_configs kernel-%{version}-aarch64*.config -%define asmarch arm64 -%define hdrarch arm64 -%define make_target Image.gz -%define kernel_image arch/arm64/boot/Image.gz -%endif - -# Should make listnewconfig fail if there's config options -# printed out? -%if %{nopatches} -%define with_configchecks 0 -%endif - -# To temporarily exclude an architecture from being built, add it to -# %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we -# don't build kernel-headers then the new build system will no longer let -# us use the previous build of that package -- it'll just be completely AWOL. -# Which is a BadThing(tm). - -# We only build kernel-headers on the following... -%if 0%{?fedora}%{?centos} -%define nobuildarches i386 -%else -%define nobuildarches i386 i686 -%endif - -%ifarch %nobuildarches -%define with_up 0 -%define with_debug 0 -%define with_debuginfo 0 -%define with_perf 0 -%define with_tools 0 -%define with_bpftool 0 -%define with_selftests 0 -%define with_pae 0 -%define _enable_debug_packages 0 -%endif - -# Architectures we build tools/cpupower on -%if 0%{?fedora}%{?centos} -%define cpupowerarchs %{ix86} x86_64 ppc64le %{arm} aarch64 -%else -%define cpupowerarchs i686 x86_64 ppc64le aarch64 -%endif - -%if %{use_vdso} - -%if 0%{?skip_nonpae_vdso} -%define _use_vdso 0 -%else -%define _use_vdso 1 -%endif - -%else -%define _use_vdso 0 -%endif - -# -# Packages that need to be installed before the kernel is, because the %%post -# scripts use them. -# -%define kernel_prereq coreutils, systemd >= 203-2, /usr/bin/kernel-install -%define initrd_prereq dracut >= 027 - - -Name: kernel%{?variant} -License: GPLv2 and Redistributable, no modification permitted -URL: https://www.kernel.org/ -Version: %{rpmversion} -Release: %{pkg_release} -# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD. -# SET %%nobuildarches (ABOVE) INSTEAD -%if 0%{?fedora} -ExclusiveArch: x86_64 s390x %{arm} aarch64 ppc64le -%else -ExclusiveArch: noarch i386 i686 x86_64 s390x %{arm} aarch64 ppc64le -%endif -ExclusiveOS: Linux -%ifnarch %{nobuildarches} -Requires: kernel-core-uname-r = %{KVERREL}%{?variant} -Requires: kernel-modules-uname-r = %{KVERREL}%{?variant} -%endif - - -# -# List the packages used during the kernel build -# -BuildRequires: kmod, patch, bash, tar, git-core -BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, diffutils, gawk -BuildRequires: binutils, redhat-rpm-config, hmaccalc, bison, flex -BuildRequires: net-tools, hostname, bc, elfutils-devel -%if 0%{?rhel} == 7 -BuildRequires: devtoolset-8-build -BuildRequires: devtoolset-8-binutils -BuildRequires: devtoolset-8-gcc -BuildRequires: devtoolset-8-make -#BuildRequires: python3-rpm-macros -%endif -%if 0%{?fedora} || 0%{?rhel} >= 8 -BuildRequires: dwarves -%else -%if 0%{?rhel} == 7 -BuildRequires: dwarves >= 1.16 -%endif -%endif -# Used to mangle unversioned shebangs to be Python 3 -BuildRequires: python2-devel -BuildRequires: python3-devel -%if %{with_headers} -BuildRequires: rsync -%endif -%if %{with_doc} -BuildRequires: xmlto, asciidoc, python3-sphinx -%endif -%if %{with_sparse} -BuildRequires: sparse -%endif -%if %{with_perf} -BuildRequires: zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex xz-devel -BuildRequires: audit-libs-devel -BuildRequires: java-devel -%ifnarch %{arm} s390x -BuildRequires: numactl-devel -%endif -%endif -%if %{with_tools} -BuildRequires: gettext ncurses-devel -%ifnarch s390x -BuildRequires: pciutils-devel -%endif -%endif -%if %{with_bpftool} -%if 0%{?rhel} == 7 -BuildRequires: python-docutils -%else -BuildRequires: python3-docutils -%endif -BuildRequires: zlib-devel binutils-devel -%endif -%if %{with_selftests} -%if 0%{?fedora} -BuildRequires: clang llvm -%else -%if 0%{?rhel} == 7 -BuildRequires: llvm-toolset-7.0 -%else -BuildRequires: llvm-toolset -%endif -%endif -%ifnarch %{arm} -BuildRequires: numactl-devel -%endif -BuildRequires: libcap-devel libcap-ng-devel rsync -%endif -BuildConflicts: rhbuildsys(DiskFree) < 500Mb -%if %{with_debuginfo} -BuildRequires: rpm-build, elfutils -BuildConflicts: rpm < 4.13.0.1-19 -%if 0%{?fedora} -BuildConflicts: dwarves < 1.13 -%endif -# Most of these should be enabled after more investigation -%undefine _include_minidebuginfo -%undefine _find_debuginfo_dwz_opts -%undefine _unique_build_ids -%undefine _unique_debug_names -%undefine _unique_debug_srcs -%undefine _debugsource_packages -%undefine _debuginfo_subpackages -%global _find_debuginfo_opts -r -%global _missing_build_ids_terminate_build 1 -%global _no_recompute_build_ids 1 -%endif -%if %{with_kabidwchk} || %{with_kabidw_base} -BuildRequires: kabi-dw -%endif - -%if %{signkernel}%{signmodules} -BuildRequires: openssl openssl-devel -%if %{signkernel} -%ifarch x86_64 aarch64 -BuildRequires: nss-tools -BuildRequires: pesign >= 0.10-4 -%endif -%endif -%endif - -%if %{with_cross} -BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu -%define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu- -%endif - -# These below are required to build man pages -%if %{with_perf} -BuildRequires: xmlto -%endif -%if %{with_perf} || %{with_tools} -BuildRequires: asciidoc -%endif -%if %{with_tools} -BuildRequires: libcap-devel -%endif - -Source0: %{name}-%{version}.tar.gz - -# Name of the packaged file containing signing key -%ifarch ppc64le -%define signing_key_filename kernel-signing-ppc.cer -%endif -%ifarch s390x -%define signing_key_filename kernel-signing-s390.cer -%endif - -Source11: x509.genkey -%if %{?released_kernel} - -Source12: centossecurebootca2.der -Source13: centos-ca-secureboot.der -Source14: centossecureboot201.der -Source15: centossecureboot001.der - -%define secureboot_ca_1 %{SOURCE12} -%define secureboot_ca_0 %{SOURCE13} -%ifarch x86_64 aarch64 -%define secureboot_key_1 %{SOURCE14} -%define pesign_name_1 centossecureboot201 -%define secureboot_key_0 %{SOURCE15} -%define pesign_name_0 centossecureboot001 -%endif - -# released_kernel -%else - -Source12: centossecurebootca2.der -Source13: centos-ca-secureboot.der -Source14: centossecureboot201.der -Source15: centossecureboot001.der - -%define secureboot_ca_1 %{SOURCE12} -%define secureboot_ca_0 %{SOURCE13} -%define secureboot_key_1 %{SOURCE14} -%define pesign_name_1 centossecureboot201 -%define secureboot_key_0 %{SOURCE15} -%define pesign_name_0 centossecureboot001 - -# released_kernel -%endif - -Source22: mod-extra.list -Source24: mod-extra.sh -Source18: mod-sign.sh -Source19: mod-extra-blacklist.sh -Source79: parallel_xz.sh - -Source80: filter-x86_64.sh -Source89: filter-modules.sh - -%define modsign_cmd %{SOURCE18} - -#Source20: kernel-aarch64-rhel.config -#Source21: kernel-aarch64-debug-rhel.config -#Source30: kernel-ppc64le-rhel.config -#Source31: kernel-ppc64le-debug-rhel.config -#Source32: kernel-s390x-rhel.config -#Source33: kernel-s390x-debug-rhel.config -#Source34: kernel-s390x-zfcpdump-rhel.config -#Source35: kernel-x86_64-rhel.config -#Source36: kernel-x86_64-debug-rhel.config -# -#Source37: kernel-aarch64-fedora.config -#Source38: kernel-aarch64-debug-fedora.config -#Source39: kernel-armv7hl-fedora.config -#Source40: kernel-armv7hl-debug-fedora.config -#Source41: kernel-armv7hl-lpae-fedora.config -#Source42: kernel-armv7hl-lpae-debug-fedora.config -#Source43: kernel-i686-fedora.config -#Source44: kernel-i686-debug-fedora.config -#Source45: kernel-ppc64le-fedora.config -#Source46: kernel-ppc64le-debug-fedora.config -#Source47: kernel-s390x-fedora.config -#Source48: kernel-s390x-debug-fedora.config -Source49: kernel-x86_64.config -Source50: kernel-x86_64-debug.config - - -Source51: generate_all_configs.sh - -Source52: process_configs.sh -Source53: generate_bls_conf.sh - -Source54: mod-internal.list -Source55: merge.pl - -Source200: check-kabi - -Source204: Module.kabi_x86_64 - -Source213: Module.kabi_dup_x86_64 - -# Source300: kernel-abi-whitelists-%{rpmversion}-%{distro_build}.tar.bz2 -# Source301: kernel-kabi-dw-%{rpmversion}-%{distro_build}.tar.bz2 - -# Sources for kernel-tools -Source2000: cpupower.service -Source2001: cpupower.config - -Source9000: centos.pem -Source3000: ima_signing_key.pub - -## Patches needed for building this package - -# Patch1: patch-%{rpmversion}-redhat.patch - -# empty final patch to facilitate testing of kernel patches -# Patch999999: linux-kernel-test.patch - -# This file is intentionally left empty in the stock kernel. Its a nicety -# added for those wanting to do custom rebuilds with altered config opts. -Source1000: kernel-x86_64.config.tis_extra - -# Here should be only the patches up to the upstream canonical Linus tree. - -# For a stable release kernel -%if 0%{?stable_update} -%if 0%{?stable_base} -#%define stable_patch_00 https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-5.%{base_sublevel}.%{stable_base}.xz -#Source5000: %{stable_patch_00} -%endif - -# non-released_kernel case -# These are automagically defined by the rcrev and gitrev values set up -# near the top of this spec file. -%else -%if 0%{?rcrev} -#Source5000: patch-5.%{upstream_sublevel}-rc%{rcrev}.xz -%if 0%{?gitrev} -#Source5001: patch-5.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz -%endif -%else -# pre-{base_sublevel+1}-rc1 case -%if 0%{?gitrev} -#Source5000: patch-5.%{base_sublevel}-git%{gitrev}.xz -%endif -%endif -%endif - -## Patches needed for building this package - -## compile fixes - -%if !%{nopatches} - -Patch0: 0001-Notification-of-death-of-arbitrary-processes.patch -Patch1: 0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch -Patch2: 0003-affine-compute-kernel-threads.patch -Patch3: 0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch -Patch4: 0005-Make-kernel-start-eth-devices-at-offset.patch -Patch5: 0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch -Patch6: 0007-turn-off-write-same-in-smartqpi-driver.patch -Patch7: 0008-Allow-dmar-quirks-for-broken-bioses.patch -Patch8: 0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch -Patch9: 0010-bpf-cgroups-Fix-cgroup-v2-fallback-on-v1-v2-mixed-mo.patch -Patch10: 0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch -Patch11: 0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch -Patch14: 0015-Revert-scsi-sd-Inline-sd_probe_part2.patch -Patch15: 0016-Revert-commit-f049cf1a7b.patch -Patch16: 0017-genirq-Export-affinity-setter-for-modules.patch -Patch17: 0018-genirq-Provide-new-interfaces-for-affinity-hints.patch -Patch18: 0019-ixgbe-Use-irq_update_affinity_hint.patch -Patch19: 0020-Add-auxiliary-bus-support.patch -Patch20: 0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch -Patch21: 0022-driver-core-auxiliary-bus-make-remove-function-retur.patch -Patch22: 0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch -Patch23: 0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch -Patch24: 0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch -Patch25: 0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch -Patch26: 0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch -Patch27: 0028-driver-core-auxiliary-bus-Enable-by-default.patch -Patch28: 0029-Enable-CONFIG_PAGE_POOL-by-default.patch -Patch29: 0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch -Patch30: 0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch -Patch31: 0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch -Patch32: 0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch -Patch33: 0034-xfs-use-current-journal_info-for-detecting-transacti.patch -Patch34: 0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch -Patch35: 0036-xfs-open-code-ioend-needs-workqueue-helper.patch -Patch36: 0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch -Patch37: 0038-xfs-drop-unnecessary-setfilesize-helper.patch - -# END OF PATCH DEFINITIONS -%endif - - -%description -The kernel meta package - -# -# This macro does requires, provides, conflicts, obsoletes for a kernel package. -# %%kernel_reqprovconf -# It uses any kernel__conflicts and kernel__obsoletes -# macros defined above. -# -%define kernel_reqprovconf \ -Provides: kernel = %{rpmversion}-%{pkg_release}\ -Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:+%{1}}\ -Provides: kernel-drm-nouveau = 16\ -Provides: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires(pre): %{kernel_prereq}\ -Requires(pre): %{initrd_prereq}\ -Requires(pre): linux-firmware >= 20150904-56.git6ebf5d57\ -Requires(preun): systemd >= 200\ -Conflicts: xfsprogs < 4.3.0-1\ -Conflicts: xorg-x11-drv-vmmouse < 13.0.99\ -%{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\ -%{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\ -%{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\ -# We can't let RPM do the dependencies automatic because it'll then pick up\ -# a correct but undesirable perl dependency from the module headers which\ -# isn't required for the kernel proper to function\ -AutoReq: no\ -AutoProv: yes\ -%{nil} - - -%package doc -Summary: Various documentation bits found in the kernel source -Group: Documentation -%description doc -This package contains documentation files from the kernel -source. Various bits of information about the Linux kernel and the -device drivers shipped with it are documented in these files. - -You'll want to install this package if you need a reference to the -options that can be passed to Linux kernel modules at load time. - - -%package headers -Summary: Header files for the Linux kernel for use by glibc -Obsoletes: glibc-kernheaders < 3.0-46 -Provides: glibc-kernheaders = 3.0-46 -Obsoletes: kernel-headers < %{rpmversion}-%{pkg_release} -Provides: kernel-headers = %{rpmversion}-%{pkg_release} -%description headers -Kernel-headers includes the C header files that specify the interface -between the Linux kernel and userspace libraries and programs. The -header files define structures and constants that are needed for -building most standard programs and are also needed for rebuilding the -glibc package. - -%package cross-headers -Summary: Header files for the Linux kernel for use by cross-glibc -%description cross-headers -Kernel-cross-headers includes the C header files that specify the interface -between the Linux kernel and userspace libraries and programs. The -header files define structures and constants that are needed for -building most standard programs and are also needed for rebuilding the -cross-glibc package. - - -%package debuginfo-common-%{_target_cpu} -Summary: Kernel source files used by %{name}-debuginfo packages -Provides: installonlypkg(kernel) -%description debuginfo-common-%{_target_cpu} -This package is required by %{name}-debuginfo subpackages. -It provides the kernel source files common to all builds. - -%if %{with_perf} -%package -n perf -Summary: Performance monitoring for the Linux kernel -License: GPLv2 -%description -n perf -This package contains the perf tool, which enables performance monitoring -of the Linux kernel. - -%package -n perf-debuginfo -Summary: Debug information for package perf -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n perf-debuginfo -This package provides debug information for the perf package. - -# Note that this pattern only works right to match the .build-id -# symlinks because of the trailing nonmatching alternation and -# the leading .*, because of find-debuginfo.sh's buggy handling -# of matching the pattern against the symlinks file. -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_libdir}/traceevent/plugins/.*|.*%%{_libdir}/libperf-jvmti.so(\.debug)?|XXX' -o perf-debuginfo.list} - -%package -n python-perf -Summary: Python bindings for apps which will manipulate perf events -%description -n python-perf -The python-perf package contains a module that permits applications -written in the Python programming language to use the interface -to manipulate perf events. - -%package -n python-perf-debuginfo -Summary: Debug information for package perf python bindings -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n python-perf-debuginfo -This package provides debug information for the perf python bindings. - -# the python_sitearch macro should already be defined from above -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{python_sitearch}/perf.*so(\.debug)?|XXX' -o python-perf-debuginfo.list} - -# with_perf -%endif - -%if %{with_tools} -%package -n kernel-tools -Summary: Assortment of tools for the Linux kernel -License: GPLv2 -%ifarch %{cpupowerarchs} -Provides: cpupowerutils = 1:009-0.6.p1 -Obsoletes: cpupowerutils < 1:009-0.6.p1 -Provides: cpufreq-utils = 1:009-0.6.p1 -Provides: cpufrequtils = 1:009-0.6.p1 -Obsoletes: cpufreq-utils < 1:009-0.6.p1 -Obsoletes: cpufrequtils < 1:009-0.6.p1 -Obsoletes: cpuspeed < 1:1.5-16 -Requires: kernel-tools-libs = %{version}-%{release} -%endif -%define __requires_exclude ^%{_bindir}/python -%description -n kernel-tools -This package contains the tools/ directory from the kernel source -and the supporting documentation. - -%package -n kernel-tools-libs -Summary: Libraries for the kernels-tools -License: GPLv2 -%description -n kernel-tools-libs -This package contains the libraries built from the tools/ directory -from the kernel source. - -%package -n kernel-tools-libs-devel -Summary: Assortment of tools for the Linux kernel -License: GPLv2 -Requires: kernel-tools = %{version}-%{release} -%ifarch %{cpupowerarchs} -Provides: cpupowerutils-devel = 1:009-0.6.p1 -Obsoletes: cpupowerutils-devel < 1:009-0.6.p1 -%endif -Requires: kernel-tools-libs = %{version}-%{release} -Provides: kernel-tools-devel -%description -n kernel-tools-libs-devel -This package contains the development files for the tools/ directory from -the kernel source. - -%package -n kernel-tools-debuginfo -Summary: Debug information for package kernel-tools -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n kernel-tools-debuginfo -This package provides debug information for package kernel-tools. - -# Note that this pattern only works right to match the .build-id -# symlinks because of the trailing nonmatching alternation and -# the leading .*, because of find-debuginfo.sh's buggy handling -# of matching the pattern against the symlinks file. -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/centrino-decode(\.debug)?|.*%%{_bindir}/powernow-k8-decode(\.debug)?|.*%%{_bindir}/cpupower(\.debug)?|.*%%{_libdir}/libcpupower.*|.*%%{_bindir}/turbostat(\.debug)?|.*%%{_bindir}/x86_energy_perf_policy(\.debug)?|.*%%{_bindir}/tmon(\.debug)?|.*%%{_bindir}/lsgpio(\.debug)?|.*%%{_bindir}/gpio-hammer(\.debug)?|.*%%{_bindir}/gpio-event-mon(\.debug)?|.*%%{_bindir}/iio_event_monitor(\.debug)?|.*%%{_bindir}/iio_generic_buffer(\.debug)?|.*%%{_bindir}/lsiio(\.debug)?|XXX' -o kernel-tools-debuginfo.list} - -# with_tools -%endif - -%if %{with_bpftool} - -%package -n bpftool -Summary: Inspection and simple manipulation of eBPF programs and maps -License: GPLv2 -%description -n bpftool -This package contains the bpftool, which allows inspection and simple -manipulation of eBPF programs and maps. - -%package -n bpftool-debuginfo -Summary: Debug information for package bpftool -Group: Development/Debug -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} -AutoReqProv: no -%description -n bpftool-debuginfo -This package provides debug information for the bpftool package. - -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_sbindir}/bpftool(\.debug)?|XXX' -o bpftool-debuginfo.list} - -# with_bpftool -%endif - -%if %{with_selftests} - -%package selftests-internal -Summary: Kernel samples and selftests -License: GPLv2 -Requires: binutils, bpftool, iproute-tc, nmap-ncat -Requires: kernel-modules-internal = %{version}-%{release} -%description selftests-internal -Kernel sample programs and selftests. - -# Note that this pattern only works right to match the .build-id -# symlinks because of the trailing nonmatching alternation and -# the leading .*, because of find-debuginfo.sh's buggy handling -# of matching the pattern against the symlinks file. -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_libexecdir}/(ksamples|kselftests)/.*|XXX' -o selftests-debuginfo.list} - -# with_selftests -%endif - -%ifarch x86_64 -%package unsigned -Summary: Unsigned build of the Linux kernel -%description unsigned -Contains an unsigned version of the Linux kernel -%endif # x86_64 - -%if %{with_gcov} -%package gcov -Summary: gcov graph and source files for coverage data collection. -%description gcov -kernel-gcov includes the gcov graph and source files for gcov coverage collection. -%endif - -%package -n kernel-abi-whitelists -Summary: The Red Hat Enterprise Linux kernel ABI symbol whitelists -AutoReqProv: no -%description -n kernel-abi-whitelists -The kABI package contains information pertaining to the Red Hat Enterprise -Linux kernel ABI, including lists of kernel symbols that are needed by -external Linux kernel modules, and a yum plugin to aid enforcement. - -%if %{with_kabidw_base} -%package kabidw-base -Summary: The baseline dataset for kABI verification using DWARF data -Group: System Environment/Kernel -AutoReqProv: no -%description kabidw-base -The kabidw-base package contains data describing the current ABI of the Red Hat -Enterprise Linux kernel, suitable for the kabi-dw tool. -%endif - -# -# This macro creates a kernel--debuginfo package. -# %%kernel_debuginfo_package -# -# Explanation of the find_debuginfo_opts: We build multiple kernels (debug -# pae etc.) so the regex filters those kernels appropriately. We also -# have to package several binaries as part of kernel-devel but getting -# unique build-ids is tricky for these userspace binaries. We don't really -# care about debugging those so we just filter those out and remove it. -%define kernel_debuginfo_package() \ -%package %{?1:%{1}-}debuginfo\ -Summary: Debug information for package %{name}%{?1:-%{1}}\ -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\ -Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\ -Provides: installonlypkg(kernel)\ -AutoReqProv: no\ -%description %{?1:%{1}-}debuginfo\ -This package provides debug information for package %{name}%{?1:-%{1}}.\ -This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\ -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*\/usr\/src\/kernels/.*|XXX' -o ignored-debuginfo.list -p '/.*/%%{KVERREL_RE}%{?1:[+]%{1}}/.*|/.*%%{KVERREL_RE}%{?1:\+%{1}}(\.debug)?' -o debuginfo%{?1}.list}\ - - -%{nil} - -# -# This macro creates a kernel--devel package. -# %%kernel_devel_package -# -%define kernel_devel_package() \ -%package %{?1:%{1}-}devel\ -Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\ -Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel-devel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Provides: installonlypkg(kernel)\ -AutoReqProv: no\ -Requires(pre): findutils\ -Requires: findutils\ -Requires: perl-interpreter\ -%description %{?1:%{1}-}devel\ -This package provides kernel headers and makefiles sufficient to build modules\ -against the %{?2:%{2} }kernel package.\ -%{nil} - -# -# This macro creates a kernel--devel-keys package. -# %%kernel_devel_keys_package -# -%define kernel_devel_keys_package() \ -%package %{?1:%{1}-}devel-keys\ -Summary: Development keys package for building signed kernel modules to match the %{?2:%{2} }kernel\ -Provides: kernel%{?1:-%{1}}-devel-keys-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel-devel-keys-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel-devel-keys-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Provides: installonlypkg(kernel)\ -AutoReqProv: no\ -Requires: kernel-devel-%{_target_cpu} = %{version}-%{release}\ -%description %{?1:%{1}-}devel-keys\ -This package provides kernel module signing keys\ -against the %{?2:%{2} }kernel package.\ -%{nil} - -# -# kernel--ipaclones-internal package -# -%define kernel_ipaclones_package() \ -%package %{?1:%{1}-}ipaclones-internal\ -Summary: *.ipa-clones files generated by -fdump-ipa-clones for kernel%{?1:-%{1}}\ -Group: System Environment/Kernel\ -AutoReqProv: no\ -%description %{?1:%{1}-}ipaclones-internal\ -This package provides *.ipa-clones files.\ -%{nil} - -# -# This macro creates a kernel--modules-internal package. -# %%kernel_modules_internal_package -# -%define kernel_modules_internal_package() \ -%package %{?1:%{1}-}modules-internal\ -Summary: Extra kernel modules to match the %{?2:%{2} }kernel\ -Group: System Environment/Kernel\ -Provides: kernel%{?1:-%{1}}-modules-internal-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel%{?1:-%{1}}-modules-internal-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel%{?1:-%{1}}-modules-internal = %{version}-%{release}%{?1:+%{1}}\ -Provides: installonlypkg(kernel-module)\ -Provides: kernel%{?1:-%{1}}-modules-internal-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -AutoReq: no\ -AutoProv: yes\ -%description %{?1:%{1}-}modules-internal\ -This package provides kernel modules for the %{?2:%{2} }kernel package for Red Hat internal usage.\ -%{nil} - -# -# This macro creates a kernel--modules-extra package. -# %%kernel_modules_extra_package -# -%define kernel_modules_extra_package() \ -%package %{?1:%{1}-}modules-extra\ -Summary: Extra kernel modules to match the %{?2:%{2} }kernel\ -Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel%{?1:-%{1}}-modules-extra = %{version}-%{release}%{?1:+%{1}}\ -Provides: installonlypkg(kernel-module)\ -Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -AutoReq: no\ -AutoProv: yes\ -%description %{?1:%{1}-}modules-extra\ -This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\ -%{nil} - -# -# This macro creates a kernel--modules package. -# %%kernel_modules_package -# -%define kernel_modules_package() \ -%package %{?1:%{1}-}modules\ -Summary: kernel modules to match the %{?2:%{2}-}core kernel\ -Provides: kernel%{?1:-%{1}}-modules-%{_target_cpu} = %{version}-%{release}\ -Provides: kernel-modules-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\ -Provides: kernel-modules = %{version}-%{release}%{?1:+%{1}}\ -Provides: installonlypkg(kernel-module)\ -Provides: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -AutoReq: no\ -AutoProv: yes\ -%description %{?1:%{1}-}modules\ -This package provides commonly used kernel modules for the %{?2:%{2}-}core kernel package.\ -%{nil} - -# -# this macro creates a kernel- meta package. -# %%kernel_meta_package -# -%define kernel_meta_package() \ -%package %{1}\ -summary: kernel meta-package for the %{1} kernel\ -Requires: kernel-%{1}-core-uname-r = %{KVERREL}%{?variant}+%{1}\ -Requires: kernel-%{1}-modules-uname-r = %{KVERREL}%{?variant}+%{1}\ -Provides: installonlypkg(kernel)\ -%description %{1}\ -The meta-package for the %{1} kernel\ -%{nil} - -# -# This macro creates a kernel- and its -devel and -debuginfo too. -# %%define variant_summary The Linux kernel compiled for -# %%kernel_variant_package [-n ] -# -%define kernel_variant_package(n:) \ -%package %{?1:%{1}-}core\ -Summary: %{variant_summary}\ -Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\ -Provides: installonlypkg(kernel)\ -%ifarch ppc64le\ -Obsoletes: kernel-bootwrapper\ -%endif\ -%{expand:%%kernel_reqprovconf}\ -%if %{?1:1} %{!?1:0} \ -%{expand:%%kernel_meta_package %{?1:%{1}}}\ -%endif\ -%{expand:%%kernel_devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_devel_keys_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_modules_internal_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\ -%{expand:%%kernel_debuginfo_package %{?1:%{1}}}\ -%{nil} - -# Now, each variant package. - -%if %{with_pae} -%define variant_summary The Linux kernel compiled for Cortex-A15 -%kernel_variant_package lpae -%description lpae-core -This package includes a version of the Linux kernel with support for -Cortex-A15 devices with LPAE and HW virtualisation support -%endif - -%if %{with_zfcpdump} -%define variant_summary The Linux kernel compiled for zfcpdump usage -%kernel_variant_package zfcpdump -%description zfcpdump-core -The kernel package contains the Linux kernel (vmlinuz) for use by the -zfcpdump infrastructure. -# with_zfcpdump -%endif - -%define variant_summary The Linux kernel compiled with extra debugging enabled -%kernel_variant_package debug -%description debug-core -The kernel package contains the Linux kernel (vmlinuz), the core of any -Linux operating system. The kernel handles the basic functions -of the operating system: memory allocation, process allocation, device -input and output, etc. - -This variant of the kernel has numerous debugging options enabled. -It should only be installed when trying to gather additional information -on kernel bugs, as some of these options impact performance noticably. - -# And finally the main -core package - -%define variant_summary The Linux kernel -%kernel_variant_package -%description core -The kernel package contains the Linux kernel (vmlinuz), the core of any -Linux operating system. The kernel handles the basic functions -of the operating system: memory allocation, process allocation, device -input and output, etc. - -%if %{with_ipaclones} -%kernel_ipaclones_package -%endif - -%prep -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -source scl_source enable llvm-toolset-7.0 || : -%endif -# do a few sanity-checks for --with *only builds -%if %{with_baseonly} -%if !%{with_up}%{with_pae} -echo "Cannot build --with baseonly, up build is disabled" -exit 1 -%endif -%endif - -%if "%{baserelease}" == "0" -echo "baserelease must be greater than zero" -exit 1 -%endif - -# more sanity checking; do it quietly -if [ "%{patches}" != "%%{patches}" ] ; then - for patch in %{patches} ; do - if [ ! -f $patch ] ; then - echo "ERROR: Patch ${patch##/*/} listed in specfile but is missing" - exit 1 - fi - done -fi 2>/dev/null - -patch_command='patch -p1 -F1 -s' -ApplyPatch() -{ - local patch=$1 - shift - if [ ! -f $RPM_SOURCE_DIR/$patch ]; then - exit 1 - fi - if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME%%%%%{?variant}}.spec ; then - if [ "${patch:0:8}" != "patch-5." ] ; then - echo "ERROR: Patch $patch not listed as a source patch in specfile" - exit 1 - fi - fi 2>/dev/null - case "$patch" in - *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *.gz) gunzip < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *.xz) unxz < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;; - *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;; - esac -} - -# don't apply patch if it's empty -ApplyOptionalPatch() -{ - local patch=$1 - shift - if [ ! -f $RPM_SOURCE_DIR/$patch ]; then - exit 1 - fi - local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}') - if [ "$C" -gt 9 ]; then - ApplyPatch $patch ${1+"$@"} - fi -} - -# First we unpack the kernel tarball. -# If this isn't the first make prep, we use links to the existing clean tarball -# which speeds things up quite a bit. - -# Update to latest upstream. -%if 0%{?released_kernel} -%define vanillaversion 5.%{base_sublevel} -# non-released_kernel case -%else -%if 0%{?rcrev} -%define vanillaversion 5.%{upstream_sublevel}-rc%{rcrev} -%if 0%{?gitrev} -%define vanillaversion 5.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev} -%endif -%else -# pre-{base_sublevel+1}-rc1 case -%if 0%{?gitrev} -%define vanillaversion 5.%{base_sublevel}-git%{gitrev} -%else -%define vanillaversion 5.%{base_sublevel} -%endif -%endif -%endif - -# %%{vanillaversion} : the full version name, e.g. 2.6.35-rc6-git3 -# %%{kversion} : the base version, e.g. 2.6.34 - -# Use kernel-%%{kversion}%%{?dist} as the top-level directory name -# so we can prep different trees within a single git directory. - -# Build a list of the other top-level kernel tree directories. -# This will be used to hardlink identical vanilla subdirs. -sharedirs=$(find "$PWD" -maxdepth 1 -type d -name 'kernel-5.*' \ - | grep -x -v "$PWD"/kernel-%{kversion}%{?dist}) ||: - -# Delete all old stale trees. -if [ -d kernel-%{kversion}%{?dist} ]; then - cd kernel-%{kversion}%{?dist} - for i in linux-* - do - if [ -d $i ]; then - # Just in case we ctrl-c'd a prep already - rm -rf deleteme.%{_target_cpu} - # Move away the stale away, and delete in background. - mv $i deleteme-$i - rm -rf deleteme* & - fi - done - cd .. -fi - -# Generate new tree -if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then - - if [ -d kernel-%{kversion}%{?dist}/vanilla-%{kversion} ]; then - - # The base vanilla version already exists. - cd kernel-%{kversion}%{?dist} - - # Any vanilla-* directories other than the base one are stale. - for dir in vanilla-*; do - [ "$dir" = vanilla-%{kversion} ] || rm -rf $dir & - done - - else - - rm -f pax_global_header - # Look for an identical base vanilla dir that can be hardlinked. - for sharedir in $sharedirs ; do - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{kversion} ]] ; then - break - fi - done - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{kversion} ]] ; then -%setup -q -n kernel-%{kversion}%{?dist} -c -T - cp -al $sharedir/vanilla-%{kversion} . - else -%setup -q -n kernel-%{kversion}%{?dist} -c - mv %{name}-%{version} vanilla-%{kversion} - fi - - fi - -%if "%{kversion}" != "%{vanillaversion}" - - for sharedir in $sharedirs ; do - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{vanillaversion} ]] ; then - break - fi - done - if [[ ! -z $sharedir && -d $sharedir/vanilla-%{vanillaversion} ]] ; then - - cp -al $sharedir/vanilla-%{vanillaversion} . - - else - - # Need to apply patches to the base vanilla version. - cp -al vanilla-%{kversion} vanilla-%{vanillaversion} - cd vanilla-%{vanillaversion} - -cp %{SOURCE12} . - -# Update vanilla to the latest upstream. -# (non-released_kernel case only) -%if 0%{?rcrev} -# xzcat %{SOURCE5000} | patch -p1 -F1 -s -%if 0%{?gitrev} - xzcat %{SOURCE5001} | patch -p1 -F1 -s -%endif -%else -# pre-{base_sublevel+1}-rc1 case -%if 0%{?gitrev} - xzcat %{SOURCE5000} | patch -p1 -F1 -s -%endif -%endif - git init - git config user.email "kernel-team@starlingx.org" - git config user.name "Starlingx Kernel Team" - git config gc.auto 0 - git add . - git commit -a -q -m "baseline" - - cd .. - - fi - -%endif - -else - - # We already have all vanilla dirs, just change to the top-level directory. - cd kernel-%{kversion}%{?dist} - -fi - -# Now build the fedora kernel tree. -cp -al vanilla-%{vanillaversion} linux-%{KVERREL} -cp -v %{SOURCE9000} linux-%{KVERREL}/certs/rhel.pem -cp -v %{SOURCE3000} linux-%{KVERREL}/certs/ - -cd linux-%{KVERREL} -if [ ! -d .git ]; then - git init - git config user.email "kernel-team@starlingx.org" - git config user.name "Starlingx Kernel Team" - git config gc.auto 0 - git add . - git commit -a -q -m "baseline" -fi - - -# released_kernel with possible stable updates -%if 0%{?stable_base} -# This is special because the kernel spec is hell and nothing is consistent -#xzcat %{SOURCE5000} | patch -p1 -F1 -s -#git commit -a -m "Stable update" -%endif - -# Note: Even in the "nopatches" path some patches (build tweaks and compile -# fixes) will always get applied; see patch defition above for details - -git am %{patches} - -# END OF PATCH APPLICATIONS - -# Any further pre-build tree manipulations happen here. - -chmod +x scripts/checkpatch.pl -mv COPYING COPYING-%{version}-%{release} - -# This Prevents scripts/setlocalversion from mucking with our version numbers. -touch .scmversion - -# Mangle /usr/bin/python shebangs to /usr/bin/python3 -# Mangle all Python shebangs to be Python 3 explicitly -# -p preserves timestamps -# -n prevents creating ~backup files -# -i specifies the interpreter for the shebang -# This fixes errors such as -# *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. Change it to python3 (or python2) explicitly. -# We patch all sources below for which we got a report/error. -pathfix.py -i "%{__python3} %{py3_shbang_opts}" -p -n \ - tools/kvm/kvm_stat/kvm_stat \ - scripts/show_delta \ - scripts/diffconfig \ - scripts/bloat-o-meter \ - scripts/jobserver-exec \ - tools/perf/tests/attr.py \ - tools/perf/scripts/python/stat-cpi.py \ - tools/perf/scripts/python/sched-migration.py \ - tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py \ - Documentation \ - scripts/clang-tools/*.py - -# only deal with configs if we are going to build for the arch -%ifnarch %nobuildarches - -if [ -L configs ]; then - rm -f configs -fi -# Deal with configs stuff -mkdir configs -cd configs - -# Drop some necessary files from the source dir into the buildroot -cp $RPM_SOURCE_DIR/kernel-*.config . -cp %{SOURCE1000} . -cp %{SOURCE55} . -cp %{SOURCE51} . -VERSION=%{version} ./generate_all_configs.sh %{debugbuildsenabled} - - -# Merge in any user-provided local config option changes -%ifnarch %nobuildarches -for i in %{all_arch_configs} -do - mv $i $i.tmp - ./merge.pl %{SOURCE1000} $i.tmp > $i - rm $i.tmp -done -%endif - -%if !%{debugbuildsenabled} -rm -f kernel-*debug.config -%endif - -# enable GCOV kernel config options if gcov is on -%if %{with_gcov} -for i in *.config -do - sed -i 's/# CONFIG_GCOV_KERNEL is not set/CONFIG_GCOV_KERNEL=y\nCONFIG_GCOV_PROFILE_ALL=y\n/' $i -done -%endif - -cp %{SOURCE52} . -OPTS="" -%if %{with_configchecks} - OPTS="$OPTS -w -n -c" -%endif -./process_configs.sh $OPTS kernel - -# end of kernel config -%endif - -cd .. -# # End of Configs stuff - -# get rid of unwanted files resulting from patch fuzz -find . \( -name "*.orig" -o -name "*~" \) -delete >/dev/null - -# remove unnecessary SCM files -find . -name .gitignore -delete >/dev/null - -cd .. - -### -### build -### -%build -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -source scl_source enable llvm-toolset-7.0 || : -%endif - -%if %{with_sparse} -%define sparse_mflags C=1 -%endif - -cp_vmlinux() -{ - eu-strip --remove-comment -o "$2" "$1" -} - -# These are for host programs that get built as part of the kernel and -# are required to be packaged in kernel-devel for building external modules. -# Since they are userspace binaries, they are required to pickup the hardening -# flags defined in the macros. The --build-id=uuid is a trick to get around -# debuginfo limitations: Typically, find-debuginfo.sh will update the build -# id of all binaries to allow for parllel debuginfo installs. The kernel -# can't use this because it breaks debuginfo for the vDSO so we have to -# use a special mechanism for kernel and modules to be unique. Unfortunately, -# we still have userspace binaries which need unique debuginfo and because -# they come from the kernel package, we can't just use find-debuginfo.sh to -# rewrite only those binaries. The easiest option right now is just to have -# the build id be a uuid for the host programs. -# -# Note we need to disable these flags for cross builds because the flags -# from redhat-rpm-config assume that host == target so target arch -# flags cause issues with the host compiler. -%if !%{with_cross} -%define build_hostcflags %{?build_cflags} -%define build_hostldflags %{?build_ldflags} -%endif - -%define make make %{?cross_opts} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" - -BuildKernel() { - MakeTarget=$1 - KernelImage=$2 - Flavour=$4 - DoVDSO=$3 - Flav=${Flavour:++${Flavour}} - InstallName=${5:-vmlinuz} - - DoModules=1 - if [ "$Flavour" = "zfcpdump" ]; then - DoModules=0 - fi - - # Pick the right config file for the kernel we're building - Config=kernel-%{_target_cpu}${Flavour:+-${Flavour}}.config - DevelDir=/usr/src/kernels/%{KVERREL}${Flav} - - # When the bootable image is just the ELF kernel, strip it. - # We already copy the unstripped file into the debuginfo package. - if [ "$KernelImage" = vmlinux ]; then - CopyKernel=cp_vmlinux - else - CopyKernel=cp - fi - - KernelVer=%{version}-%{release}.%{_target_cpu}${Flav} - echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}... - - %if 0%{?stable_update} - # make sure SUBLEVEL is incremented on a stable release. Sigh 3.x. - perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{?stablerev}/" Makefile - %endif - - # make sure EXTRAVERSION says what we want it to say - perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile - - # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme - %if !0%{?rcrev} - %if 0%{?gitrev} - perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile - %endif - %endif - - # and now to start the build process - - %{make} %{?_smp_mflags} mrproper - cp configs/$Config .config - - %if %{signkernel}%{signmodules} - cp $RPM_SOURCE_DIR/x509.genkey certs/. - %endif - - Arch=`head -1 .config | cut -b 3-` - echo USING ARCH=$Arch - - KCFLAGS="%{?kcflags}" - - # add kpatch flags for base kernel - if [ "$Flavour" == "" ]; then - KCFLAGS="$KCFLAGS %{?kpatch_kcflags}" - fi - - %{make} ARCH=$Arch olddefconfig >/dev/null - - # This ensures build-ids are unique to allow parallel debuginfo - perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config - %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags} - if [ $DoModules -eq 1 ]; then - %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" %{?_smp_mflags} modules %{?sparse_mflags} || exit 1 - fi - - mkdir -p $RPM_BUILD_ROOT/%{image_install_path} - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer -%if %{with_debuginfo} - mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path} -%endif - -%ifarch %{arm} aarch64 - %{make} ARCH=$Arch dtbs INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer - %{make} ARCH=$Arch dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer - cp -r $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/dtb - find arch/$Arch/boot/dts -name '*.dtb' -type f -delete -%endif - - # Start installing the results - install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer - install -m 644 .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/config - install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer - install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/System.map - - # We estimate the size of the initramfs because rpm needs to take this size - # into consideration when performing disk space calculations. (See bz #530778) - dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20 - - if [ -f arch/$Arch/boot/zImage.stub ]; then - cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || : - cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/lib/modules/$KernelVer/zImage.stub-$KernelVer || : - fi - -%ifarch x86_64 - $CopyKernel $KernelImage $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer.unsigned -%endif - - %if %{signkernel} - if [ "$KernelImage" = vmlinux ]; then - # We can't strip and sign $KernelImage in place, because - # we need to preserve original vmlinux for debuginfo. - # Use a copy for signing. - $CopyKernel $KernelImage $KernelImage.tosign - KernelImage=$KernelImage.tosign - CopyKernel=cp - fi - - # Sign the image if we're using EFI - # aarch64 kernels are gziped EFI images - KernelExtension=${KernelImage##*.} - if [ "$KernelExtension" == "gz" ]; then - SignImage=${KernelImage%.*} - else - SignImage=$KernelImage - fi - - %ifarch x86_64 aarch64 - %pesign -s -i $SignImage -o vmlinuz.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} - %pesign -s -i vmlinuz.tmp -o vmlinuz.signed -a %{secureboot_ca_1} -c %{secureboot_key_1} -n %{pesign_name_1} - rm vmlinuz.tmp - %endif - %ifarch s390x ppc64le - if [ -x /usr/bin/rpm-sign ]; then - rpm-sign --key "%{pesign_name_0}" --lkmsign $SignImage --output vmlinuz.signed - elif [ $DoModules -eq 1 ]; then - chmod +x scripts/sign-file - ./scripts/sign-file -p sha256 certs/signing_key.pem certs/signing_key.x509 $SignImage vmlinuz.signed - else - mv $SignImage vmlinuz.signed - fi - %endif - - if [ ! -s vmlinuz.signed ]; then - echo "pesigning failed" - exit 1 - fi - mv vmlinuz.signed $SignImage - if [ "$KernelExtension" == "gz" ]; then - gzip -f9 $SignImage - fi - # signkernel - %endif - - $CopyKernel $KernelImage \ - $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer - chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer - cp $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/$InstallName - - # hmac sign the kernel for FIPS - echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac" - ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer - sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac; - cp $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac $RPM_BUILD_ROOT/lib/modules/$KernelVer/.vmlinuz.hmac - - if [ $DoModules -eq 1 ]; then - # Override $(mod-fw) because we don't want it to install any firmware - # we'll get it from the linux-firmware package and we don't want conflicts - %{make} %{?_smp_mflags} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT %{?_smp_mflags} modules_install KERNELRELEASE=$KernelVer mod-fw= - fi - -%if %{with_gcov} - # install gcov-needed files to $BUILDROOT/$BUILD/...: - # gcov_info->filename is absolute path - # gcno references to sources can use absolute paths (e.g. in out-of-tree builds) - # sysfs symlink targets (set up at compile time) use absolute paths to BUILD dir - find . \( -name '*.gcno' -o -name '*.[chS]' \) -exec install -D '{}' "$RPM_BUILD_ROOT/$(pwd)/{}" \; -%endif - - # add an a noop %%defattr statement 'cause rpm doesn't like empty file list files - echo '%%defattr(-,-,-)' > ../kernel${Flavour:+-${Flavour}}-ldsoconf.list - if [ $DoVDSO -ne 0 ]; then - %{make} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer - if [ -s ldconfig-kernel.conf ]; then - install -D -m 444 ldconfig-kernel.conf \ - $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf - echo /etc/ld.so.conf.d/kernel-$KernelVer.conf >> ../kernel${Flavour:+-${Flavour}}-ldsoconf.list - fi - - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id - fi - - # And save the headers/makefiles etc for building modules against - # - # This all looks scary, but the end result is supposed to be: - # * all arch relevant include/ files - # * all Makefile/Kconfig files - # * all script/ files - - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source) - # dirs for additional modules per module-init-tools, kbuild/modules.txt - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/internal - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates -%if 0%{!?fedora:1} - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/weak-updates -%endif - # CONFIG_KERNEL_HEADER_TEST generates some extra files in the process of - # testing so just delete - find . -name *.h.s -delete - # first copy everything - cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - if [ -s Module.markers ]; then - cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - fi - - # create the kABI metadata for use in packaging - # NOTENOTE: the name symvers is used by the rpm backend - # NOTENOTE: to discover and run the /usr/lib/rpm/fileattrs/kabi.attr - # NOTENOTE: script which dynamically adds exported kernel symbol - # NOTENOTE: checksums to the rpm metadata provides list. - # NOTENOTE: if you change the symvers name, update the backend too - echo "**** GENERATING kernel ABI metadata ****" - gzip -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz - cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.gz - -%if %{with_kabichk} - echo "**** kABI checking is enabled in kernel SPEC file. ****" - chmod 0755 $RPM_SOURCE_DIR/check-kabi - if [ -e $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu}$Flavour ]; then - cp $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu}$Flavour $RPM_BUILD_ROOT/Module.kabi - $RPM_SOURCE_DIR/check-kabi -k $RPM_BUILD_ROOT/Module.kabi -s Module.symvers || exit 1 - # for now, don't keep it around. - rm $RPM_BUILD_ROOT/Module.kabi - else - echo "**** NOTE: Cannot find reference Module.kabi file. ****" - fi -%endif - -%if %{with_kabidupchk} - echo "**** kABI DUP checking is enabled in kernel SPEC file. ****" - if [ -e $RPM_SOURCE_DIR/Module.kabi_dup_%{_target_cpu}$Flavour ]; then - cp $RPM_SOURCE_DIR/Module.kabi_dup_%{_target_cpu}$Flavour $RPM_BUILD_ROOT/Module.kabi - $RPM_SOURCE_DIR/check-kabi -k $RPM_BUILD_ROOT/Module.kabi -s Module.symvers || exit 1 - # for now, don't keep it around. - rm $RPM_BUILD_ROOT/Module.kabi - else - echo "**** NOTE: Cannot find DUP reference Module.kabi file. ****" - fi -%endif - -%if %{with_kabidw_base} - # Don't build kabi base for debug kernels - if [ "$Flavour" != "kdump" -a "$Flavour" != "debug" ]; then - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf - tar xjvf %{SOURCE301} -C $RPM_BUILD_ROOT/kabi-dwarf - - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf/whitelists - tar xjvf %{SOURCE300} -C $RPM_BUILD_ROOT/kabi-dwarf/whitelists - - echo "**** GENERATING DWARF-based kABI baseline dataset ****" - chmod 0755 $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh - $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh generate \ - "$RPM_BUILD_ROOT/kabi-dwarf/whitelists/kabi-current/kabi_whitelist_%{_target_cpu}" \ - "$(pwd)" \ - "$RPM_BUILD_ROOT/kabidw-base/%{_target_cpu}${Flavour:+.${Flavour}}" || : - - rm -rf $RPM_BUILD_ROOT/kabi-dwarf - fi -%endif - -%if %{with_kabidwchk} - if [ "$Flavour" != "kdump" ]; then - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf - tar xjvf %{SOURCE301} -C $RPM_BUILD_ROOT/kabi-dwarf - if [ -d "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}" ]; then - mkdir -p $RPM_BUILD_ROOT/kabi-dwarf/whitelists - tar xjvf %{SOURCE300} -C $RPM_BUILD_ROOT/kabi-dwarf/whitelists - - echo "**** GENERATING DWARF-based kABI dataset ****" - chmod 0755 $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh - $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh generate \ - "$RPM_BUILD_ROOT/kabi-dwarf/whitelists/kabi-current/kabi_whitelist_%{_target_cpu}" \ - "$(pwd)" \ - "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}.tmp" || : - - echo "**** kABI DWARF-based comparison report ****" - $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh compare \ - "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}" \ - "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}.tmp" || : - echo "**** End of kABI DWARF-based comparison report ****" - else - echo "**** Baseline dataset for kABI DWARF-BASED comparison report not found ****" - fi - - rm -rf $RPM_BUILD_ROOT/kabi-dwarf - fi -%endif - - # then drop all but the needed Makefiles/Kconfig files - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include - cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/tracing - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/spdxcheck.py - - # Files for 'make scripts' to succeed with kernel-devel. - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/security/selinux/include - cp -a --parents security/selinux/include/classmap.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp -a --parents security/selinux/include/initial_sid_to_string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/include/tools - cp -a --parents tools/include/tools/be_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - - if [ -f tools/objtool/objtool ]; then - cp -a tools/objtool/objtool $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/objtool/ || : - fi - if [ -d arch/$Arch/scripts ]; then - cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || : - fi - if [ -f arch/$Arch/*lds ]; then - cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || : - fi - if [ -f arch/%{asmarch}/kernel/module.lds ]; then - cp -a --parents arch/%{asmarch}/kernel/module.lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - fi - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o - rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o -%ifarch ppc64le - cp -a --parents arch/powerpc/lib/crtsavres.[So] $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ -%endif - if [ -d arch/%{asmarch}/include ]; then - cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - fi -%ifarch aarch64 - # arch/arm64/include/asm/xen references arch/arm - cp -a --parents arch/arm/include/asm/xen $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - # arch/arm64/include/asm/opcodes.h references arch/arm - cp -a --parents arch/arm/include/asm/opcodes.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ -%endif - # include the machine specific headers for ARM variants, if available. -%ifarch %{arm} - if [ -d arch/%{asmarch}/mach-${Flavour}/include ]; then - cp -a --parents arch/%{asmarch}/mach-${Flavour}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - fi - # include a few files for 'make prepare' - cp -a --parents arch/arm/tools/gen-mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/arm/tools/mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - -%endif - cp -a include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include -%ifarch i686 x86_64 - # files for 'make prepare' to succeed with kernel-devel - cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/entry/syscalls/syscalltbl.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/entry/syscalls/syscallhdr.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs_32.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs_64.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs_common.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/tools/relocs.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/purgatory.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/stack.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/setup-x86_64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/purgatory/entry64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/boot/string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/boot/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ - cp -a --parents arch/x86/boot/ctype.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/ -%endif - # Make sure the Makefile and version.h have a matching timestamp so that - # external modules can be built - touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/generated/uapi/linux/version.h - - # Copy .config to include/config/auto.conf so "make prepare" is unnecessary. - cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf - -%if %{with_debuginfo} - eu-readelf -n vmlinux | grep "Build ID" | awk '{print $NF}' > vmlinux.id - cp vmlinux.id $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/vmlinux.id - - # - # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm - # - mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer - cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer -%endif - - find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames - - # mark modules executable so that strip-to-file can strip them - xargs --no-run-if-empty chmod u+x < modnames - - # Generate a list of modules for block and networking. - - grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA | - sed -n 's,^.*/\([^/]*\.ko\): *U \(.*\)$,\1 \2,p' > drivers.undef - - collect_modules_list() - { - sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef | - LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1 - if [ ! -z "$3" ]; then - sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1 - fi - } - - collect_modules_list networking \ - 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice' - collect_modules_list block \ - 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko' - collect_modules_list drm \ - 'drm_open|drm_init' - collect_modules_list modesetting \ - 'drm_crtc_init' - - # detect missing or incorrect license tags - ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \ - grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1 - - # remove files that will be auto generated by depmod at rpm -i time - pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ - rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep} - popd - - # Call the modules-extra script to move things around - %{SOURCE24} $RPM_BUILD_ROOT/lib/modules/$KernelVer $RPM_SOURCE_DIR/mod-extra.list - # Blacklist net autoloadable modules in modules-extra - %{SOURCE19} $RPM_BUILD_ROOT lib/modules/$KernelVer - # Call the modules-extra script for internal modules - %{SOURCE24} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE54} internal - - # - # Generate the kernel-core and kernel-modules files lists - # - - # Copy the System.map file for depmod to use, and create a backup of the - # full module tree so we can restore it after we're done filtering - cp System.map $RPM_BUILD_ROOT/. - pushd $RPM_BUILD_ROOT - mkdir restore - cp -r lib/modules/$KernelVer/* restore/. - - # don't include anything going into k-m-e and k-m-i in the file lists - rm -rf lib/modules/$KernelVer/{extra,internal} - - if [ $DoModules -eq 1 ]; then - # Find all the module files and filter them out into the core and - # modules lists. This actually removes anything going into -modules - # from the dir. - find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list - cp $RPM_SOURCE_DIR/filter-*.sh . - ./filter-modules.sh modules.list %{_target_cpu} - rm filter-*.sh - - # Run depmod on the resulting module tree and make sure it isn't broken - depmod -b . -aeF ./System.map $KernelVer &> depmod.out - if [ -s depmod.out ]; then - echo "Depmod failure" - cat depmod.out - exit 1 - else - rm depmod.out - fi - else - # Ensure important files/directories exist to let the packaging succeed - echo '%%defattr(-,-,-)' > modules.list - echo '%%defattr(-,-,-)' > k-d.list - mkdir -p lib/modules/$KernelVer/kernel - # Add files usually created by make modules, needed to prevent errors - # thrown by depmod during package installation - touch lib/modules/$KernelVer/modules.order - touch lib/modules/$KernelVer/modules.builtin - fi - - # remove files that will be auto generated by depmod at rpm -i time - pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/ - rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep} - popd - - # Go back and find all of the various directories in the tree. We use this - # for the dir lists in kernel-core - find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n > module-dirs.list - - # Cleanup - rm System.map - cp -r restore/* lib/modules/$KernelVer/. - rm -rf restore - popd - - # Make sure the files lists start with absolute paths or rpmbuild fails. - # Also add in the dir entries - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/k-d.list > ../kernel${Flavour:+-${Flavour}}-modules.list - sed -e 's/^lib*/%dir \/lib/' %{?zipsed} $RPM_BUILD_ROOT/module-dirs.list > ../kernel${Flavour:+-${Flavour}}-core.list - sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/modules.list >> ../kernel${Flavour:+-${Flavour}}-core.list - - # Cleanup - rm -f $RPM_BUILD_ROOT/k-d.list - rm -f $RPM_BUILD_ROOT/modules.list - rm -f $RPM_BUILD_ROOT/module-dirs.list - -%if %{signmodules} - if [ $DoModules -eq 1 ]; then - # Save the signing keys so we can sign the modules in __modsign_install_post - cp certs/signing_key.pem certs/signing_key.pem.sign${Flav} - cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav} - # STX: Copy these keys as part of the devel package - # The Module signing keys are to ensure that only Out-of-tree - # built against the StarlingX Kernel get signed and loaded sans warnings - cp certs/signing_key.pem ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/ - chmod 755 ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/signing_key.pem - cp certs/signing_key.x509 ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/ - fi -%endif - - # Move the devel headers out of the root file system - mkdir -p $RPM_BUILD_ROOT/usr/src/kernels - mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir - - # This is going to create a broken link during the build, but we don't use - # it after this point. We need the link to actually point to something - # when kernel-devel is installed, and a relative link doesn't work across - # the F17 UsrMove feature. - ln -sf $DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build - - # prune junk from kernel-devel - find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -delete - - # build a BLS config for this kernel - %{SOURCE53} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}" - - # Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel - mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer - %ifarch x86_64 aarch64 - install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20200609.cer - install -m 0644 %{secureboot_ca_1} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20140212.cer - ln -s kernel-signing-ca-20200609.cer $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - %else - install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - %endif - %ifarch s390x ppc64le - if [ $DoModules -eq 1 ]; then - if [ -x /usr/bin/rpm-sign ]; then - install -m 0644 %{secureboot_key_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - else - install -m 0644 certs/signing_key.x509.sign${Flav} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer - openssl x509 -in certs/signing_key.pem.sign${Flav} -outform der -out $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - chmod 0644 $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename} - fi - fi - %endif - -%if %{with_ipaclones} - MAXPROCS=$(echo %{?_smp_mflags} | sed -n 's/-j\s*\([0-9]\+\)/\1/p') - if [ -z "$MAXPROCS" ]; then - MAXPROCS=1 - fi - if [ "$Flavour" == "" ]; then - mkdir -p $RPM_BUILD_ROOT/$DevelDir-ipaclones - find . -name '*.ipa-clones' | xargs -i{} -r -n 1 -P $MAXPROCS install -m 644 -D "{}" "$RPM_BUILD_ROOT/$DevelDir-ipaclones/{}" - fi -%endif - -} - -### -# DO it... -### - -# prepare directories -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/boot -mkdir -p $RPM_BUILD_ROOT%{_libexecdir} - -cd linux-%{KVERREL} - - -%if %{with_debug} -BuildKernel %make_target %kernel_image %{_use_vdso} debug -%endif - -%if %{with_zfcpdump} -BuildKernel %make_target %kernel_image %{_use_vdso} zfcpdump -%endif - -%if %{with_pae} -BuildKernel %make_target %kernel_image %{use_vdso} lpae -%endif - -%if %{with_up} -BuildKernel %make_target %kernel_image %{_use_vdso} -%endif - -%global perf_make \ - make -s EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 prefix=%{_prefix} PYTHON=%{__python} -%if %{with_perf} -# perf -# make sure check-headers.sh is executable -chmod +x tools/perf/check-headers.sh -%{perf_make} DESTDIR=$RPM_BUILD_ROOT all -%endif - -%global tools_make \ - %{make} CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" V=1 - -%if %{with_tools} -%ifarch %{cpupowerarchs} -# cpupower -# make sure version-gen.sh is executable. -chmod +x tools/power/cpupower/utils/version-gen.sh -%{tools_make} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false -%ifarch x86_64 - pushd tools/power/cpupower/debug/x86_64 - %{tools_make} %{?_smp_mflags} centrino-decode powernow-k8-decode - popd -%endif -%ifarch x86_64 - pushd tools/power/x86/x86_energy_perf_policy/ - %{tools_make} - popd - pushd tools/power/x86/turbostat - %{tools_make} - popd - pushd tools/power/x86/intel-speed-select - %{make} - popd -%endif -%endif -pushd tools/thermal/tmon/ -%{tools_make} -popd -pushd tools/iio/ -%{make} -popd -pushd tools/gpio/ -%{make} -popd -%endif - -%global bpftool_make \ - make EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT V=1 -%if %{with_bpftool} -pushd tools/bpf/bpftool -%{bpftool_make} -popd -%endif - -%if %{with_selftests} -%{make} -s ARCH=$Arch V=1 samples/bpf/ -pushd tools/testing/selftests -# We need to install here because we need to call make with ARCH set which -# doesn't seem possible to do in the install section. -%{make} -s ARCH=$Arch V=1 TARGETS="bpf livepatch net" INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests install -popd -%endif - -%if %{with_doc} -# Make the HTML pages. -make PYTHON=/usr/bin/python3 htmldocs || %{doc_build_fail} - -# sometimes non-world-readable files sneak into the kernel source tree -chmod -R a=rX Documentation -find Documentation -type d | xargs chmod u+w -%endif - -# In the modsign case, we do 3 things. 1) We check the "flavour" and hard -# code the value in the following invocations. This is somewhat sub-optimal -# but we're doing this inside of an RPM macro and it isn't as easy as it -# could be because of that. 2) We restore the .tmp_versions/ directory from -# the one we saved off in BuildKernel above. This is to make sure we're -# signing the modules we actually built/installed in that flavour. 3) We -# grab the arch and invoke mod-sign.sh command to actually sign the modules. -# -# We have to do all of those things _after_ find-debuginfo runs, otherwise -# that will strip the signature off of the modules. -# -# Don't sign modules for the zfcpdump flavour as it is monolithic. - -%define __modsign_install_post \ - if [ "%{signmodules}" -eq "1" ]; then \ - if [ "%{with_pae}" -ne "0" ]; then \ - %{modsign_cmd} certs/signing_key.pem.sign+lpae certs/signing_key.x509.sign+lpae $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+lpae/ \ - fi \ - if [ "%{with_debug}" -ne "0" ]; then \ - %{modsign_cmd} certs/signing_key.pem.sign+debug certs/signing_key.x509.sign+debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+debug/ \ - fi \ - if [ "%{with_up}" -ne "0" ]; then \ - %{modsign_cmd} certs/signing_key.pem.sign certs/signing_key.x509.sign $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/ \ - fi \ - fi \ - if [ "%{zipmodules}" -eq "1" ]; then \ - find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -P%{zcpu} xz; \ - fi \ -%{nil} - -### -### Special hacks for debuginfo subpackages. -### - -# This macro is used by %%install, so we must redefine it before that. -%define debug_package %{nil} - -%if %{with_debuginfo} - -%ifnarch noarch -%global __debug_package 1 -%files -f debugfiles.list debuginfo-common-%{_target_cpu} -%endif - -%endif - -# We don't want to package debuginfo for self-tests and samples but -# we have to delete them to avoid an error messages about unpackaged -# files. -# Delete the debuginfo for for kernel-devel files -%define __remove_unwanted_dbginfo_install_post \ - if [ "%{with_selftests}" -ne "0" ]; then \ - rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/libexec/ksamples; \ - rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/libexec/kselftests; \ - fi \ - rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/src; \ -%{nil} - -# -# Disgusting hack alert! We need to ensure we sign modules *after* all -# invocations of strip occur, which is in __debug_install_post if -# find-debuginfo.sh runs, and __os_install_post if not. -# -%define __spec_install_post \ - %{?__debug_package:%{__debug_install_post}}\ - %{__arch_install_post}\ - %{__os_install_post}\ - %{__remove_unwanted_dbginfo_install_post}\ - %{__modsign_install_post} - -### -### install -### - -%install -%if 0%{?rhel} == 7 -source scl_source enable devtoolset-8 || : -source scl_source enable llvm-toolset-7.0 || : -%endif - -cd linux-%{KVERREL} - -%if %{with_doc} -docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{rpmversion} - -# copy the source over -mkdir -p $docdir -tar -h -f - --exclude=man --exclude='.*' -c Documentation | tar xf - -C $docdir - -# with_doc -%endif - -# We have to do the headers install before the tools install because the -# kernel headers_install will remove any header files in /usr/include that -# it doesn't install itself. - -%if %{with_headers} -# Install kernel headers -make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install - -find $RPM_BUILD_ROOT/usr/include \ - \( -name .install -o -name .check -o \ - -name ..install.cmd -o -name ..check.cmd \) -delete - -%endif - -%if %{with_cross_headers} -%if 0%{?fedora} -HDR_ARCH_LIST='arm arm64 powerpc s390 x86' -%else -HDR_ARCH_LIST='arm64 powerpc s390 x86' -%endif -mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers - -for arch in $HDR_ARCH_LIST; do - mkdir $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} - make ARCH=${arch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} headers_install -done - -find $RPM_BUILD_ROOT/usr/tmp-headers \ - \( -name .install -o -name .check -o \ - -name ..install.cmd -o -name ..check.cmd \) -delete - -# Copy all the architectures we care about to their respective asm directories -for arch in $HDR_ARCH_LIST ; do - mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include - mv $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch}/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/ -done - -rm -rf $RPM_BUILD_ROOT/usr/tmp-headers -%endif - -%if %{with_kernel_abi_whitelists} -# kabi directory -INSTALL_KABI_PATH=$RPM_BUILD_ROOT/lib/modules/ -mkdir -p $INSTALL_KABI_PATH - -# install kabi releases directories -tar xjvf %{SOURCE300} -C $INSTALL_KABI_PATH -# with_kernel_abi_whitelists -%endif - -%if %{with_perf} -# perf tool binary and supporting scripts/binaries -%{perf_make} DESTDIR=$RPM_BUILD_ROOT lib=%{_lib} install-bin install-traceevent-plugins -# remove the 'trace' symlink. -rm -f %{buildroot}%{_bindir}/trace - -# For both of the below, yes, this should be using a macro but right now -# it's hard coded and we don't actually want it anyway right now. -# Whoever wants examples can fix it up! - -# remove examples -rm -rf %{buildroot}/usr/lib/perf/examples -# remove the stray files that somehow got packaged -rm -rf %{buildroot}/usr/lib/perf/include/bpf/bpf.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/stdio.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/linux/socket.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/pid_filter.h -rm -rf %{buildroot}/usr/lib/perf/include/bpf/unistd.h - -# python-perf extension -%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext - -# perf man pages (note: implicit rpm magic compresses them later) -mkdir -p %{buildroot}/%{_mandir}/man1 -%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man -%endif - -%if %{with_tools} -%ifarch %{cpupowerarchs} -%{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install -rm -f %{buildroot}%{_libdir}/*.{a,la} -%find_lang cpupower -mv cpupower.lang ../ -%ifarch x86_64 - pushd tools/power/cpupower/debug/x86_64 - install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode - install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode - popd -%endif -chmod 0755 %{buildroot}%{_libdir}/libcpupower.so* -mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig -install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service -install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower -%endif -%ifarch x86_64 - mkdir -p %{buildroot}%{_mandir}/man8 - pushd tools/power/x86/x86_energy_perf_policy - %{tools_make} DESTDIR=%{buildroot} install - popd - pushd tools/power/x86/turbostat - %{tools_make} DESTDIR=%{buildroot} install - popd - pushd tools/power/x86/intel-speed-select - %{tools_make} CFLAGS+="-D_GNU_SOURCE -Iinclude" DESTDIR=%{buildroot} install - popd -%endif -pushd tools/thermal/tmon -%{tools_make} INSTALL_ROOT=%{buildroot} install -popd -pushd tools/iio -make DESTDIR=%{buildroot} install -popd -pushd tools/gpio -make DESTDIR=%{buildroot} install -popd -pushd tools/kvm/kvm_stat -make INSTALL_ROOT=%{buildroot} install-tools -make INSTALL_ROOT=%{buildroot} install-man -popd -%endif - -%if %{with_bpftool} -pushd tools/bpf/bpftool -%{bpftool_make} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install -popd -%endif - -%if %{with_selftests} -pushd samples -install -d %{buildroot}%{_libexecdir}/ksamples -# install bpf samples -pushd bpf -install -d %{buildroot}%{_libexecdir}/ksamples/bpf -find -type f -executable -exec install -m755 {} %{buildroot}%{_libexecdir}/ksamples/bpf \; -install -m755 *.sh %{buildroot}%{_libexecdir}/ksamples/bpf -# test_lwt_bpf.sh compiles test_lwt_bpf.c when run; this works only from the -# kernel tree. Just remove it. -rm %{buildroot}%{_libexecdir}/ksamples/bpf/test_lwt_bpf.sh -install -m644 tcp_bpf.readme %{buildroot}%{_libexecdir}/ksamples/bpf -popd -# install pktgen samples -pushd pktgen -install -d %{buildroot}%{_libexecdir}/ksamples/pktgen -find . -type f -executable -exec install -m755 {} %{buildroot}%{_libexecdir}/ksamples/pktgen/{} \; -find . -type f ! -executable -exec install -m644 {} %{buildroot}%{_libexecdir}/ksamples/pktgen/{} \; -popd -popd -# install drivers/net/mlxsw selftests -pushd tools/testing/selftests/drivers/net/mlxsw -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \; -popd -# install net/forwarding selftests -pushd tools/testing/selftests/net/forwarding -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \; -popd -# install tc-testing selftests -pushd tools/testing/selftests/tc-testing -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \; -popd -# install livepatch selftests -pushd tools/testing/selftests/livepatch -find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \; -find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \; -find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \; -popd -%endif - -# We have to do the headers checksum calculation after the tools install because -# these might end up installing their own set of headers on top of kernel's -%if %{with_headers} -# compute a content hash to export as Provides: kernel-headers-checksum -HEADERS_CHKSUM=$(export LC_ALL=C; find $RPM_BUILD_ROOT/usr/include -type f -name "*.h" \ - ! -path $RPM_BUILD_ROOT/usr/include/linux/version.h | \ - sort | xargs cat | sha1sum - | cut -f 1 -d ' '); -# export the checksum via usr/include/linux/version.h, so the dynamic -# find-provides can grab the hash to update it accordingly -echo "#define KERNEL_HEADERS_CHECKSUM \"$HEADERS_CHKSUM\"" >> $RPM_BUILD_ROOT/usr/include/linux/version.h -%endif - -### -### clean -### - -### -### scripts -### -%transfiletriggerpostun -- /lib/modules/%{KVERREL}%{?1:+%{1}}/ -# No file list is provided via standard input, according to the -# documentation, so we do not need to flush standard input. - -# This script will not run if the patch includes kernel. - -echo "Updating initramfs with dracut..." -if dracut --force ; then - echo "Successfully updated initramfs." -else - echo "Failed to update initramfs." - echo "You must update your initramfs image for changes to take place." - exit -1 -fi - -%transfiletriggerin -- /lib/modules/%{KVERREL}%{?1:+%{1}}/ -# Need to flush the standard input, because a list of files that caused -# this trigger to fire is provided by RPM via standard input. If needed, -# we can check if there are specific files we are interested in and only -# re-generate initramfs in that case, but in our use case, this is not -# necessary -- we always want to regenerate the initramfs. - -# Regardless of which files fire the trigger, we would like to regenerate -# the initramfs, so flush the standard input. -cat >/dev/null -# There will be one left-over initramfs after upgrade or downgrade if the -# patch includes kernel. To solve this problem, we added a judgment, if -# the kernel is upgrading, initramfs will not be generated. - -# For example, we will downgrade kernel from 5.10.112-200.49 to 5.10.112-200.48. -# There will be two initramfs in /boot after downgrade. -# initramfs-5.10.112-200.48.tis.el7.x86_64.img -# initramfs-5.10.112-200.49.tis.el7.x86_64.img(left-over one) -# The running kernel verion is 5.10.112-200.49 when this script run, so -# initramfs-5.10.112-200.49.tis.el7.x86_64.img is generated. -# The running kernel version is different with the one that we will -# upgrade or downgrade. -if [ "$(uname -r)" == "%{KVERREL}%{?1:+%{1}}" ]; then - echo "Updating initramfs with dracut..." - if dracut --force ; then - echo "Successfully updated initramfs." - else - echo "Failed to update initramfs." - echo "You must update your initramfs image for changes to take place." - exit -1 - fi -fi - -%if %{with_tools} -%post -n kernel-tools-libs -/sbin/ldconfig - -%postun -n kernel-tools-libs -/sbin/ldconfig -%endif - -# -# This macro defines a %%post script for a kernel*-devel package. -# %%kernel_devel_post [] -# Note we don't run hardlink if ostree is in use, as ostree is -# a far more sophisticated hardlink implementation. -# https://github.com/projectatomic/rpm-ostree/commit/58a79056a889be8814aa51f507b2c7a4dccee526 -# -%define kernel_devel_post() \ -%{expand:%%post %{?1:%{1}-}devel}\ -if [ -f /etc/sysconfig/kernel ]\ -then\ - . /etc/sysconfig/kernel || exit $?\ -fi\ -if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink -a ! -e /run/ostree-booted ] \ -then\ - (cd /usr/src/kernels/%{KVERREL}%{?1:+%{1}} &&\ - /usr/bin/find . -type f | while read f; do\ - hardlink -c /usr/src/kernels/*%{?dist}.*/$f $f\ - done)\ -fi\ -%{nil} - -# -# This macro defines a %%post script for a kernel*-modules-extra package. -# It also defines a %%postun script that does the same thing. -# %%kernel_modules_extra_post [] -# -%define kernel_modules_extra_post() \ -%{expand:%%post %{?1:%{1}-}modules-extra}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil}\ -%{expand:%%postun %{?1:%{1}-}modules-extra}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil} - -# -# This macro defines a %%post script for a kernel*-modules-internal package. -# It also defines a %%postun script that does the same thing. -# %%kernel_modules_internal_post [] -# -%define kernel_modules_internal_post() \ -%{expand:%%post %{?1:%{1}-}modules-internal}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil}\ -%{expand:%%postun %{?1:%{1}-}modules-internal}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil} - -# -# This macro defines a %%post script for a kernel*-modules package. -# It also defines a %%postun script that does the same thing. -# %%kernel_modules_post [] -# -%define kernel_modules_post() \ -%{expand:%%post %{?1:%{1}-}modules}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil}\ -%{expand:%%postun %{?1:%{1}-}modules}\ -/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\ -%{nil} - -# This macro defines a %%posttrans script for a kernel package. -# %%kernel_variant_posttrans [] -# More text can follow to go at the end of this variant's %%post. -# -%define kernel_variant_posttrans() \ -%{expand:%%posttrans %{?1:%{1}-}core}\ -%if 0%{!?fedora:1}\ -if [ -x %{_sbindir}/weak-modules ]\ -then\ - %{_sbindir}/weak-modules --add-kernel %{KVERREL}%{?1:+%{1}} || exit $?\ -fi\ -%endif\ -/bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ -/usr/sbin/grub2-set-default 0 || :\ -%{nil} - -# -# This macro defines a %%post script for a kernel package and its devel package. -# %%kernel_variant_post [-v ] [-r ] -# More text can follow to go at the end of this variant's %%post. -# -%define kernel_variant_post(v:r:) \ -%{expand:%%kernel_devel_post %{?-v*}}\ -%{expand:%%kernel_modules_post %{?-v*}}\ -%{expand:%%kernel_modules_extra_post %{?-v*}}\ -%{expand:%%kernel_modules_internal_post %{?-v*}}\ -%{expand:%%kernel_variant_posttrans %{?-v*}}\ -%{expand:%%post %{?-v*:%{-v*}-}core}\ -%{-r:\ -if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ] &&\ - [ -f /etc/sysconfig/kernel ]; then\ - /bin/sed -r -i -e 's/^DEFAULTKERNEL=%{-r*}$/DEFAULTKERNEL=kernel%{?-v:-%{-v*}}/' /etc/sysconfig/kernel || exit $?\ -fi}\ -%{nil} - -# -# This macro defines a %%preun script for a kernel package. -# %%kernel_variant_preun -# -%define kernel_variant_preun() \ -%{expand:%%preun %{?1:%{1}-}core}\ -/bin/kernel-install remove %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ -%if 0%{!?fedora:1}\ -if [ -x %{_sbindir}/weak-modules ]\ -then\ - %{_sbindir}/weak-modules --remove-kernel %{KVERREL}%{?1:+%{1}} || exit $?\ -fi\ -%endif\ -%{nil} - -%kernel_variant_preun -%kernel_variant_post -r kernel-smp - -%if %{with_pae} -%kernel_variant_preun lpae -%kernel_variant_post -v lpae -r (kernel|kernel-smp) -%endif - -%kernel_variant_preun debug -%kernel_variant_post -v debug - -%if %{with_zfcpdump} -%kernel_variant_preun zfcpdump -%kernel_variant_post -v zfcpdump -%endif - -if [ -x /sbin/ldconfig ] -then - /sbin/ldconfig -X || exit $? -fi - -### -### file lists -### - -%if %{with_headers} -%files headers -/usr/include/* -%endif - -%if %{with_cross_headers} -%files cross-headers -/usr/*-linux-gnu/include/* -%endif - -%if %{with_kernel_abi_whitelists} -%files -n kernel-abi-whitelists -/lib/modules/kabi-* -%endif - -%if %{with_kabidw_base} -%ifarch x86_64 s390x ppc64 ppc64le aarch64 -%files kabidw-base -%defattr(-,root,root) -/kabidw-base/%{_target_cpu}/* -%endif -%endif - -# only some architecture builds need kernel-doc -%if %{with_doc} -%files doc -%defattr(-,root,root) -%{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation/* -%dir %{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation -%dir %{_datadir}/doc/kernel-doc-%{rpmversion} -%endif - -%if %{with_perf} -%files -n perf -%{_bindir}/perf -%{_libdir}/libperf-jvmti.so -%dir %{_libdir}/traceevent/plugins -%{_libdir}/traceevent/plugins/* -%dir %{_libexecdir}/perf-core -%{_libexecdir}/perf-core/* -%{_datadir}/perf-core/* -%{_mandir}/man[1-8]/perf* -%{_sysconfdir}/bash_completion.d/perf -%doc linux-%{KVERREL}/tools/perf/Documentation/examples.txt -%{_docdir}/perf-tip/tips.txt - -%files -n python-perf -%{python_sitearch}/* - -%if %{with_debuginfo} -%files -f perf-debuginfo.list -n perf-debuginfo - -%files -f python-perf-debuginfo.list -n python-perf-debuginfo -%endif -# with_perf -%endif - -%if %{with_tools} -%ifnarch %{cpupowerarchs} -%files -n kernel-tools -%else -%files -n kernel-tools -f cpupower.lang -%{_bindir}/cpupower -%{_datadir}/bash-completion/completions/cpupower -%ifarch x86_64 -%{_bindir}/centrino-decode -%{_bindir}/powernow-k8-decode -%endif -%{_unitdir}/cpupower.service -%{_mandir}/man[1-8]/cpupower* -%config(noreplace) %{_sysconfdir}/sysconfig/cpupower -%ifarch x86_64 -%{_bindir}/x86_energy_perf_policy -%{_mandir}/man8/x86_energy_perf_policy* -%{_bindir}/turbostat -%{_mandir}/man8/turbostat* -%{_bindir}/intel-speed-select -%endif -# cpupowerarchs -%endif -%{_bindir}/tmon -%{_bindir}/iio_event_monitor -%{_bindir}/iio_generic_buffer -%{_bindir}/lsiio -%{_bindir}/lsgpio -%{_bindir}/gpio-hammer -%{_bindir}/gpio-event-mon -%{_bindir}/gpio-watch -%{_mandir}/man1/kvm_stat* -%{_bindir}/kvm_stat - -%if %{with_debuginfo} -%files -f kernel-tools-debuginfo.list -n kernel-tools-debuginfo -%endif - -%ifarch %{cpupowerarchs} -%files -n kernel-tools-libs -%{_libdir}/libcpupower.so.0 -%{_libdir}/libcpupower.so.0.0.1 - -%files -n kernel-tools-libs-devel -%{_libdir}/libcpupower.so -%{_includedir}/cpufreq.h -%endif -# with_tools -%endif - -%if %{with_bpftool} -%files -n bpftool -%{_sbindir}/bpftool -%{_sysconfdir}/bash_completion.d/bpftool -%{_mandir}/man8/bpftool-cgroup.8.gz -%{_mandir}/man8/bpftool-gen.8.gz -%{_mandir}/man8/bpftool-iter.8.gz -%{_mandir}/man8/bpftool-link.8.gz -%{_mandir}/man8/bpftool-map.8.gz -%{_mandir}/man8/bpftool-prog.8.gz -%{_mandir}/man8/bpftool-perf.8.gz -%{_mandir}/man8/bpftool.8.gz -%{_mandir}/man7/bpf-helpers.7.gz -%{_mandir}/man8/bpftool-net.8.gz -%{_mandir}/man8/bpftool-feature.8.gz -%{_mandir}/man8/bpftool-btf.8.gz -%{_mandir}/man8/bpftool-struct_ops.8.gz - -%if %{with_debuginfo} -%files -f bpftool-debuginfo.list -n bpftool-debuginfo -%defattr(-,root,root) -%endif -%endif - -%if %{with_selftests} -%files selftests-internal -%{_libexecdir}/ksamples -%{_libexecdir}/kselftests -%endif - -# empty meta-package -%ifnarch %nobuildarches noarch -%files -%endif - -%if %{with_gcov} -%ifarch x86_64 s390x ppc64le aarch64 -%files gcov -%{_builddir} -%endif -%endif - -# This is %%{image_install_path} on an arch where that includes ELF files, -# or empty otherwise. -%define elf_image_install_path %{?kernel_image_elf:%{image_install_path}} - -# -# This macro defines the %%files sections for a kernel package -# and its devel and debuginfo packages. -# %%kernel_variant_files [-k vmlinux] -# -%define kernel_variant_files(k:) \ -%if %{2}\ -%{expand:%%files -f kernel-%{?3:%{3}-}core.list %{?1:-f kernel-%{?3:%{3}-}ldsoconf.list} %{?3:%{3}-}core}\ -%{!?_licensedir:%global license %%doc}\ -%license linux-%{KVERREL}/COPYING-%{version}-%{release}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}\ -%ghost /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/.vmlinuz.hmac \ -%ghost /%{image_install_path}/.vmlinuz-%{KVERREL}%{?3:+%{3}}.hmac \ -%ifarch %{arm} aarch64\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/dtb \ -%ghost /%{image_install_path}/dtb-%{KVERREL}%{?3:+%{3}} \ -%endif\ -%attr(600,root,root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\ -%ghost /boot/System.map-%{KVERREL}%{?3:+%{3}}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.gz\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/config\ -%if 0%{?rhel} == 7\ -/boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ -%else\ -%ghost /boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ -%endif\ -%ghost /boot/config-%{KVERREL}%{?3:+%{3}}\ -%ghost /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ -%dir /lib/modules\ -%dir /lib/modules/%{KVERREL}%{?3:+%{3}}\ -%dir /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/build\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/source\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/updates\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/bls.conf\ -%if 0%{!?fedora:1}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/weak-updates\ -%endif\ -%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/kernel-signing-ca*.cer\ -%ifarch s390x ppc64le\ -%if 0%{!?4:1}\ -%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/%{signing_key_filename} \ -%endif\ -%endif\ -%if %{1}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/vdso\ -%endif\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/modules.*\ -%{expand:%%files -f kernel-%{?3:%{3}-}modules.list %{?3:%{3}-}modules}\ -%{expand:%%files %{?3:%{3}-}devel}\ -%defverify(not mtime)\ -/usr/src/kernels/%{KVERREL}%{?3:+%{3}}\ -%exclude /usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.x509\ -%exclude /usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.pem\ -%{expand:%%files %{?3:%{3}-}devel-keys}\ -/usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.x509\ -/usr/src/kernels/%{KVERREL}%{?3:+%{3}}/signing_key.pem\ -%{expand:%%files %{?3:%{3}-}modules-extra}\ -%config(noreplace) /etc/modprobe.d/*-blacklist.conf\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/extra\ -%{expand:%%files %{?3:%{3}-}modules-internal}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/internal\ -%if %{with_debuginfo}\ -%ifnarch noarch\ -%{expand:%%files -f debuginfo%{?3}.list %{?3:%{3}-}debuginfo}\ -%endif\ -%endif\ -%ifarch x86_64\ -%{expand:%%files %{?3:%{3}-}unsigned}\ -/%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}.unsigned\ -%endif\ -%if %{?3:1} %{!?3:0}\ -%{expand:%%files %{3}}\ -%endif\ -%endif\ -%{nil} - -%kernel_variant_files %{_use_vdso} %{with_up} -%kernel_variant_files %{_use_vdso} %{with_debug} debug -%kernel_variant_files %{use_vdso} %{with_pae} lpae -%kernel_variant_files %{_use_vdso} %{with_zfcpdump} zfcpdump 1 - -%define kernel_variant_ipaclones(k:) \ -%if %{1}\ -%if %{with_ipaclones}\ -%{expand:%%files %{?2:%{2}-}ipaclones-internal}\ -%defattr(-,root,root)\ -%defverify(not mtime)\ -/usr/src/kernels/%{KVERREL}%{?2:+%{2}}-ipaclones\ -%endif\ -%endif\ -%{nil} - -%kernel_variant_ipaclones %{with_up} - -# plz don't put in a version string unless you're going to tag -# and build. -# -# -%changelog -* Tue Aug 30 2022 Jiping Ma - 5.10.112 -- Place module signing keys in a separate package kernel-devel-keys. - -* Mon Jul 05 2021 Jiping Ma - 5.10.30 -- This spec file is based on -- https://vault.centos.org/altarch/7/experimental/Source/SPackages/kernel-5.10.23-200.el7.src.rpm -- kernel.spec file with adaptations for StarlingX and linux-yocto. -- Added STX patches -- Support linux-yocto git source -- Copy keys as part of the devel package -- kernel-5.10.30-x86_64.config.tis_extra repace of kernel-local. -- Add a dist field to avoid undesired rebuildsi -- Ensure -unsigned package is populated - -* Thu Mar 11 2021 Justin M. Forbes - 5.10.23-200 -- Linux v5.10.23 - diff --git a/kernel-std/centos/patches/0001-Notification-of-death-of-arbitrary-processes.patch b/kernel-std/centos/patches/0001-Notification-of-death-of-arbitrary-processes.patch deleted file mode 100644 index 7f26121b..00000000 --- a/kernel-std/centos/patches/0001-Notification-of-death-of-arbitrary-processes.patch +++ /dev/null @@ -1,545 +0,0 @@ -From a6d19757680f81e529c789e77bcac01f9b9e2fbd Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Thu, 17 Jun 2021 07:44:04 +0000 -Subject: [PATCH] Notification of death of arbitrary processes - -Note: this commit was copied from Titanium Cloud Rel2 - -This exposes a new feature which may be called to request -notification when an arbitrary process changes state. The -caller specifies a pid, signal number, and event mask, and -when that pid dies, or is stopped, or anything else that -would normally cause a SIGCHLD, the kernel will send the -specified signal to the caller if the event is in the event -mask originally passed down. The siginfo_t struct will -contain the same information as would be included with SIGCHLD. - -This is exposed to userspace via the prctl() call with the -PR_DO_NOTIFY_TASK_STATE option. - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Shuicheng Lin -[jm: Adapted the patch for context changes.] -Signed-off-by: Jiping Ma ---- - include/linux/init_task.h | 9 ++ - include/linux/sched.h | 6 + - include/uapi/linux/prctl.h | 16 +++ - init/Kconfig | 15 +++ - init/init_task.c | 1 + - kernel/Makefile | 1 + - kernel/death_notify.c | 228 +++++++++++++++++++++++++++++++++++++ - kernel/death_notify.h | 46 ++++++++ - kernel/exit.c | 6 + - kernel/fork.c | 4 + - kernel/signal.c | 11 ++ - kernel/sys.c | 8 ++ - 12 files changed, 351 insertions(+) - create mode 100644 kernel/death_notify.c - create mode 100644 kernel/death_notify.h - -diff --git a/include/linux/init_task.h b/include/linux/init_task.h -index b2412b4d4c20..7a0828daf59c 100644 ---- a/include/linux/init_task.h -+++ b/include/linux/init_task.h -@@ -25,6 +25,15 @@ - extern struct files_struct init_files; - extern struct fs_struct init_fs; - extern struct nsproxy init_nsproxy; -+ -+#ifdef CONFIG_SIGEXIT -+#define INIT_SIGEXIT(tsk) \ -+ .notify = LIST_HEAD_INIT(tsk.notify), \ -+ .monitor = LIST_HEAD_INIT(tsk.monitor), -+#else -+#define INIT_SIGEXIT(tsk) -+#endif -+ - extern struct group_info init_groups; - extern struct cred init_cred; - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 76cd21fa5501..614cd20935a7 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -1119,6 +1119,12 @@ struct task_struct { - short il_prev; - short pref_node_fork; - #endif -+#ifdef CONFIG_SIGEXIT -+ /* list of processes to notify on death */ -+ struct list_head notify; -+ /* list of outstanding monitor requests */ -+ struct list_head monitor; -+#endif - #ifdef CONFIG_NUMA_BALANCING - int numa_scan_seq; - unsigned int numa_scan_period; -diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h -index 7f0827705c9a..dbd5a8b6e002 100644 ---- a/include/uapi/linux/prctl.h -+++ b/include/uapi/linux/prctl.h -@@ -63,6 +63,22 @@ - # define PR_ENDIAN_LITTLE 1 /* True little endian mode */ - # define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ - -+#define PR_DO_NOTIFY_TASK_STATE 17 /* Set/get notification for task -+ state changes */ -+ -+/* This is the data structure for requestion process death -+ * (and other state change) information. Sig of -1 means -+ * query, sig of 0 means deregistration, positive sig means -+ * that you want to set it. sig and events are value-result -+ * and will be updated with the previous values on every -+ * successful call. -+ */ -+struct task_state_notify_info { -+ int pid; -+ int sig; -+ unsigned int events; -+}; -+ - /* Get/set process seccomp mode */ - #define PR_GET_SECCOMP 21 - #define PR_SET_SECCOMP 22 -diff --git a/init/Kconfig b/init/Kconfig -index fc4c9f416fad..df9d5284f8d6 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1851,6 +1851,21 @@ config VM_EVENT_COUNTERS - on EXPERT systems. /proc/vmstat will only show page counts - if VM event counters are disabled. - -+config SIGEXIT -+ bool "Notification of death of arbitrary processes" -+ default n -+ help -+ When enabled this exposes a new feature which may be called to request -+ notification when an arbitrary process changes state. The caller specifies -+ a pid, signal number, and event mask, and when that pid dies, or is -+ stopped, or anything else that would normally cause a SIGCHLD, the -+ kernel will send the specified signal to the caller if the event is in -+ the event mask originally passed down. The siginfo_t struct will -+ contain the same information as would be included with SIGCHLD. -+ -+ This is exposed to userspace via the prctl() -+ call with the PR_DO_NOTIFY_TASK_STATE option -+ - config SLUB_DEBUG - default y - bool "Enable SLUB debugging support" if EXPERT -diff --git a/init/init_task.c b/init/init_task.c -index 16d14c2ebb55..eaee56e60985 100644 ---- a/init/init_task.c -+++ b/init/init_task.c -@@ -128,6 +128,7 @@ struct task_struct init_task - .alloc_lock = __SPIN_LOCK_UNLOCKED(init_task.alloc_lock), - .journal_info = NULL, - INIT_CPU_TIMERS(init_task) -+ INIT_SIGEXIT(init_task) - .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(init_task.pi_lock), - .timer_slack_ns = 50000, /* 50 usec default slack */ - .thread_pid = &init_struct_pid, -diff --git a/kernel/Makefile b/kernel/Makefile -index 88b60a6e5dd0..36377f54555a 100644 ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -108,6 +108,7 @@ obj-$(CONFIG_BPF) += bpf/ - obj-$(CONFIG_KCSAN) += kcsan/ - obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o - obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o -+obj-$(CONFIG_SIGEXIT) += death_notify.o - - obj-$(CONFIG_PERF_EVENTS) += events/ - -diff --git a/kernel/death_notify.c b/kernel/death_notify.c -new file mode 100644 -index 000000000000..5819d35a2564 ---- /dev/null -+++ b/kernel/death_notify.c -@@ -0,0 +1,228 @@ -+/* -+ * kernel/death_notify.c, Process death notification support -+ * -+ * Copyright (c) 2006-2014 Wind River Systems, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "death_notify.h" -+ -+static void unlink_status_notifier(struct signotifier *n) -+{ -+ list_del(&n->monitor_list); -+ list_del(&n->notify_list); -+ kfree(n); -+} -+ -+static void handle_already_monitoring(struct signotifier *node, -+ struct task_state_notify_info *args, -+ struct task_state_notify_info *oldargs) -+{ -+ /* Store the old values */ -+ oldargs->sig = node->sig; -+ oldargs->events = node->events; -+ -+ /* We know that args->sig is 0 or a valid signal. */ -+ if (args->sig > 0) { -+ /* Update the new values */ -+ node->sig = args->sig; -+ node->events = args->events; -+ } else if (!args->sig) { -+ /* args->sig of 0 means to deregister */ -+ unlink_status_notifier(node); -+ } -+} -+ -+static void setup_new_node(struct task_struct *p, -+ struct signotifier *node, -+ struct task_state_notify_info *args) -+{ -+ node->notify_tsk = current; -+ node->sig = args->sig; -+ node->events = args->events; -+ -+ /* Add this node to the list of notification requests -+ * for the specified process. -+ */ -+ list_add_tail(&node->notify_list, &p->notify); -+ -+ /* Also add this node to the list of monitor requests -+ * for the current process. -+ */ -+ list_add_tail(&node->monitor_list, ¤t->monitor); -+} -+ -+/* Returns 0 if arguments are valid, 1 if they are not. */ -+static int invalid_args(struct task_state_notify_info *args) -+{ -+ int ret = 1; -+ -+ if (args->pid <= 0) -+ goto out; -+ -+ /* Sig of -1 implies query, sig of 0 implies deregistration. -+ * Otherwise sig must be positive and within range. -+ */ -+ if ((args->sig < -1) || (args->sig > _NSIG)) -+ goto out; -+ -+ /* If positive sig, must have valid events. */ -+ if (args->sig > 0) { -+ if (!args->events || (args->events >= (1 << (NSIGCHLD+1)))) -+ goto out; -+ } -+ -+ ret = 0; -+out: -+ return ret; -+} -+ -+/* Notify those registered for process state updates via do_notify_task_state(). -+ * If "del" is nonzero, the process is dying and we want to free -+ * the nodes in the list as we go. -+ * -+ * Note: we only notify processes for events in which they have registered -+ * interest. -+ * -+ * Must be called holding a lock on tasklist_lock. -+ */ -+void do_notify_others(struct task_struct *tsk, struct kernel_siginfo *info) -+{ -+ struct signotifier *node; -+ unsigned int events; -+ -+ /* This method of generating the event bit must be -+ * matched in the userspace library. -+ */ -+ events = 1 << (info->si_code & 0xFF); -+ -+ list_for_each_entry(node, &tsk->notify, notify_list) { -+ if (events & node->events) { -+ info->si_signo = node->sig; -+ group_send_sig_info(node->sig, info, node->notify_tsk, PIDTYPE_TGID); -+ } -+ } -+} -+ -+void release_notify_others(struct task_struct *p) -+{ -+ struct signotifier *n, *t; -+ -+ /* Need to clean up any outstanding requests where we -+ * wanted to be notified when others died. -+ */ -+ list_for_each_entry_safe(n, t, &p->monitor, monitor_list) { -+ unlink_status_notifier(n); -+ } -+ -+ /* Also need to clean up any outstanding requests where others -+ * wanted to be notified when we died. -+ */ -+ list_for_each_entry_safe(n, t, &p->notify, notify_list) { -+ unlink_status_notifier(n); -+ } -+} -+ -+/* If the config is defined, then processes can call this routine -+ * to request notification when the specified task's state changes. -+ * On the death (or other state change) of the specified process, -+ * we will send them the specified signal if the event is listed -+ * in their event bitfield. -+ * -+ * A sig of 0 means that we want to deregister. -+ * -+ * The sig/events fields are value/result. On success we update them -+ * to reflect what they were before the call. -+ * -+ * Returns error code on error, on success we return 0. -+ */ -+int do_notify_task_state(unsigned long arg) -+{ -+ int err; -+ struct task_struct *p; -+ struct signotifier *node, *tmp; -+ struct task_state_notify_info args, oldargs; -+ -+ if (copy_from_user(&args, (struct task_state_notify_info __user *)arg, -+ sizeof(args))) -+ return -EFAULT; -+ oldargs.pid = args.pid; -+ -+ /* Validate the arguments passed in. */ -+ err = -EINVAL; -+ if (invalid_args(&args)) -+ goto out; -+ -+ /* We must hold a write lock on tasklist_lock to add the notification -+ * later on, and we need some lock on tasklist_lock for -+ * find_task_by_pid(), so may as well take the write lock now. -+ * Must use write_lock_irq(). -+ */ -+ write_lock_irq(&tasklist_lock); -+ -+ err = -ESRCH; -+ p = find_task_by_vpid(args.pid); -+ if (!p) -+ goto unlock_out; -+ -+ /* Now we know pid exists, unlikely to fail. */ -+ err = 0; -+ -+ /* Check if we're already monitoring the specified pid. If so, update -+ * the monitoring parameters and return the old ones. -+ */ -+ list_for_each_entry(tmp, &p->notify, notify_list) { -+ if (tmp->notify_tsk == current) { -+ handle_already_monitoring(tmp, &args, &oldargs); -+ goto unlock_out; -+ } -+ } -+ -+ /* If we get here, we're not currently monitoring the process. */ -+ oldargs.sig = 0; -+ oldargs.events = 0; -+ -+ /* If we wanted to set up a new monitor, do it now. If we didn't -+ * manage to allocate memory for the new node, then we return -+ * an appropriate error. -+ */ -+ if (args.sig > 0) { -+ node = kmalloc(sizeof(*node), GFP_ATOMIC); -+ if (node) -+ setup_new_node(p, node, &args); -+ else -+ err = -ENOMEM; -+ } -+ -+unlock_out: -+ write_unlock_irq(&tasklist_lock); -+ -+ /* Copy the old values back to caller. */ -+ if (copy_to_user((struct task_state_notify_info __user *)arg, -+ &oldargs, sizeof(oldargs))) -+ err = -EFAULT; -+ -+out: -+ return err; -+} -+ -diff --git a/kernel/death_notify.h b/kernel/death_notify.h -new file mode 100644 -index 000000000000..14a0995b79af ---- /dev/null -+++ b/kernel/death_notify.h -@@ -0,0 +1,46 @@ -+/* -+ * kernel/death_notify.h, Process death notification support -+ * -+ * Copyright (c) 2006-2014 Wind River Systems, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ */ -+#ifndef _KERNEL_DEATH_NOTIFY_H -+#define _KERNEL_DEATH_NOTIFY_H -+ -+#ifdef CONFIG_SIGEXIT -+ -+struct signotifier { -+ struct task_struct *notify_tsk; -+ struct list_head notify_list; -+ struct list_head monitor_list; -+ int sig; -+ unsigned int events; -+}; -+ -+extern int do_notify_task_state(unsigned long arg); -+extern void do_notify_others(struct task_struct *tsk, -+ struct kernel_siginfo *info); -+extern void release_notify_others(struct task_struct *p); -+ -+#else /* !CONFIG_SIGEXIT */ -+ -+static inline void do_notify_others(struct task_struct *tsk, -+ struct kernel_siginfo *info) {} -+static inline void release_notify_others(struct task_struct *p) {} -+ -+#endif /* CONFIG_SIGEXIT */ -+#endif -+ -diff --git a/kernel/exit.c b/kernel/exit.c -index d13d67fc5f4e..0e7adf824a52 100644 ---- a/kernel/exit.c -+++ b/kernel/exit.c -@@ -68,6 +68,9 @@ - #include - #include - #include -+#ifdef CONFIG_SIGEXIT -+#include "death_notify.h" -+#endif - - static void __unhash_process(struct task_struct *p, bool group_dead) - { -@@ -194,6 +197,9 @@ void release_task(struct task_struct *p) - cgroup_release(p); - - write_lock_irq(&tasklist_lock); -+#ifdef CONFIG_SIGEXIT -+ release_notify_others(p); -+#endif - ptrace_release_task(p); - thread_pid = get_pid(p->thread_pid); - __exit_signal(p); -diff --git a/kernel/fork.c b/kernel/fork.c -index 7c044d377926..5333090a7cc5 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -2069,6 +2069,10 @@ static __latent_entropy struct task_struct *copy_process( - p->sequential_io = 0; - p->sequential_io_avg = 0; - #endif -+#ifdef CONFIG_SIGEXIT -+ INIT_LIST_HEAD(&p->notify); -+ INIT_LIST_HEAD(&p->monitor); -+#endif - - /* Perform scheduler related setup. Assign this task to a CPU. */ - retval = sched_fork(clone_flags, p); -diff --git a/kernel/signal.c b/kernel/signal.c -index ef8f2a28d37c..5c41ee2ccf7e 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -55,6 +55,9 @@ - #include - #include - #include -+#ifdef CONFIG_SIGEXIT -+#include "death_notify.h" -+#endif - - /* - * SLAB caches for signal bits. -@@ -1999,6 +2002,10 @@ bool do_notify_parent(struct task_struct *tsk, int sig) - __wake_up_parent(tsk, tsk->parent); - spin_unlock_irqrestore(&psig->siglock, flags); - -+#ifdef CONFIG_SIGEXIT -+ do_notify_others(tsk, &info); -+#endif -+ - return autoreap; - } - -@@ -2071,6 +2078,10 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, - */ - __wake_up_parent(tsk, parent); - spin_unlock_irqrestore(&sighand->siglock, flags); -+ -+#ifdef CONFIG_SIGEXIT -+ do_notify_others(tsk, &info); -+#endif - } - - static inline bool may_ptrace_stop(void) -diff --git a/kernel/sys.c b/kernel/sys.c -index a730c03ee607..0f8decf763f1 100644 ---- a/kernel/sys.c -+++ b/kernel/sys.c -@@ -73,6 +73,9 @@ - #include - - #include "uid16.h" -+#ifdef CONFIG_SIGEXIT -+#include "death_notify.h" -+#endif - - #ifndef SET_UNALIGN_CTL - # define SET_UNALIGN_CTL(a, b) (-EINVAL) -@@ -2423,6 +2426,11 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, - else - error = PR_MCE_KILL_DEFAULT; - break; -+#ifdef CONFIG_SIGEXIT -+ case PR_DO_NOTIFY_TASK_STATE: -+ error = do_notify_task_state(arg2); -+ break; -+#endif - case PR_SET_MM: - error = prctl_set_mm(arg2, arg3, arg4, arg5); - break; --- -2.29.2 - diff --git a/kernel-std/centos/patches/0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch b/kernel-std/centos/patches/0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch deleted file mode 100644 index 6112c98d..00000000 --- a/kernel-std/centos/patches/0002-PCI-Add-ACS-quirk-for-Intel-Fortville-NICs.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8d508571597d4e2d8c64621015c375ce0a346748 Mon Sep 17 00:00:00 2001 -From: Dahir Osman -Date: Wed, 13 Jan 2016 10:01:11 -0500 -Subject: [PATCH 02/10] PCI: Add ACS quirk for Intel Fortville NICs - -Use quirks to determine isolation for now until a later kernel can -properly read the Fortville ACS capabilities. - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - drivers/pci/quirks.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index b570f297e3ec..910026923549 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -4740,6 +4740,10 @@ static const struct pci_dev_acs_enabled { - { PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs }, - { PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs }, - { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_rciep_acs }, -+ /* I40 */ -+ { PCI_VENDOR_ID_INTEL, 0x1572, pci_quirk_mf_endpoint_acs }, -+ { PCI_VENDOR_ID_INTEL, 0x1586, pci_quirk_mf_endpoint_acs }, -+ { PCI_VENDOR_ID_INTEL, 0x1583, pci_quirk_mf_endpoint_acs }, - /* QCOM QDF2xxx root ports */ - { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, - { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs }, --- -2.29.2 - diff --git a/kernel-std/centos/patches/0003-affine-compute-kernel-threads.patch b/kernel-std/centos/patches/0003-affine-compute-kernel-threads.patch deleted file mode 100644 index cf926622..00000000 --- a/kernel-std/centos/patches/0003-affine-compute-kernel-threads.patch +++ /dev/null @@ -1,174 +0,0 @@ -From d4c6a64967be6e34fec40ddff5714efe001be7c3 Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Tue, 24 Nov 2015 16:27:28 -0500 -Subject: [PATCH] affine compute kernel threads - -This is a kernel enhancement to configure the cpu affinity of kernel -threads via kernel boot option kthread_cpus=. The compute -kickstart file and compute-huge.sh scripts will update grub with the -new option. - -With kthread_cpus specified, the cpumask is immediately applied upon -thread launch. This does not affect kernel threads that specify cpu -and node. - -Note: this is based off of Christoph Lameter's patch at -https://lwn.net/Articles/565932/ with the only difference being -the kernel parameter changed from kthread to kthread_cpus. - -Signed-off-by: Christoph Lameter -Signed-off-by: Chris Friesen -[VT: The existing "isolcpus" - kernel bootarg, cgroup/cpuset, and taskset might provide the some - way to have cpu isolation. However none of them satisfies the requirements. - Replacing spaces with tabs. Combine two calls of set_cpus_allowed_ptr() - in kernel_init_freeable() in init/main.c into one. Performed tests] -Signed-off-by: Vu Tran - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Vefa Bicakci -[jm: Adapted the patch for context changes.] -Signed-off-by: Jiping Ma ---- - .../admin-guide/kernel-parameters.txt | 10 ++++++++ - include/linux/cpumask.h | 3 +++ - init/main.c | 2 ++ - kernel/cpu.c | 23 +++++++++++++++++++ - kernel/kthread.c | 5 ++-- - kernel/umh.c | 3 +++ - 6 files changed, 43 insertions(+), 3 deletions(-) - -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index 19e9e220eaa1..0260789adc94 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -2223,6 +2223,16 @@ - See also Documentation/trace/kprobetrace.rst "Kernel - Boot Parameter" section. - -+ kthread_cpus= [KNL, SMP] Only run kernel threads on the specified -+ list of processors. The kernel will start threads -+ on the indicated processors only (unless there -+ are specific reasons to run a thread with -+ different affinities). This can be used to make -+ init start on certain processors and also to -+ control where kmod and other user space threads -+ are being spawned. Allows to keep kernel threads -+ away from certain cores unless absoluteluy necessary. -+ - kpti= [ARM64] Control page table isolation of user - and kernel address spaces. - Default: enabled on cores which need mitigation. -diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h -index f0d895d6ac39..45f338cfdd6f 100644 ---- a/include/linux/cpumask.h -+++ b/include/linux/cpumask.h -@@ -55,6 +55,7 @@ extern unsigned int nr_cpu_ids; - * cpu_present_mask - has bit 'cpu' set iff cpu is populated - * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler - * cpu_active_mask - has bit 'cpu' set iff cpu available to migration -+ * cpu_kthread_mask - has bit 'cpu' set iff general kernel threads allowed - * - * If !CONFIG_HOTPLUG_CPU, present == possible, and active == online. - * -@@ -91,10 +92,12 @@ extern struct cpumask __cpu_possible_mask; - extern struct cpumask __cpu_online_mask; - extern struct cpumask __cpu_present_mask; - extern struct cpumask __cpu_active_mask; -+extern struct cpumask __cpu_kthread_mask; - #define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask) - #define cpu_online_mask ((const struct cpumask *)&__cpu_online_mask) - #define cpu_present_mask ((const struct cpumask *)&__cpu_present_mask) - #define cpu_active_mask ((const struct cpumask *)&__cpu_active_mask) -+#define cpu_kthread_mask ((const struct cpumask *)&__cpu_kthread_mask) - - extern atomic_t __num_online_cpus; - -diff --git a/init/main.c b/init/main.c -index db693781a12f..4e7777bdab6e 100644 ---- a/init/main.c -+++ b/init/main.c -@@ -1536,6 +1536,8 @@ static noinline void __init kernel_init_freeable(void) - - do_basic_setup(); - -+ set_cpus_allowed_ptr(current, cpu_kthread_mask); -+ - kunit_run_all_tests(); - - console_on_rootfs(); -diff --git a/kernel/cpu.c b/kernel/cpu.c -index 67c22941b5f2..67b1a67bd8f0 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -2498,6 +2498,29 @@ EXPORT_SYMBOL(__cpu_active_mask); - atomic_t __num_online_cpus __read_mostly; - EXPORT_SYMBOL(__num_online_cpus); - -+struct cpumask __cpu_kthread_mask __read_mostly -+ = {CPU_BITS_ALL}; -+EXPORT_SYMBOL(__cpu_kthread_mask); -+ -+static int __init kthread_setup(char *str) -+{ -+ cpumask_var_t tmp_mask; -+ int err; -+ -+ alloc_bootmem_cpumask_var(&tmp_mask); -+ -+ err = cpulist_parse(str, tmp_mask); -+ if (!err) -+ cpumask_copy(&__cpu_kthread_mask, tmp_mask); -+ else -+ pr_err("Cannot parse 'kthread_cpus=%s'; error %d\n", str, err); -+ -+ free_bootmem_cpumask_var(tmp_mask); -+ -+ return 1; -+} -+__setup("kthread_cpus=", kthread_setup); -+ - void init_cpu_present(const struct cpumask *src) - { - cpumask_copy(&__cpu_present_mask, src); -diff --git a/kernel/kthread.c b/kernel/kthread.c -index 508fe5278285..a7bb87b00cea 100644 ---- a/kernel/kthread.c -+++ b/kernel/kthread.c -@@ -405,8 +405,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data), - * The kernel thread should not inherit these properties. - */ - sched_setscheduler_nocheck(task, SCHED_NORMAL, ¶m); -- set_cpus_allowed_ptr(task, -- housekeeping_cpumask(HK_FLAG_KTHREAD)); -+ set_cpus_allowed_ptr(task, cpu_kthread_mask); - } - kfree(create); - return task; -@@ -655,7 +654,7 @@ int kthreadd(void *unused) - /* Setup a clean context for our children to inherit. */ - set_task_comm(tsk, "kthreadd"); - ignore_signals(tsk); -- set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_FLAG_KTHREAD)); -+ set_cpus_allowed_ptr(tsk, cpu_kthread_mask); - set_mems_allowed(node_states[N_MEMORY]); - - current->flags |= PF_NOFREEZE; -diff --git a/kernel/umh.c b/kernel/umh.c -index 3f646613a9d3..e5027cee43f7 100644 ---- a/kernel/umh.c -+++ b/kernel/umh.c -@@ -80,6 +80,9 @@ static int call_usermodehelper_exec_async(void *data) - */ - current->fs->umask = 0022; - -+ /* We can run only where init is allowed to run. */ -+ set_cpus_allowed_ptr(current, cpu_kthread_mask); -+ - /* - * Our parent (unbound workqueue) runs with elevated scheduling - * priority. Avoid propagating that into the userspace child. --- -2.29.2 - diff --git a/kernel-std/centos/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch b/kernel-std/centos/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch deleted file mode 100644 index 947ac114..00000000 --- a/kernel-std/centos/patches/0004-Affine-irqs-and-workqueues-with-kthread_cpus.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 286f3a8af7f620dac84f20de5f7ad6542f447ace Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Tue, 24 Nov 2015 16:27:29 -0500 -Subject: [PATCH 04/10] Affine irqs and workqueues with kthread_cpus - -If the kthread_cpus boot arg is set it means we want to affine -kernel threads to the specified CPU mask as much as possible -in order to avoid doing work on other CPUs. - -In this commit we extend the meaning of that boot arg to also -apply to the CPU affinity of unbound and ordered workqueues. - -We also use the kthread_cpus value to determine the default irq -affinity. Specifically, as long as the previously-calculated -irq affinity intersects with the kthread_cpus affinity then we'll -use the intersection of the two as the default irq affinity. - -Signed-off-by: Chris Friesen -[VT: replacing spaces with tabs. Performed tests] -Signed-off-by: Vu Tran - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - kernel/irq/manage.c | 7 +++++++ - kernel/workqueue.c | 4 ++++ - 2 files changed, 11 insertions(+) - -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index 79dc02b956dc..420b5ce0bf89 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -515,6 +515,13 @@ int irq_setup_affinity(struct irq_desc *desc) - if (cpumask_intersects(&mask, nodemask)) - cpumask_and(&mask, &mask, nodemask); - } -+ -+ /* This will narrow down the affinity further if we've specified -+ * a reduced cpu_kthread_mask in the boot args. -+ */ -+ if (cpumask_intersects(&mask, cpu_kthread_mask)) -+ cpumask_and(&mask, &mask, cpu_kthread_mask); -+ - ret = irq_do_set_affinity(&desc->irq_data, &mask, false); - raw_spin_unlock(&mask_lock); - return ret; -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 1e2ca744dadb..b854874d0518 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -5956,6 +5956,8 @@ void __init workqueue_init_early(void) - - BUG_ON(!(attrs = alloc_workqueue_attrs())); - attrs->nice = std_nice[i]; -+ /* If we've specified a kthread mask apply it here too. */ -+ cpumask_copy(attrs->cpumask, cpu_kthread_mask); - unbound_std_wq_attrs[i] = attrs; - - /* -@@ -5966,6 +5968,8 @@ void __init workqueue_init_early(void) - BUG_ON(!(attrs = alloc_workqueue_attrs())); - attrs->nice = std_nice[i]; - attrs->no_numa = true; -+ /* If we've specified a kthread mask apply it here too. */ -+ cpumask_copy(attrs->cpumask, cpu_kthread_mask); - ordered_wq_attrs[i] = attrs; - } - --- -2.29.2 - diff --git a/kernel-std/centos/patches/0005-Make-kernel-start-eth-devices-at-offset.patch b/kernel-std/centos/patches/0005-Make-kernel-start-eth-devices-at-offset.patch deleted file mode 100644 index db639775..00000000 --- a/kernel-std/centos/patches/0005-Make-kernel-start-eth-devices-at-offset.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 82e56b6b7c05eebc589b37e96ed3b0a44d6cdef7 Mon Sep 17 00:00:00 2001 -From: Chris Friesen -Date: Thu, 12 May 2016 18:00:00 -0400 -Subject: [PATCH 05/10] Make kernel start eth devices at offset - -In order to avoid naming collisions, we want to make the kernel -start naming its "ethX" devices at eth1000 instead of eth0. This -will let us rename to a range starting at eth0. - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - net/core/dev.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/net/core/dev.c b/net/core/dev.c -index 62ff7121b22d..e63fe7662c73 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -1218,6 +1218,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf) - set_bit(i, inuse); - } - -+ /* STX extension, want kernel to start at eth1000 */ -+ if (strcmp(name, "eth%d") == 0) { -+ for (i=0; i < 1000; i++) -+ set_bit(i, inuse); -+ } -+ - i = find_first_zero_bit(inuse, max_netdevices); - free_page((unsigned long) inuse); - } --- -2.29.2 - diff --git a/kernel-std/centos/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch b/kernel-std/centos/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch deleted file mode 100644 index c515fa2d..00000000 --- a/kernel-std/centos/patches/0006-intel-iommu-allow-ignoring-Ethernet-device-RMRR-with.patch +++ /dev/null @@ -1,125 +0,0 @@ -From c35ee3034b61e72bf9fef888a3c4702049a77bcc Mon Sep 17 00:00:00 2001 -From: Matt Peters -Date: Mon, 30 May 2016 10:51:02 -0400 -Subject: [PATCH] intel-iommu: allow ignoring Ethernet device RMRR with IOMMU - passthrough - -Some BIOS's are reporting DMAR RMRR entries for Ethernet devices -which is causing problems when PCI passthrough is enabled. These -devices should be able to use the static identity map since the -host should not be enforcing specific address ranges when IOMMU -passthrough is enabled. - -Originally-by: Matt Peters -[PG: Added bootarg wrapper and documentation entries.] -Signed-off-by: Paul Gortmaker -Signed-off-by: Nam Ninh -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Dongqi Chen -[lz: Adapted the patch for context changes.] -Signed-off-by: Li Zhou -[jp: fix warning: this 'else' clause does not guard] -Signed-off-by: Jiping Ma ---- - .../admin-guide/kernel-parameters.txt | 5 +++++ - Documentation/x86/intel-iommu.rst | 18 +++++++++++++++ - drivers/iommu/intel/iommu.c | 22 ++++++++++++++++++- - 3 files changed, 44 insertions(+), 1 deletion(-) - -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index 552f1db5b9d7..e862aabe6255 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -1861,6 +1861,11 @@ - than 32-bit addressing. The default is to look - for translation below 32-bit and if not available - then look in the higher range. -+ eth_no_rmrr [Default Off] -+ With this option provided, the kernel will ignore -+ any specified RMRR regions specified by the BIOS -+ for PCI ethernet devices. Confirm with your hardware -+ vendor the RMRR regions are indeed invalid first. - strict [Default Off] - With this option on every unmap_single operation will - result in a hardware IOTLB flush operation as opposed -diff --git a/Documentation/x86/intel-iommu.rst b/Documentation/x86/intel-iommu.rst -index 099f13d51d5f..18e6a8d8b1ee 100644 ---- a/Documentation/x86/intel-iommu.rst -+++ b/Documentation/x86/intel-iommu.rst -@@ -33,6 +33,24 @@ regions will fail. Hence BIOS uses RMRR to specify these regions along with - devices that need to access these regions. OS is expected to setup - unity mappings for these regions for these devices to access these regions. - -+RMRR for other devices? -+----------------------- -+ -+There are reports of BIOS out there that indicate RMRR regions for things -+like ethernet devices. As per mainline commit c875d2c1b8083 ("iommu/vt-d: -+Exclude devices using RMRRs from IOMMU API domains") such a device is -+"fundamentally incompatible" with the IOMMU API and "we must prevent such -+devices from being used by the IOMMU API." However, in the event that -+the RMRR indicated by the BIOS is assumed to be just a reporting error, -+there is an additional iommu boot arg that can be used to ignore RMRR -+settings for ethernet, i.e. "intel_iommu=on,eth_no_rmrr iommu=pt". -+Note that iommu=pt is required in order to eth_no_rmrr to have effect. -+ -+If you use this setting, you should consult with your hardware vendor to -+confirm that it is just a reporting error, and that it truly is not -+actively using any DMA to/from RMRR, as otherwise system instability -+may result. -+ - How is IOVA generated? - ---------------------- - -diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c -index 7e3db4c0324d..16ebba2723cb 100644 ---- a/drivers/iommu/intel/iommu.c -+++ b/drivers/iommu/intel/iommu.c -@@ -354,6 +354,7 @@ static int dmar_map_gfx = 1; - static int dmar_forcedac; - static int intel_iommu_strict; - static int intel_iommu_superpage = 1; -+static int intel_iommu_ethrmrr = 1; - static int iommu_identity_mapping; - static int intel_no_bounce; - static int iommu_skip_te_disable; -@@ -448,6 +449,15 @@ static int __init intel_iommu_setup(char *str) - } else if (!strncmp(str, "forcedac", 8)) { - pr_info("Forcing DAC for PCI devices\n"); - dmar_forcedac = 1; -+ } else if (!strncmp(str, "eth_no_rmrr", 11)) { -+ if (!iommu_default_passthrough()) { -+ printk(KERN_WARNING -+ "Intel-IOMMU: error - eth_no_rmrr requires iommu=pt\n"); -+ } else { -+ printk(KERN_INFO -+ "Intel-IOMMU: ignoring ethernet RMRR values\n"); -+ intel_iommu_ethrmrr = 0; -+ } - } else if (!strncmp(str, "strict", 6)) { - pr_info("Disable batched IOTLB flush\n"); - intel_iommu_strict = 1; -@@ -2880,8 +2890,18 @@ static bool device_rmrr_is_relaxable(struct device *dev) - pdev = to_pci_dev(dev); - if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev)) - return true; -- else -+ else { -+ /* As a temporary workaround for issues seen on ProLiant DL380p, -+ * allow the operator to ignore the RMRR settings for ethernet -+ * devices. Ideally the end user should contact their vendor -+ * regarding why there are RMRR, as per mainline c875d2c1b8083 -+ * ("iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains") -+ * it seems that these make no sense at all. -+ */ -+ if ((pdev->class >> 8) == PCI_CLASS_NETWORK_ETHERNET && !intel_iommu_ethrmrr) -+ return true; - return false; -+ } - } - - /* --- -2.29.2 - diff --git a/kernel-std/centos/patches/0007-turn-off-write-same-in-smartqpi-driver.patch b/kernel-std/centos/patches/0007-turn-off-write-same-in-smartqpi-driver.patch deleted file mode 100644 index dd84bfeb..00000000 --- a/kernel-std/centos/patches/0007-turn-off-write-same-in-smartqpi-driver.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 87e7e3bd136b05d9ae105fe87879d1fe6730ee18 Mon Sep 17 00:00:00 2001 -From: Jim Somerville -Date: Tue, 6 Mar 2018 12:54:40 -0500 -Subject: [PATCH 06/10] turn off write same in smartqpi driver - -Signed-off-by: Jim Somerville -Signed-off-by: Zhang Zhiguo -Signed-off-by: Jiping Ma ---- - drivers/scsi/smartpqi/smartpqi_init.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c -index 9d0229656681..af46f3a024da 100644 ---- a/drivers/scsi/smartpqi/smartpqi_init.c -+++ b/drivers/scsi/smartpqi/smartpqi_init.c -@@ -6571,6 +6571,7 @@ static struct scsi_host_template pqi_driver_template = { - .map_queues = pqi_map_queues, - .sdev_attrs = pqi_sdev_attrs, - .shost_attrs = pqi_shost_attrs, -+ .no_write_same = 1, - }; - - static int pqi_register_scsi(struct pqi_ctrl_info *ctrl_info) --- -2.29.2 - diff --git a/kernel-std/centos/patches/0008-Allow-dmar-quirks-for-broken-bioses.patch b/kernel-std/centos/patches/0008-Allow-dmar-quirks-for-broken-bioses.patch deleted file mode 100644 index a4fc62af..00000000 --- a/kernel-std/centos/patches/0008-Allow-dmar-quirks-for-broken-bioses.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 4d58a9a618827e4410e3828b4deef5832a8576db Mon Sep 17 00:00:00 2001 -From: Jim Somerville -Date: Wed, 29 Jan 2020 14:19:22 -0500 -Subject: [PATCH 07/10] Allow dmar quirks for broken bioses - -Problem: -Broken bios creates inaccurate DMAR tables, -reporting some bridges as having endpoint types. -This causes IOMMU initialization to bail -out early with an error code, the result of -which is vfio not working correctly. -This is seen on some Skylake based Wolfpass -server platforms with up-to-date bios installed. - -Solution: -Instead of just bailing out of IOMMU -initialization when such a condition is found, -we report it and continue. The IOMMU ends -up successfully initialized anyway. We do this -only on platforms that have the Skylake bridges -where this issue has been seen. - -This change is inspired by a similar one posted by -Lu Baolu of Intel Corp to lkml - -https://lkml.org/lkml/2019/12/24/15 - -Signed-off-by: Jim Somerville -Signed-off-by: Jiping Ma ---- - drivers/iommu/intel/dmar.c | 25 ++++++++++++++++++++++++- - 1 file changed, 24 insertions(+), 1 deletion(-) - -diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c -index 02e7c10a4224..7d423ac36a44 100644 ---- a/drivers/iommu/intel/dmar.c -+++ b/drivers/iommu/intel/dmar.c -@@ -66,6 +66,26 @@ static void free_iommu(struct intel_iommu *iommu); - - extern const struct iommu_ops intel_iommu_ops; - -+static int scope_mismatch_quirk; -+static void quirk_dmar_scope_mismatch(struct pci_dev *dev) -+{ -+ pci_info(dev, "scope mismatch ignored\n"); -+ scope_mismatch_quirk = 1; -+} -+ -+/* -+ * We expect devices with endpoint scope to have normal PCI -+ * headers, and devices with bridge scope to have bridge PCI -+ * headers. However some PCI devices may be listed in the -+ * DMAR table with bridge scope, even though they have a -+ * normal PCI header and vice versa. We don't declare a -+ * scope mismatch for the special cases below, even though -+ * the bios creates broken tables. -+ */ -+/* Sky Lake-E PCI Express Root Port A */ -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2030, -+ quirk_dmar_scope_mismatch); -+ - static void dmar_register_drhd_unit(struct dmar_drhd_unit *drhd) - { - /* -@@ -255,7 +275,10 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info, - info->dev->class >> 16 != PCI_BASE_CLASS_BRIDGE))) { - pr_warn("Device scope type does not match for %s\n", - pci_name(info->dev)); -- return -EINVAL; -+ if (!scope_mismatch_quirk) -+ return -EINVAL; -+ else -+ pr_warn("but continuing anyway\n"); - } - - for_each_dev_scope(devices, devices_cnt, i, tmp) --- -2.29.2 - diff --git a/kernel-std/centos/patches/0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch b/kernel-std/centos/patches/0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch deleted file mode 100644 index a5ac31b4..00000000 --- a/kernel-std/centos/patches/0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 451738188482a34603a184e868893f407998bdd4 Mon Sep 17 00:00:00 2001 -From: Nayna Jain -Date: Fri, 10 Nov 2017 17:16:35 -0500 -Subject: [PATCH 08/10] tpm: ignore burstcount to improve tpm_tis send() - performance -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The TPM burstcount status indicates the number of bytes that can -be sent to the TPM without causing bus wait states.  Effectively, -it is the number of empty bytes in the command FIFO. - -This patch optimizes the tpm_tis_send_data() function by checking -the burstcount only once. And if the burstcount is valid, it writes -all the bytes at once, permitting wait state. - -After this change, performance on a TPM 1.2 with an 8 byte -burstcount for 1000 extends improved from ~41sec to ~14sec. - -Suggested-by: Ken Goldman in -conjunction with the TPM Device Driver work group. -Signed-off-by: Nayna Jain -Acked-by: Mimi Zohar -Reviewed-by: Jarkko Sakkinen -Tested-by: Jarkko Sakkinen -Signed-off-by: Jarkko Sakkinen -Signed-off-by: Dongqi Chen -Signed-off-by: Jiping Ma ---- - drivers/char/tpm/tpm_tis_core.c | 43 ++++++++++++--------------------- - 1 file changed, 15 insertions(+), 28 deletions(-) - -diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c -index a2e0395cbe61..2c69fde1e4e5 100644 ---- a/drivers/char/tpm/tpm_tis_core.c -+++ b/drivers/char/tpm/tpm_tis_core.c -@@ -330,7 +330,6 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len) - { - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc, status, burstcnt; -- size_t count = 0; - bool itpm = priv->flags & TPM_TIS_ITPM_WORKAROUND; - - status = tpm_tis_status(chip); -@@ -343,36 +342,24 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len) - goto out_err; - } - } -- -- while (count < len - 1) { -- burstcnt = get_burstcount(chip); -- if (burstcnt < 0) { -- dev_err(&chip->dev, "Unable to read burstcount\n"); -- rc = burstcnt; -- goto out_err; -- } -- burstcnt = min_t(int, burstcnt, len - count - 1); -- rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality), -- burstcnt, buf + count); -- if (rc < 0) -- goto out_err; -- -- count += burstcnt; -- -- if (wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c, -- &priv->int_queue, false) < 0) { -- rc = -ETIME; -- goto out_err; -- } -- status = tpm_tis_status(chip); -- if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) { -- rc = -EIO; -- goto out_err; -- } -+ /* -+ * Get the initial burstcount to ensure TPM is ready to -+ * accept data, even when waiting for burstcount is disabled. -+ */ -+ burstcnt = get_burstcount(chip); -+ if (burstcnt < 0) { -+ dev_err(&chip->dev, "Unable to read burstcount\n"); -+ rc = burstcnt; -+ goto out_err; - } - -+ rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality), -+ len -1, buf); -+ if (rc < 0) -+ goto out_err; -+ - /* write last byte */ -- rc = tpm_tis_write8(priv, TPM_DATA_FIFO(priv->locality), buf[count]); -+ rc = tpm_tis_write8(priv, TPM_DATA_FIFO(priv->locality), buf[len-1]); - if (rc < 0) - goto out_err; - --- -2.29.2 - diff --git a/kernel-std/centos/patches/0010-bpf-cgroups-Fix-cgroup-v2-fallback-on-v1-v2-mixed-mo.patch b/kernel-std/centos/patches/0010-bpf-cgroups-Fix-cgroup-v2-fallback-on-v1-v2-mixed-mo.patch deleted file mode 100644 index 7c1bbfef..00000000 --- a/kernel-std/centos/patches/0010-bpf-cgroups-Fix-cgroup-v2-fallback-on-v1-v2-mixed-mo.patch +++ /dev/null @@ -1,395 +0,0 @@ -From b377b8aed56d93aef67f7dbad01d026bacffedb1 Mon Sep 17 00:00:00 2001 -From: Daniel Borkmann -Date: Tue, 14 Sep 2021 01:07:57 +0200 -Subject: [PATCH] bpf, cgroups: Fix cgroup v2 fallback on v1/v2 mixed mode - -Fix cgroup v1 interference when non-root cgroup v2 BPF programs are used. -Back in the days, commit bd1060a1d671 ("sock, cgroup: add sock->sk_cgroup") -embedded per-socket cgroup information into sock->sk_cgrp_data and in order -to save 8 bytes in struct sock made both mutually exclusive, that is, when -cgroup v1 socket tagging (e.g. net_cls/net_prio) is used, then cgroup v2 -falls back to the root cgroup in sock_cgroup_ptr() (&cgrp_dfl_root.cgrp). - -The assumption made was "there is no reason to mix the two and this is in line -with how legacy and v2 compatibility is handled" as stated in bd1060a1d671. -However, with Kubernetes more widely supporting cgroups v2 as well nowadays, -this assumption no longer holds, and the possibility of the v1/v2 mixed mode -with the v2 root fallback being hit becomes a real security issue. - -Many of the cgroup v2 BPF programs are also used for policy enforcement, just -to pick _one_ example, that is, to programmatically deny socket related system -calls like connect(2) or bind(2). A v2 root fallback would implicitly cause -a policy bypass for the affected Pods. - -In production environments, we have recently seen this case due to various -circumstances: i) a different 3rd party agent and/or ii) a container runtime -such as [0] in the user's environment configuring legacy cgroup v1 net_cls -tags, which triggered implicitly mentioned root fallback. Another case is -Kubernetes projects like kind [1] which create Kubernetes nodes in a container -and also add cgroup namespaces to the mix, meaning programs which are attached -to the cgroup v2 root of the cgroup namespace get attached to a non-root -cgroup v2 path from init namespace point of view. And the latter's root is -out of reach for agents on a kind Kubernetes node to configure. Meaning, any -entity on the node setting cgroup v1 net_cls tag will trigger the bypass -despite cgroup v2 BPF programs attached to the namespace root. - -Generally, this mutual exclusiveness does not hold anymore in today's user -environments and makes cgroup v2 usage from BPF side fragile and unreliable. -This fix adds proper struct cgroup pointer for the cgroup v2 case to struct -sock_cgroup_data in order to address these issues; this implicitly also fixes -the tradeoffs being made back then with regards to races and refcount leaks -as stated in bd1060a1d671, and removes the fallback, so that cgroup v2 BPF -programs always operate as expected. - - [0] https://github.com/nestybox/sysbox/ - [1] https://kind.sigs.k8s.io/ - -Fixes: bd1060a1d671 ("sock, cgroup: add sock->sk_cgroup") -Signed-off-by: Daniel Borkmann -Signed-off-by: Alexei Starovoitov -Acked-by: Stanislav Fomichev -Acked-by: Tejun Heo -Link: https://lore.kernel.org/bpf/20210913230759.2313-1-daniel@iogearbox.net -(cherry picked from commit 8520e224f547cd070c7c8f97b1fc6d58cff7ccaa) -Signed-off-by: M. Vefa Bicakci ---- - include/linux/cgroup-defs.h | 107 +++++++++-------------------------- - include/linux/cgroup.h | 22 +------ - kernel/cgroup/cgroup.c | 50 ++++------------ - net/core/netclassid_cgroup.c | 7 +-- - net/core/netprio_cgroup.c | 10 +--- - 5 files changed, 41 insertions(+), 155 deletions(-) - -diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h -index fee0b5547cd0..3e406626168a 100644 ---- a/include/linux/cgroup-defs.h -+++ b/include/linux/cgroup-defs.h -@@ -763,107 +763,54 @@ static inline void cgroup_threadgroup_change_end(struct task_struct *tsk) {} - * sock_cgroup_data is embedded at sock->sk_cgrp_data and contains - * per-socket cgroup information except for memcg association. - * -- * On legacy hierarchies, net_prio and net_cls controllers directly set -- * attributes on each sock which can then be tested by the network layer. -- * On the default hierarchy, each sock is associated with the cgroup it was -- * created in and the networking layer can match the cgroup directly. -- * -- * To avoid carrying all three cgroup related fields separately in sock, -- * sock_cgroup_data overloads (prioidx, classid) and the cgroup pointer. -- * On boot, sock_cgroup_data records the cgroup that the sock was created -- * in so that cgroup2 matches can be made; however, once either net_prio or -- * net_cls starts being used, the area is overriden to carry prioidx and/or -- * classid. The two modes are distinguished by whether the lowest bit is -- * set. Clear bit indicates cgroup pointer while set bit prioidx and -- * classid. -- * -- * While userland may start using net_prio or net_cls at any time, once -- * either is used, cgroup2 matching no longer works. There is no reason to -- * mix the two and this is in line with how legacy and v2 compatibility is -- * handled. On mode switch, cgroup references which are already being -- * pointed to by socks may be leaked. While this can be remedied by adding -- * synchronization around sock_cgroup_data, given that the number of leaked -- * cgroups is bound and highly unlikely to be high, this seems to be the -- * better trade-off. -+ * On legacy hierarchies, net_prio and net_cls controllers directly -+ * set attributes on each sock which can then be tested by the network -+ * layer. On the default hierarchy, each sock is associated with the -+ * cgroup it was created in and the networking layer can match the -+ * cgroup directly. - */ - struct sock_cgroup_data { -- union { --#ifdef __LITTLE_ENDIAN -- struct { -- u8 is_data : 1; -- u8 no_refcnt : 1; -- u8 unused : 6; -- u8 padding; -- u16 prioidx; -- u32 classid; -- } __packed; --#else -- struct { -- u32 classid; -- u16 prioidx; -- u8 padding; -- u8 unused : 6; -- u8 no_refcnt : 1; -- u8 is_data : 1; -- } __packed; -+ struct cgroup *cgroup; /* v2 */ -+#ifdef CONFIG_CGROUP_NET_CLASSID -+ u32 classid; /* v1 */ -+#endif -+#ifdef CONFIG_CGROUP_NET_PRIO -+ u16 prioidx; /* v1 */ - #endif -- u64 val; -- }; - }; - --/* -- * There's a theoretical window where the following accessors race with -- * updaters and return part of the previous pointer as the prioidx or -- * classid. Such races are short-lived and the result isn't critical. -- */ - static inline u16 sock_cgroup_prioidx(const struct sock_cgroup_data *skcd) - { -- /* fallback to 1 which is always the ID of the root cgroup */ -- return (skcd->is_data & 1) ? skcd->prioidx : 1; -+#ifdef CONFIG_CGROUP_NET_PRIO -+ return READ_ONCE(skcd->prioidx); -+#else -+ return 1; -+#endif - } - - static inline u32 sock_cgroup_classid(const struct sock_cgroup_data *skcd) - { -- /* fallback to 0 which is the unconfigured default classid */ -- return (skcd->is_data & 1) ? skcd->classid : 0; -+#ifdef CONFIG_CGROUP_NET_CLASSID -+ return READ_ONCE(skcd->classid); -+#else -+ return 0; -+#endif - } - --/* -- * If invoked concurrently, the updaters may clobber each other. The -- * caller is responsible for synchronization. -- */ - static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd, - u16 prioidx) - { -- struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }}; -- -- if (sock_cgroup_prioidx(&skcd_buf) == prioidx) -- return; -- -- if (!(skcd_buf.is_data & 1)) { -- skcd_buf.val = 0; -- skcd_buf.is_data = 1; -- } -- -- skcd_buf.prioidx = prioidx; -- WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */ -+#ifdef CONFIG_CGROUP_NET_PRIO -+ WRITE_ONCE(skcd->prioidx, prioidx); -+#endif - } - - static inline void sock_cgroup_set_classid(struct sock_cgroup_data *skcd, - u32 classid) - { -- struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }}; -- -- if (sock_cgroup_classid(&skcd_buf) == classid) -- return; -- -- if (!(skcd_buf.is_data & 1)) { -- skcd_buf.val = 0; -- skcd_buf.is_data = 1; -- } -- -- skcd_buf.classid = classid; -- WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */ -+#ifdef CONFIG_CGROUP_NET_CLASSID -+ WRITE_ONCE(skcd->classid, classid); -+#endif - } - - #else /* CONFIG_SOCK_CGROUP_DATA */ -diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h -index 618838c48313..9c88b7da3245 100644 ---- a/include/linux/cgroup.h -+++ b/include/linux/cgroup.h -@@ -816,33 +816,13 @@ static inline void cgroup_account_cputime_field(struct task_struct *task, - */ - #ifdef CONFIG_SOCK_CGROUP_DATA - --#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID) --extern spinlock_t cgroup_sk_update_lock; --#endif -- --void cgroup_sk_alloc_disable(void); - void cgroup_sk_alloc(struct sock_cgroup_data *skcd); - void cgroup_sk_clone(struct sock_cgroup_data *skcd); - void cgroup_sk_free(struct sock_cgroup_data *skcd); - - static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd) - { --#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID) -- unsigned long v; -- -- /* -- * @skcd->val is 64bit but the following is safe on 32bit too as we -- * just need the lower ulong to be written and read atomically. -- */ -- v = READ_ONCE(skcd->val); -- -- if (v & 3) -- return &cgrp_dfl_root.cgrp; -- -- return (struct cgroup *)(unsigned long)v ?: &cgrp_dfl_root.cgrp; --#else -- return (struct cgroup *)(unsigned long)skcd->val; --#endif -+ return skcd->cgroup; - } - - #else /* CONFIG_CGROUP_DATA */ -diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c -index c8b811e039cc..e065307f2346 100644 ---- a/kernel/cgroup/cgroup.c -+++ b/kernel/cgroup/cgroup.c -@@ -6419,74 +6419,44 @@ int cgroup_parse_float(const char *input, unsigned dec_shift, s64 *v) - */ - #ifdef CONFIG_SOCK_CGROUP_DATA - --#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID) -- --DEFINE_SPINLOCK(cgroup_sk_update_lock); --static bool cgroup_sk_alloc_disabled __read_mostly; -- --void cgroup_sk_alloc_disable(void) --{ -- if (cgroup_sk_alloc_disabled) -- return; -- pr_info("cgroup: disabling cgroup2 socket matching due to net_prio or net_cls activation\n"); -- cgroup_sk_alloc_disabled = true; --} -- --#else -- --#define cgroup_sk_alloc_disabled false -- --#endif -- - void cgroup_sk_alloc(struct sock_cgroup_data *skcd) - { -- if (cgroup_sk_alloc_disabled) { -- skcd->no_refcnt = 1; -- return; -- } -- - /* Don't associate the sock with unrelated interrupted task's cgroup. */ - if (in_interrupt()) - return; - - rcu_read_lock(); -- - while (true) { - struct css_set *cset; - - cset = task_css_set(current); - if (likely(cgroup_tryget(cset->dfl_cgrp))) { -- skcd->val = (unsigned long)cset->dfl_cgrp; -+ skcd->cgroup = cset->dfl_cgrp; - cgroup_bpf_get(cset->dfl_cgrp); - break; - } - cpu_relax(); - } -- - rcu_read_unlock(); - } - - void cgroup_sk_clone(struct sock_cgroup_data *skcd) - { -- if (skcd->val) { -- if (skcd->no_refcnt) -- return; -- /* -- * We might be cloning a socket which is left in an empty -- * cgroup and the cgroup might have already been rmdir'd. -- * Don't use cgroup_get_live(). -- */ -- cgroup_get(sock_cgroup_ptr(skcd)); -- cgroup_bpf_get(sock_cgroup_ptr(skcd)); -- } -+ struct cgroup *cgrp = sock_cgroup_ptr(skcd); -+ -+ /* -+ * We might be cloning a socket which is left in an empty -+ * cgroup and the cgroup might have already been rmdir'd. -+ * Don't use cgroup_get_live(). -+ */ -+ cgroup_get(cgrp); -+ cgroup_bpf_get(cgrp); - } - - void cgroup_sk_free(struct sock_cgroup_data *skcd) - { - struct cgroup *cgrp = sock_cgroup_ptr(skcd); - -- if (skcd->no_refcnt) -- return; - cgroup_bpf_put(cgrp); - cgroup_put(cgrp); - } -diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c -index 41b24cd31562..b6de5ee22391 100644 ---- a/net/core/netclassid_cgroup.c -+++ b/net/core/netclassid_cgroup.c -@@ -72,11 +72,8 @@ static int update_classid_sock(const void *v, struct file *file, unsigned n) - struct update_classid_context *ctx = (void *)v; - struct socket *sock = sock_from_file(file, &err); - -- if (sock) { -- spin_lock(&cgroup_sk_update_lock); -+ if (sock) - sock_cgroup_set_classid(&sock->sk->sk_cgrp_data, ctx->classid); -- spin_unlock(&cgroup_sk_update_lock); -- } - if (--ctx->batch == 0) { - ctx->batch = UPDATE_CLASSID_BATCH; - return n + 1; -@@ -122,8 +119,6 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft, - struct css_task_iter it; - struct task_struct *p; - -- cgroup_sk_alloc_disable(); -- - cs->classid = (u32)value; - - css_task_iter_start(css, 0, &it); -diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c -index 9bd4cab7d510..d4c71e382a13 100644 ---- a/net/core/netprio_cgroup.c -+++ b/net/core/netprio_cgroup.c -@@ -207,8 +207,6 @@ static ssize_t write_priomap(struct kernfs_open_file *of, - if (!dev) - return -ENODEV; - -- cgroup_sk_alloc_disable(); -- - rtnl_lock(); - - ret = netprio_set_prio(of_css(of), dev, prio); -@@ -222,12 +220,10 @@ static int update_netprio(const void *v, struct file *file, unsigned n) - { - int err; - struct socket *sock = sock_from_file(file, &err); -- if (sock) { -- spin_lock(&cgroup_sk_update_lock); -+ -+ if (sock) - sock_cgroup_set_prioidx(&sock->sk->sk_cgrp_data, - (unsigned long)v); -- spin_unlock(&cgroup_sk_update_lock); -- } - return 0; - } - -@@ -236,8 +232,6 @@ static void net_prio_attach(struct cgroup_taskset *tset) - struct task_struct *p; - struct cgroup_subsys_state *css; - -- cgroup_sk_alloc_disable(); -- - cgroup_taskset_for_each(p, css, tset) { - void *v = (void *)(unsigned long)css->id; - --- -2.29.2 - diff --git a/kernel-std/centos/patches/0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch b/kernel-std/centos/patches/0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch deleted file mode 100644 index 202ddafd..00000000 --- a/kernel-std/centos/patches/0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2a32d5bc7e385fbf40f22cc413354e17a24d4de9 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sun, 10 Oct 2021 18:56:26 -0700 -Subject: [PATCH] scsi: smartpqi: Enable sas_address sysfs for SATA device - type. - -We met the issue DM complains that it can't find the disk specified -in the deployment config file after we updated the Linux kernel to 5.10. -The error is "failed to find disk for path /dev/disk/by-path/ -pci-0000:3b:00.0-sas-0x31402ec001d92983-lun-0" - -This happens because device type SATA is excluded from being -processed with the function pqi_is_device_with_sas_address. -which causes all SATA type disk drives to appear the same, having -zeroes in the lun name. /dev/disk/by-path/ -pci-0000:3b:00.0-sas-0x0000000000000000-lun-0 - -We can add type SA_DEVICE_TYPE_SATA to class device_with_sas_address, -since it will also get the sas_address from wwid. and works transparently -with the old kernel without gaps. - -Signed-off-by: Jiping Ma ---- - drivers/scsi/smartpqi/smartpqi_init.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c -index ecb2af3f43ca..df16e0a27a41 100644 ---- a/drivers/scsi/smartpqi/smartpqi_init.c -+++ b/drivers/scsi/smartpqi/smartpqi_init.c -@@ -2101,6 +2101,7 @@ static inline void pqi_mask_device(u8 *scsi3addr) - static inline bool pqi_is_device_with_sas_address(struct pqi_scsi_dev *device) - { - switch (device->device_type) { -+ case SA_DEVICE_TYPE_SATA: - case SA_DEVICE_TYPE_SAS: - case SA_DEVICE_TYPE_EXPANDER_SMP: - case SA_DEVICE_TYPE_SES: --- -2.31.1 - diff --git a/kernel-std/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch b/kernel-std/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch deleted file mode 100644 index c3ea0d8a..00000000 --- a/kernel-std/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ee39df8a1626eb35797b0f9943dc881752c36588 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 9 Sep 2021 04:56:46 -0400 -Subject: [PATCH] workqueue: Affine rescuer threads and unbound wqs - -This commit ensures that workqueue rescuer threads are affined to the -platform CPUs specified by the "kthread_cpus" kernel argument. Prior to -this commit, rescuer threads could be bound to any CPU. Rescuer threads -are described in "kernel/workqueue.c" as follows: - -"Regular work processing on a pool may block trying to create a new -worker which uses GFP_KERNEL allocation which has slight chance of -developing into deadlock if some works currently on the same queue -need to be processed to satisfy the GFP_KERNEL allocation. This is -the problem rescuer solves. - -When such condition is possible, the pool summons rescuers of all -workqueues which have works queued on the pool and let them process -those works so that forward progress can be guaranteed." - -This commit also affines unbound workqueues to the platform CPUs instead -of the housekeeping CPUs, because the latter can be a superset of the -former. - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - kernel/workqueue.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index d6bdf3ad61e9..43f11a383cba 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -4242,7 +4242,7 @@ static int init_rescuer(struct workqueue_struct *wq) - } - - wq->rescuer = rescuer; -- kthread_bind_mask(rescuer->task, cpu_possible_mask); -+ kthread_bind_mask(rescuer->task, cpu_kthread_mask); - wake_up_process(rescuer->task); - - return 0; -@@ -5937,13 +5937,12 @@ static void __init wq_numa_init(void) - void __init workqueue_init_early(void) - { - int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL }; -- int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; - int i, cpu; - - BUILD_BUG_ON(__alignof__(struct pool_workqueue) < __alignof__(long long)); - - BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL)); -- cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(hk_flags)); -+ cpumask_copy(wq_unbound_cpumask, cpu_kthread_mask); - - pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC); - --- -2.29.2 - diff --git a/kernel-std/centos/patches/0015-Revert-scsi-sd-Inline-sd_probe_part2.patch b/kernel-std/centos/patches/0015-Revert-scsi-sd-Inline-sd_probe_part2.patch deleted file mode 100644 index b5fb9260..00000000 --- a/kernel-std/centos/patches/0015-Revert-scsi-sd-Inline-sd_probe_part2.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 42f1ccc21f873a27c125a4e1aa3cb70a2336aa14 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Wed, 8 Dec 2021 17:49:56 -0800 -Subject: [PATCH] Revert "scsi: sd: Inline sd_probe_part2()" - -This reverts commit 82a54da641f3cacfa31db36fc58a5e903f804c22. - -Merge conflicts were encountered when reverting this commit, which -inlines sd_probe_part2() into sd_probe(). However, the inlined parts -of sd_probe_part2() have since been modified. To avoid a difference -in behaviour, the updated code was relocated to sd_probe_part2(). - -The inlined code has been modified as follows since the inlining -happened: -The following code was added - if (sdp->rpm_autosuspend) { - pm_runtime_set_autosuspend_delay(dev, - sdp->host->hostt->rpm_autosuspend_delay); - } -between the following line - blk_pm_runtime_init(sdp->request_queue, dev); -and the following line - device_add_disk(dev, gd, NULL); - -In addition, init_opal_dev() is now passed the pointer "sdkp" -instead of "sdp" as the first argument. This commit ensures that -these two changes were accounted for when reverting the inlining -of sd_probe_part2(). - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - drivers/scsi/sd.c | 111 ++++++++++++++++++++++++++-------------------- - 1 file changed, 63 insertions(+), 48 deletions(-) - -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index 56e291708587..d1d27516fc6a 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -3364,6 +3364,68 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) - return 0; - } - -+static void sd_probe_part2(struct scsi_disk *sdkp) -+{ -+ struct scsi_device *sdp; -+ struct gendisk *gd; -+ u32 index; -+ struct device *dev; -+ -+ sdp = sdkp->device; -+ gd = sdkp->disk; -+ index = sdkp->index; -+ dev = &sdp->sdev_gendev; -+ -+ gd->major = sd_major((index & 0xf0) >> 4); -+ gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); -+ -+ gd->fops = &sd_fops; -+ gd->private_data = &sdkp->driver; -+ gd->queue = sdkp->device->request_queue; -+ -+ /* defaults, until the device tells us otherwise */ -+ sdp->sector_size = 512; -+ sdkp->capacity = 0; -+ sdkp->media_present = 1; -+ sdkp->write_prot = 0; -+ sdkp->cache_override = 0; -+ sdkp->WCE = 0; -+ sdkp->RCD = 0; -+ sdkp->ATO = 0; -+ sdkp->first_scan = 1; -+ sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; -+ -+ sd_revalidate_disk(gd); -+ -+ gd->flags = GENHD_FL_EXT_DEVT; -+ if (sdp->removable) { -+ gd->flags |= GENHD_FL_REMOVABLE; -+ gd->events |= DISK_EVENT_MEDIA_CHANGE; -+ gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT; -+ } -+ -+ blk_pm_runtime_init(sdp->request_queue, dev); -+ if (sdp->rpm_autosuspend) { -+ pm_runtime_set_autosuspend_delay(dev, -+ sdp->host->hostt->rpm_autosuspend_delay); -+ } -+ device_add_disk(dev, gd, NULL); -+ if (sdkp->capacity) -+ sd_dif_config_host(sdkp); -+ -+ sd_revalidate_disk(gd); -+ -+ if (sdkp->security) { -+ sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit); -+ if (sdkp->opal_dev) -+ sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); -+ } -+ -+ sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", -+ sdp->removable ? "removable " : ""); -+ scsi_autopm_put_device(sdp); -+} -+ - /** - * sd_probe - called during driver initialization and whenever a - * new scsi device is attached to the system. It is called once -@@ -3455,54 +3517,7 @@ static int sd_probe(struct device *dev) - - dev_set_drvdata(dev, sdkp); - -- gd->major = sd_major((index & 0xf0) >> 4); -- gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); -- -- gd->fops = &sd_fops; -- gd->private_data = &sdkp->driver; -- gd->queue = sdkp->device->request_queue; -- -- /* defaults, until the device tells us otherwise */ -- sdp->sector_size = 512; -- sdkp->capacity = 0; -- sdkp->media_present = 1; -- sdkp->write_prot = 0; -- sdkp->cache_override = 0; -- sdkp->WCE = 0; -- sdkp->RCD = 0; -- sdkp->ATO = 0; -- sdkp->first_scan = 1; -- sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; -- -- sd_revalidate_disk(gd); -- -- gd->flags = GENHD_FL_EXT_DEVT; -- if (sdp->removable) { -- gd->flags |= GENHD_FL_REMOVABLE; -- gd->events |= DISK_EVENT_MEDIA_CHANGE; -- gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT; -- } -- -- blk_pm_runtime_init(sdp->request_queue, dev); -- if (sdp->rpm_autosuspend) { -- pm_runtime_set_autosuspend_delay(dev, -- sdp->host->hostt->rpm_autosuspend_delay); -- } -- device_add_disk(dev, gd, NULL); -- if (sdkp->capacity) -- sd_dif_config_host(sdkp); -- -- sd_revalidate_disk(gd); -- -- if (sdkp->security) { -- sdkp->opal_dev = init_opal_dev(sdkp, &sd_sec_submit); -- if (sdkp->opal_dev) -- sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); -- } -- -- sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", -- sdp->removable ? "removable " : ""); -- scsi_autopm_put_device(sdp); -+ sd_probe_part2(sdkp); - - return 0; - --- -2.31.1 - diff --git a/kernel-std/centos/patches/0016-Revert-commit-f049cf1a7b.patch b/kernel-std/centos/patches/0016-Revert-commit-f049cf1a7b.patch deleted file mode 100644 index 55e6ccaa..00000000 --- a/kernel-std/centos/patches/0016-Revert-commit-f049cf1a7b.patch +++ /dev/null @@ -1,135 +0,0 @@ -From b5dad6e67f9704968ca7d4daf1715667cddafa3d Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Wed, 8 Dec 2021 18:34:59 -0800 -Subject: [PATCH 2/2] Revert commit f049cf1a7b - -commit f049cf1a7b "scsi: sd: Rely on the driver core for asynchronous -probing" - -This reverts commit f049cf1a7b6737c75884247c3f6383ef104d255a, -and it is a clean revert, there is not any conflict. - -Signed-off-by: M. Vefa Bicakci -Signed-off-by: Jiping Ma ---- - drivers/scsi/scsi.c | 12 +++++++++--- - drivers/scsi/scsi_pm.c | 6 +++++- - drivers/scsi/scsi_priv.h | 1 + - drivers/scsi/sd.c | 12 +++++++++--- - 4 files changed, 24 insertions(+), 7 deletions(-) - -diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c -index 24619c3bebd5..3080292a16cd 100644 ---- a/drivers/scsi/scsi.c -+++ b/drivers/scsi/scsi.c -@@ -86,10 +86,15 @@ unsigned int scsi_logging_level; - EXPORT_SYMBOL(scsi_logging_level); - #endif - -+/* sd, scsi core and power management need to coordinate flushing async actions */ -+ASYNC_DOMAIN(scsi_sd_probe_domain); -+EXPORT_SYMBOL(scsi_sd_probe_domain); -+ - /* -- * Domain for asynchronous system resume operations. It is marked 'exclusive' -- * to avoid being included in the async_synchronize_full() that is invoked by -- * dpm_resume(). -+ * Separate domain (from scsi_sd_probe_domain) to maximize the benefit of -+ * asynchronous system resume operations. It is marked 'exclusive' to avoid -+ * being included in the async_synchronize_full() that is invoked by -+ * dpm_resume() - */ - ASYNC_DOMAIN_EXCLUSIVE(scsi_sd_pm_domain); - EXPORT_SYMBOL(scsi_sd_pm_domain); -@@ -799,6 +804,7 @@ static void __exit exit_scsi(void) - scsi_exit_devinfo(); - scsi_exit_procfs(); - scsi_exit_queue(); -+ async_unregister_domain(&scsi_sd_probe_domain); - } - - subsys_initcall(init_scsi); -diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c -index 3717eea37ecb..b3d71b516213 100644 ---- a/drivers/scsi/scsi_pm.c -+++ b/drivers/scsi/scsi_pm.c -@@ -175,7 +175,11 @@ static int scsi_bus_resume_common(struct device *dev, - - static int scsi_bus_prepare(struct device *dev) - { -- if (scsi_is_host_device(dev)) { -+ if (scsi_is_sdev_device(dev)) { -+ /* sd probing uses async_schedule. Wait until it finishes. */ -+ async_synchronize_full_domain(&scsi_sd_probe_domain); -+ -+ } else if (scsi_is_host_device(dev)) { - /* Wait until async scanning is finished */ - scsi_complete_async_scans(); - } -diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h -index 180636d54982..c43456f0870c 100644 ---- a/drivers/scsi/scsi_priv.h -+++ b/drivers/scsi/scsi_priv.h -@@ -172,6 +172,7 @@ static inline void scsi_autopm_put_host(struct Scsi_Host *h) {} - #endif /* CONFIG_PM */ - - extern struct async_domain scsi_sd_pm_domain; -+extern struct async_domain scsi_sd_probe_domain; - - /* scsi_dh.c */ - #ifdef CONFIG_SCSI_DH -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index 2e22ee4501e7..e6c70475f084 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -616,7 +616,6 @@ static struct scsi_driver sd_template = { - .name = "sd", - .owner = THIS_MODULE, - .probe = sd_probe, -- .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .remove = sd_remove, - .shutdown = sd_shutdown, - .pm = &sd_pm_ops, -@@ -3364,8 +3363,12 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) - return 0; - } - --static void sd_probe_part2(struct scsi_disk *sdkp) -+/* -+ * The asynchronous part of sd_probe -+ */ -+static void sd_probe_async(void *data, async_cookie_t cookie) - { -+ struct scsi_disk *sdkp = data; - struct scsi_device *sdp; - struct gendisk *gd; - u32 index; -@@ -3424,6 +3427,7 @@ static void sd_probe_part2(struct scsi_disk *sdkp) - sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", - sdp->removable ? "removable " : ""); - scsi_autopm_put_device(sdp); -+ put_device(&sdkp->dev); - } - - /** -@@ -3517,7 +3521,8 @@ static int sd_probe(struct device *dev) - - dev_set_drvdata(dev, sdkp); - -- sd_probe_part2(sdkp); -+ get_device(&sdkp->dev); /* prevent release before async_schedule */ -+ async_schedule_domain(sd_probe_async, sdkp, &scsi_sd_probe_domain); - - return 0; - -@@ -3554,6 +3559,7 @@ static int sd_remove(struct device *dev) - scsi_autopm_get_device(sdkp->device); - - async_synchronize_full_domain(&scsi_sd_pm_domain); -+ async_synchronize_full_domain(&scsi_sd_probe_domain); - device_del(&sdkp->dev); - del_gendisk(sdkp->disk); - sd_shutdown(dev); --- -2.31.1 - diff --git a/kernel-std/centos/patches/0017-genirq-Export-affinity-setter-for-modules.patch b/kernel-std/centos/patches/0017-genirq-Export-affinity-setter-for-modules.patch deleted file mode 100644 index a56cd82c..00000000 --- a/kernel-std/centos/patches/0017-genirq-Export-affinity-setter-for-modules.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 7c2dc6277376104f8cfe7f8d07c77f6d7155fb73 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Tue, 18 May 2021 11:17:26 +0200 -Subject: [PATCH] genirq: Export affinity setter for modules - -Perf modules abuse irq_set_affinity_hint() to set the affinity of system -PMU interrupts just because irq_set_affinity() was not exported. - -The fact that irq_set_affinity_hint() actually sets the affinity is a -non-documented side effect and the name is clearly saying it's a hint. - -To clean this up, export the real affinity setter. - -Signed-off-by: Thomas Gleixner -Acked-by: Mark Rutland -Link: https://lore.kernel.org/r/20210518093117.968251441@linutronix.de -(cherry picked from commit 4d80d6ca5d77fde9880da8466e5b64f250e5bf82) -[mvb: Adjust context for a function that does not exist in v5.10.] -Signed-off-by: M. Vefa Bicakci ---- - include/linux/interrupt.h | 35 ++--------------------------------- - kernel/irq/manage.c | 33 ++++++++++++++++++++++++++++++++- - 2 files changed, 34 insertions(+), 34 deletions(-) - -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index ee8299eb1f52..087a1cfad35c 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -314,39 +314,8 @@ struct irq_affinity_desc { - - extern cpumask_var_t irq_default_affinity; - --/* Internal implementation. Use the helpers below */ --extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask, -- bool force); -- --/** -- * irq_set_affinity - Set the irq affinity of a given irq -- * @irq: Interrupt to set affinity -- * @cpumask: cpumask -- * -- * Fails if cpumask does not contain an online CPU -- */ --static inline int --irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) --{ -- return __irq_set_affinity(irq, cpumask, false); --} -- --/** -- * irq_force_affinity - Force the irq affinity of a given irq -- * @irq: Interrupt to set affinity -- * @cpumask: cpumask -- * -- * Same as irq_set_affinity, but without checking the mask against -- * online cpus. -- * -- * Solely for low level cpu hotplug code, where we need to make per -- * cpu interrupts affine before the cpu becomes online. -- */ --static inline int --irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) --{ -- return __irq_set_affinity(irq, cpumask, true); --} -+extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); -+extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask); - - extern int irq_can_set_affinity(unsigned int irq); - extern int irq_select_affinity(unsigned int irq); -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index 420b5ce0bf89..eeedb6224e2f 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -371,7 +371,8 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, - return ret; - } - --int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) -+static int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, -+ bool force) - { - struct irq_desc *desc = irq_to_desc(irq); - unsigned long flags; -@@ -386,6 +387,36 @@ int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) - return ret; - } - -+/** -+ * irq_set_affinity - Set the irq affinity of a given irq -+ * @irq: Interrupt to set affinity -+ * @cpumask: cpumask -+ * -+ * Fails if cpumask does not contain an online CPU -+ */ -+int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) -+{ -+ return __irq_set_affinity(irq, cpumask, false); -+} -+EXPORT_SYMBOL_GPL(irq_set_affinity); -+ -+/** -+ * irq_force_affinity - Force the irq affinity of a given irq -+ * @irq: Interrupt to set affinity -+ * @cpumask: cpumask -+ * -+ * Same as irq_set_affinity, but without checking the mask against -+ * online cpus. -+ * -+ * Solely for low level cpu hotplug code, where we need to make per -+ * cpu interrupts affine before the cpu becomes online. -+ */ -+int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) -+{ -+ return __irq_set_affinity(irq, cpumask, true); -+} -+EXPORT_SYMBOL_GPL(irq_force_affinity); -+ - int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) - { - unsigned long flags; --- -2.29.2 - diff --git a/kernel-std/centos/patches/0018-genirq-Provide-new-interfaces-for-affinity-hints.patch b/kernel-std/centos/patches/0018-genirq-Provide-new-interfaces-for-affinity-hints.patch deleted file mode 100644 index ac466b78..00000000 --- a/kernel-std/centos/patches/0018-genirq-Provide-new-interfaces-for-affinity-hints.patch +++ /dev/null @@ -1,146 +0,0 @@ -From d4b260fea6b5d7f0da84236f97b385312ab2e0ac Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Fri, 3 Sep 2021 11:24:17 -0400 -Subject: [PATCH] genirq: Provide new interfaces for affinity hints - -The discussion about removing the side effect of irq_set_affinity_hint() of -actually applying the cpumask (if not NULL) as affinity to the interrupt, -unearthed a few unpleasantries: - - 1) The modular perf drivers rely on the current behaviour for the very - wrong reasons. - - 2) While none of the other drivers prevents user space from changing - the affinity, a cursorily inspection shows that there are at least - expectations in some drivers. - - #1 needs to be cleaned up anyway, so that's not a problem - - #2 might result in subtle regressions especially when irqbalanced (which - nowadays ignores the affinity hint) is disabled. - -Provide new interfaces: - - irq_update_affinity_hint() - Only sets the affinity hint pointer - irq_set_affinity_and_hint() - Set the pointer and apply the affinity to - the interrupt - -Make irq_set_affinity_hint() a wrapper around irq_apply_affinity_hint() and -document it to be phased out. - -Signed-off-by: Thomas Gleixner -Signed-off-by: Nitesh Narayan Lal -Signed-off-by: Thomas Gleixner -Reviewed-by: Ming Lei -Link: https://lore.kernel.org/r/20210501021832.743094-1-jesse.brandeburg@intel.com -Link: https://lore.kernel.org/r/20210903152430.244937-2-nitesh@redhat.com -(cherry picked from commit 65c7cdedeb3026fabcc967a7aae2f755ad4d0783) -[mvb: Adapt to v5.10 by resolving a minor merge conflict.] -Signed-off-by: M. Vefa Bicakci ---- - include/linux/interrupt.h | 52 ++++++++++++++++++++++++++++++++++++++- - kernel/irq/manage.c | 8 +++--- - 2 files changed, 55 insertions(+), 5 deletions(-) - -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index 087a1cfad35c..72350bdee846 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -320,7 +320,45 @@ extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask); - extern int irq_can_set_affinity(unsigned int irq); - extern int irq_select_affinity(unsigned int irq); - --extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); -+extern int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, -+ bool setaffinity); -+ -+/** -+ * irq_update_affinity_hint - Update the affinity hint -+ * @irq: Interrupt to update -+ * @m: cpumask pointer (NULL to clear the hint) -+ * -+ * Updates the affinity hint, but does not change the affinity of the interrupt. -+ */ -+static inline int -+irq_update_affinity_hint(unsigned int irq, const struct cpumask *m) -+{ -+ return __irq_apply_affinity_hint(irq, m, false); -+} -+ -+/** -+ * irq_set_affinity_and_hint - Update the affinity hint and apply the provided -+ * cpumask to the interrupt -+ * @irq: Interrupt to update -+ * @m: cpumask pointer (NULL to clear the hint) -+ * -+ * Updates the affinity hint and if @m is not NULL it applies it as the -+ * affinity of that interrupt. -+ */ -+static inline int -+irq_set_affinity_and_hint(unsigned int irq, const struct cpumask *m) -+{ -+ return __irq_apply_affinity_hint(irq, m, true); -+} -+ -+/* -+ * Deprecated. Use irq_update_affinity_hint() or irq_set_affinity_and_hint() -+ * instead. -+ */ -+static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) -+{ -+ return irq_set_affinity_and_hint(irq, m); -+} - - extern int - irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); -@@ -350,6 +388,18 @@ static inline int irq_can_set_affinity(unsigned int irq) - - static inline int irq_select_affinity(unsigned int irq) { return 0; } - -+static inline int irq_update_affinity_hint(unsigned int irq, -+ const struct cpumask *m) -+{ -+ return -EINVAL; -+} -+ -+static inline int irq_set_affinity_and_hint(unsigned int irq, -+ const struct cpumask *m) -+{ -+ return -EINVAL; -+} -+ - static inline int irq_set_affinity_hint(unsigned int irq, - const struct cpumask *m) - { -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index eeedb6224e2f..63e7de3683d2 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -417,7 +417,8 @@ int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) - } - EXPORT_SYMBOL_GPL(irq_force_affinity); - --int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) -+int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, -+ bool setaffinity) - { - unsigned long flags; - struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); -@@ -426,12 +427,11 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) - return -EINVAL; - desc->affinity_hint = m; - irq_put_desc_unlock(desc, flags); -- /* set the initial affinity to prevent every interrupt being on CPU0 */ -- if (m) -+ if (m && setaffinity) - __irq_set_affinity(irq, m, false); - return 0; - } --EXPORT_SYMBOL_GPL(irq_set_affinity_hint); -+EXPORT_SYMBOL_GPL(__irq_apply_affinity_hint); - - static void irq_affinity_notify(struct work_struct *work) - { --- -2.29.2 - diff --git a/kernel-std/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch b/kernel-std/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch deleted file mode 100644 index 03afb03b..00000000 --- a/kernel-std/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 07298341feaa2c35fdd225735b4ee5299efb112f Mon Sep 17 00:00:00 2001 -From: Nitesh Narayan Lal -Date: Fri, 3 Sep 2021 11:24:25 -0400 -Subject: [PATCH] ixgbe: Use irq_update_affinity_hint() - -The driver uses irq_set_affinity_hint() to update the affinity_hint mask -that is consumed by the userspace to distribute the interrupts. However, -under the hood irq_set_affinity_hint() also applies the provided cpumask -(if not NULL) as the affinity for the given interrupt which is an -undocumented side effect. - -To remove this side effect irq_set_affinity_hint() has been marked -as deprecated and new interfaces have been introduced. Hence, replace the -irq_set_affinity_hint() with the new interface irq_update_affinity_hint() -that only updates the affinity_hint pointer. - -Signed-off-by: Nitesh Narayan Lal -Signed-off-by: Thomas Gleixner -Acked-by: Jesse Brandeburg -Link: https://lore.kernel.org/r/20210903152430.244937-10-nitesh@redhat.com -(cherry picked from commit cc493264c01d055742a34cfbaecaffb258dcc58c) -Signed-off-by: M. Vefa Bicakci ---- - drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -index ffe322136c58..fe10776d8479 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -@@ -3250,8 +3250,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) - /* If Flow Director is enabled, set interrupt affinity */ - if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { - /* assign the mask for this irq */ -- irq_set_affinity_hint(entry->vector, -- &q_vector->affinity_mask); -+ irq_update_affinity_hint(entry->vector, -+ &q_vector->affinity_mask); - } - } - -@@ -3267,8 +3267,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) - free_queue_irqs: - while (vector) { - vector--; -- irq_set_affinity_hint(adapter->msix_entries[vector].vector, -- NULL); -+ irq_update_affinity_hint(adapter->msix_entries[vector].vector, -+ NULL); - free_irq(adapter->msix_entries[vector].vector, - adapter->q_vector[vector]); - } -@@ -3401,7 +3401,7 @@ static void ixgbe_free_irq(struct ixgbe_adapter *adapter) - continue; - - /* clear the affinity_mask in the IRQ descriptor */ -- irq_set_affinity_hint(entry->vector, NULL); -+ irq_update_affinity_hint(entry->vector, NULL); - - free_irq(entry->vector, q_vector); - } --- -2.29.2 - diff --git a/kernel-std/centos/patches/0020-Add-auxiliary-bus-support.patch b/kernel-std/centos/patches/0020-Add-auxiliary-bus-support.patch deleted file mode 100644 index b4a182e0..00000000 --- a/kernel-std/centos/patches/0020-Add-auxiliary-bus-support.patch +++ /dev/null @@ -1,743 +0,0 @@ -From a6492f505f12f830372636043098ad9dab3607d6 Mon Sep 17 00:00:00 2001 -From: Dave Ertman -Date: Wed, 2 Dec 2020 16:54:24 -0800 -Subject: [PATCH] Add auxiliary bus support - -Add support for the Auxiliary Bus, auxiliary_device and auxiliary_driver. -It enables drivers to create an auxiliary_device and bind an -auxiliary_driver to it. - -The bus supports probe/remove shutdown and suspend/resume callbacks. -Each auxiliary_device has a unique string based id; driver binds to -an auxiliary_device based on this id through the bus. - -Co-developed-by: Kiran Patil -Co-developed-by: Ranjani Sridharan -Co-developed-by: Fred Oh -Co-developed-by: Leon Romanovsky -Signed-off-by: Kiran Patil -Signed-off-by: Ranjani Sridharan -Signed-off-by: Fred Oh -Signed-off-by: Leon Romanovsky -Signed-off-by: Dave Ertman -Reviewed-by: Pierre-Louis Bossart -Reviewed-by: Shiraz Saleem -Reviewed-by: Parav Pandit -Reviewed-by: Dan Williams -Reviewed-by: Martin Habets -Link: https://lore.kernel.org/r/20201113161859.1775473-2-david.m.ertman@intel.com -Signed-off-by: Dan Williams -Link: https://lore.kernel.org/r/160695681289.505290.8978295443574440604.stgit@dwillia2-desk3.amr.corp.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 7de3697e9cbd4bd3d62bafa249d57990e1b8f294) -Signed-off-by: M. Vefa Bicakci ---- - Documentation/driver-api/auxiliary_bus.rst | 234 ++++++++++++++++++ - Documentation/driver-api/index.rst | 1 + - drivers/base/Kconfig | 3 + - drivers/base/Makefile | 1 + - drivers/base/auxiliary.c | 268 +++++++++++++++++++++ - include/linux/auxiliary_bus.h | 78 ++++++ - include/linux/mod_devicetable.h | 8 + - scripts/mod/devicetable-offsets.c | 3 + - scripts/mod/file2alias.c | 8 + - 9 files changed, 604 insertions(+) - create mode 100644 Documentation/driver-api/auxiliary_bus.rst - create mode 100644 drivers/base/auxiliary.c - create mode 100644 include/linux/auxiliary_bus.h - -diff --git a/Documentation/driver-api/auxiliary_bus.rst b/Documentation/driver-api/auxiliary_bus.rst -new file mode 100644 -index 000000000000..5dd7804631ef ---- /dev/null -+++ b/Documentation/driver-api/auxiliary_bus.rst -@@ -0,0 +1,234 @@ -+.. SPDX-License-Identifier: GPL-2.0-only -+ -+============= -+Auxiliary Bus -+============= -+ -+In some subsystems, the functionality of the core device (PCI/ACPI/other) is -+too complex for a single device to be managed by a monolithic driver -+(e.g. Sound Open Firmware), multiple devices might implement a common -+intersection of functionality (e.g. NICs + RDMA), or a driver may want to -+export an interface for another subsystem to drive (e.g. SIOV Physical Function -+export Virtual Function management). A split of the functinoality into child- -+devices representing sub-domains of functionality makes it possible to -+compartmentalize, layer, and distribute domain-specific concerns via a Linux -+device-driver model. -+ -+An example for this kind of requirement is the audio subsystem where a single -+IP is handling multiple entities such as HDMI, Soundwire, local devices such as -+mics/speakers etc. The split for the core's functionality can be arbitrary or -+be defined by the DSP firmware topology and include hooks for test/debug. This -+allows for the audio core device to be minimal and focused on hardware-specific -+control and communication. -+ -+Each auxiliary_device represents a part of its parent functionality. The -+generic behavior can be extended and specialized as needed by encapsulating an -+auxiliary_device within other domain-specific structures and the use of .ops -+callbacks. Devices on the auxiliary bus do not share any structures and the use -+of a communication channel with the parent is domain-specific. -+ -+Note that ops are intended as a way to augment instance behavior within a class -+of auxiliary devices, it is not the mechanism for exporting common -+infrastructure from the parent. Consider EXPORT_SYMBOL_NS() to convey -+infrastructure from the parent module to the auxiliary module(s). -+ -+ -+When Should the Auxiliary Bus Be Used -+===================================== -+ -+The auxiliary bus is to be used when a driver and one or more kernel modules, -+who share a common header file with the driver, need a mechanism to connect and -+provide access to a shared object allocated by the auxiliary_device's -+registering driver. The registering driver for the auxiliary_device(s) and the -+kernel module(s) registering auxiliary_drivers can be from the same subsystem, -+or from multiple subsystems. -+ -+The emphasis here is on a common generic interface that keeps subsystem -+customization out of the bus infrastructure. -+ -+One example is a PCI network device that is RDMA-capable and exports a child -+device to be driven by an auxiliary_driver in the RDMA subsystem. The PCI -+driver allocates and registers an auxiliary_device for each physical -+function on the NIC. The RDMA driver registers an auxiliary_driver that claims -+each of these auxiliary_devices. This conveys data/ops published by the parent -+PCI device/driver to the RDMA auxiliary_driver. -+ -+Another use case is for the PCI device to be split out into multiple sub -+functions. For each sub function an auxiliary_device is created. A PCI sub -+function driver binds to such devices that creates its own one or more class -+devices. A PCI sub function auxiliary device is likely to be contained in a -+struct with additional attributes such as user defined sub function number and -+optional attributes such as resources and a link to the parent device. These -+attributes could be used by systemd/udev; and hence should be initialized -+before a driver binds to an auxiliary_device. -+ -+A key requirement for utilizing the auxiliary bus is that there is no -+dependency on a physical bus, device, register accesses or regmap support. -+These individual devices split from the core cannot live on the platform bus as -+they are not physical devices that are controlled by DT/ACPI. The same -+argument applies for not using MFD in this scenario as MFD relies on individual -+function devices being physical devices. -+ -+Auxiliary Device -+================ -+ -+An auxiliary_device represents a part of its parent device's functionality. It -+is given a name that, combined with the registering drivers KBUILD_MODNAME, -+creates a match_name that is used for driver binding, and an id that combined -+with the match_name provide a unique name to register with the bus subsystem. -+ -+Registering an auxiliary_device is a two-step process. First call -+auxiliary_device_init(), which checks several aspects of the auxiliary_device -+struct and performs a device_initialize(). After this step completes, any -+error state must have a call to auxiliary_device_uninit() in its resolution path. -+The second step in registering an auxiliary_device is to perform a call to -+auxiliary_device_add(), which sets the name of the device and add the device to -+the bus. -+ -+Unregistering an auxiliary_device is also a two-step process to mirror the -+register process. First call auxiliary_device_delete(), then call -+auxiliary_device_uninit(). -+ -+.. code-block:: c -+ -+ struct auxiliary_device { -+ struct device dev; -+ const char *name; -+ u32 id; -+ }; -+ -+If two auxiliary_devices both with a match_name "mod.foo" are registered onto -+the bus, they must have unique id values (e.g. "x" and "y") so that the -+registered devices names are "mod.foo.x" and "mod.foo.y". If match_name + id -+are not unique, then the device_add fails and generates an error message. -+ -+The auxiliary_device.dev.type.release or auxiliary_device.dev.release must be -+populated with a non-NULL pointer to successfully register the auxiliary_device. -+ -+The auxiliary_device.dev.parent must also be populated. -+ -+Auxiliary Device Memory Model and Lifespan -+------------------------------------------ -+ -+The registering driver is the entity that allocates memory for the -+auxiliary_device and register it on the auxiliary bus. It is important to note -+that, as opposed to the platform bus, the registering driver is wholly -+responsible for the management for the memory used for the driver object. -+ -+A parent object, defined in the shared header file, contains the -+auxiliary_device. It also contains a pointer to the shared object(s), which -+also is defined in the shared header. Both the parent object and the shared -+object(s) are allocated by the registering driver. This layout allows the -+auxiliary_driver's registering module to perform a container_of() call to go -+from the pointer to the auxiliary_device, that is passed during the call to the -+auxiliary_driver's probe function, up to the parent object, and then have -+access to the shared object(s). -+ -+The memory for the auxiliary_device is freed only in its release() callback -+flow as defined by its registering driver. -+ -+The memory for the shared object(s) must have a lifespan equal to, or greater -+than, the lifespan of the memory for the auxiliary_device. The auxiliary_driver -+should only consider that this shared object is valid as long as the -+auxiliary_device is still registered on the auxiliary bus. It is up to the -+registering driver to manage (e.g. free or keep available) the memory for the -+shared object beyond the life of the auxiliary_device. -+ -+The registering driver must unregister all auxiliary devices before its own -+driver.remove() is completed. -+ -+Auxiliary Drivers -+================= -+ -+Auxiliary drivers follow the standard driver model convention, where -+discovery/enumeration is handled by the core, and drivers -+provide probe() and remove() methods. They support power management -+and shutdown notifications using the standard conventions. -+ -+.. code-block:: c -+ -+ struct auxiliary_driver { -+ int (*probe)(struct auxiliary_device *, -+ const struct auxiliary_device_id *id); -+ int (*remove)(struct auxiliary_device *); -+ void (*shutdown)(struct auxiliary_device *); -+ int (*suspend)(struct auxiliary_device *, pm_message_t); -+ int (*resume)(struct auxiliary_device *); -+ struct device_driver driver; -+ const struct auxiliary_device_id *id_table; -+ }; -+ -+Auxiliary drivers register themselves with the bus by calling -+auxiliary_driver_register(). The id_table contains the match_names of auxiliary -+devices that a driver can bind with. -+ -+Example Usage -+============= -+ -+Auxiliary devices are created and registered by a subsystem-level core device -+that needs to break up its functionality into smaller fragments. One way to -+extend the scope of an auxiliary_device is to encapsulate it within a domain- -+pecific structure defined by the parent device. This structure contains the -+auxiliary_device and any associated shared data/callbacks needed to establish -+the connection with the parent. -+ -+An example is: -+ -+.. code-block:: c -+ -+ struct foo { -+ struct auxiliary_device auxdev; -+ void (*connect)(struct auxiliary_device *auxdev); -+ void (*disconnect)(struct auxiliary_device *auxdev); -+ void *data; -+ }; -+ -+The parent device then registers the auxiliary_device by calling -+auxiliary_device_init(), and then auxiliary_device_add(), with the pointer to -+the auxdev member of the above structure. The parent provides a name for the -+auxiliary_device that, combined with the parent's KBUILD_MODNAME, creates a -+match_name that is be used for matching and binding with a driver. -+ -+Whenever an auxiliary_driver is registered, based on the match_name, the -+auxiliary_driver's probe() is invoked for the matching devices. The -+auxiliary_driver can also be encapsulated inside custom drivers that make the -+core device's functionality extensible by adding additional domain-specific ops -+as follows: -+ -+.. code-block:: c -+ -+ struct my_ops { -+ void (*send)(struct auxiliary_device *auxdev); -+ void (*receive)(struct auxiliary_device *auxdev); -+ }; -+ -+ -+ struct my_driver { -+ struct auxiliary_driver auxiliary_drv; -+ const struct my_ops ops; -+ }; -+ -+An example of this type of usage is: -+ -+.. code-block:: c -+ -+ const struct auxiliary_device_id my_auxiliary_id_table[] = { -+ { .name = "foo_mod.foo_dev" }, -+ { }, -+ }; -+ -+ const struct my_ops my_custom_ops = { -+ .send = my_tx, -+ .receive = my_rx, -+ }; -+ -+ const struct my_driver my_drv = { -+ .auxiliary_drv = { -+ .name = "myauxiliarydrv", -+ .id_table = my_auxiliary_id_table, -+ .probe = my_probe, -+ .remove = my_remove, -+ .shutdown = my_shutdown, -+ }, -+ .ops = my_custom_ops, -+ }; -diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst -index f357f3eb400c..86759a74b7f1 100644 ---- a/Documentation/driver-api/index.rst -+++ b/Documentation/driver-api/index.rst -@@ -72,6 +72,7 @@ available subsections can be seen below. - thermal/index - fpga/index - acpi/index -+ auxiliary_bus - backlight/lp855x-driver.rst - connector - console -diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig -index 8d7001712062..040be48ce046 100644 ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -1,6 +1,9 @@ - # SPDX-License-Identifier: GPL-2.0 - menu "Generic Driver Options" - -+config AUXILIARY_BUS -+ bool -+ - config UEVENT_HELPER - bool "Support for uevent helper" - help -diff --git a/drivers/base/Makefile b/drivers/base/Makefile -index 41369fc7004f..5e7bf9669a81 100644 ---- a/drivers/base/Makefile -+++ b/drivers/base/Makefile -@@ -7,6 +7,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ - attribute_container.o transport_class.o \ - topology.o container.o property.o cacheinfo.o \ - swnode.o -+obj-$(CONFIG_AUXILIARY_BUS) += auxiliary.o - obj-$(CONFIG_DEVTMPFS) += devtmpfs.o - obj-y += power/ - obj-$(CONFIG_ISA_BUS_API) += isa.o -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -new file mode 100644 -index 000000000000..ef2af417438b ---- /dev/null -+++ b/drivers/base/auxiliary.c -@@ -0,0 +1,268 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Copyright (c) 2019-2020 Intel Corporation -+ * -+ * Please see Documentation/driver-api/auxiliary_bus.rst for more information. -+ */ -+ -+#define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id, -+ const struct auxiliary_device *auxdev) -+{ -+ for (; id->name[0]; id++) { -+ const char *p = strrchr(dev_name(&auxdev->dev), '.'); -+ int match_size; -+ -+ if (!p) -+ continue; -+ match_size = p - dev_name(&auxdev->dev); -+ -+ /* use dev_name(&auxdev->dev) prefix before last '.' char to match to */ -+ if (strlen(id->name) == match_size && -+ !strncmp(dev_name(&auxdev->dev), id->name, match_size)) -+ return id; -+ } -+ return NULL; -+} -+ -+static int auxiliary_match(struct device *dev, struct device_driver *drv) -+{ -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv); -+ -+ return !!auxiliary_match_id(auxdrv->id_table, auxdev); -+} -+ -+static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) -+{ -+ const char *name, *p; -+ -+ name = dev_name(dev); -+ p = strrchr(name, '.'); -+ -+ return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, (int)(p - name), -+ name); -+} -+ -+static const struct dev_pm_ops auxiliary_dev_pm_ops = { -+ SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend, pm_generic_runtime_resume, NULL) -+ SET_SYSTEM_SLEEP_PM_OPS(pm_generic_suspend, pm_generic_resume) -+}; -+ -+static int auxiliary_bus_probe(struct device *dev) -+{ -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ int ret; -+ -+ ret = dev_pm_domain_attach(dev, true); -+ if (ret) { -+ dev_warn(dev, "Failed to attach to PM Domain : %d\n", ret); -+ return ret; -+ } -+ -+ ret = auxdrv->probe(auxdev, auxiliary_match_id(auxdrv->id_table, auxdev)); -+ if (ret) -+ dev_pm_domain_detach(dev, true); -+ -+ return ret; -+} -+ -+static int auxiliary_bus_remove(struct device *dev) -+{ -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ int ret = 0; -+ -+ if (auxdrv->remove) -+ ret = auxdrv->remove(auxdev); -+ dev_pm_domain_detach(dev, true); -+ -+ return ret; -+} -+ -+static void auxiliary_bus_shutdown(struct device *dev) -+{ -+ struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ -+ if (auxdrv->shutdown) -+ auxdrv->shutdown(auxdev); -+} -+ -+static struct bus_type auxiliary_bus_type = { -+ .name = "auxiliary", -+ .probe = auxiliary_bus_probe, -+ .remove = auxiliary_bus_remove, -+ .shutdown = auxiliary_bus_shutdown, -+ .match = auxiliary_match, -+ .uevent = auxiliary_uevent, -+ .pm = &auxiliary_dev_pm_ops, -+}; -+ -+/** -+ * auxiliary_device_init - check auxiliary_device and initialize -+ * @auxdev: auxiliary device struct -+ * -+ * This is the first step in the two-step process to register an auxiliary_device. -+ * -+ * When this function returns an error code, then the device_initialize will *not* have -+ * been performed, and the caller will be responsible to free any memory allocated for the -+ * auxiliary_device in the error path directly. -+ * -+ * It returns 0 on success. On success, the device_initialize has been performed. After this -+ * point any error unwinding will need to include a call to auxiliary_device_uninit(). -+ * In this post-initialize error scenario, a call to the device's .release callback will be -+ * triggered, and all memory clean-up is expected to be handled there. -+ */ -+int auxiliary_device_init(struct auxiliary_device *auxdev) -+{ -+ struct device *dev = &auxdev->dev; -+ -+ if (!dev->parent) { -+ pr_err("auxiliary_device has a NULL dev->parent\n"); -+ return -EINVAL; -+ } -+ -+ if (!auxdev->name) { -+ pr_err("auxiliary_device has a NULL name\n"); -+ return -EINVAL; -+ } -+ -+ dev->bus = &auxiliary_bus_type; -+ device_initialize(&auxdev->dev); -+ return 0; -+} -+EXPORT_SYMBOL_GPL(auxiliary_device_init); -+ -+/** -+ * __auxiliary_device_add - add an auxiliary bus device -+ * @auxdev: auxiliary bus device to add to the bus -+ * @modname: name of the parent device's driver module -+ * -+ * This is the second step in the two-step process to register an auxiliary_device. -+ * -+ * This function must be called after a successful call to auxiliary_device_init(), which -+ * will perform the device_initialize. This means that if this returns an error code, then a -+ * call to auxiliary_device_uninit() must be performed so that the .release callback will -+ * be triggered to free the memory associated with the auxiliary_device. -+ * -+ * The expectation is that users will call the "auxiliary_device_add" macro so that the caller's -+ * KBUILD_MODNAME is automatically inserted for the modname parameter. Only if a user requires -+ * a custom name would this version be called directly. -+ */ -+int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname) -+{ -+ struct device *dev = &auxdev->dev; -+ int ret; -+ -+ if (!modname) { -+ pr_err("auxiliary device modname is NULL\n"); -+ return -EINVAL; -+ } -+ -+ ret = dev_set_name(dev, "%s.%s.%d", modname, auxdev->name, auxdev->id); -+ if (ret) { -+ pr_err("auxiliary device dev_set_name failed: %d\n", ret); -+ return ret; -+ } -+ -+ ret = device_add(dev); -+ if (ret) -+ dev_err(dev, "adding auxiliary device failed!: %d\n", ret); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(__auxiliary_device_add); -+ -+/** -+ * auxiliary_find_device - auxiliary device iterator for locating a particular device. -+ * @start: Device to begin with -+ * @data: Data to pass to match function -+ * @match: Callback function to check device -+ * -+ * This function returns a reference to a device that is 'found' -+ * for later use, as determined by the @match callback. -+ * -+ * The callback should return 0 if the device doesn't match and non-zero -+ * if it does. If the callback returns non-zero, this function will -+ * return to the caller and not iterate over any more devices. -+ */ -+struct auxiliary_device * -+auxiliary_find_device(struct device *start, const void *data, -+ int (*match)(struct device *dev, const void *data)) -+{ -+ struct device *dev; -+ -+ dev = bus_find_device(&auxiliary_bus_type, start, data, match); -+ if (!dev) -+ return NULL; -+ -+ return to_auxiliary_dev(dev); -+} -+EXPORT_SYMBOL_GPL(auxiliary_find_device); -+ -+/** -+ * __auxiliary_driver_register - register a driver for auxiliary bus devices -+ * @auxdrv: auxiliary_driver structure -+ * @owner: owning module/driver -+ * @modname: KBUILD_MODNAME for parent driver -+ */ -+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, -+ const char *modname) -+{ -+ if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) -+ return -EINVAL; -+ -+ if (auxdrv->name) -+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, auxdrv->name); -+ else -+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s", modname); -+ if (!auxdrv->driver.name) -+ return -ENOMEM; -+ -+ auxdrv->driver.owner = owner; -+ auxdrv->driver.bus = &auxiliary_bus_type; -+ auxdrv->driver.mod_name = modname; -+ -+ return driver_register(&auxdrv->driver); -+} -+EXPORT_SYMBOL_GPL(__auxiliary_driver_register); -+ -+/** -+ * auxiliary_driver_unregister - unregister a driver -+ * @auxdrv: auxiliary_driver structure -+ */ -+void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv) -+{ -+ driver_unregister(&auxdrv->driver); -+ kfree(auxdrv->driver.name); -+} -+EXPORT_SYMBOL_GPL(auxiliary_driver_unregister); -+ -+static int __init auxiliary_bus_init(void) -+{ -+ return bus_register(&auxiliary_bus_type); -+} -+ -+static void __exit auxiliary_bus_exit(void) -+{ -+ bus_unregister(&auxiliary_bus_type); -+} -+ -+module_init(auxiliary_bus_init); -+module_exit(auxiliary_bus_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Auxiliary Bus"); -+MODULE_AUTHOR("David Ertman "); -+MODULE_AUTHOR("Kiran Patil "); -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -new file mode 100644 -index 000000000000..282fbf7bf9af ---- /dev/null -+++ b/include/linux/auxiliary_bus.h -@@ -0,0 +1,78 @@ -+/* SPDX-License-Identifier: GPL-2.0-only */ -+/* -+ * Copyright (c) 2019-2020 Intel Corporation -+ * -+ * Please see Documentation/driver-api/auxiliary_bus.rst for more information. -+ */ -+ -+#ifndef _AUXILIARY_BUS_H_ -+#define _AUXILIARY_BUS_H_ -+ -+#include -+#include -+#include -+ -+struct auxiliary_device { -+ struct device dev; -+ const char *name; -+ u32 id; -+}; -+ -+struct auxiliary_driver { -+ int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id); -+ int (*remove)(struct auxiliary_device *auxdev); -+ void (*shutdown)(struct auxiliary_device *auxdev); -+ int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state); -+ int (*resume)(struct auxiliary_device *auxdev); -+ const char *name; -+ struct device_driver driver; -+ const struct auxiliary_device_id *id_table; -+}; -+ -+static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev) -+{ -+ return container_of(dev, struct auxiliary_device, dev); -+} -+ -+static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv) -+{ -+ return container_of(drv, struct auxiliary_driver, driver); -+} -+ -+int auxiliary_device_init(struct auxiliary_device *auxdev); -+int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname); -+#define auxiliary_device_add(auxdev) __auxiliary_device_add(auxdev, KBUILD_MODNAME) -+ -+static inline void auxiliary_device_uninit(struct auxiliary_device *auxdev) -+{ -+ put_device(&auxdev->dev); -+} -+ -+static inline void auxiliary_device_delete(struct auxiliary_device *auxdev) -+{ -+ device_del(&auxdev->dev); -+} -+ -+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, -+ const char *modname); -+#define auxiliary_driver_register(auxdrv) \ -+ __auxiliary_driver_register(auxdrv, THIS_MODULE, KBUILD_MODNAME) -+ -+void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv); -+ -+/** -+ * module_auxiliary_driver() - Helper macro for registering an auxiliary driver -+ * @__auxiliary_driver: auxiliary driver struct -+ * -+ * Helper macro for auxiliary drivers which do not do anything special in -+ * module init/exit. This eliminates a lot of boilerplate. Each module may only -+ * use this macro once, and calling it replaces module_init() and module_exit() -+ */ -+#define module_auxiliary_driver(__auxiliary_driver) \ -+ module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister) -+ -+struct auxiliary_device * -+auxiliary_find_device(struct device *start, const void *data, -+ int (*match)(struct device *dev, const void *data)); -+ -+#endif /* _AUXILIARY_BUS_H_ */ -diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h -index 5b08a473cdba..c425290b21e2 100644 ---- a/include/linux/mod_devicetable.h -+++ b/include/linux/mod_devicetable.h -@@ -838,4 +838,12 @@ struct mhi_device_id { - kernel_ulong_t driver_data; - }; - -+#define AUXILIARY_NAME_SIZE 32 -+#define AUXILIARY_MODULE_PREFIX "auxiliary:" -+ -+struct auxiliary_device_id { -+ char name[AUXILIARY_NAME_SIZE]; -+ kernel_ulong_t driver_data; -+}; -+ - #endif /* LINUX_MOD_DEVICETABLE_H */ -diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c -index 27007c18e754..e377f52dbfa3 100644 ---- a/scripts/mod/devicetable-offsets.c -+++ b/scripts/mod/devicetable-offsets.c -@@ -243,5 +243,8 @@ int main(void) - DEVID(mhi_device_id); - DEVID_FIELD(mhi_device_id, chan); - -+ DEVID(auxiliary_device_id); -+ DEVID_FIELD(auxiliary_device_id, name); -+ - return 0; - } -diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c -index 2417dd1dee33..fb4827027536 100644 ---- a/scripts/mod/file2alias.c -+++ b/scripts/mod/file2alias.c -@@ -1364,6 +1364,13 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias) - { - DEF_FIELD_ADDR(symval, mhi_device_id, chan); - sprintf(alias, MHI_DEVICE_MODALIAS_FMT, *chan); -+ return 1; -+} -+ -+static int do_auxiliary_entry(const char *filename, void *symval, char *alias) -+{ -+ DEF_FIELD_ADDR(symval, auxiliary_device_id, name); -+ sprintf(alias, AUXILIARY_MODULE_PREFIX "%s", *name); - - return 1; - } -@@ -1442,6 +1449,7 @@ static const struct devtable devtable[] = { - {"tee", SIZE_tee_client_device_id, do_tee_entry}, - {"wmi", SIZE_wmi_device_id, do_wmi_entry}, - {"mhi", SIZE_mhi_device_id, do_mhi_entry}, -+ {"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry}, - }; - - /* Create MODULE_ALIAS() statements. --- -2.29.2 - diff --git a/kernel-std/centos/patches/0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch b/kernel-std/centos/patches/0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch deleted file mode 100644 index d87eaa2b..00000000 --- a/kernel-std/centos/patches/0021-driver-core-auxiliary-bus-move-slab.h-from-include-f.patch +++ /dev/null @@ -1,54 +0,0 @@ -From a64e93a757edfad34955b79f1774d10e9dae955e Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman -Date: Fri, 4 Dec 2020 12:43:47 +0100 -Subject: [PATCH] driver core: auxiliary bus: move slab.h from include file - -No need to include slab.h in include/linux/auxiliary_bus.h, as it is not -needed there. Move it to drivers/base/auxiliary.c instead. - -Cc: Dan Williams -Cc: Dave Ertman -Cc: Fred Oh -Cc: Kiran Patil -Cc: Leon Romanovsky -Cc: Martin Habets -Cc: Parav Pandit -Cc: Pierre-Louis Bossart -Cc: Ranjani Sridharan -Cc: Shiraz Saleem -Link: https://lore.kernel.org/r/X8og8xi3WkoYXet9@kroah.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 7bbb79ff5f7499e0c5d65987458410e8099207d8) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 1 + - include/linux/auxiliary_bus.h | 1 - - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index ef2af417438b..eca36d6284d0 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -9,6 +9,7 @@ - - #include - #include -+#include - #include - #include - #include -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -index 282fbf7bf9af..3580743d0e8d 100644 ---- a/include/linux/auxiliary_bus.h -+++ b/include/linux/auxiliary_bus.h -@@ -10,7 +10,6 @@ - - #include - #include --#include - - struct auxiliary_device { - struct device dev; --- -2.29.2 - diff --git a/kernel-std/centos/patches/0022-driver-core-auxiliary-bus-make-remove-function-retur.patch b/kernel-std/centos/patches/0022-driver-core-auxiliary-bus-make-remove-function-retur.patch deleted file mode 100644 index 96992af5..00000000 --- a/kernel-std/centos/patches/0022-driver-core-auxiliary-bus-make-remove-function-retur.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 1eef241f79083237468a534e739ae053f2b7cfd5 Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman -Date: Fri, 4 Dec 2020 12:44:07 +0100 -Subject: [PATCH] driver core: auxiliary bus: make remove function return void - -There's an effort to move the remove() callback in the driver core to -not return an int, as nothing can be done if this function fails. To -make that effort easier, make the aux bus remove function void to start -with so that no users have to be changed sometime in the future. - -Cc: Dan Williams -Cc: Dave Ertman -Cc: Fred Oh -Cc: Kiran Patil -Cc: Leon Romanovsky -Cc: Martin Habets -Cc: Parav Pandit -Cc: Pierre-Louis Bossart -Cc: Ranjani Sridharan -Cc: Shiraz Saleem -Link: https://lore.kernel.org/r/X8ohB1ks1NK7kPop@kroah.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 8142a46c50d2dd8160c42284e1044eed3bec0d18) -Signed-off-by: M. Vefa Bicakci ---- - Documentation/driver-api/auxiliary_bus.rst | 2 +- - drivers/base/auxiliary.c | 5 ++--- - include/linux/auxiliary_bus.h | 2 +- - 3 files changed, 4 insertions(+), 5 deletions(-) - -diff --git a/Documentation/driver-api/auxiliary_bus.rst b/Documentation/driver-api/auxiliary_bus.rst -index 5dd7804631ef..2312506b0674 100644 ---- a/Documentation/driver-api/auxiliary_bus.rst -+++ b/Documentation/driver-api/auxiliary_bus.rst -@@ -150,7 +150,7 @@ and shutdown notifications using the standard conventions. - struct auxiliary_driver { - int (*probe)(struct auxiliary_device *, - const struct auxiliary_device_id *id); -- int (*remove)(struct auxiliary_device *); -+ void (*remove)(struct auxiliary_device *); - void (*shutdown)(struct auxiliary_device *); - int (*suspend)(struct auxiliary_device *, pm_message_t); - int (*resume)(struct auxiliary_device *); -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index eca36d6284d0..c44e85802b43 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -82,13 +82,12 @@ static int auxiliary_bus_remove(struct device *dev) - { - struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); - struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -- int ret = 0; - - if (auxdrv->remove) -- ret = auxdrv->remove(auxdev); -+ auxdrv->remove(auxdev); - dev_pm_domain_detach(dev, true); - -- return ret; -+ return 0; - } - - static void auxiliary_bus_shutdown(struct device *dev) -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -index 3580743d0e8d..d67b17606210 100644 ---- a/include/linux/auxiliary_bus.h -+++ b/include/linux/auxiliary_bus.h -@@ -19,7 +19,7 @@ struct auxiliary_device { - - struct auxiliary_driver { - int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id); -- int (*remove)(struct auxiliary_device *auxdev); -+ void (*remove)(struct auxiliary_device *auxdev); - void (*shutdown)(struct auxiliary_device *auxdev); - int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state); - int (*resume)(struct auxiliary_device *auxdev); --- -2.29.2 - diff --git a/kernel-std/centos/patches/0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch b/kernel-std/centos/patches/0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch deleted file mode 100644 index 7145e36b..00000000 --- a/kernel-std/centos/patches/0023-driver-core-auxiliary-bus-minor-coding-style-tweaks.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 67b5e80aad2083d07dcbe0e36eb15e65217f373b Mon Sep 17 00:00:00 2001 -From: Greg Kroah-Hartman -Date: Fri, 4 Dec 2020 12:49:28 +0100 -Subject: [PATCH] driver core: auxiliary bus: minor coding style tweaks - -For some reason, the original aux bus patch had some really long lines -in a few places, probably due to it being a very long-lived patch in -development by many different people. Fix that up so that the two files -all have the same length lines and function formatting styles. - -Cc: Dan Williams -Cc: Dave Ertman -Cc: Fred Oh -Cc: Kiran Patil -Cc: Leon Romanovsky -Cc: Martin Habets -Cc: Parav Pandit -Cc: Pierre-Louis Bossart -Cc: Ranjani Sridharan -Cc: Shiraz Saleem -Link: https://lore.kernel.org/r/X8oiSFTpYHw1xE/o@kroah.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 0d2bf11a6b3e275a526b8d42d8d4a3a6067cf953) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 58 +++++++++++++++++++---------------- - include/linux/auxiliary_bus.h | 6 ++-- - 2 files changed, 35 insertions(+), 29 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index c44e85802b43..f303daadf843 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -50,8 +50,8 @@ static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) - name = dev_name(dev); - p = strrchr(name, '.'); - -- return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, (int)(p - name), -- name); -+ return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX, -+ (int)(p - name), name); - } - - static const struct dev_pm_ops auxiliary_dev_pm_ops = { -@@ -113,16 +113,18 @@ static struct bus_type auxiliary_bus_type = { - * auxiliary_device_init - check auxiliary_device and initialize - * @auxdev: auxiliary device struct - * -- * This is the first step in the two-step process to register an auxiliary_device. -+ * This is the first step in the two-step process to register an -+ * auxiliary_device. - * -- * When this function returns an error code, then the device_initialize will *not* have -- * been performed, and the caller will be responsible to free any memory allocated for the -- * auxiliary_device in the error path directly. -+ * When this function returns an error code, then the device_initialize will -+ * *not* have been performed, and the caller will be responsible to free any -+ * memory allocated for the auxiliary_device in the error path directly. - * -- * It returns 0 on success. On success, the device_initialize has been performed. After this -- * point any error unwinding will need to include a call to auxiliary_device_uninit(). -- * In this post-initialize error scenario, a call to the device's .release callback will be -- * triggered, and all memory clean-up is expected to be handled there. -+ * It returns 0 on success. On success, the device_initialize has been -+ * performed. After this point any error unwinding will need to include a call -+ * to auxiliary_device_uninit(). In this post-initialize error scenario, a call -+ * to the device's .release callback will be triggered, and all memory clean-up -+ * is expected to be handled there. - */ - int auxiliary_device_init(struct auxiliary_device *auxdev) - { -@@ -149,16 +151,19 @@ EXPORT_SYMBOL_GPL(auxiliary_device_init); - * @auxdev: auxiliary bus device to add to the bus - * @modname: name of the parent device's driver module - * -- * This is the second step in the two-step process to register an auxiliary_device. -+ * This is the second step in the two-step process to register an -+ * auxiliary_device. - * -- * This function must be called after a successful call to auxiliary_device_init(), which -- * will perform the device_initialize. This means that if this returns an error code, then a -- * call to auxiliary_device_uninit() must be performed so that the .release callback will -- * be triggered to free the memory associated with the auxiliary_device. -+ * This function must be called after a successful call to -+ * auxiliary_device_init(), which will perform the device_initialize. This -+ * means that if this returns an error code, then a call to -+ * auxiliary_device_uninit() must be performed so that the .release callback -+ * will be triggered to free the memory associated with the auxiliary_device. - * -- * The expectation is that users will call the "auxiliary_device_add" macro so that the caller's -- * KBUILD_MODNAME is automatically inserted for the modname parameter. Only if a user requires -- * a custom name would this version be called directly. -+ * The expectation is that users will call the "auxiliary_device_add" macro so -+ * that the caller's KBUILD_MODNAME is automatically inserted for the modname -+ * parameter. Only if a user requires a custom name would this version be -+ * called directly. - */ - int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname) - { -@@ -166,13 +171,13 @@ int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname) - int ret; - - if (!modname) { -- pr_err("auxiliary device modname is NULL\n"); -+ dev_err(dev, "auxiliary device modname is NULL\n"); - return -EINVAL; - } - - ret = dev_set_name(dev, "%s.%s.%d", modname, auxdev->name, auxdev->id); - if (ret) { -- pr_err("auxiliary device dev_set_name failed: %d\n", ret); -+ dev_err(dev, "auxiliary device dev_set_name failed: %d\n", ret); - return ret; - } - -@@ -197,9 +202,9 @@ EXPORT_SYMBOL_GPL(__auxiliary_device_add); - * if it does. If the callback returns non-zero, this function will - * return to the caller and not iterate over any more devices. - */ --struct auxiliary_device * --auxiliary_find_device(struct device *start, const void *data, -- int (*match)(struct device *dev, const void *data)) -+struct auxiliary_device *auxiliary_find_device(struct device *start, -+ const void *data, -+ int (*match)(struct device *dev, const void *data)) - { - struct device *dev; - -@@ -217,14 +222,15 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device); - * @owner: owning module/driver - * @modname: KBUILD_MODNAME for parent driver - */ --int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, -- const char *modname) -+int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, -+ struct module *owner, const char *modname) - { - if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) - return -EINVAL; - - if (auxdrv->name) -- auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, auxdrv->name); -+ auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s.%s", modname, -+ auxdrv->name); - else - auxdrv->driver.name = kasprintf(GFP_KERNEL, "%s", modname); - if (!auxdrv->driver.name) -diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h -index d67b17606210..fc51d45f106b 100644 ---- a/include/linux/auxiliary_bus.h -+++ b/include/linux/auxiliary_bus.h -@@ -70,8 +70,8 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv); - #define module_auxiliary_driver(__auxiliary_driver) \ - module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister) - --struct auxiliary_device * --auxiliary_find_device(struct device *start, const void *data, -- int (*match)(struct device *dev, const void *data)); -+struct auxiliary_device *auxiliary_find_device(struct device *start, -+ const void *data, -+ int (*match)(struct device *dev, const void *data)); - - #endif /* _AUXILIARY_BUS_H_ */ --- -2.29.2 - diff --git a/kernel-std/centos/patches/0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch b/kernel-std/centos/patches/0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch deleted file mode 100644 index 7960421f..00000000 --- a/kernel-std/centos/patches/0024-driver-core-auxiliary-bus-Fix-auxiliary-bus-shutdown.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 7f4d45ef5bfe6dd025b1f7c736d198b9a208cdef Mon Sep 17 00:00:00 2001 -From: Dave Jiang -Date: Fri, 4 Dec 2020 09:46:49 -0700 -Subject: [PATCH] driver core: auxiliary bus: Fix auxiliary bus shutdown null - auxdrv ptr - -If the probe of the auxdrv failed, the device->driver is set to NULL. -During kernel shutdown, the bus shutdown will call auxdrv->shutdown and -cause an invalid ptr dereference. Add check to make sure device->driver is -not NULL before we proceed. - -Fixes: 7de3697e9cbd ("Add auxiliary bus support") -Cc: Dave Ertman -Signed-off-by: Dave Jiang -Reviewed-by: Dan Williams -Link: https://lore.kernel.org/r/160710040926.1889434.8840329810698403478.stgit@djiang5-desk3.ch.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 784b2c48ac12dcee27db001fb1a3c58c39380cb6) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index f303daadf843..8336535f1e11 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -92,10 +92,15 @@ static int auxiliary_bus_remove(struct device *dev) - - static void auxiliary_bus_shutdown(struct device *dev) - { -- struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); -- struct auxiliary_device *auxdev = to_auxiliary_dev(dev); -+ struct auxiliary_driver *auxdrv = NULL; -+ struct auxiliary_device *auxdev; -+ -+ if (dev->driver) { -+ auxdrv = to_auxiliary_drv(dev->driver); -+ auxdev = to_auxiliary_dev(dev); -+ } - -- if (auxdrv->shutdown) -+ if (auxdrv && auxdrv->shutdown) - auxdrv->shutdown(auxdev); - } - --- -2.29.2 - diff --git a/kernel-std/centos/patches/0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch b/kernel-std/centos/patches/0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch deleted file mode 100644 index 7d7af988..00000000 --- a/kernel-std/centos/patches/0025-driver-core-auxiliary-bus-Fix-calling-stage-for-auxi.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 87f05137d98572c5926bbc6949ecc6616bd90057 Mon Sep 17 00:00:00 2001 -From: Dave Jiang -Date: Wed, 10 Feb 2021 13:16:11 -0700 -Subject: [PATCH] driver core: auxiliary bus: Fix calling stage for auxiliary - bus init - -When the auxiliary device code is built into the kernel, it can be executed -before the auxiliary bus is registered. This causes bus->p to be not -allocated and triggers a NULL pointer dereference when the auxiliary bus -device gets added with bus_add_device(). Call the auxiliary_bus_init() -under driver_init() so the bus is initialized before devices. - -Below is the kernel splat for the bug: -[ 1.948215] BUG: kernel NULL pointer dereference, address: 0000000000000060 -[ 1.950670] #PF: supervisor read access in kernel mode -[ 1.950670] #PF: error_code(0x0000) - not-present page -[ 1.950670] PGD 0 -[ 1.950670] Oops: 0000 1 SMP NOPTI -[ 1.950670] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-intel-nextsvmtest+ #2205 -[ 1.950670] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 -[ 1.950670] RIP: 0010:bus_add_device+0x64/0x140 -[ 1.950670] Code: 00 49 8b 75 20 48 89 df e8 59 a1 ff ff 41 89 c4 85 c0 75 7b 48 8b 53 50 48 85 d2 75 03 48 8b 13 49 8b 85 a0 00 00 00 48 89 de <48> 8 -78 60 48 83 c7 18 e8 ef d9 a9 ff 41 89 c4 85 c0 75 45 48 8b -[ 1.950670] RSP: 0000:ff46032ac001baf8 EFLAGS: 00010246 -[ 1.950670] RAX: 0000000000000000 RBX: ff4597f7414aa680 RCX: 0000000000000000 -[ 1.950670] RDX: ff4597f74142bbc0 RSI: ff4597f7414aa680 RDI: ff4597f7414aa680 -[ 1.950670] RBP: ff46032ac001bb10 R08: 0000000000000044 R09: 0000000000000228 -[ 1.950670] R10: ff4597f741141b30 R11: ff4597f740182a90 R12: 0000000000000000 -[ 1.950670] R13: ffffffffa5e936c0 R14: 0000000000000000 R15: 0000000000000000 -[ 1.950670] FS: 0000000000000000(0000) GS:ff4597f7bba00000(0000) knlGS:0000000000000000 -[ 1.950670] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 -[ 1.950670] CR2: 0000000000000060 CR3: 000000002140c001 CR4: 0000000000f71ef0 -[ 1.950670] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 -[ 1.950670] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 -[ 1.950670] PKRU: 55555554 -[ 1.950670] Call Trace: -[ 1.950670] device_add+0x3ee/0x850 -[ 1.950670] __auxiliary_device_add+0x47/0x60 -[ 1.950670] idxd_pci_probe+0xf77/0x1180 -[ 1.950670] local_pci_probe+0x4a/0x90 -[ 1.950670] pci_device_probe+0xff/0x1b0 -[ 1.950670] really_probe+0x1cf/0x440 -[ 1.950670] ? rdinit_setup+0x31/0x31 -[ 1.950670] driver_probe_device+0xe8/0x150 -[ 1.950670] device_driver_attach+0x58/0x60 -[ 1.950670] __driver_attach+0x8f/0x150 -[ 1.950670] ? device_driver_attach+0x60/0x60 -[ 1.950670] ? device_driver_attach+0x60/0x60 -[ 1.950670] bus_for_each_dev+0x79/0xc0 -[ 1.950670] ? kmem_cache_alloc_trace+0x323/0x430 -[ 1.950670] driver_attach+0x1e/0x20 -[ 1.950670] bus_add_driver+0x154/0x1f0 -[ 1.950670] driver_register+0x70/0xc0 -[ 1.950670] __pci_register_driver+0x54/0x60 -[ 1.950670] idxd_init_module+0xe2/0xfc -[ 1.950670] ? idma64_platform_driver_init+0x19/0x19 -[ 1.950670] do_one_initcall+0x4a/0x1e0 -[ 1.950670] kernel_init_freeable+0x1fc/0x25c -[ 1.950670] ? rest_init+0xba/0xba -[ 1.950670] kernel_init+0xe/0x116 -[ 1.950670] ret_from_fork+0x1f/0x30 -[ 1.950670] Modules linked in: -[ 1.950670] CR2: 0000000000000060 -[ 1.950670] --[ end trace cd7d1b226d3ca901 ]-- - -Fixes: 7de3697e9cbd ("Add auxiliary bus support") -Reported-by: Jacob Pan -Reviewed-by: Dan Williams -Acked-by: Dave Ertman -Signed-off-by: Dave Jiang -Link: https://lore.kernel.org/r/20210210201611.1611074-1-dave.jiang@intel.com -Cc: stable -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 471b12c43f376d5203dbff0e91316eea11f6f4df) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 13 +++---------- - drivers/base/base.h | 5 +++++ - drivers/base/init.c | 1 + - 3 files changed, 9 insertions(+), 10 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index 8336535f1e11..d8b314e7d0fd 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include "base.h" - - static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id, - const struct auxiliary_device *auxdev) -@@ -260,19 +261,11 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv) - } - EXPORT_SYMBOL_GPL(auxiliary_driver_unregister); - --static int __init auxiliary_bus_init(void) -+void __init auxiliary_bus_init(void) - { -- return bus_register(&auxiliary_bus_type); -+ WARN_ON(bus_register(&auxiliary_bus_type)); - } - --static void __exit auxiliary_bus_exit(void) --{ -- bus_unregister(&auxiliary_bus_type); --} -- --module_init(auxiliary_bus_init); --module_exit(auxiliary_bus_exit); -- - MODULE_LICENSE("GPL v2"); - MODULE_DESCRIPTION("Auxiliary Bus"); - MODULE_AUTHOR("David Ertman "); -diff --git a/drivers/base/base.h b/drivers/base/base.h -index 91cfb8405abd..7d97447460fa 100644 ---- a/drivers/base/base.h -+++ b/drivers/base/base.h -@@ -119,6 +119,11 @@ static inline int hypervisor_init(void) { return 0; } - extern int platform_bus_init(void); - extern void cpu_dev_init(void); - extern void container_dev_init(void); -+#ifdef CONFIG_AUXILIARY_BUS -+extern void auxiliary_bus_init(void); -+#else -+static inline void auxiliary_bus_init(void) { } -+#endif - - struct kobject *virtual_device_parent(struct device *dev); - -diff --git a/drivers/base/init.c b/drivers/base/init.c -index 908e6520e804..a9f57c22fb9e 100644 ---- a/drivers/base/init.c -+++ b/drivers/base/init.c -@@ -32,6 +32,7 @@ void __init driver_init(void) - */ - of_core_init(); - platform_bus_init(); -+ auxiliary_bus_init(); - cpu_dev_init(); - memory_dev_init(); - container_dev_init(); --- -2.29.2 - diff --git a/kernel-std/centos/patches/0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch b/kernel-std/centos/patches/0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch deleted file mode 100644 index f72de9cf..00000000 --- a/kernel-std/centos/patches/0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch +++ /dev/null @@ -1,35 +0,0 @@ -From bcfe18a2fd6d45f14ae60c742a7661a64e46305e Mon Sep 17 00:00:00 2001 -From: Dave Jiang -Date: Thu, 11 Feb 2021 13:21:29 -0700 -Subject: [PATCH] driver core: auxiliary bus: Remove unneeded module bits - -Remove module bits in the auxiliary bus code since the auxiliary bus -cannot be built as a module and the relevant code is not needed. - -Cc: Dave Ertman -Suggested-by: Greg Kroah-Hartman -Signed-off-by: Dave Jiang -Link: https://lore.kernel.org/r/161307488980.1896017.15627190714413338196.stgit@djiang5-desk3.ch.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit bbf44abeeabfe05a124535e6c3a9fd7d682d42bf) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index d8b314e7d0fd..adc199dfba3c 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -265,8 +265,3 @@ void __init auxiliary_bus_init(void) - { - WARN_ON(bus_register(&auxiliary_bus_type)); - } -- --MODULE_LICENSE("GPL v2"); --MODULE_DESCRIPTION("Auxiliary Bus"); --MODULE_AUTHOR("David Ertman "); --MODULE_AUTHOR("Kiran Patil "); --- -2.29.2 - diff --git a/kernel-std/centos/patches/0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch b/kernel-std/centos/patches/0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch deleted file mode 100644 index 9b893e99..00000000 --- a/kernel-std/centos/patches/0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 09b57232d358202d79e2133d523a664906e9759c Mon Sep 17 00:00:00 2001 -From: Peter Ujfalusi -Date: Tue, 13 Jul 2021 12:34:38 +0300 -Subject: [PATCH] driver core: auxiliary bus: Fix memory leak when - driver_register() fail - -If driver_register() returns with error we need to free the memory -allocated for auxdrv->driver.name before returning from -__auxiliary_driver_register() - -Fixes: 7de3697e9cbd4 ("Add auxiliary bus support") -Reviewed-by: Dan Williams -Cc: stable -Signed-off-by: Peter Ujfalusi -Link: https://lore.kernel.org/r/20210713093438.3173-1-peter.ujfalusi@linux.intel.com -Signed-off-by: Greg Kroah-Hartman -(cherry picked from commit 4afa0c22eed33cfe0c590742387f0d16f32412f3) -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/auxiliary.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c -index adc199dfba3c..6a30264ab2ba 100644 ---- a/drivers/base/auxiliary.c -+++ b/drivers/base/auxiliary.c -@@ -231,6 +231,8 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device); - int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, - struct module *owner, const char *modname) - { -+ int ret; -+ - if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) - return -EINVAL; - -@@ -246,7 +248,11 @@ int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, - auxdrv->driver.bus = &auxiliary_bus_type; - auxdrv->driver.mod_name = modname; - -- return driver_register(&auxdrv->driver); -+ ret = driver_register(&auxdrv->driver); -+ if (ret) -+ kfree(auxdrv->driver.name); -+ -+ return ret; - } - EXPORT_SYMBOL_GPL(__auxiliary_driver_register); - --- -2.29.2 - diff --git a/kernel-std/centos/patches/0028-driver-core-auxiliary-bus-Enable-by-default.patch b/kernel-std/centos/patches/0028-driver-core-auxiliary-bus-Enable-by-default.patch deleted file mode 100644 index 779f2e42..00000000 --- a/kernel-std/centos/patches/0028-driver-core-auxiliary-bus-Enable-by-default.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b1d1297d44033ae1d756838d6e06f04d52d1ceb6 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 17 Feb 2022 14:17:58 -0500 -Subject: [PATCH] driver core: auxiliary bus: Enable by default - -This commit enables CONFIG_AUXILIARY_BUS by default. This is necessary, -because StarlingX does not enable any kernel modules that 'select' -CONFIG_AUXILIARY_BUS, which causes the kernel's build system to -automatically disable this option. - -However, StarlingX has out-of-tree users of this functionality (such as -the 'ice' and 'mlnx-ofa_kernel' out-of-tree kernel driver packages), -hence the need for this change. Prior to this commit, the aforementioned -out-of-tree kernel drivers would use their embedded/bundled copy of the -same functionality, which would cause kernel symbol conflicts at -run-time when users attempted to load both ice and mlnx-ofa_kernel -drivers. - -Signed-off-by: M. Vefa Bicakci ---- - drivers/base/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig -index 040be48ce046..a18ec49b9dac 100644 ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -3,6 +3,7 @@ menu "Generic Driver Options" - - config AUXILIARY_BUS - bool -+ default y - - config UEVENT_HELPER - bool "Support for uevent helper" --- -2.29.2 - diff --git a/kernel-std/centos/patches/0029-Enable-CONFIG_PAGE_POOL-by-default.patch b/kernel-std/centos/patches/0029-Enable-CONFIG_PAGE_POOL-by-default.patch deleted file mode 100644 index fd854f70..00000000 --- a/kernel-std/centos/patches/0029-Enable-CONFIG_PAGE_POOL-by-default.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 3ba9b411491dfdca077f7810cf474e82026f63c8 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 3 Feb 2022 21:34:14 -0500 -Subject: [PATCH] Enable CONFIG_PAGE_POOL by default - -CONFIG_PAGE_POOL is a "hidden" configuration option, which causes it to -be enabled only when another kernel configuration option explicitly -selects it. Specifying CONFIG_PAGE_POOL=y in .config does not have any -effect. - -Given that StarlingX disables all in-tree device drivers that explicitly -select CONFIG_PAGE_POOL, and given that at least one out-of-tree kernel -module (mlnx-ofa_kernel) requires the features made available by -CONFIG_PAGE_POOL, this commit enables the configuration option in -question by default. - -Signed-off-by: M. Vefa Bicakci ---- - net/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/net/Kconfig b/net/Kconfig -index d6567162c1cf..add29b03a664 100644 ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -437,6 +437,7 @@ config NET_DEVLINK - - config PAGE_POOL - bool -+ default y - - config FAILOVER - tristate "Generic failover module" --- -2.29.2 - diff --git a/kernel-std/centos/patches/0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch b/kernel-std/centos/patches/0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch deleted file mode 100644 index fc85924c..00000000 --- a/kernel-std/centos/patches/0030-x86-Enumerate-AVX512-FP16-CPUID-feature-flag.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 42f9b0c612aafd7094f6f4a5a80756159d2d5b21 Mon Sep 17 00:00:00 2001 -From: Kyung Min Park -Date: Mon, 7 Dec 2020 19:34:40 -0800 -Subject: [PATCH] x86: Enumerate AVX512 FP16 CPUID feature flag - -Enumerate AVX512 Half-precision floating point (FP16) CPUID feature -flag. Compared with using FP32, using FP16 cut the number of bits -required for storage in half, reducing the exponent from 8 bits to 5, -and the mantissa from 23 bits to 10. Using FP16 also enables developers -to train and run inference on deep learning models fast when all -precision or magnitude (FP32) is not needed. - -A processor supports AVX512 FP16 if CPUID.(EAX=7,ECX=0):EDX[bit 23] -is present. The AVX512 FP16 requires AVX512BW feature be implemented -since the instructions for manipulating 32bit masks are associated with -AVX512BW. - -The only in-kernel usage of this is kvm passthrough. The CPU feature -flag is shown as "avx512_fp16" in /proc/cpuinfo. - -Signed-off-by: Kyung Min Park -Acked-by: Dave Hansen -Reviewed-by: Tony Luck -Message-Id: <20201208033441.28207-2-kyung.min.park@intel.com> -Acked-by: Borislav Petkov -Signed-off-by: Paolo Bonzini -(cherry picked from commit e1b35da5e624f8b09d2e98845c2e4c84b179d9a4) -Signed-off-by: M. Vefa Bicakci ---- - arch/x86/include/asm/cpufeatures.h | 1 + - arch/x86/kernel/cpu/cpuid-deps.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h -index 3b407f46f1a0..b5252fd26682 100644 ---- a/arch/x86/include/asm/cpufeatures.h -+++ b/arch/x86/include/asm/cpufeatures.h -@@ -374,6 +374,7 @@ - #define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */ - #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ - #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */ -+#define X86_FEATURE_AVX512_FP16 (18*32+23) /* AVX512 FP16 */ - #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ - #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ - #define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */ -diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c -index d502241995a3..42af31b64c2c 100644 ---- a/arch/x86/kernel/cpu/cpuid-deps.c -+++ b/arch/x86/kernel/cpu/cpuid-deps.c -@@ -69,6 +69,7 @@ static const struct cpuid_dep cpuid_deps[] = { - { X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC }, - { X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC }, - { X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL }, -+ { X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW }, - { X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES }, - { X86_FEATURE_PER_THREAD_MBA, X86_FEATURE_MBA }, - {} --- -2.29.2 - diff --git a/kernel-std/centos/patches/0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch b/kernel-std/centos/patches/0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch deleted file mode 100644 index 23d7094a..00000000 --- a/kernel-std/centos/patches/0031-KVM-x86-Expose-AVX512_FP16-for-supported-CPUID.patch +++ /dev/null @@ -1,41 +0,0 @@ -From d0edc9f018b2de1b4d35ef83920c0fd416e8abf8 Mon Sep 17 00:00:00 2001 -From: Cathy Zhang -Date: Mon, 7 Dec 2020 19:34:41 -0800 -Subject: [PATCH] KVM: x86: Expose AVX512_FP16 for supported CPUID - -AVX512_FP16 is supported by Intel processors, like Sapphire Rapids. -It could gain better performance for it's faster compared to FP32 -if the precision or magnitude requirements are met. It's availability -is indicated by CPUID.(EAX=7,ECX=0):EDX[bit 23]. - -Expose it in KVM supported CPUID, then guest could make use of it; no -new registers are used, only new instructions. - -Signed-off-by: Cathy Zhang -Signed-off-by: Kyung Min Park -Acked-by: Dave Hansen -Reviewed-by: Tony Luck -Message-Id: <20201208033441.28207-3-kyung.min.park@intel.com> -Signed-off-by: Paolo Bonzini -(cherry picked from commit 2224fc9efb2d6593fbfb57287e39ba4958b188ba) -Signed-off-by: M. Vefa Bicakci ---- - arch/x86/kvm/cpuid.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c -index 41b0dc37720e..61f10169fc16 100644 ---- a/arch/x86/kvm/cpuid.c -+++ b/arch/x86/kvm/cpuid.c -@@ -418,7 +418,7 @@ void kvm_set_cpu_caps(void) - F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) | - F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES) | F(INTEL_STIBP) | - F(MD_CLEAR) | F(AVX512_VP2INTERSECT) | F(FSRM) | -- F(SERIALIZE) | F(TSXLDTRK) -+ F(SERIALIZE) | F(TSXLDTRK) | F(AVX512_FP16) - ); - - /* TSC_ADJUST and ARCH_CAPABILITIES are emulated in software. */ --- -2.29.2 - diff --git a/kernel-std/centos/patches/0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch b/kernel-std/centos/patches/0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch deleted file mode 100644 index 2fa0800d..00000000 --- a/kernel-std/centos/patches/0032-tools-headers-cpufeatures-Sync-with-the-kernel-sourc.patch +++ /dev/null @@ -1,51 +0,0 @@ -From f9b6b17e103470f5374bb65fc930472bf62770ee Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Mon, 21 Dec 2020 09:04:54 -0300 -Subject: [PATCH] tools headers cpufeatures: Sync with the kernel sources - -To pick the changes in: - - 69372cf01290b958 ("x86/cpu: Add VM page flush MSR availablility as a CPUID feature") - e1b35da5e624f8b0 ("x86: Enumerate AVX512 FP16 CPUID feature flag") - -That causes only these 'perf bench' objects to rebuild: - - CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o - CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o - -And addresses these perf build warnings: - - Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' - diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h - -Cc: Adrian Hunter -Cc: Ian Rogers -Cc: Jiri Olsa -Cc: Kyung Min Park -Cc: Namhyung Kim -Cc: Paolo Bonzini -Cc: Tom Lendacky -Signed-off-by: Arnaldo Carvalho de Melo -(cherry picked from commit 7f3905f00a2025591a6883ee6880f928029b4d96) -[mvb: Remove X86_FEATURE_VM_PAGE_FLUSH from this commit as that CPU - feature constant is not provided by StarlingX's v5.10 baseline.] -Signed-off-by: M. Vefa Bicakci ---- - tools/arch/x86/include/asm/cpufeatures.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h -index b58730cc12e8..d7accc927691 100644 ---- a/tools/arch/x86/include/asm/cpufeatures.h -+++ b/tools/arch/x86/include/asm/cpufeatures.h -@@ -374,6 +374,7 @@ - #define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */ - #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ - #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */ -+#define X86_FEATURE_AVX512_FP16 (18*32+23) /* AVX512 FP16 */ - #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ - #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ - #define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */ --- -2.29.2 - diff --git a/kernel-std/centos/patches/0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch b/kernel-std/centos/patches/0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch deleted file mode 100644 index 973f8c16..00000000 --- a/kernel-std/centos/patches/0033-rcu-Avoid-running-boost-kthreads-on-isolated-CPUs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 547921028c785f90e52adb7f54cc2f13103934de Mon Sep 17 00:00:00 2001 -Message-Id: <547921028c785f90e52adb7f54cc2f13103934de.1665174246.git.jim.somerville@windriver.com> -From: Zqiang -Date: Mon, 15 Nov 2021 13:15:46 +0800 -Subject: [PATCH] rcu: Avoid running boost kthreads on isolated CPUs - -When the boost kthreads are created on systems with nohz_full CPUs, -the cpus_allowed_ptr is set to housekeeping_cpumask(HK_FLAG_KTHREAD). -However, when the rcu_boost_kthread_setaffinity() is called, the original -affinity will be changed and these kthreads can subsequently run on -nohz_full CPUs. This commit makes rcu_boost_kthread_setaffinity() -restrict these boost kthreads to housekeeping CPUs. - -Signed-off-by: Zqiang -Signed-off-by: Paul E. McKenney -[ commit c2cf0767e98eb4487444e5c7ebba491a866811ce upstream ] -Signed-off-by: Jim Somerville ---- - kernel/rcu/tree_plugin.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h -index 9db906dcbdac..0a18fa5d27b3 100644 ---- a/kernel/rcu/tree_plugin.h -+++ b/kernel/rcu/tree_plugin.h -@@ -1185,8 +1185,9 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) - if ((mask & leaf_node_cpu_bit(rnp, cpu)) && - cpu != outgoingcpu) - cpumask_set_cpu(cpu, cm); -+ cpumask_and(cm, cm, housekeeping_cpumask(HK_FLAG_RCU)); - if (cpumask_weight(cm) == 0) -- cpumask_setall(cm); -+ cpumask_copy(cm, housekeeping_cpumask(HK_FLAG_RCU)); - set_cpus_allowed_ptr(t, cm); - free_cpumask_var(cm); - } --- -2.25.1 - diff --git a/kernel-std/centos/patches/0034-xfs-use-current-journal_info-for-detecting-transacti.patch b/kernel-std/centos/patches/0034-xfs-use-current-journal_info-for-detecting-transacti.patch deleted file mode 100644 index eea1a5e7..00000000 --- a/kernel-std/centos/patches/0034-xfs-use-current-journal_info-for-detecting-transacti.patch +++ /dev/null @@ -1,269 +0,0 @@ -From aebe2063884ef5e8a969d73d75e1086ea67d8033 Mon Sep 17 00:00:00 2001 -From: Dave Chinner -Date: Sun, 3 Jul 2022 08:04:50 +0300 -Subject: [PATCH 1/5] xfs: use current->journal_info for detecting transaction - recursion - -commit 756b1c343333a5aefcc26b0409f3fd16f72281bf upstream. - -Because the iomap code using PF_MEMALLOC_NOFS to detect transaction -recursion in XFS is just wrong. Remove it from the iomap code and -replace it with XFS specific internal checks using -current->journal_info instead. - -[djwong: This change also realigns the lifetime of NOFS flag changes to -match the incore transaction, instead of the inconsistent scheme we have -now.] - -Fixes: 9070733b4efa ("xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS") -Signed-off-by: Dave Chinner -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -Reviewed-by: Christoph Hellwig -Signed-off-by: Amir Goldstein -Acked-by: Darrick J. Wong -Signed-off-by: Greg Kroah-Hartman -[commit b261cd005ab980c4018634a849f77e036bfd4f80 from - git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git - linux-5.10.y branch] -Signed-off-by: Zhixiong Chi ---- - fs/iomap/buffered-io.c | 7 ------- - fs/xfs/libxfs/xfs_btree.c | 12 ++++++++++-- - fs/xfs/xfs_aops.c | 17 +++++++++++++++-- - fs/xfs/xfs_trans.c | 20 +++++--------------- - fs/xfs/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ - 5 files changed, 60 insertions(+), 26 deletions(-) - -diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c -index cd9f7baa5..47279fe00 100644 ---- a/fs/iomap/buffered-io.c -+++ b/fs/iomap/buffered-io.c -@@ -1459,13 +1459,6 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data) - PF_MEMALLOC)) - goto redirty; - -- /* -- * Given that we do not allow direct reclaim to call us, we should -- * never be called in a recursive filesystem reclaim context. -- */ -- if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) -- goto redirty; -- - /* - * Is this page beyond the end of the file? - * -diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c -index 2d25bab68..fe87ecd76 100644 ---- a/fs/xfs/libxfs/xfs_btree.c -+++ b/fs/xfs/libxfs/xfs_btree.c -@@ -2814,7 +2814,7 @@ xfs_btree_split_worker( - struct xfs_btree_split_args *args = container_of(work, - struct xfs_btree_split_args, work); - unsigned long pflags; -- unsigned long new_pflags = PF_MEMALLOC_NOFS; -+ unsigned long new_pflags = 0; - - /* - * we are in a transaction context here, but may also be doing work -@@ -2826,12 +2826,20 @@ xfs_btree_split_worker( - new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; - - current_set_flags_nested(&pflags, new_pflags); -+ xfs_trans_set_context(args->cur->bc_tp); - - args->result = __xfs_btree_split(args->cur, args->level, args->ptrp, - args->key, args->curp, args->stat); -- complete(args->done); - -+ xfs_trans_clear_context(args->cur->bc_tp); - current_restore_flags_nested(&pflags, new_pflags); -+ -+ /* -+ * Do not access args after complete() has run here. We don't own args -+ * and the owner may run and free args before we return here. -+ */ -+ complete(args->done); -+ - } - - /* -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 4304c6416..b4186d666 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -62,7 +62,7 @@ xfs_setfilesize_trans_alloc( - * We hand off the transaction to the completion thread now, so - * clear the flag here. - */ -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -+ xfs_trans_clear_context(tp); - return 0; - } - -@@ -125,7 +125,7 @@ xfs_setfilesize_ioend( - * thus we need to mark ourselves as being in a transaction manually. - * Similarly for freeze protection. - */ -- current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -+ xfs_trans_set_context(tp); - __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS); - - /* we abort the update if there was an IO error */ -@@ -568,6 +568,12 @@ xfs_vm_writepage( - { - struct xfs_writepage_ctx wpc = { }; - -+ if (WARN_ON_ONCE(current->journal_info)) { -+ redirty_page_for_writepage(wbc, page); -+ unlock_page(page); -+ return 0; -+ } -+ - return iomap_writepage(page, wbc, &wpc.ctx, &xfs_writeback_ops); - } - -@@ -578,6 +584,13 @@ xfs_vm_writepages( - { - struct xfs_writepage_ctx wpc = { }; - -+ /* -+ * Writing back data in a transaction context can result in recursive -+ * transactions. This is bad, so issue a warning and get out of here. -+ */ -+ if (WARN_ON_ONCE(current->journal_info)) -+ return 0; -+ - xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); - return iomap_writepages(mapping, wbc, &wpc.ctx, &xfs_writeback_ops); - } -diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c -index c94e71f74..2d7deacea 100644 ---- a/fs/xfs/xfs_trans.c -+++ b/fs/xfs/xfs_trans.c -@@ -68,6 +68,7 @@ xfs_trans_free( - xfs_extent_busy_clear(tp->t_mountp, &tp->t_busy, false); - - trace_xfs_trans_free(tp, _RET_IP_); -+ xfs_trans_clear_context(tp); - if (!(tp->t_flags & XFS_TRANS_NO_WRITECOUNT)) - sb_end_intwrite(tp->t_mountp->m_super); - xfs_trans_free_dqinfo(tp); -@@ -119,7 +120,8 @@ xfs_trans_dup( - - ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; - tp->t_rtx_res = tp->t_rtx_res_used; -- ntp->t_pflags = tp->t_pflags; -+ -+ xfs_trans_switch_context(tp, ntp); - - /* move deferred ops over to the new tp */ - xfs_defer_move(ntp, tp); -@@ -153,9 +155,6 @@ xfs_trans_reserve( - int error = 0; - bool rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; - -- /* Mark this thread as being in a transaction */ -- current_set_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -- - /* - * Attempt to reserve the needed disk blocks by decrementing - * the number needed from the number available. This will -@@ -163,10 +162,8 @@ xfs_trans_reserve( - */ - if (blocks > 0) { - error = xfs_mod_fdblocks(mp, -((int64_t)blocks), rsvd); -- if (error != 0) { -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -+ if (error != 0) - return -ENOSPC; -- } - tp->t_blk_res += blocks; - } - -@@ -240,9 +237,6 @@ xfs_trans_reserve( - xfs_mod_fdblocks(mp, (int64_t)blocks, rsvd); - tp->t_blk_res = 0; - } -- -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -- - return error; - } - -@@ -266,6 +260,7 @@ xfs_trans_alloc( - tp = kmem_cache_zalloc(xfs_trans_zone, GFP_KERNEL | __GFP_NOFAIL); - if (!(flags & XFS_TRANS_NO_WRITECOUNT)) - sb_start_intwrite(mp->m_super); -+ xfs_trans_set_context(tp); - - /* - * Zero-reservation ("empty") transactions can't modify anything, so -@@ -878,7 +873,6 @@ __xfs_trans_commit( - - xfs_log_commit_cil(mp, tp, &commit_lsn, regrant); - -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - xfs_trans_free(tp); - - /* -@@ -910,7 +904,6 @@ __xfs_trans_commit( - xfs_log_ticket_ungrant(mp->m_log, tp->t_ticket); - tp->t_ticket = NULL; - } -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); - xfs_trans_free_items(tp, !!error); - xfs_trans_free(tp); - -@@ -970,9 +963,6 @@ xfs_trans_cancel( - tp->t_ticket = NULL; - } - -- /* mark this thread as no longer being in a transaction */ -- current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); -- - xfs_trans_free_items(tp, dirty); - xfs_trans_free(tp); - } -diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h -index 084658946..075eeade4 100644 ---- a/fs/xfs/xfs_trans.h -+++ b/fs/xfs/xfs_trans.h -@@ -268,4 +268,34 @@ xfs_trans_item_relog( - return lip->li_ops->iop_relog(lip, tp); - } - -+static inline void -+xfs_trans_set_context( -+ struct xfs_trans *tp) -+{ -+ ASSERT(current->journal_info == NULL); -+ tp->t_pflags = memalloc_nofs_save(); -+ current->journal_info = tp; -+} -+ -+static inline void -+xfs_trans_clear_context( -+ struct xfs_trans *tp) -+{ -+ if (current->journal_info == tp) { -+ memalloc_nofs_restore(tp->t_pflags); -+ current->journal_info = NULL; -+ } -+} -+ -+static inline void -+xfs_trans_switch_context( -+ struct xfs_trans *old_tp, -+ struct xfs_trans *new_tp) -+{ -+ ASSERT(current->journal_info == old_tp); -+ new_tp->t_pflags = old_tp->t_pflags; -+ old_tp->t_pflags = 0; -+ current->journal_info = new_tp; -+} -+ - #endif /* __XFS_TRANS_H__ */ --- -2.34.1 - diff --git a/kernel-std/centos/patches/0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch b/kernel-std/centos/patches/0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch deleted file mode 100644 index 4a50e4cb..00000000 --- a/kernel-std/centos/patches/0035-xfs-drop-submit-side-trans-alloc-for-append-ioends.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 8182ec00803085354761bbadf0287cad7eac0e2f Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:43 -0700 -Subject: [PATCH 2/5] xfs: drop submit side trans alloc for append ioends - -Per-inode ioend completion batching has a log reservation deadlock -vector between preallocated append transactions and transactions -that are acquired at completion time for other purposes (i.e., -unwritten extent conversion or COW fork remaps). For example, if the -ioend completion workqueue task executes on a batch of ioends that -are sorted such that an append ioend sits at the tail, it's possible -for the outstanding append transaction reservation to block -allocation of transactions required to process preceding ioends in -the list. - -Append ioend completion is historically the common path for on-disk -inode size updates. While file extending writes may have completed -sometime earlier, the on-disk inode size is only updated after -successful writeback completion. These transactions are preallocated -serially from writeback context to mitigate concurrency and -associated log reservation pressure across completions processed by -multi-threaded workqueue tasks. - -However, now that delalloc blocks unconditionally map to unwritten -extents at physical block allocation time, size updates via append -ioends are relatively rare. This means that inode size updates most -commonly occur as part of the preexisting completion time -transaction to convert unwritten extents. As a result, there is no -longer a strong need to preallocate size update transactions. - -Remove the preallocation of inode size update transactions to avoid -the ioend completion processing log reservation deadlock. Instead, -continue to send all potential size extending ioends to workqueue -context for completion and allocate the transaction from that -context. This ensures that no outstanding log reservation is owned -by the ioend completion worker task when it begins to process -ioends. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit 7cd3099f4925d7c15887d1940ebd65acd66100f5 upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 45 +++------------------------------------------ - 1 file changed, 3 insertions(+), 42 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index b4186d666..60943b28f 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -39,33 +39,6 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) - XFS_I(ioend->io_inode)->i_d.di_size; - } - --STATIC int --xfs_setfilesize_trans_alloc( -- struct iomap_ioend *ioend) --{ -- struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount; -- struct xfs_trans *tp; -- int error; -- -- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); -- if (error) -- return error; -- -- ioend->io_private = tp; -- -- /* -- * We may pass freeze protection with a transaction. So tell lockdep -- * we released it. -- */ -- __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS); -- /* -- * We hand off the transaction to the completion thread now, so -- * clear the flag here. -- */ -- xfs_trans_clear_context(tp); -- return 0; --} -- - /* - * Update on-disk file size now that data has been written to disk. - */ -@@ -182,12 +155,10 @@ xfs_end_ioend( - error = xfs_reflink_end_cow(ip, offset, size); - else if (ioend->io_type == IOMAP_UNWRITTEN) - error = xfs_iomap_write_unwritten(ip, offset, size, false); -- else -- ASSERT(!xfs_ioend_is_append(ioend) || ioend->io_private); - -+ if (!error && xfs_ioend_is_append(ioend)) -+ error = xfs_setfilesize(ip, ioend->io_offset, ioend->io_size); - done: -- if (ioend->io_private) -- error = xfs_setfilesize_ioend(ioend, error); - iomap_finish_ioends(ioend, error); - memalloc_nofs_restore(nofs_flag); - } -@@ -237,7 +208,7 @@ xfs_end_io( - - static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend) - { -- return ioend->io_private || -+ return xfs_ioend_is_append(ioend) || - ioend->io_type == IOMAP_UNWRITTEN || - (ioend->io_flags & IOMAP_F_SHARED); - } -@@ -250,8 +221,6 @@ xfs_end_bio( - struct xfs_inode *ip = XFS_I(ioend->io_inode); - unsigned long flags; - -- ASSERT(xfs_ioend_needs_workqueue(ioend)); -- - spin_lock_irqsave(&ip->i_ioend_lock, flags); - if (list_empty(&ip->i_ioend_list)) - WARN_ON_ONCE(!queue_work(ip->i_mount->m_unwritten_workqueue, -@@ -501,14 +470,6 @@ xfs_prepare_ioend( - ioend->io_offset, ioend->io_size); - } - -- /* Reserve log space if we might write beyond the on-disk inode size. */ -- if (!status && -- ((ioend->io_flags & IOMAP_F_SHARED) || -- ioend->io_type != IOMAP_UNWRITTEN) && -- xfs_ioend_is_append(ioend) && -- !ioend->io_private) -- status = xfs_setfilesize_trans_alloc(ioend); -- - memalloc_nofs_restore(nofs_flag); - - if (xfs_ioend_needs_workqueue(ioend)) --- -2.34.1 - diff --git a/kernel-std/centos/patches/0036-xfs-open-code-ioend-needs-workqueue-helper.patch b/kernel-std/centos/patches/0036-xfs-open-code-ioend-needs-workqueue-helper.patch deleted file mode 100644 index 1be641cf..00000000 --- a/kernel-std/centos/patches/0036-xfs-open-code-ioend-needs-workqueue-helper.patch +++ /dev/null @@ -1,51 +0,0 @@ -From edbf1eb9032b84631031d9b43570e262f3461c24 Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:55 -0700 -Subject: [PATCH 3/5] xfs: open code ioend needs workqueue helper - -Open code xfs_ioend_needs_workqueue() into the only remaining -caller. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit 7adb8f14e134d5f885d47c4ccd620836235f0b7f upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 60943b28f..a74a9ead5 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -206,13 +206,6 @@ xfs_end_io( - } - } - --static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend) --{ -- return xfs_ioend_is_append(ioend) || -- ioend->io_type == IOMAP_UNWRITTEN || -- (ioend->io_flags & IOMAP_F_SHARED); --} -- - STATIC void - xfs_end_bio( - struct bio *bio) -@@ -472,7 +465,9 @@ xfs_prepare_ioend( - - memalloc_nofs_restore(nofs_flag); - -- if (xfs_ioend_needs_workqueue(ioend)) -+ /* send ioends that might require a transaction to the completion wq */ -+ if (xfs_ioend_is_append(ioend) || ioend->io_type == IOMAP_UNWRITTEN || -+ (ioend->io_flags & IOMAP_F_SHARED)) - ioend->io_bio->bi_end_io = xfs_end_bio; - return status; - } --- -2.34.1 - diff --git a/kernel-std/centos/patches/0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch b/kernel-std/centos/patches/0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch deleted file mode 100644 index d87b3af7..00000000 --- a/kernel-std/centos/patches/0037-xfs-drop-unused-ioend-private-merge-and-setfilesize-.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 170e31793806ce5e5a9647b6340954536244518e Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:55 -0700 -Subject: [PATCH 4/5] xfs: drop unused ioend private merge and setfilesize code - -XFS no longer attaches anthing to ioend->io_private. Remove the -unnecessary ->io_private merging code. This removes the only remaining -user of xfs_setfilesize_ioend() so remove that function as well. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit 044c6449f18f174ba8d86640936add3fc7582e49 upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 46 +--------------------------------------------- - 1 file changed, 1 insertion(+), 45 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index a74a9ead5..23a9bd9ff 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -85,31 +85,6 @@ xfs_setfilesize( - return __xfs_setfilesize(ip, tp, offset, size); - } - --STATIC int --xfs_setfilesize_ioend( -- struct iomap_ioend *ioend, -- int error) --{ -- struct xfs_inode *ip = XFS_I(ioend->io_inode); -- struct xfs_trans *tp = ioend->io_private; -- -- /* -- * The transaction may have been allocated in the I/O submission thread, -- * thus we need to mark ourselves as being in a transaction manually. -- * Similarly for freeze protection. -- */ -- xfs_trans_set_context(tp); -- __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS); -- -- /* we abort the update if there was an IO error */ -- if (error) { -- xfs_trans_cancel(tp); -- return error; -- } -- -- return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size); --} -- - /* - * IO write completion. - */ -@@ -163,25 +138,6 @@ xfs_end_ioend( - memalloc_nofs_restore(nofs_flag); - } - --/* -- * If the to be merged ioend has a preallocated transaction for file -- * size updates we need to ensure the ioend it is merged into also -- * has one. If it already has one we can simply cancel the transaction -- * as it is guaranteed to be clean. -- */ --static void --xfs_ioend_merge_private( -- struct iomap_ioend *ioend, -- struct iomap_ioend *next) --{ -- if (!ioend->io_private) { -- ioend->io_private = next->io_private; -- next->io_private = NULL; -- } else { -- xfs_setfilesize_ioend(next, -ECANCELED); -- } --} -- - /* Finish all pending io completions. */ - void - xfs_end_io( -@@ -201,7 +157,7 @@ xfs_end_io( - while ((ioend = list_first_entry_or_null(&tmp, struct iomap_ioend, - io_list))) { - list_del_init(&ioend->io_list); -- iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private); -+ iomap_ioend_try_merge(ioend, &tmp, NULL); - xfs_end_ioend(ioend); - } - } --- -2.34.1 - diff --git a/kernel-std/centos/patches/0038-xfs-drop-unnecessary-setfilesize-helper.patch b/kernel-std/centos/patches/0038-xfs-drop-unnecessary-setfilesize-helper.patch deleted file mode 100644 index 922aa59f..00000000 --- a/kernel-std/centos/patches/0038-xfs-drop-unnecessary-setfilesize-helper.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 2fd609b6c90a88630a50fb317473b210759b3873 Mon Sep 17 00:00:00 2001 -From: Brian Foster -Date: Fri, 9 Apr 2021 10:27:56 -0700 -Subject: [PATCH 5/5] xfs: drop unnecessary setfilesize helper - -xfs_setfilesize() is the only remaining caller of the internal -__xfs_setfilesize() helper. Fold them into a single function. - -Signed-off-by: Brian Foster -Reviewed-by: Christoph Hellwig -Reviewed-by: Darrick J. Wong -Signed-off-by: Darrick J. Wong -[commit e7a3d7e792a5ad50583a2e6c35e72bd2ca6096f4 upstream - git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git] -Signed-off-by: Zhixiong Chi ---- - fs/xfs/xfs_aops.c | 29 +++++++++-------------------- - 1 file changed, 9 insertions(+), 20 deletions(-) - -diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c -index 23a9bd9ff..9e32d4135 100644 ---- a/fs/xfs/xfs_aops.c -+++ b/fs/xfs/xfs_aops.c -@@ -42,14 +42,20 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) - /* - * Update on-disk file size now that data has been written to disk. - */ --STATIC int --__xfs_setfilesize( -+int -+xfs_setfilesize( - struct xfs_inode *ip, -- struct xfs_trans *tp, - xfs_off_t offset, - size_t size) - { -+ struct xfs_mount *mp = ip->i_mount; -+ struct xfs_trans *tp; - xfs_fsize_t isize; -+ int error; -+ -+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); -+ if (error) -+ return error; - - xfs_ilock(ip, XFS_ILOCK_EXCL); - isize = xfs_new_eof(ip, offset + size); -@@ -68,23 +74,6 @@ __xfs_setfilesize( - return xfs_trans_commit(tp); - } - --int --xfs_setfilesize( -- struct xfs_inode *ip, -- xfs_off_t offset, -- size_t size) --{ -- struct xfs_mount *mp = ip->i_mount; -- struct xfs_trans *tp; -- int error; -- -- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); -- if (error) -- return error; -- -- return __xfs_setfilesize(ip, tp, offset, size); --} -- - /* - * IO write completion. - */ --- -2.34.1 - diff --git a/userspace/broadcom/libbnxt_re/centos/build_srpm.data b/userspace/broadcom/libbnxt_re/centos/build_srpm.data deleted file mode 100644 index 5066b7db..00000000 --- a/userspace/broadcom/libbnxt_re/centos/build_srpm.data +++ /dev/null @@ -1,5 +0,0 @@ -COPY_LIST=" \ - $PKG_BASE/centos/patches/* \ - " - -TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/userspace/broadcom/libbnxt_re/centos/meta_patches/0001-libbnxt.spec-StarlingX-adaptations.patch b/userspace/broadcom/libbnxt_re/centos/meta_patches/0001-libbnxt.spec-StarlingX-adaptations.patch deleted file mode 100644 index 1cdc8435..00000000 --- a/userspace/broadcom/libbnxt_re/centos/meta_patches/0001-libbnxt.spec-StarlingX-adaptations.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 78be296d1e11aa86c684a5a263083e3cfd546cdc Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Wed, 16 Feb 2022 15:12:25 -0500 -Subject: [PATCH] libbnxt.spec: StarlingX adaptations - -This patch adapts libbnxt.spec to StarlingX as follows: - -* The Release field is modified and BuildRoot field is removed for - StarlingX. - -* StarlingX's build scripts cannot successfully parse the spec file when - there are space characters between the spec file's field names (such - as "Version") and the colons (":") following the field names. Hence, - this patch removes all whitespace between field names and colon - characters. - -* The source RPM provided by Broadcom has a "configure" script - pre-generated for Red Hat Enterprise Linux 7.9, which hardcodes the - variable RDMA_CORE_VERSION to v22; however, StarlingX has a newer - version of the rdma-core library (v37 as of this writing) included, - which requires StarlingX build to regenerate the configure script from - configure.ac. This requires various autotools packages as well as - making the autogen.sh script executable and calling the latter script - prior to calling configure. - -* A build-time dependency on the kernel headers >= 5.10 is added to - ensure that the expected kernel{,-rt}-headers package is installed - into the build chroot/mock file system prior to attempting to build - libbnxt_re. - - If the aforementioned BuildRequires is not present, then the - pre-existing "kernel-headers-4.18.0-147.3.1.el8_1.x86_64" package in - the chroot/mock file system is found satisfactory by rpmbuild, which - triggers the following compilation errors, caused by a conflict - between the header files in the rdma-core-devel package and the - aforementioned kernel{,-rt}-headers package: - - In file included from ./src/rc-compat/v35/cmd_ioctl.h:40:0, - from ./src/rc-compat/v35/driver.h:42, - from src/main.h:55, - from src/verbs.c:56: - /usr/include/rdma/rdma_user_ioctl_cmds.h:87:6: error: nested redefinition of 'enum rdma_driver_id' - enum rdma_driver_id { - ^ - /usr/include/rdma/rdma_user_ioctl_cmds.h:87:6: error: redeclaration of 'enum rdma_driver_id' - In file included from /usr/include/infiniband/verbs_api.h:66:0, - from /usr/include/infiniband/verbs.h:48, - from ./src/rc-compat/v35/driver.h:40, - from src/main.h:55, - from src/verbs.c:56: - /usr/include/infiniband/ib_user_ioctl_verbs.h:232:6: note: originally defined here - enum rdma_driver_id { - ^ - -* Broadcom's libbnxt RPMs replace pre-existing libbnxt_re libraries from - /usr/lib64/libibverbs at package installation time and restore the - older versions at package removal time via post-install and - post-uninstall directives. rdma-core in StarlingX does not package - libbnxt_re, which allows the libbnxt_re package to provide this - library. Hence, this patch instead modifies the spec file so that the - library symbolic link in /usr/lib64/libibverbs is placed at package - build time instead of package installation time. - -* This patch also modifies the spec file to apply a patch that allows - the libbnxt_re build to succeed with StarlingX's older CentOS 7 - toolchain which does not provide the "stdatomic.h" header. - -* Finally, a SuSe-related section of the spec file is trimmed. - -Signed-off-by: M. Vefa Bicakci ---- - SPECS/libbnxt.spec | 61 ++++++++++++++++++++++++++-------------------- - 1 file changed, 34 insertions(+), 27 deletions(-) - -diff --git a/SPECS/libbnxt.spec b/SPECS/libbnxt.spec -index 173229da92a5..992bda9e18ff 100644 ---- a/SPECS/libbnxt.spec -+++ b/SPECS/libbnxt.spec -@@ -1,23 +1,28 @@ --Name : libbnxt_re --Version : 220.0.5.0 --Release : rhel7u9 --Summary : Userspace Library for Broadcom ROCE Device. --Group : System Environment/Libraries --License : GPL/BSD --Vendor : Broadcom Limited --URL : http://www.broadcom.com --Source : libbnxt_re-220.0.5.0.tar.gz --BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -+%if "%{_tis_build_type}" == "rt" -+%define bt_ext -rt -+%else -+%undefine bt_ext -+%endif -+ -+Name: libbnxt_re -+Version: 220.0.5.0 -+Release: rhel7u9%{?_tis_dist}.%{tis_patch_ver} -+Summary: Userspace Library for Broadcom ROCE Device. -+Group: System Environment/Libraries -+License: GPL/BSD -+Vendor: Broadcom Limited -+URL: http://www.broadcom.com -+Source: libbnxt_re-220.0.5.0.tar.gz - BuildRequires: rdma-core-devel -+BuildRequires: automake autoconf libtool -+BuildRequires: kernel%{?bt_ext}-headers >= 5.10 -+ -+Patch0001: 0001-Set-up-stdatomic.h-if-necessary.patch - - %description - libbnxt_re provides a device-specific userspace driver for Broadcom Netxtreme RoCE Adapters - for use with the libibverbs library. - --%if %{defined suse_version} --%debug_package --%endif -- - %package devel - Summary: Development files for the libbnxt_re driver - Group: System Environment/Libraries -@@ -29,8 +34,11 @@ application, which may be useful for debugging. - - %prep - %setup -q -n %{name}-%{version} -+%patch0001 -p1 - - %build -+chmod a+x autogen.sh -+./autogen.sh - %configure - make %{?_smp_mflags} - -@@ -40,23 +48,21 @@ rm -rf $RPM_BUILD_ROOT - # remove unpackaged files from the buildroot - rm -f $RPM_BUILD_ROOT%{_libdir}/*.la - -+# Now, the following symbolic link exists: -+# /usr/lib64/libbnxt_re.so -> libbnxt_re-rdmav34.so -+# -+# We need to create the following symbolic link as well: -+# /usr/lib64/libibverbs/libbnxt_re-rdmav34.so -> ../libbnxt_re-rdmav34.so -+# -+# To avoid hard-coding the version (v34), read the link. -+libname="$(readlink $RPM_BUILD_ROOT%{_libdir}/libbnxt_re.so)" -+mkdir -p $RPM_BUILD_ROOT%{_libdir}/libibverbs/ -+ln -s "../${libname}" $RPM_BUILD_ROOT%{_libdir}/libibverbs/"${libname}" -+ - %post --# If libbnxt_re is inboxed --if [ -f "%{_libdir}/libibverbs/libbnxt_re-rdmav"*".so" ];then -- #to get full name and path -- libbnxtre=$(ls "%{_libdir}/libibverbs/libbnxt_re-rdmav"*".so") -- libbnxtre_mod=$(echo $libbnxtre | sed "s/libbnxt_re-/old.libbnxt_re-/") -- mv $libbnxtre $libbnxtre_mod > /dev/null 2>&1 --fi - /sbin/ldconfig - - %postun --# Undo the change if we had renamed the file --if [ -f "%{_libdir}/libibverbs/old.libbnxt_re-rdmav"*".so" ];then -- libbnxtre_mod=$(ls "%{_libdir}/libibverbs/old.libbnxt_re-rdmav"*".so") -- libbnxtre=$(echo $libbnxtre_mod | sed "s/old.//") -- mv $libbnxtre_mod $libbnxtre > /dev/null 2>&1 --fi - /sbin/ldconfig - - %clean -@@ -65,6 +71,7 @@ rm -rf $RPM_BUILD_ROOT - %files - %defattr(-,root,root,-) - %{_libdir}/libbnxt_re*.so -+%{_libdir}/libibverbs/libbnxt_re*.so - #%doc AUTHORS COPYING ChangeLog README - %config %{_sysconfdir}/libibverbs.d/bnxt_re.driver - --- -2.29.2 - diff --git a/userspace/broadcom/libbnxt_re/centos/meta_patches/0002-libbnxt.spec-Add-support-for-rdma-core-v37.patch b/userspace/broadcom/libbnxt_re/centos/meta_patches/0002-libbnxt.spec-Add-support-for-rdma-core-v37.patch deleted file mode 100644 index d633f4a4..00000000 --- a/userspace/broadcom/libbnxt_re/centos/meta_patches/0002-libbnxt.spec-Add-support-for-rdma-core-v37.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a70be96c876117fb72c6cff9dc454fb22231c8b8 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 31 Mar 2022 16:37:32 -0400 -Subject: [PATCH] libbnxt.spec: Add support for rdma-core v37 - -This modification to libbnxt.spec applies two patches to libbnxt_re, so -that it is compatible with rdma-core v37. - -Signed-off-by: M. Vefa Bicakci ---- - SPECS/libbnxt.spec | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/SPECS/libbnxt.spec b/SPECS/libbnxt.spec -index 992bda9e18ff..a509a80bdddf 100644 ---- a/SPECS/libbnxt.spec -+++ b/SPECS/libbnxt.spec -@@ -18,6 +18,8 @@ BuildRequires: automake autoconf libtool - BuildRequires: kernel%{?bt_ext}-headers >= 5.10 - - Patch0001: 0001-Set-up-stdatomic.h-if-necessary.patch -+Patch0002: 0002-rc-compat-Add-headers-from-v37.3.patch -+Patch0003: 0003-configure.ac-Detect-rdma-core-v36-and-v37-too.patch - - %description - libbnxt_re provides a device-specific userspace driver for Broadcom Netxtreme RoCE Adapters -@@ -35,6 +37,8 @@ application, which may be useful for debugging. - %prep - %setup -q -n %{name}-%{version} - %patch0001 -p1 -+%patch0002 -p1 -+%patch0003 -p1 - - %build - chmod a+x autogen.sh --- -2.29.2 - diff --git a/userspace/broadcom/libbnxt_re/centos/meta_patches/PATCH_ORDER b/userspace/broadcom/libbnxt_re/centos/meta_patches/PATCH_ORDER deleted file mode 100644 index 07899d1a..00000000 --- a/userspace/broadcom/libbnxt_re/centos/meta_patches/PATCH_ORDER +++ /dev/null @@ -1,2 +0,0 @@ -0001-libbnxt.spec-StarlingX-adaptations.patch -0002-libbnxt.spec-Add-support-for-rdma-core-v37.patch diff --git a/userspace/broadcom/libbnxt_re/centos/patches/0001-Set-up-stdatomic.h-if-necessary.patch b/userspace/broadcom/libbnxt_re/centos/patches/0001-Set-up-stdatomic.h-if-necessary.patch deleted file mode 100644 index fe066a99..00000000 --- a/userspace/broadcom/libbnxt_re/centos/patches/0001-Set-up-stdatomic.h-if-necessary.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 05fe24097fa8287bddea3418799e32d949999267 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Mon, 14 Feb 2022 13:13:09 -0500 -Subject: [PATCH] Set up stdatomic.h if necessary - -The toolchain used for building libraries in StarlingX (i.e., CentOS 7) -does not provide the stdatomic.h header. Thankfully, the libbnxt_re -package includes a compatibility-oriented version of this header in -rc-compat/v22. - -Hence, copy over this header from the rc-compat/v22 directory to the -current rc-compat version sub-directory, but only if required, to let -the build finish successfully. - -Signed-off-by: M. Vefa Bicakci ---- - configure.ac | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 9e4e980886d4..61f2a014eb94 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -481,6 +481,22 @@ AC_HEADER_STDC - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST - -+dnl Check if the host's toolchain provides stdatomic.h and use -+dnl our local copy if required. -+tmp_stdatomic=if$$.c -+echo "#include " > ${tmp_stdatomic} -+dnl Need to work around embedded newlines, hence the additional -+dnl level of indirection. -+incpath=$(echo -n __include_path__) -+if echo -- $incpath | grep -q src/rc-compat/ && \ -+ ! $CC $CPPFLAGS -E ${tmp_stdatomic} >/dev/null 2>/dev/null && \ -+ ! test -f src/rc-compat/$(echo -n rcore_version)/stdatomic.h; then -+ cp -v src/rc-compat/v22/stdatomic.h src/rc-compat/$(echo -n rcore_version)/stdatomic.h -+fi -+rm -f ${tmp_stdatomic} -+unset tmp_stdatomic -+unset incpath -+ - dnl Check for libibverbs device library extension - dummy=if$$ - cat < $dummy.c --- -2.29.2 - diff --git a/userspace/broadcom/libbnxt_re/centos/patches/0002-rc-compat-Add-headers-from-v37.3.patch b/userspace/broadcom/libbnxt_re/centos/patches/0002-rc-compat-Add-headers-from-v37.3.patch deleted file mode 100644 index 6222a40a..00000000 --- a/userspace/broadcom/libbnxt_re/centos/patches/0002-rc-compat-Add-headers-from-v37.3.patch +++ /dev/null @@ -1,8186 +0,0 @@ -From 0ace34eb5bcc23dacc68285cd43b828331b42262 Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 31 Mar 2022 15:52:34 -0400 -Subject: [PATCH] rc-compat: Add headers from v37.3 - -All of the headers were copied from rdma-core repository tag "v37.3". We -do not copy from the v36.y tag, because Mellanox's OpenFabrics -Enterprise Distribution (OFED) package in use by StarlingX is based on -rdma-core v37, and we do not need headers from v36 as a result. - -This commit is intended to go away when the vendor releases a version of -libbnxt_re with native support for Mellanox OFED's rdma-core v37 -baseline. - -The only change to the headers were as follows: - -- Some of the #include directives in driver.h were modified to align - them to their counterparts in the v35 directory, by replacing - angle-brackets ('<' and '>') with double quotes ('"') so that the - files in the rc-compat/v37 directory would be used. - -- The following line was added to driver.h: - #define IBV_DEVICE_LIBRARY_EXTENSION rdmav34 - -- kernel-abi_ib_user_verbs.h was generated using a script in the - rdma-core repository as follows: - - python3 ../buildlib/make_abi_structs.py \ - ./rdma/ib_user_verbs.h \ - kernel-abi_ib_user_verbs.h - -- config.h was adapted from src/rc-compat/v35/config.h in libbnxt_re's - source code. - -Signed-off-by: M. Vefa Bicakci ---- - src/rc-compat/v37/ccan/array_size.h | 26 + - src/rc-compat/v37/ccan/bitmap.h | 239 ++++ - src/rc-compat/v37/ccan/build_assert.h | 40 + - src/rc-compat/v37/ccan/check_type.h | 64 + - src/rc-compat/v37/ccan/compiler.h | 230 ++++ - src/rc-compat/v37/ccan/container_of.h | 146 ++ - src/rc-compat/v37/ccan/ilog.h | 151 ++ - src/rc-compat/v37/ccan/list.h | 842 ++++++++++++ - src/rc-compat/v37/ccan/minmax.h | 65 + - src/rc-compat/v37/ccan/str.h | 228 +++ - src/rc-compat/v37/ccan/str_debug.h | 30 + - src/rc-compat/v37/cmd_ioctl.h | 412 ++++++ - src/rc-compat/v37/config.h | 56 + - src/rc-compat/v37/driver.h | 755 ++++++++++ - src/rc-compat/v37/ib_user_verbs.h | 1301 ++++++++++++++++++ - src/rc-compat/v37/kern-abi.h | 322 +++++ - src/rc-compat/v37/kernel-abi_ib_user_verbs.h | 1114 +++++++++++++++ - src/rc-compat/v37/rdma_user_ioctl_cmds.h | 87 ++ - src/rc-compat/v37/util/cl_qmap.h | 970 +++++++++++++ - src/rc-compat/v37/util/compiler.h | 54 + - src/rc-compat/v37/util/mmio.h | 267 ++++ - src/rc-compat/v37/util/node_name_map.h | 19 + - src/rc-compat/v37/util/rdma_nl.h | 52 + - src/rc-compat/v37/util/symver.h | 107 ++ - src/rc-compat/v37/util/udma_barrier.h | 267 ++++ - src/rc-compat/v37/util/util.h | 93 ++ - 26 files changed, 7937 insertions(+) - create mode 100644 src/rc-compat/v37/ccan/array_size.h - create mode 100644 src/rc-compat/v37/ccan/bitmap.h - create mode 100644 src/rc-compat/v37/ccan/build_assert.h - create mode 100644 src/rc-compat/v37/ccan/check_type.h - create mode 100644 src/rc-compat/v37/ccan/compiler.h - create mode 100644 src/rc-compat/v37/ccan/container_of.h - create mode 100644 src/rc-compat/v37/ccan/ilog.h - create mode 100644 src/rc-compat/v37/ccan/list.h - create mode 100644 src/rc-compat/v37/ccan/minmax.h - create mode 100644 src/rc-compat/v37/ccan/str.h - create mode 100644 src/rc-compat/v37/ccan/str_debug.h - create mode 100644 src/rc-compat/v37/cmd_ioctl.h - create mode 100644 src/rc-compat/v37/config.h - create mode 100644 src/rc-compat/v37/driver.h - create mode 100644 src/rc-compat/v37/ib_user_verbs.h - create mode 100644 src/rc-compat/v37/kern-abi.h - create mode 100644 src/rc-compat/v37/kernel-abi_ib_user_verbs.h - create mode 100644 src/rc-compat/v37/rdma_user_ioctl_cmds.h - create mode 100644 src/rc-compat/v37/util/cl_qmap.h - create mode 100644 src/rc-compat/v37/util/compiler.h - create mode 100644 src/rc-compat/v37/util/mmio.h - create mode 100644 src/rc-compat/v37/util/node_name_map.h - create mode 100644 src/rc-compat/v37/util/rdma_nl.h - create mode 100644 src/rc-compat/v37/util/symver.h - create mode 100644 src/rc-compat/v37/util/udma_barrier.h - create mode 100644 src/rc-compat/v37/util/util.h - -diff --git a/src/rc-compat/v37/ccan/array_size.h b/src/rc-compat/v37/ccan/array_size.h -new file mode 100644 -index 000000000000..37b200f5e239 ---- /dev/null -+++ b/src/rc-compat/v37/ccan/array_size.h -@@ -0,0 +1,26 @@ -+/* CC0 (Public domain) - see LICENSE file for details */ -+#ifndef CCAN_ARRAY_SIZE_H -+#define CCAN_ARRAY_SIZE_H -+#include "config.h" -+#include -+ -+/** -+ * ARRAY_SIZE - get the number of elements in a visible array -+ * @arr: the array whose size you want. -+ * -+ * This does not work on pointers, or arrays declared as [], or -+ * function parameters. With correct compiler support, such usage -+ * will cause a build error (see build_assert). -+ */ -+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + _array_size_chk(arr)) -+ -+#if HAVE_BUILTIN_TYPES_COMPATIBLE_P && HAVE_TYPEOF -+/* Two gcc extensions. -+ * &a[0] degrades to a pointer: a different type from an array */ -+#define _array_size_chk(arr) \ -+ BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(arr), \ -+ typeof(&(arr)[0]))) -+#else -+#define _array_size_chk(arr) 0 -+#endif -+#endif /* CCAN_ALIGNOF_H */ -diff --git a/src/rc-compat/v37/ccan/bitmap.h b/src/rc-compat/v37/ccan/bitmap.h -new file mode 100644 -index 000000000000..ff0b8c83da46 ---- /dev/null -+++ b/src/rc-compat/v37/ccan/bitmap.h -@@ -0,0 +1,239 @@ -+/* Licensed under LGPLv2+ - see LICENSE file for details */ -+#ifndef CCAN_BITMAP_H_ -+#define CCAN_BITMAP_H_ -+ -+#include -+#include -+#include -+#include -+ -+typedef unsigned long bitmap_word; -+ -+#define BITMAP_WORD_BITS (sizeof(bitmap_word) * CHAR_BIT) -+#define BITMAP_NWORDS(_n) \ -+ (((_n) + BITMAP_WORD_BITS - 1) / BITMAP_WORD_BITS) -+ -+/* -+ * We wrap each word in a structure for type checking. -+ */ -+typedef struct { -+ bitmap_word w; -+} bitmap; -+ -+#define BITMAP_DECLARE(_name, _nbits) \ -+ bitmap (_name)[BITMAP_NWORDS(_nbits)] -+ -+static inline size_t bitmap_sizeof(unsigned long nbits) -+{ -+ return BITMAP_NWORDS(nbits) * sizeof(bitmap_word); -+} -+ -+static inline bitmap_word bitmap_bswap(bitmap_word w) -+{ -+ /* We do not need to have the bitmap in any specific endianness */ -+ return w; -+} -+ -+#define BITMAP_WORD(_bm, _n) ((_bm)[(_n) / BITMAP_WORD_BITS].w) -+#define BITMAP_WORDBIT(_n) \ -+ (bitmap_bswap(1UL << (BITMAP_WORD_BITS - ((_n) % BITMAP_WORD_BITS) - 1))) -+ -+#define BITMAP_HEADWORDS(_nbits) \ -+ ((_nbits) / BITMAP_WORD_BITS) -+#define BITMAP_HEADBYTES(_nbits) \ -+ (BITMAP_HEADWORDS(_nbits) * sizeof(bitmap_word)) -+ -+#define BITMAP_TAILWORD(_bm, _nbits) \ -+ ((_bm)[BITMAP_HEADWORDS(_nbits)].w) -+#define BITMAP_HASTAIL(_nbits) (((_nbits) % BITMAP_WORD_BITS) != 0) -+#define BITMAP_TAILBITS(_nbits) \ -+ (bitmap_bswap(~(-1UL >> ((_nbits) % BITMAP_WORD_BITS)))) -+#define BITMAP_TAIL(_bm, _nbits) \ -+ (BITMAP_TAILWORD(_bm, _nbits) & BITMAP_TAILBITS(_nbits)) -+ -+static inline void bitmap_set_bit(bitmap *bmap, unsigned long n) -+{ -+ BITMAP_WORD(bmap, n) |= BITMAP_WORDBIT(n); -+} -+ -+static inline void bitmap_clear_bit(bitmap *bmap, unsigned long n) -+{ -+ BITMAP_WORD(bmap, n) &= ~BITMAP_WORDBIT(n); -+} -+ -+static inline void bitmap_change_bit(bitmap *bmap, unsigned long n) -+{ -+ BITMAP_WORD(bmap, n) ^= BITMAP_WORDBIT(n); -+} -+ -+static inline bool bitmap_test_bit(const bitmap *bmap, unsigned long n) -+{ -+ return !!(BITMAP_WORD(bmap, n) & BITMAP_WORDBIT(n)); -+} -+ -+void bitmap_zero_range(bitmap *bmap, unsigned long n, unsigned long m); -+void bitmap_fill_range(bitmap *bmap, unsigned long n, unsigned long m); -+ -+static inline void bitmap_zero(bitmap *bmap, unsigned long nbits) -+{ -+ memset(bmap, 0, bitmap_sizeof(nbits)); -+} -+ -+static inline void bitmap_fill(bitmap *bmap, unsigned long nbits) -+{ -+ memset(bmap, 0xff, bitmap_sizeof(nbits)); -+} -+ -+static inline void bitmap_copy(bitmap *dst, const bitmap *src, -+ unsigned long nbits) -+{ -+ memcpy(dst, src, bitmap_sizeof(nbits)); -+} -+ -+#define BITMAP_DEF_BINOP(_name, _op) \ -+ static inline void bitmap_##_name(bitmap *dst, bitmap *src1, bitmap *src2, \ -+ unsigned long nbits) \ -+ { \ -+ unsigned long i = 0; \ -+ for (i = 0; i < BITMAP_NWORDS(nbits); i++) { \ -+ dst[i].w = src1[i].w _op src2[i].w; \ -+ } \ -+ } -+ -+BITMAP_DEF_BINOP(and, &) -+BITMAP_DEF_BINOP(or, |) -+BITMAP_DEF_BINOP(xor, ^) -+BITMAP_DEF_BINOP(andnot, & ~) -+ -+#undef BITMAP_DEF_BINOP -+ -+static inline void bitmap_complement(bitmap *dst, const bitmap *src, -+ unsigned long nbits) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < BITMAP_NWORDS(nbits); i++) -+ dst[i].w = ~src[i].w; -+} -+ -+static inline bool bitmap_equal(const bitmap *src1, const bitmap *src2, -+ unsigned long nbits) -+{ -+ return (memcmp(src1, src2, BITMAP_HEADBYTES(nbits)) == 0) -+ && (!BITMAP_HASTAIL(nbits) -+ || (BITMAP_TAIL(src1, nbits) == BITMAP_TAIL(src2, nbits))); -+} -+ -+static inline bool bitmap_intersects(const bitmap *src1, const bitmap *src2, -+ unsigned long nbits) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) { -+ if (src1[i].w & src2[i].w) -+ return true; -+ } -+ if (BITMAP_HASTAIL(nbits) && -+ (BITMAP_TAIL(src1, nbits) & BITMAP_TAIL(src2, nbits))) -+ return true; -+ return false; -+} -+ -+static inline bool bitmap_subset(const bitmap *src1, const bitmap *src2, -+ unsigned long nbits) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) { -+ if (src1[i].w & ~src2[i].w) -+ return false; -+ } -+ if (BITMAP_HASTAIL(nbits) && -+ (BITMAP_TAIL(src1, nbits) & ~BITMAP_TAIL(src2, nbits))) -+ return false; -+ return true; -+} -+ -+static inline bool bitmap_full(const bitmap *bmap, unsigned long nbits) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) { -+ if (bmap[i].w != -1UL) -+ return false; -+ } -+ if (BITMAP_HASTAIL(nbits) && -+ (BITMAP_TAIL(bmap, nbits) != BITMAP_TAILBITS(nbits))) -+ return false; -+ -+ return true; -+} -+ -+static inline bool bitmap_empty(const bitmap *bmap, unsigned long nbits) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) { -+ if (bmap[i].w != 0) -+ return false; -+ } -+ if (BITMAP_HASTAIL(nbits) && (BITMAP_TAIL(bmap, nbits) != 0)) -+ return false; -+ -+ return true; -+} -+ -+unsigned long bitmap_ffs(const bitmap *bmap, -+ unsigned long n, unsigned long m); -+ -+/* -+ * Allocation functions -+ */ -+static inline bitmap *bitmap_alloc(unsigned long nbits) -+{ -+ return malloc(bitmap_sizeof(nbits)); -+} -+ -+static inline bitmap *bitmap_alloc0(unsigned long nbits) -+{ -+ bitmap *bmap; -+ -+ bmap = bitmap_alloc(nbits); -+ if (bmap) -+ bitmap_zero(bmap, nbits); -+ return bmap; -+} -+ -+static inline bitmap *bitmap_alloc1(unsigned long nbits) -+{ -+ bitmap *bmap; -+ -+ bmap = bitmap_alloc(nbits); -+ if (bmap) -+ bitmap_fill(bmap, nbits); -+ return bmap; -+} -+ -+static inline bitmap *bitmap_realloc0(bitmap *bmap, unsigned long obits, -+ unsigned long nbits) -+{ -+ bmap = realloc(bmap, bitmap_sizeof(nbits)); -+ -+ if ((nbits > obits) && bmap) -+ bitmap_zero_range(bmap, obits, nbits); -+ -+ return bmap; -+} -+ -+static inline bitmap *bitmap_realloc1(bitmap *bmap, unsigned long obits, -+ unsigned long nbits) -+{ -+ bmap = realloc(bmap, bitmap_sizeof(nbits)); -+ -+ if ((nbits > obits) && bmap) -+ bitmap_fill_range(bmap, obits, nbits); -+ -+ return bmap; -+} -+ -+#endif /* CCAN_BITMAP_H_ */ -diff --git a/src/rc-compat/v37/ccan/build_assert.h b/src/rc-compat/v37/ccan/build_assert.h -new file mode 100644 -index 000000000000..0ecd7ff36633 ---- /dev/null -+++ b/src/rc-compat/v37/ccan/build_assert.h -@@ -0,0 +1,40 @@ -+/* CC0 (Public domain) - see LICENSE.CC0 file for details */ -+#ifndef CCAN_BUILD_ASSERT_H -+#define CCAN_BUILD_ASSERT_H -+ -+/** -+ * BUILD_ASSERT - assert a build-time dependency. -+ * @cond: the compile-time condition which must be true. -+ * -+ * Your compile will fail if the condition isn't true, or can't be evaluated -+ * by the compiler. This can only be used within a function. -+ * -+ * Example: -+ * #include -+ * ... -+ * static char *foo_to_char(struct foo *foo) -+ * { -+ * // This code needs string to be at start of foo. -+ * BUILD_ASSERT(offsetof(struct foo, string) == 0); -+ * return (char *)foo; -+ * } -+ */ -+#define BUILD_ASSERT(cond) \ -+ do { (void) sizeof(char [1 - 2*!(cond)]); } while(0) -+ -+/** -+ * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression. -+ * @cond: the compile-time condition which must be true. -+ * -+ * Your compile will fail if the condition isn't true, or can't be evaluated -+ * by the compiler. This can be used in an expression: its value is "0". -+ * -+ * Example: -+ * #define foo_to_char(foo) \ -+ * ((char *)(foo) \ -+ * + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0)) -+ */ -+#define BUILD_ASSERT_OR_ZERO(cond) \ -+ (sizeof(char [1 - 2*!(cond)]) - 1) -+ -+#endif /* CCAN_BUILD_ASSERT_H */ -diff --git a/src/rc-compat/v37/ccan/check_type.h b/src/rc-compat/v37/ccan/check_type.h -new file mode 100644 -index 000000000000..a576a5018e01 ---- /dev/null -+++ b/src/rc-compat/v37/ccan/check_type.h -@@ -0,0 +1,64 @@ -+/* CC0 (Public domain) - see LICENSE.CC0 file for details */ -+#ifndef CCAN_CHECK_TYPE_H -+#define CCAN_CHECK_TYPE_H -+#include "config.h" -+ -+/** -+ * check_type - issue a warning or build failure if type is not correct. -+ * @expr: the expression whose type we should check (not evaluated). -+ * @type: the exact type we expect the expression to be. -+ * -+ * This macro is usually used within other macros to try to ensure that a macro -+ * argument is of the expected type. No type promotion of the expression is -+ * done: an unsigned int is not the same as an int! -+ * -+ * check_type() always evaluates to 0. -+ * -+ * If your compiler does not support typeof, then the best we can do is fail -+ * to compile if the sizes of the types are unequal (a less complete check). -+ * -+ * Example: -+ * // They should always pass a 64-bit value to _set_some_value! -+ * #define set_some_value(expr) \ -+ * _set_some_value((check_type((expr), uint64_t), (expr))) -+ */ -+ -+/** -+ * check_types_match - issue a warning or build failure if types are not same. -+ * @expr1: the first expression (not evaluated). -+ * @expr2: the second expression (not evaluated). -+ * -+ * This macro is usually used within other macros to try to ensure that -+ * arguments are of identical types. No type promotion of the expressions is -+ * done: an unsigned int is not the same as an int! -+ * -+ * check_types_match() always evaluates to 0. -+ * -+ * If your compiler does not support typeof, then the best we can do is fail -+ * to compile if the sizes of the types are unequal (a less complete check). -+ * -+ * Example: -+ * // Do subtraction to get to enclosing type, but make sure that -+ * // pointer is of correct type for that member. -+ * #define container_of(mbr_ptr, encl_type, mbr) \ -+ * (check_types_match((mbr_ptr), &((encl_type *)0)->mbr), \ -+ * ((encl_type *) \ -+ * ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr)))) -+ */ -+#if HAVE_TYPEOF -+#define check_type(expr, type) \ -+ ((typeof(expr) *)0 != (type *)0) -+ -+#define check_types_match(expr1, expr2) \ -+ ((typeof(expr1) *)0 != (typeof(expr2) *)0) -+#else -+#include -+/* Without typeof, we can only test the sizes. */ -+#define check_type(expr, type) \ -+ BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type)) -+ -+#define check_types_match(expr1, expr2) \ -+ BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2)) -+#endif /* HAVE_TYPEOF */ -+ -+#endif /* CCAN_CHECK_TYPE_H */ -diff --git a/src/rc-compat/v37/ccan/compiler.h b/src/rc-compat/v37/ccan/compiler.h -new file mode 100644 -index 000000000000..cc0d4d1af2ca ---- /dev/null -+++ b/src/rc-compat/v37/ccan/compiler.h -@@ -0,0 +1,230 @@ -+/* CC0 (Public domain) - see LICENSE file for details */ -+#ifndef CCAN_COMPILER_H -+#define CCAN_COMPILER_H -+#include "config.h" -+ -+#ifndef COLD -+/** -+ * COLD - a function is unlikely to be called. -+ * -+ * Used to mark an unlikely code path and optimize appropriately. -+ * It is usually used on logging or error routines. -+ * -+ * Example: -+ * static void COLD moan(const char *reason) -+ * { -+ * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); -+ * } -+ */ -+#define COLD __attribute__((__cold__)) -+#endif -+ -+#ifndef NORETURN -+/** -+ * NORETURN - a function does not return -+ * -+ * Used to mark a function which exits; useful for suppressing warnings. -+ * -+ * Example: -+ * static void NORETURN fail(const char *reason) -+ * { -+ * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); -+ * exit(1); -+ * } -+ */ -+#define NORETURN __attribute__((__noreturn__)) -+#endif -+ -+#ifndef PRINTF_FMT -+/** -+ * PRINTF_FMT - a function takes printf-style arguments -+ * @nfmt: the 1-based number of the function's format argument. -+ * @narg: the 1-based number of the function's first variable argument. -+ * -+ * This allows the compiler to check your parameters as it does for printf(). -+ * -+ * Example: -+ * void PRINTF_FMT(2,3) my_printf(const char *prefix, const char *fmt, ...); -+ */ -+#define PRINTF_FMT(nfmt, narg) \ -+ __attribute__((format(__printf__, nfmt, narg))) -+#endif -+ -+#ifndef CONST_FUNCTION -+/** -+ * CONST_FUNCTION - a function's return depends only on its argument -+ * -+ * This allows the compiler to assume that the function will return the exact -+ * same value for the exact same arguments. This implies that the function -+ * must not use global variables, or dereference pointer arguments. -+ */ -+#define CONST_FUNCTION __attribute__((__const__)) -+ -+#ifndef PURE_FUNCTION -+/** -+ * PURE_FUNCTION - a function is pure -+ * -+ * A pure function is one that has no side effects other than it's return value -+ * and uses no inputs other than it's arguments and global variables. -+ */ -+#define PURE_FUNCTION __attribute__((__pure__)) -+#endif -+#endif -+ -+#ifndef UNNEEDED -+/** -+ * UNNEEDED - a variable/function may not be needed -+ * -+ * This suppresses warnings about unused variables or functions, but tells -+ * the compiler that if it is unused it need not emit it into the source code. -+ * -+ * Example: -+ * // With some preprocessor options, this is unnecessary. -+ * static UNNEEDED int counter; -+ * -+ * // With some preprocessor options, this is unnecessary. -+ * static UNNEEDED void add_to_counter(int add) -+ * { -+ * counter += add; -+ * } -+ */ -+#define UNNEEDED __attribute__((__unused__)) -+#endif -+ -+#ifndef NEEDED -+/** -+ * NEEDED - a variable/function is needed -+ * -+ * This suppresses warnings about unused variables or functions, but tells -+ * the compiler that it must exist even if it (seems) unused. -+ * -+ * Example: -+ * // Even if this is unused, these are vital for debugging. -+ * static NEEDED int counter; -+ * static NEEDED void dump_counter(void) -+ * { -+ * printf("Counter is %i\n", counter); -+ * } -+ */ -+#define NEEDED __attribute__((__used__)) -+#endif -+ -+#ifndef UNUSED -+/** -+ * UNUSED - a parameter is unused -+ * -+ * Some compilers (eg. gcc with -W or -Wunused) warn about unused -+ * function parameters. This suppresses such warnings and indicates -+ * to the reader that it's deliberate. -+ * -+ * Example: -+ * // This is used as a callback, so needs to have this prototype. -+ * static int some_callback(void *unused UNUSED) -+ * { -+ * return 0; -+ * } -+ */ -+#define UNUSED __attribute__((__unused__)) -+#endif -+ -+#ifndef IS_COMPILE_CONSTANT -+/** -+ * IS_COMPILE_CONSTANT - does the compiler know the value of this expression? -+ * @expr: the expression to evaluate -+ * -+ * When an expression manipulation is complicated, it is usually better to -+ * implement it in a function. However, if the expression being manipulated is -+ * known at compile time, it is better to have the compiler see the entire -+ * expression so it can simply substitute the result. -+ * -+ * This can be done using the IS_COMPILE_CONSTANT() macro. -+ * -+ * Example: -+ * enum greek { ALPHA, BETA, GAMMA, DELTA, EPSILON }; -+ * -+ * // Out-of-line version. -+ * const char *greek_name(enum greek greek); -+ * -+ * // Inline version. -+ * static inline const char *_greek_name(enum greek greek) -+ * { -+ * switch (greek) { -+ * case ALPHA: return "alpha"; -+ * case BETA: return "beta"; -+ * case GAMMA: return "gamma"; -+ * case DELTA: return "delta"; -+ * case EPSILON: return "epsilon"; -+ * default: return "**INVALID**"; -+ * } -+ * } -+ * -+ * // Use inline if compiler knows answer. Otherwise call function -+ * // to avoid copies of the same code everywhere. -+ * #define greek_name(g) \ -+ * (IS_COMPILE_CONSTANT(greek) ? _greek_name(g) : greek_name(g)) -+ */ -+#define IS_COMPILE_CONSTANT(expr) __builtin_constant_p(expr) -+#endif -+ -+#ifndef WARN_UNUSED_RESULT -+/** -+ * WARN_UNUSED_RESULT - warn if a function return value is unused. -+ * -+ * Used to mark a function where it is extremely unlikely that the caller -+ * can ignore the result, eg realloc(). -+ * -+ * Example: -+ * // buf param may be freed by this; need return value! -+ * static char *WARN_UNUSED_RESULT enlarge(char *buf, unsigned *size) -+ * { -+ * return realloc(buf, (*size) *= 2); -+ * } -+ */ -+#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) -+#endif -+ -+ -+/** -+ * WARN_DEPRECATED - warn that a function/type/variable is deprecated when used. -+ * -+ * Used to mark a function, type or variable should not be used. -+ * -+ * Example: -+ * WARN_DEPRECATED char *oldfunc(char *buf); -+ */ -+#define WARN_DEPRECATED __attribute__((__deprecated__)) -+ -+ -+/** -+ * NO_NULL_ARGS - specify that no arguments to this function can be NULL. -+ * -+ * The compiler will warn if any pointer args are NULL. -+ * -+ * Example: -+ * NO_NULL_ARGS char *my_copy(char *buf); -+ */ -+#define NO_NULL_ARGS __attribute__((__nonnull__)) -+ -+/** -+ * NON_NULL_ARGS - specify that some arguments to this function can't be NULL. -+ * @...: 1-based argument numbers for which args can't be NULL. -+ * -+ * The compiler will warn if any of the specified pointer args are NULL. -+ * -+ * Example: -+ * char *my_copy2(char *buf, char *maybenull) NON_NULL_ARGS(1); -+ */ -+#define NON_NULL_ARGS(...) __attribute__((__nonnull__(__VA_ARGS__))) -+ -+ -+/** -+ * LAST_ARG_NULL - specify the last argument of a variadic function must be NULL. -+ * -+ * The compiler will warn if the last argument isn't NULL. -+ * -+ * Example: -+ * char *join_string(char *buf, ...) LAST_ARG_NULL; -+ */ -+#define LAST_ARG_NULL __attribute__((__sentinel__)) -+ -+#endif /* CCAN_COMPILER_H */ -diff --git a/src/rc-compat/v37/ccan/container_of.h b/src/rc-compat/v37/ccan/container_of.h -new file mode 100644 -index 000000000000..9180f37f0d15 ---- /dev/null -+++ b/src/rc-compat/v37/ccan/container_of.h -@@ -0,0 +1,146 @@ -+/* CC0 (Public domain) - see LICENSE.CC0 file for details */ -+#ifndef CCAN_CONTAINER_OF_H -+#define CCAN_CONTAINER_OF_H -+#include -+ -+#include "config.h" -+#include -+ -+/** -+ * container_of - get pointer to enclosing structure -+ * @member_ptr: pointer to the structure member -+ * @containing_type: the type this member is within -+ * @member: the name of this member within the structure. -+ * -+ * Given a pointer to a member of a structure, this macro does pointer -+ * subtraction to return the pointer to the enclosing type. -+ * -+ * Example: -+ * struct foo { -+ * int fielda, fieldb; -+ * // ... -+ * }; -+ * struct info { -+ * int some_other_field; -+ * struct foo my_foo; -+ * }; -+ * -+ * static struct info *foo_to_info(struct foo *foo) -+ * { -+ * return container_of(foo, struct info, my_foo); -+ * } -+ */ -+#ifndef container_of -+#define container_of(member_ptr, containing_type, member) \ -+ ((containing_type *) \ -+ ((char *)(member_ptr) \ -+ - container_off(containing_type, member)) \ -+ + check_types_match(*(member_ptr), ((containing_type *)0)->member)) -+#endif -+ -+/** -+ * container_of_or_null - get pointer to enclosing structure, or NULL -+ * @member_ptr: pointer to the structure member -+ * @containing_type: the type this member is within -+ * @member: the name of this member within the structure. -+ * -+ * Given a pointer to a member of a structure, this macro does pointer -+ * subtraction to return the pointer to the enclosing type, unless it -+ * is given NULL, in which case it also returns NULL. -+ * -+ * Example: -+ * struct foo { -+ * int fielda, fieldb; -+ * // ... -+ * }; -+ * struct info { -+ * int some_other_field; -+ * struct foo my_foo; -+ * }; -+ * -+ * static struct info *foo_to_info_allowing_null(struct foo *foo) -+ * { -+ * return container_of_or_null(foo, struct info, my_foo); -+ * } -+ */ -+static inline char *container_of_or_null_(void *member_ptr, size_t offset) -+{ -+ return member_ptr ? (char *)member_ptr - offset : NULL; -+} -+#define container_of_or_null(member_ptr, containing_type, member) \ -+ ((containing_type *) \ -+ container_of_or_null_(member_ptr, \ -+ container_off(containing_type, member)) \ -+ + check_types_match(*(member_ptr), ((containing_type *)0)->member)) -+ -+/** -+ * container_off - get offset to enclosing structure -+ * @containing_type: the type this member is within -+ * @member: the name of this member within the structure. -+ * -+ * Given a pointer to a member of a structure, this macro does -+ * typechecking and figures out the offset to the enclosing type. -+ * -+ * Example: -+ * struct foo { -+ * int fielda, fieldb; -+ * // ... -+ * }; -+ * struct info { -+ * int some_other_field; -+ * struct foo my_foo; -+ * }; -+ * -+ * static struct info *foo_to_info(struct foo *foo) -+ * { -+ * size_t off = container_off(struct info, my_foo); -+ * return (void *)((char *)foo - off); -+ * } -+ */ -+#define container_off(containing_type, member) \ -+ offsetof(containing_type, member) -+ -+/** -+ * container_of_var - get pointer to enclosing structure using a variable -+ * @member_ptr: pointer to the structure member -+ * @container_var: a pointer of same type as this member's container -+ * @member: the name of this member within the structure. -+ * -+ * Given a pointer to a member of a structure, this macro does pointer -+ * subtraction to return the pointer to the enclosing type. -+ * -+ * Example: -+ * static struct info *foo_to_i(struct foo *foo) -+ * { -+ * struct info *i = container_of_var(foo, i, my_foo); -+ * return i; -+ * } -+ */ -+#if HAVE_TYPEOF -+#define container_of_var(member_ptr, container_var, member) \ -+ container_of(member_ptr, typeof(*container_var), member) -+#else -+#define container_of_var(member_ptr, container_var, member) \ -+ ((void *)((char *)(member_ptr) - \ -+ container_off_var(container_var, member))) -+#endif -+ -+/** -+ * container_off_var - get offset of a field in enclosing structure -+ * @container_var: a pointer to a container structure -+ * @member: the name of a member within the structure. -+ * -+ * Given (any) pointer to a structure and a its member name, this -+ * macro does pointer subtraction to return offset of member in a -+ * structure memory layout. -+ * -+ */ -+#if HAVE_TYPEOF -+#define container_off_var(var, member) \ -+ container_off(typeof(*var), member) -+#else -+#define container_off_var(var, member) \ -+ ((const char *)&(var)->member - (const char *)(var)) -+#endif -+ -+#endif /* CCAN_CONTAINER_OF_H */ -diff --git a/src/rc-compat/v37/ccan/ilog.h b/src/rc-compat/v37/ccan/ilog.h -new file mode 100644 -index 000000000000..2793a7056afe ---- /dev/null -+++ b/src/rc-compat/v37/ccan/ilog.h -@@ -0,0 +1,151 @@ -+/* CC0 (Public domain) - see LICENSE file for details */ -+#if !defined(_ilog_H) -+# define _ilog_H (1) -+# include "config.h" -+# include -+# include -+# include -+ -+/** -+ * ilog32 - Integer binary logarithm of a 32-bit value. -+ * @_v: A 32-bit value. -+ * Returns floor(log2(_v))+1, or 0 if _v==0. -+ * This is the number of bits that would be required to represent _v in two's -+ * complement notation with all of the leading zeros stripped. -+ * Note that many uses will resolve to the fast macro version instead. -+ * -+ * See Also: -+ * ilog32_nz(), ilog64() -+ * -+ * Example: -+ * // Rounds up to next power of 2 (if not a power of 2). -+ * static uint32_t round_up32(uint32_t i) -+ * { -+ * assert(i != 0); -+ * return 1U << ilog32(i-1); -+ * } -+ */ -+int ilog32(uint32_t _v); -+ -+/** -+ * ilog32_nz - Integer binary logarithm of a non-zero 32-bit value. -+ * @_v: A 32-bit value. -+ * Returns floor(log2(_v))+1, or undefined if _v==0. -+ * This is the number of bits that would be required to represent _v in two's -+ * complement notation with all of the leading zeros stripped. -+ * Note that many uses will resolve to the fast macro version instead. -+ * See Also: -+ * ilog32(), ilog64_nz() -+ * Example: -+ * // Find Last Set (ie. highest bit set, 0 to 31). -+ * static uint32_t fls32(uint32_t i) -+ * { -+ * assert(i != 0); -+ * return ilog32_nz(i) - 1; -+ * } -+ */ -+int ilog32_nz(uint32_t _v); -+ -+/** -+ * ilog64 - Integer binary logarithm of a 64-bit value. -+ * @_v: A 64-bit value. -+ * Returns floor(log2(_v))+1, or 0 if _v==0. -+ * This is the number of bits that would be required to represent _v in two's -+ * complement notation with all of the leading zeros stripped. -+ * Note that many uses will resolve to the fast macro version instead. -+ * See Also: -+ * ilog64_nz(), ilog32() -+ */ -+int ilog64(uint64_t _v); -+ -+/** -+ * ilog64_nz - Integer binary logarithm of a non-zero 64-bit value. -+ * @_v: A 64-bit value. -+ * Returns floor(log2(_v))+1, or undefined if _v==0. -+ * This is the number of bits that would be required to represent _v in two's -+ * complement notation with all of the leading zeros stripped. -+ * Note that many uses will resolve to the fast macro version instead. -+ * See Also: -+ * ilog64(), ilog32_nz() -+ */ -+int ilog64_nz(uint64_t _v); -+ -+/** -+ * STATIC_ILOG_32 - The integer logarithm of an (unsigned, 32-bit) constant. -+ * @_v: A non-negative 32-bit constant. -+ * Returns floor(log2(_v))+1, or 0 if _v==0. -+ * This is the number of bits that would be required to represent _v in two's -+ * complement notation with all of the leading zeros stripped. -+ * This macro should only be used when you need a compile-time constant, -+ * otherwise ilog32 or ilog32_nz are just as fast and more flexible. -+ * -+ * Example: -+ * #define MY_PAGE_SIZE 4096 -+ * #define MY_PAGE_BITS (STATIC_ILOG_32(PAGE_SIZE) - 1) -+ */ -+#define STATIC_ILOG_32(_v) (STATIC_ILOG5((uint32_t)(_v))) -+ -+/** -+ * STATIC_ILOG_64 - The integer logarithm of an (unsigned, 64-bit) constant. -+ * @_v: A non-negative 64-bit constant. -+ * Returns floor(log2(_v))+1, or 0 if _v==0. -+ * This is the number of bits that would be required to represent _v in two's -+ * complement notation with all of the leading zeros stripped. -+ * This macro should only be used when you need a compile-time constant, -+ * otherwise ilog64 or ilog64_nz are just as fast and more flexible. -+ */ -+#define STATIC_ILOG_64(_v) (STATIC_ILOG6((uint64_t)(_v))) -+ -+/* Private implementation details */ -+ -+/*Note the casts to (int) below: this prevents "upgrading" -+ the type of an entire expression to an (unsigned) size_t.*/ -+#if INT_MAX>=2147483647 && HAVE_BUILTIN_CLZ -+#define builtin_ilog32_nz(v) \ -+ (((int)sizeof(unsigned)*CHAR_BIT) - __builtin_clz(v)) -+#elif LONG_MAX>=2147483647L && HAVE_BUILTIN_CLZL -+#define builtin_ilog32_nz(v) \ -+ (((int)sizeof(unsigned)*CHAR_BIT) - __builtin_clzl(v)) -+#endif -+ -+#if INT_MAX>=9223372036854775807LL && HAVE_BUILTIN_CLZ -+#define builtin_ilog64_nz(v) \ -+ (((int)sizeof(unsigned)*CHAR_BIT) - __builtin_clz(v)) -+#elif LONG_MAX>=9223372036854775807LL && HAVE_BUILTIN_CLZL -+#define builtin_ilog64_nz(v) \ -+ (((int)sizeof(unsigned long)*CHAR_BIT) - __builtin_clzl(v)) -+#elif HAVE_BUILTIN_CLZLL -+#define builtin_ilog64_nz(v) \ -+ (((int)sizeof(unsigned long long)*CHAR_BIT) - __builtin_clzll(v)) -+#endif -+ -+#ifdef builtin_ilog32_nz -+#define ilog32(_v) (builtin_ilog32_nz(_v)&-!!(_v)) -+#define ilog32_nz(_v) builtin_ilog32_nz(_v) -+#else -+#define ilog32_nz(_v) ilog32(_v) -+#define ilog32(_v) (IS_COMPILE_CONSTANT(_v) ? STATIC_ILOG_32(_v) : ilog32(_v)) -+#endif /* builtin_ilog32_nz */ -+ -+#ifdef builtin_ilog64_nz -+#define ilog64(_v) (builtin_ilog64_nz(_v)&-!!(_v)) -+#define ilog64_nz(_v) builtin_ilog64_nz(_v) -+#else -+#define ilog64_nz(_v) ilog64(_v) -+#define ilog64(_v) (IS_COMPILE_CONSTANT(_v) ? STATIC_ILOG_64(_v) : ilog64(_v)) -+#endif /* builtin_ilog64_nz */ -+ -+/* Macros for evaluating compile-time constant ilog. */ -+# define STATIC_ILOG0(_v) (!!(_v)) -+# define STATIC_ILOG1(_v) (((_v)&0x2)?2:STATIC_ILOG0(_v)) -+# define STATIC_ILOG2(_v) (((_v)&0xC)?2+STATIC_ILOG1((_v)>>2):STATIC_ILOG1(_v)) -+# define STATIC_ILOG3(_v) \ -+ (((_v)&0xF0)?4+STATIC_ILOG2((_v)>>4):STATIC_ILOG2(_v)) -+# define STATIC_ILOG4(_v) \ -+ (((_v)&0xFF00)?8+STATIC_ILOG3((_v)>>8):STATIC_ILOG3(_v)) -+# define STATIC_ILOG5(_v) \ -+ (((_v)&0xFFFF0000)?16+STATIC_ILOG4((_v)>>16):STATIC_ILOG4(_v)) -+# define STATIC_ILOG6(_v) \ -+ (((_v)&0xFFFFFFFF00000000ULL)?32+STATIC_ILOG5((_v)>>32):STATIC_ILOG5(_v)) -+ -+#endif /* _ilog_H */ -diff --git a/src/rc-compat/v37/ccan/list.h b/src/rc-compat/v37/ccan/list.h -new file mode 100644 -index 000000000000..f4006660f7ef ---- /dev/null -+++ b/src/rc-compat/v37/ccan/list.h -@@ -0,0 +1,842 @@ -+/* Licensed under MIT - see LICENSE.MIT file for details */ -+#ifndef CCAN_LIST_H -+#define CCAN_LIST_H -+//#define CCAN_LIST_DEBUG 1 -+#include -+#include -+#include -+#include -+#include -+ -+/** -+ * struct list_node - an entry in a doubly-linked list -+ * @next: next entry (self if empty) -+ * @prev: previous entry (self if empty) -+ * -+ * This is used as an entry in a linked list. -+ * Example: -+ * struct child { -+ * const char *name; -+ * // Linked list of all us children. -+ * struct list_node list; -+ * }; -+ */ -+struct list_node -+{ -+ struct list_node *next, *prev; -+}; -+ -+/** -+ * struct list_head - the head of a doubly-linked list -+ * @h: the list_head (containing next and prev pointers) -+ * -+ * This is used as the head of a linked list. -+ * Example: -+ * struct parent { -+ * const char *name; -+ * struct list_head children; -+ * unsigned int num_children; -+ * }; -+ */ -+struct list_head -+{ -+ struct list_node n; -+}; -+ -+/** -+ * list_check - check head of a list for consistency -+ * @h: the list_head -+ * @abortstr: the location to print on aborting, or NULL. -+ * -+ * Because list_nodes have redundant information, consistency checking between -+ * the back and forward links can be done. This is useful as a debugging check. -+ * If @abortstr is non-NULL, that will be printed in a diagnostic if the list -+ * is inconsistent, and the function will abort. -+ * -+ * Returns the list head if the list is consistent, NULL if not (it -+ * can never return NULL if @abortstr is set). -+ * -+ * See also: list_check_node() -+ * -+ * Example: -+ * static void dump_parent(struct parent *p) -+ * { -+ * struct child *c; -+ * -+ * printf("%s (%u children):\n", p->name, p->num_children); -+ * list_check(&p->children, "bad child list"); -+ * list_for_each(&p->children, c, list) -+ * printf(" -> %s\n", c->name); -+ * } -+ */ -+struct list_head *list_check(const struct list_head *h, const char *abortstr); -+ -+/** -+ * list_check_node - check node of a list for consistency -+ * @n: the list_node -+ * @abortstr: the location to print on aborting, or NULL. -+ * -+ * Check consistency of the list node is in (it must be in one). -+ * -+ * See also: list_check() -+ * -+ * Example: -+ * static void dump_child(const struct child *c) -+ * { -+ * list_check_node(&c->list, "bad child list"); -+ * printf("%s\n", c->name); -+ * } -+ */ -+struct list_node *list_check_node(const struct list_node *n, -+ const char *abortstr); -+ -+#define LIST_LOC __FILE__ ":" stringify(__LINE__) -+#ifdef CCAN_LIST_DEBUG -+#define list_debug(h, loc) list_check((h), loc) -+#define list_debug_node(n, loc) list_check_node((n), loc) -+#else -+#define list_debug(h, loc) ((void)loc, h) -+#define list_debug_node(n, loc) ((void)loc, n) -+#endif -+ -+/** -+ * LIST_HEAD_INIT - initializer for an empty list_head -+ * @name: the name of the list. -+ * -+ * Explicit initializer for an empty list. -+ * -+ * See also: -+ * LIST_HEAD, list_head_init() -+ * -+ * Example: -+ * static struct list_head my_list = LIST_HEAD_INIT(my_list); -+ */ -+#define LIST_HEAD_INIT(name) { { &(name).n, &(name).n } } -+ -+/** -+ * LIST_HEAD - define and initialize an empty list_head -+ * @name: the name of the list. -+ * -+ * The LIST_HEAD macro defines a list_head and initializes it to an empty -+ * list. It can be prepended by "static" to define a static list_head. -+ * -+ * See also: -+ * LIST_HEAD_INIT, list_head_init() -+ * -+ * Example: -+ * static LIST_HEAD(my_global_list); -+ */ -+#define LIST_HEAD(name) \ -+ struct list_head name = LIST_HEAD_INIT(name) -+ -+/** -+ * list_head_init - initialize a list_head -+ * @h: the list_head to set to the empty list -+ * -+ * Example: -+ * ... -+ * struct parent *parent = malloc(sizeof(*parent)); -+ * -+ * list_head_init(&parent->children); -+ * parent->num_children = 0; -+ */ -+static inline void list_head_init(struct list_head *h) -+{ -+ h->n.next = h->n.prev = &h->n; -+} -+ -+/** -+ * list_node_init - initialize a list_node -+ * @n: the list_node to link to itself. -+ * -+ * You don't need to use this normally! But it lets you list_del(@n) -+ * safely. -+ */ -+static inline void list_node_init(struct list_node *n) -+{ -+ n->next = n->prev = n; -+} -+ -+/** -+ * list_add_after - add an entry after an existing node in a linked list -+ * @h: the list_head to add the node to (for debugging) -+ * @p: the existing list_node to add the node after -+ * @n: the new list_node to add to the list. -+ * -+ * The existing list_node must already be a member of the list. -+ * The new list_node does not need to be initialized; it will be overwritten. -+ * -+ * Example: -+ * struct child c1, c2, c3; -+ * LIST_HEAD(h); -+ * -+ * list_add_tail(&h, &c1.list); -+ * list_add_tail(&h, &c3.list); -+ * list_add_after(&h, &c1.list, &c2.list); -+ */ -+#define list_add_after(h, p, n) list_add_after_(h, p, n, LIST_LOC) -+static inline void list_add_after_(struct list_head *h, -+ struct list_node *p, -+ struct list_node *n, -+ const char *abortstr) -+{ -+ n->next = p->next; -+ n->prev = p; -+ p->next->prev = n; -+ p->next = n; -+ (void)list_debug(h, abortstr); -+} -+ -+/** -+ * list_add - add an entry at the start of a linked list. -+ * @h: the list_head to add the node to -+ * @n: the list_node to add to the list. -+ * -+ * The list_node does not need to be initialized; it will be overwritten. -+ * Example: -+ * struct child *child = malloc(sizeof(*child)); -+ * -+ * child->name = "marvin"; -+ * list_add(&parent->children, &child->list); -+ * parent->num_children++; -+ */ -+#define list_add(h, n) list_add_(h, n, LIST_LOC) -+static inline void list_add_(struct list_head *h, -+ struct list_node *n, -+ const char *abortstr) -+{ -+ list_add_after_(h, &h->n, n, abortstr); -+} -+ -+/** -+ * list_add_before - add an entry before an existing node in a linked list -+ * @h: the list_head to add the node to (for debugging) -+ * @p: the existing list_node to add the node before -+ * @n: the new list_node to add to the list. -+ * -+ * The existing list_node must already be a member of the list. -+ * The new list_node does not need to be initialized; it will be overwritten. -+ * -+ * Example: -+ * list_head_init(&h); -+ * list_add_tail(&h, &c1.list); -+ * list_add_tail(&h, &c3.list); -+ * list_add_before(&h, &c3.list, &c2.list); -+ */ -+#define list_add_before(h, p, n) list_add_before_(h, p, n, LIST_LOC) -+static inline void list_add_before_(struct list_head *h, -+ struct list_node *p, -+ struct list_node *n, -+ const char *abortstr) -+{ -+ n->next = p; -+ n->prev = p->prev; -+ p->prev->next = n; -+ p->prev = n; -+ (void)list_debug(h, abortstr); -+} -+ -+/** -+ * list_add_tail - add an entry at the end of a linked list. -+ * @h: the list_head to add the node to -+ * @n: the list_node to add to the list. -+ * -+ * The list_node does not need to be initialized; it will be overwritten. -+ * Example: -+ * list_add_tail(&parent->children, &child->list); -+ * parent->num_children++; -+ */ -+#define list_add_tail(h, n) list_add_tail_(h, n, LIST_LOC) -+static inline void list_add_tail_(struct list_head *h, -+ struct list_node *n, -+ const char *abortstr) -+{ -+ list_add_before_(h, &h->n, n, abortstr); -+} -+ -+/** -+ * list_empty - is a list empty? -+ * @h: the list_head -+ * -+ * If the list is empty, returns true. -+ * -+ * Example: -+ * assert(list_empty(&parent->children) == (parent->num_children == 0)); -+ */ -+#define list_empty(h) list_empty_(h, LIST_LOC) -+static inline bool list_empty_(const struct list_head *h, const char* abortstr) -+{ -+ (void)list_debug(h, abortstr); -+ return h->n.next == &h->n; -+} -+ -+/** -+ * list_empty_nodebug - is a list empty (and don't perform debug checks)? -+ * @h: the list_head -+ * -+ * If the list is empty, returns true. -+ * This differs from list_empty() in that if CCAN_LIST_DEBUG is set it -+ * will NOT perform debug checks. Only use this function if you REALLY -+ * know what you're doing. -+ * -+ * Example: -+ * assert(list_empty_nodebug(&parent->children) == (parent->num_children == 0)); -+ */ -+#ifndef CCAN_LIST_DEBUG -+#define list_empty_nodebug(h) list_empty(h) -+#else -+static inline bool list_empty_nodebug(const struct list_head *h) -+{ -+ return h->n.next == &h->n; -+} -+#endif -+ -+/** -+ * list_empty_nocheck - is a list empty? -+ * @h: the list_head -+ * -+ * If the list is empty, returns true. This doesn't perform any -+ * debug check for list consistency, so it can be called without -+ * locks, racing with the list being modified. This is ok for -+ * checks where an incorrect result is not an issue (optimized -+ * bail out path for example). -+ */ -+static inline bool list_empty_nocheck(const struct list_head *h) -+{ -+ return h->n.next == &h->n; -+} -+ -+/** -+ * list_del - delete an entry from an (unknown) linked list. -+ * @n: the list_node to delete from the list. -+ * -+ * Note that this leaves @n in an undefined state; it can be added to -+ * another list, but not deleted again. -+ * -+ * See also: -+ * list_del_from(), list_del_init() -+ * -+ * Example: -+ * list_del(&child->list); -+ * parent->num_children--; -+ */ -+#define list_del(n) list_del_(n, LIST_LOC) -+static inline void list_del_(struct list_node *n, const char* abortstr) -+{ -+ (void)list_debug_node(n, abortstr); -+ n->next->prev = n->prev; -+ n->prev->next = n->next; -+#ifdef CCAN_LIST_DEBUG -+ /* Catch use-after-del. */ -+ n->next = n->prev = NULL; -+#endif -+} -+ -+/** -+ * list_del_init - delete a node, and reset it so it can be deleted again. -+ * @n: the list_node to be deleted. -+ * -+ * list_del(@n) or list_del_init() again after this will be safe, -+ * which can be useful in some cases. -+ * -+ * See also: -+ * list_del_from(), list_del() -+ * -+ * Example: -+ * list_del_init(&child->list); -+ * parent->num_children--; -+ */ -+#define list_del_init(n) list_del_init_(n, LIST_LOC) -+static inline void list_del_init_(struct list_node *n, const char *abortstr) -+{ -+ list_del_(n, abortstr); -+ list_node_init(n); -+} -+ -+/** -+ * list_del_from - delete an entry from a known linked list. -+ * @h: the list_head the node is in. -+ * @n: the list_node to delete from the list. -+ * -+ * This explicitly indicates which list a node is expected to be in, -+ * which is better documentation and can catch more bugs. -+ * -+ * See also: list_del() -+ * -+ * Example: -+ * list_del_from(&parent->children, &child->list); -+ * parent->num_children--; -+ */ -+static inline void list_del_from(struct list_head *h, struct list_node *n) -+{ -+#ifdef CCAN_LIST_DEBUG -+ { -+ /* Thorough check: make sure it was in list! */ -+ struct list_node *i; -+ for (i = h->n.next; i != n; i = i->next) -+ assert(i != &h->n); -+ } -+#endif /* CCAN_LIST_DEBUG */ -+ -+ /* Quick test that catches a surprising number of bugs. */ -+ assert(!list_empty(h)); -+ list_del(n); -+} -+ -+/** -+ * list_swap - swap out an entry from an (unknown) linked list for a new one. -+ * @o: the list_node to replace from the list. -+ * @n: the list_node to insert in place of the old one. -+ * -+ * Note that this leaves @o in an undefined state; it can be added to -+ * another list, but not deleted/swapped again. -+ * -+ * See also: -+ * list_del() -+ * -+ * Example: -+ * struct child x1, x2; -+ * LIST_HEAD(xh); -+ * -+ * list_add(&xh, &x1.list); -+ * list_swap(&x1.list, &x2.list); -+ */ -+#define list_swap(o, n) list_swap_(o, n, LIST_LOC) -+static inline void list_swap_(struct list_node *o, -+ struct list_node *n, -+ const char* abortstr) -+{ -+ (void)list_debug_node(o, abortstr); -+ *n = *o; -+ n->next->prev = n; -+ n->prev->next = n; -+#ifdef CCAN_LIST_DEBUG -+ /* Catch use-after-del. */ -+ o->next = o->prev = NULL; -+#endif -+} -+ -+/** -+ * list_entry - convert a list_node back into the structure containing it. -+ * @n: the list_node -+ * @type: the type of the entry -+ * @member: the list_node member of the type -+ * -+ * Example: -+ * // First list entry is children.next; convert back to child. -+ * child = list_entry(parent->children.n.next, struct child, list); -+ * -+ * See Also: -+ * list_top(), list_for_each() -+ */ -+#define list_entry(n, type, member) container_of(n, type, member) -+ -+/** -+ * list_top - get the first entry in a list -+ * @h: the list_head -+ * @type: the type of the entry -+ * @member: the list_node member of the type -+ * -+ * If the list is empty, returns NULL. -+ * -+ * Example: -+ * struct child *first; -+ * first = list_top(&parent->children, struct child, list); -+ * if (!first) -+ * printf("Empty list!\n"); -+ */ -+#define list_top(h, type, member) \ -+ ((type *)list_top_((h), list_off_(type, member))) -+ -+static inline const void *list_top_(const struct list_head *h, size_t off) -+{ -+ if (list_empty(h)) -+ return NULL; -+ return (const char *)h->n.next - off; -+} -+ -+/** -+ * list_pop - remove the first entry in a list -+ * @h: the list_head -+ * @type: the type of the entry -+ * @member: the list_node member of the type -+ * -+ * If the list is empty, returns NULL. -+ * -+ * Example: -+ * struct child *one; -+ * one = list_pop(&parent->children, struct child, list); -+ * if (!one) -+ * printf("Empty list!\n"); -+ */ -+#define list_pop(h, type, member) \ -+ ((type *)list_pop_((h), list_off_(type, member))) -+ -+static inline const void *list_pop_(const struct list_head *h, size_t off) -+{ -+ struct list_node *n; -+ -+ if (list_empty(h)) -+ return NULL; -+ n = h->n.next; -+ list_del(n); -+ return (const char *)n - off; -+} -+ -+/** -+ * list_tail - get the last entry in a list -+ * @h: the list_head -+ * @type: the type of the entry -+ * @member: the list_node member of the type -+ * -+ * If the list is empty, returns NULL. -+ * -+ * Example: -+ * struct child *last; -+ * last = list_tail(&parent->children, struct child, list); -+ * if (!last) -+ * printf("Empty list!\n"); -+ */ -+#define list_tail(h, type, member) \ -+ ((type *)list_tail_((h), list_off_(type, member))) -+ -+static inline const void *list_tail_(const struct list_head *h, size_t off) -+{ -+ if (list_empty(h)) -+ return NULL; -+ return (const char *)h->n.prev - off; -+} -+ -+/** -+ * list_for_each - iterate through a list. -+ * @h: the list_head (warning: evaluated multiple times!) -+ * @i: the structure containing the list_node -+ * @member: the list_node member of the structure -+ * -+ * This is a convenient wrapper to iterate @i over the entire list. It's -+ * a for loop, so you can break and continue as normal. -+ * -+ * Example: -+ * list_for_each(&parent->children, child, list) -+ * printf("Name: %s\n", child->name); -+ */ -+#define list_for_each(h, i, member) \ -+ list_for_each_off(h, i, list_off_var_(i, member)) -+ -+/** -+ * list_for_each_rev - iterate through a list backwards. -+ * @h: the list_head -+ * @i: the structure containing the list_node -+ * @member: the list_node member of the structure -+ * -+ * This is a convenient wrapper to iterate @i over the entire list. It's -+ * a for loop, so you can break and continue as normal. -+ * -+ * Example: -+ * list_for_each_rev(&parent->children, child, list) -+ * printf("Name: %s\n", child->name); -+ */ -+#define list_for_each_rev(h, i, member) \ -+ list_for_each_rev_off(h, i, list_off_var_(i, member)) -+ -+/** -+ * list_for_each_rev_safe - iterate through a list backwards, -+ * maybe during deletion -+ * @h: the list_head -+ * @i: the structure containing the list_node -+ * @nxt: the structure containing the list_node -+ * @member: the list_node member of the structure -+ * -+ * This is a convenient wrapper to iterate @i over the entire list backwards. -+ * It's a for loop, so you can break and continue as normal. The extra -+ * variable * @nxt is used to hold the next element, so you can delete @i -+ * from the list. -+ * -+ * Example: -+ * struct child *next; -+ * list_for_each_rev_safe(&parent->children, child, next, list) { -+ * printf("Name: %s\n", child->name); -+ * } -+ */ -+#define list_for_each_rev_safe(h, i, nxt, member) \ -+ list_for_each_rev_safe_off(h, i, nxt, list_off_var_(i, member)) -+ -+/** -+ * list_for_each_safe - iterate through a list, maybe during deletion -+ * @h: the list_head -+ * @i: the structure containing the list_node -+ * @nxt: the structure containing the list_node -+ * @member: the list_node member of the structure -+ * -+ * This is a convenient wrapper to iterate @i over the entire list. It's -+ * a for loop, so you can break and continue as normal. The extra variable -+ * @nxt is used to hold the next element, so you can delete @i from the list. -+ * -+ * Example: -+ * list_for_each_safe(&parent->children, child, next, list) { -+ * list_del(&child->list); -+ * parent->num_children--; -+ * } -+ */ -+#define list_for_each_safe(h, i, nxt, member) \ -+ list_for_each_safe_off(h, i, nxt, list_off_var_(i, member)) -+ -+/** -+ * list_next - get the next entry in a list -+ * @h: the list_head -+ * @i: a pointer to an entry in the list. -+ * @member: the list_node member of the structure -+ * -+ * If @i was the last entry in the list, returns NULL. -+ * -+ * Example: -+ * struct child *second; -+ * second = list_next(&parent->children, first, list); -+ * if (!second) -+ * printf("No second child!\n"); -+ */ -+#define list_next(h, i, member) \ -+ ((list_typeof(i))list_entry_or_null(list_debug(h, \ -+ __FILE__ ":" stringify(__LINE__)), \ -+ (i)->member.next, \ -+ list_off_var_((i), member))) -+ -+/** -+ * list_prev - get the previous entry in a list -+ * @h: the list_head -+ * @i: a pointer to an entry in the list. -+ * @member: the list_node member of the structure -+ * -+ * If @i was the first entry in the list, returns NULL. -+ * -+ * Example: -+ * first = list_prev(&parent->children, second, list); -+ * if (!first) -+ * printf("Can't go back to first child?!\n"); -+ */ -+#define list_prev(h, i, member) \ -+ ((list_typeof(i))list_entry_or_null(list_debug(h, \ -+ __FILE__ ":" stringify(__LINE__)), \ -+ (i)->member.prev, \ -+ list_off_var_((i), member))) -+ -+/** -+ * list_append_list - empty one list onto the end of another. -+ * @to: the list to append into -+ * @from: the list to empty. -+ * -+ * This takes the entire contents of @from and moves it to the end of -+ * @to. After this @from will be empty. -+ * -+ * Example: -+ * struct list_head adopter; -+ * -+ * list_append_list(&adopter, &parent->children); -+ * assert(list_empty(&parent->children)); -+ * parent->num_children = 0; -+ */ -+#define list_append_list(t, f) list_append_list_(t, f, \ -+ __FILE__ ":" stringify(__LINE__)) -+static inline void list_append_list_(struct list_head *to, -+ struct list_head *from, -+ const char *abortstr) -+{ -+ struct list_node *from_tail = list_debug(from, abortstr)->n.prev; -+ struct list_node *to_tail = list_debug(to, abortstr)->n.prev; -+ -+ /* Sew in head and entire list. */ -+ to->n.prev = from_tail; -+ from_tail->next = &to->n; -+ to_tail->next = &from->n; -+ from->n.prev = to_tail; -+ -+ /* Now remove head. */ -+ list_del(&from->n); -+ list_head_init(from); -+} -+ -+/** -+ * list_prepend_list - empty one list into the start of another. -+ * @to: the list to prepend into -+ * @from: the list to empty. -+ * -+ * This takes the entire contents of @from and moves it to the start -+ * of @to. After this @from will be empty. -+ * -+ * Example: -+ * list_prepend_list(&adopter, &parent->children); -+ * assert(list_empty(&parent->children)); -+ * parent->num_children = 0; -+ */ -+#define list_prepend_list(t, f) list_prepend_list_(t, f, LIST_LOC) -+static inline void list_prepend_list_(struct list_head *to, -+ struct list_head *from, -+ const char *abortstr) -+{ -+ struct list_node *from_tail = list_debug(from, abortstr)->n.prev; -+ struct list_node *to_head = list_debug(to, abortstr)->n.next; -+ -+ /* Sew in head and entire list. */ -+ to->n.next = &from->n; -+ from->n.prev = &to->n; -+ to_head->prev = from_tail; -+ from_tail->next = to_head; -+ -+ /* Now remove head. */ -+ list_del(&from->n); -+ list_head_init(from); -+} -+ -+/* internal macros, do not use directly */ -+#define list_for_each_off_dir_(h, i, off, dir) \ -+ for (i = list_node_to_off_(list_debug(h, LIST_LOC)->n.dir, \ -+ (off)); \ -+ list_node_from_off_((void *)i, (off)) != &(h)->n; \ -+ i = list_node_to_off_(list_node_from_off_((void *)i, (off))->dir, \ -+ (off))) -+ -+#define list_for_each_safe_off_dir_(h, i, nxt, off, dir) \ -+ for (i = list_node_to_off_(list_debug(h, LIST_LOC)->n.dir, \ -+ (off)), \ -+ nxt = list_node_to_off_(list_node_from_off_(i, (off))->dir, \ -+ (off)); \ -+ list_node_from_off_(i, (off)) != &(h)->n; \ -+ i = nxt, \ -+ nxt = list_node_to_off_(list_node_from_off_(i, (off))->dir, \ -+ (off))) -+ -+/** -+ * list_for_each_off - iterate through a list of memory regions. -+ * @h: the list_head -+ * @i: the pointer to a memory region wich contains list node data. -+ * @off: offset(relative to @i) at which list node data resides. -+ * -+ * This is a low-level wrapper to iterate @i over the entire list, used to -+ * implement all oher, more high-level, for-each constructs. It's a for loop, -+ * so you can break and continue as normal. -+ * -+ * WARNING! Being the low-level macro that it is, this wrapper doesn't know -+ * nor care about the type of @i. The only assumtion made is that @i points -+ * to a chunk of memory that at some @offset, relative to @i, contains a -+ * properly filled `struct node_list' which in turn contains pointers to -+ * memory chunks and it's turtles all the way down. Whith all that in mind -+ * remember that given the wrong pointer/offset couple this macro will -+ * happilly churn all you memory untill SEGFAULT stops it, in other words -+ * caveat emptor. -+ * -+ * It is worth mentioning that one of legitimate use-cases for that wrapper -+ * is operation on opaque types with known offset for `struct list_node' -+ * member(preferably 0), because it allows you not to disclose the type of -+ * @i. -+ * -+ * Example: -+ * list_for_each_off(&parent->children, child, -+ * offsetof(struct child, list)) -+ * printf("Name: %s\n", child->name); -+ */ -+#define list_for_each_off(h, i, off) \ -+ list_for_each_off_dir_((h),(i),(off),next) -+ -+/** -+ * list_for_each_rev_off - iterate through a list of memory regions backwards -+ * @h: the list_head -+ * @i: the pointer to a memory region wich contains list node data. -+ * @off: offset(relative to @i) at which list node data resides. -+ * -+ * See list_for_each_off for details -+ */ -+#define list_for_each_rev_off(h, i, off) \ -+ list_for_each_off_dir_((h),(i),(off),prev) -+ -+/** -+ * list_for_each_safe_off - iterate through a list of memory regions, maybe -+ * during deletion -+ * @h: the list_head -+ * @i: the pointer to a memory region wich contains list node data. -+ * @nxt: the structure containing the list_node -+ * @off: offset(relative to @i) at which list node data resides. -+ * -+ * For details see `list_for_each_off' and `list_for_each_safe' -+ * descriptions. -+ * -+ * Example: -+ * list_for_each_safe_off(&parent->children, child, -+ * next, offsetof(struct child, list)) -+ * printf("Name: %s\n", child->name); -+ */ -+#define list_for_each_safe_off(h, i, nxt, off) \ -+ list_for_each_safe_off_dir_((h),(i),(nxt),(off),next) -+ -+/** -+ * list_for_each_rev_safe_off - iterate backwards through a list of -+ * memory regions, maybe during deletion -+ * @h: the list_head -+ * @i: the pointer to a memory region wich contains list node data. -+ * @nxt: the structure containing the list_node -+ * @off: offset(relative to @i) at which list node data resides. -+ * -+ * For details see `list_for_each_rev_off' and `list_for_each_rev_safe' -+ * descriptions. -+ * -+ * Example: -+ * list_for_each_rev_safe_off(&parent->children, child, -+ * next, offsetof(struct child, list)) -+ * printf("Name: %s\n", child->name); -+ */ -+#define list_for_each_rev_safe_off(h, i, nxt, off) \ -+ list_for_each_safe_off_dir_((h),(i),(nxt),(off),prev) -+ -+/* Other -off variants. */ -+#define list_entry_off(n, type, off) \ -+ ((type *)list_node_from_off_((n), (off))) -+ -+#define list_head_off(h, type, off) \ -+ ((type *)list_head_off((h), (off))) -+ -+#define list_tail_off(h, type, off) \ -+ ((type *)list_tail_((h), (off))) -+ -+#define list_add_off(h, n, off) \ -+ list_add((h), list_node_from_off_((n), (off))) -+ -+#define list_del_off(n, off) \ -+ list_del(list_node_from_off_((n), (off))) -+ -+#define list_del_from_off(h, n, off) \ -+ list_del_from(h, list_node_from_off_((n), (off))) -+ -+/* Offset helper functions so we only single-evaluate. */ -+static inline void *list_node_to_off_(struct list_node *node, size_t off) -+{ -+ return (void *)((char *)node - off); -+} -+static inline struct list_node *list_node_from_off_(void *ptr, size_t off) -+{ -+ return (struct list_node *)((char *)ptr + off); -+} -+ -+/* Get the offset of the member, but make sure it's a list_node. */ -+#define list_off_(type, member) \ -+ (container_off(type, member) + \ -+ check_type(((type *)0)->member, struct list_node)) -+ -+#define list_off_var_(var, member) \ -+ (container_off_var(var, member) + \ -+ check_type(var->member, struct list_node)) -+ -+#if HAVE_TYPEOF -+#define list_typeof(var) typeof(var) -+#else -+#define list_typeof(var) void * -+#endif -+ -+/* Returns member, or NULL if at end of list. */ -+static inline void *list_entry_or_null(const struct list_head *h, -+ const struct list_node *n, -+ size_t off) -+{ -+ if (n == &h->n) -+ return NULL; -+ return (char *)n - off; -+} -+#endif /* CCAN_LIST_H */ -diff --git a/src/rc-compat/v37/ccan/minmax.h b/src/rc-compat/v37/ccan/minmax.h -new file mode 100644 -index 000000000000..ab6c55472b9a ---- /dev/null -+++ b/src/rc-compat/v37/ccan/minmax.h -@@ -0,0 +1,65 @@ -+/* CC0 (Public domain) - see LICENSE.CC0 file for details */ -+#ifndef CCAN_MINMAX_H -+#define CCAN_MINMAX_H -+ -+#include "config.h" -+ -+#include -+ -+#if !HAVE_STATEMENT_EXPR || !HAVE_TYPEOF -+/* -+ * Without these, there's no way to avoid unsafe double evaluation of -+ * the arguments -+ */ -+#error Sorry, minmax module requires statement expressions and typeof -+#endif -+ -+#if HAVE_BUILTIN_TYPES_COMPATIBLE_P -+#define MINMAX_ASSERT_COMPATIBLE(a, b) \ -+ BUILD_ASSERT(__builtin_types_compatible_p(a, b)) -+#else -+#define MINMAX_ASSERT_COMPATIBLE(a, b) \ -+ do { } while (0) -+#endif -+ -+#define min(a, b) \ -+ ({ \ -+ typeof(a) _a = (a); \ -+ typeof(b) _b = (b); \ -+ MINMAX_ASSERT_COMPATIBLE(typeof(_a), typeof(_b)); \ -+ _a < _b ? _a : _b; \ -+ }) -+ -+#define max(a, b) \ -+ ({ \ -+ typeof(a) _a = (a); \ -+ typeof(b) _b = (b); \ -+ MINMAX_ASSERT_COMPATIBLE(typeof(_a), typeof(_b)); \ -+ _a > _b ? _a : _b; \ -+ }) -+ -+#define clamp(v, f, c) (max(min((v), (c)), (f))) -+ -+ -+#define min_t(t, a, b) \ -+ ({ \ -+ t _ta = (a); \ -+ t _tb = (b); \ -+ min(_ta, _tb); \ -+ }) -+#define max_t(t, a, b) \ -+ ({ \ -+ t _ta = (a); \ -+ t _tb = (b); \ -+ max(_ta, _tb); \ -+ }) -+ -+#define clamp_t(t, v, f, c) \ -+ ({ \ -+ t _tv = (v); \ -+ t _tf = (f); \ -+ t _tc = (c); \ -+ clamp(_tv, _tf, _tc); \ -+ }) -+ -+#endif /* CCAN_MINMAX_H */ -diff --git a/src/rc-compat/v37/ccan/str.h b/src/rc-compat/v37/ccan/str.h -new file mode 100644 -index 000000000000..68c8a518b700 ---- /dev/null -+++ b/src/rc-compat/v37/ccan/str.h -@@ -0,0 +1,228 @@ -+/* CC0 (Public domain) - see LICENSE.CC0 file for details */ -+#ifndef CCAN_STR_H -+#define CCAN_STR_H -+#include "config.h" -+#include -+#include -+#include -+#include -+ -+/** -+ * streq - Are two strings equal? -+ * @a: first string -+ * @b: first string -+ * -+ * This macro is arguably more readable than "!strcmp(a, b)". -+ * -+ * Example: -+ * if (streq(somestring, "")) -+ * printf("String is empty!\n"); -+ */ -+#define streq(a,b) (strcmp((a),(b)) == 0) -+ -+/** -+ * strstarts - Does this string start with this prefix? -+ * @str: string to test -+ * @prefix: prefix to look for at start of str -+ * -+ * Example: -+ * if (strstarts(somestring, "foo")) -+ * printf("String %s begins with 'foo'!\n", somestring); -+ */ -+#define strstarts(str,prefix) (strncmp((str),(prefix),strlen(prefix)) == 0) -+ -+/** -+ * strends - Does this string end with this postfix? -+ * @str: string to test -+ * @postfix: postfix to look for at end of str -+ * -+ * Example: -+ * if (strends(somestring, "foo")) -+ * printf("String %s end with 'foo'!\n", somestring); -+ */ -+static inline bool strends(const char *str, const char *postfix) -+{ -+ if (strlen(str) < strlen(postfix)) -+ return false; -+ -+ return streq(str + strlen(str) - strlen(postfix), postfix); -+} -+ -+/** -+ * stringify - Turn expression into a string literal -+ * @expr: any C expression -+ * -+ * Example: -+ * #define PRINT_COND_IF_FALSE(cond) \ -+ * ((cond) || printf("%s is false!", stringify(cond))) -+ */ -+#define stringify(expr) stringify_1(expr) -+/* Double-indirection required to stringify expansions */ -+#define stringify_1(expr) #expr -+ -+/** -+ * strcount - Count number of (non-overlapping) occurrences of a substring. -+ * @haystack: a C string -+ * @needle: a substring -+ * -+ * Example: -+ * assert(strcount("aaa aaa", "a") == 6); -+ * assert(strcount("aaa aaa", "ab") == 0); -+ * assert(strcount("aaa aaa", "aa") == 2); -+ */ -+size_t strcount(const char *haystack, const char *needle); -+ -+/** -+ * STR_MAX_CHARS - Maximum possible size of numeric string for this type. -+ * @type_or_expr: a pointer or integer type or expression. -+ * -+ * This provides enough space for a nul-terminated string which represents the -+ * largest possible value for the type or expression. -+ * -+ * Note: The implementation adds extra space so hex values or negative -+ * values will fit (eg. sprintf(... "%p"). ) -+ * -+ * Example: -+ * char str[STR_MAX_CHARS(int)]; -+ * -+ * sprintf(str, "%i", 7); -+ */ -+#define STR_MAX_CHARS(type_or_expr) \ -+ ((sizeof(type_or_expr) * CHAR_BIT + 8) / 9 * 3 + 2 \ -+ + STR_MAX_CHARS_TCHECK_(type_or_expr)) -+ -+#if HAVE_TYPEOF -+/* Only a simple type can have 0 assigned, so test that. */ -+#define STR_MAX_CHARS_TCHECK_(type_or_expr) \ -+ ({ typeof(type_or_expr) x = 0; (void)x; 0; }) -+#else -+#define STR_MAX_CHARS_TCHECK_(type_or_expr) 0 -+#endif -+ -+/** -+ * cisalnum - isalnum() which takes a char (and doesn't accept EOF) -+ * @c: a character -+ * -+ * Surprisingly, the standard ctype.h isalnum() takes an int, which -+ * must have the value of EOF (-1) or an unsigned char. This variant -+ * takes a real char, and doesn't accept EOF. -+ */ -+static inline bool cisalnum(char c) -+{ -+ return isalnum((unsigned char)c); -+} -+static inline bool cisalpha(char c) -+{ -+ return isalpha((unsigned char)c); -+} -+static inline bool cisascii(char c) -+{ -+ return isascii((unsigned char)c); -+} -+#if HAVE_ISBLANK -+static inline bool cisblank(char c) -+{ -+ return isblank((unsigned char)c); -+} -+#endif -+static inline bool ciscntrl(char c) -+{ -+ return iscntrl((unsigned char)c); -+} -+static inline bool cisdigit(char c) -+{ -+ return isdigit((unsigned char)c); -+} -+static inline bool cisgraph(char c) -+{ -+ return isgraph((unsigned char)c); -+} -+static inline bool cislower(char c) -+{ -+ return islower((unsigned char)c); -+} -+static inline bool cisprint(char c) -+{ -+ return isprint((unsigned char)c); -+} -+static inline bool cispunct(char c) -+{ -+ return ispunct((unsigned char)c); -+} -+static inline bool cisspace(char c) -+{ -+ return isspace((unsigned char)c); -+} -+static inline bool cisupper(char c) -+{ -+ return isupper((unsigned char)c); -+} -+static inline bool cisxdigit(char c) -+{ -+ return isxdigit((unsigned char)c); -+} -+ -+#include -+ -+/* These checks force things out of line, hence they are under DEBUG. */ -+#ifdef CCAN_STR_DEBUG -+#include -+ -+/* These are commonly misused: they take -1 or an *unsigned* char value. */ -+#undef isalnum -+#undef isalpha -+#undef isascii -+#undef isblank -+#undef iscntrl -+#undef isdigit -+#undef isgraph -+#undef islower -+#undef isprint -+#undef ispunct -+#undef isspace -+#undef isupper -+#undef isxdigit -+ -+/* You can use a char if char is unsigned. */ -+#if HAVE_BUILTIN_TYPES_COMPATIBLE_P && HAVE_TYPEOF -+#define str_check_arg_(i) \ -+ ((i) + BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(i), \ -+ char) \ -+ || (char)255 > 0)) -+#else -+#define str_check_arg_(i) (i) -+#endif -+ -+#define isalnum(i) str_isalnum(str_check_arg_(i)) -+#define isalpha(i) str_isalpha(str_check_arg_(i)) -+#define isascii(i) str_isascii(str_check_arg_(i)) -+#if HAVE_ISBLANK -+#define isblank(i) str_isblank(str_check_arg_(i)) -+#endif -+#define iscntrl(i) str_iscntrl(str_check_arg_(i)) -+#define isdigit(i) str_isdigit(str_check_arg_(i)) -+#define isgraph(i) str_isgraph(str_check_arg_(i)) -+#define islower(i) str_islower(str_check_arg_(i)) -+#define isprint(i) str_isprint(str_check_arg_(i)) -+#define ispunct(i) str_ispunct(str_check_arg_(i)) -+#define isspace(i) str_isspace(str_check_arg_(i)) -+#define isupper(i) str_isupper(str_check_arg_(i)) -+#define isxdigit(i) str_isxdigit(str_check_arg_(i)) -+ -+#if HAVE_TYPEOF -+/* With GNU magic, we can make const-respecting standard string functions. */ -+#undef strstr -+#undef strchr -+#undef strrchr -+ -+/* + 0 is needed to decay array into pointer. */ -+#define strstr(haystack, needle) \ -+ ((typeof((haystack) + 0))str_strstr((haystack), (needle))) -+#define strchr(haystack, c) \ -+ ((typeof((haystack) + 0))str_strchr((haystack), (c))) -+#define strrchr(haystack, c) \ -+ ((typeof((haystack) + 0))str_strrchr((haystack), (c))) -+#endif -+#endif /* CCAN_STR_DEBUG */ -+ -+#endif /* CCAN_STR_H */ -diff --git a/src/rc-compat/v37/ccan/str_debug.h b/src/rc-compat/v37/ccan/str_debug.h -new file mode 100644 -index 000000000000..7a3343816f7f ---- /dev/null -+++ b/src/rc-compat/v37/ccan/str_debug.h -@@ -0,0 +1,30 @@ -+/* CC0 (Public domain) - see LICENSE.CC0 file for details */ -+#ifndef CCAN_STR_DEBUG_H -+#define CCAN_STR_DEBUG_H -+ -+/* #define CCAN_STR_DEBUG 1 */ -+ -+#ifdef CCAN_STR_DEBUG -+/* Because we mug the real ones with macros, we need our own wrappers. */ -+int str_isalnum(int i); -+int str_isalpha(int i); -+int str_isascii(int i); -+#if HAVE_ISBLANK -+int str_isblank(int i); -+#endif -+int str_iscntrl(int i); -+int str_isdigit(int i); -+int str_isgraph(int i); -+int str_islower(int i); -+int str_isprint(int i); -+int str_ispunct(int i); -+int str_isspace(int i); -+int str_isupper(int i); -+int str_isxdigit(int i); -+ -+char *str_strstr(const char *haystack, const char *needle); -+char *str_strchr(const char *s, int c); -+char *str_strrchr(const char *s, int c); -+#endif /* CCAN_STR_DEBUG */ -+ -+#endif /* CCAN_STR_DEBUG_H */ -diff --git a/src/rc-compat/v37/cmd_ioctl.h b/src/rc-compat/v37/cmd_ioctl.h -new file mode 100644 -index 000000000000..d5889a16ecc3 ---- /dev/null -+++ b/src/rc-compat/v37/cmd_ioctl.h -@@ -0,0 +1,412 @@ -+/* -+ * Copyright (c) 2018 Mellanox Technologies, Ltd. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#ifndef __INFINIBAND_VERBS_IOCTL_H -+#define __INFINIBAND_VERBS_IOCTL_H -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static inline uint64_t ioctl_ptr_to_u64(const void *ptr) -+{ -+ if (sizeof(ptr) == sizeof(uint64_t)) -+ return (uintptr_t)ptr; -+ -+ /* -+ * Some CPU architectures require sign extension when converting from -+ * a 32 bit to 64 bit pointer. This should match the kernel -+ * implementation of compat_ptr() for the architecture. -+ */ -+#if defined(__tilegx__) -+ return (int64_t)(intptr_t)ptr; -+#else -+ return (uintptr_t)ptr; -+#endif -+} -+ -+static inline void _scrub_ptr_attr(void **ptr) -+{ -+#if UINTPTR_MAX == UINT64_MAX -+ /* Do nothing */ -+#else -+ RDMA_UAPI_PTR(void *, data) *scrub_data; -+ -+ scrub_data = container_of(ptr, typeof(*scrub_data), data); -+ scrub_data->data_data_u64 = ioctl_ptr_to_u64(scrub_data->data); -+#endif -+} -+ -+#define scrub_ptr_attr(ptr) _scrub_ptr_attr((void **)(&ptr)) -+ -+/* -+ * The command buffer is organized as a linked list of blocks of attributes. -+ * Each stack frame allocates its block and then calls up toward to core code -+ * which will do the ioctl. The frame that does the ioctl calls the special -+ * FINAL variant which will allocate enough space to linearize the attribute -+ * buffer for the kernel. -+ * -+ * The current range of attributes to fill is next_attr -> last_attr. -+ */ -+struct ibv_command_buffer { -+ struct ibv_command_buffer *next; -+ struct ib_uverbs_attr *next_attr; -+ struct ib_uverbs_attr *last_attr; -+ /* -+ * Used by the legacy write interface to keep track of where the UHW -+ * buffer is located and the 'headroom' space that the common code -+ * uses to construct the command header and common command struct -+ * directly before the drivers' UHW. -+ */ -+ uint8_t uhw_in_idx; -+ uint8_t uhw_out_idx; -+ uint8_t uhw_in_headroom_dwords; -+ uint8_t uhw_out_headroom_dwords; -+ -+ uint8_t buffer_error:1; -+ /* -+ * These flags control what execute_ioctl_fallback does if the kernel -+ * does not support ioctl -+ */ -+ uint8_t fallback_require_ex:1; -+ uint8_t fallback_ioctl_only:1; -+ struct ib_uverbs_ioctl_hdr hdr; -+}; -+ -+enum {_UHW_NO_INDEX = 0xFF}; -+ -+/* -+ * Constructing an array of ibv_command_buffer is a reasonable way to expand -+ * the VLA in hdr.attrs on the stack and also allocate some internal state in -+ * a single contiguous stack memory region. It will over-allocate the region in -+ * some cases, but this approach allows the number of elements to be dynamic, -+ * and not fixed as a compile time constant. -+ */ -+#define _IOCTL_NUM_CMDB(_num_attrs) \ -+ ((sizeof(struct ibv_command_buffer) + \ -+ sizeof(struct ib_uverbs_attr) * (_num_attrs) + \ -+ sizeof(struct ibv_command_buffer) - 1) / \ -+ sizeof(struct ibv_command_buffer)) -+ -+unsigned int __ioctl_final_num_attrs(unsigned int num_attrs, -+ struct ibv_command_buffer *link); -+ -+/* If the user doesn't provide a link then don't create a VLA */ -+#define _ioctl_final_num_attrs(_num_attrs, _link) \ -+ ((__builtin_constant_p(!(_link)) && !(_link)) \ -+ ? (_num_attrs) \ -+ : __ioctl_final_num_attrs(_num_attrs, _link)) -+ -+#define _COMMAND_BUFFER_INIT(_hdr, _object_id, _method_id, _num_attrs, _link) \ -+ ((struct ibv_command_buffer){ \ -+ .hdr = \ -+ { \ -+ .object_id = (_object_id), \ -+ .method_id = (_method_id), \ -+ }, \ -+ .next = _link, \ -+ .uhw_in_idx = _UHW_NO_INDEX, \ -+ .uhw_out_idx = _UHW_NO_INDEX, \ -+ .next_attr = (_hdr).attrs, \ -+ .last_attr = (_hdr).attrs + _num_attrs}) -+ -+/* -+ * C99 does not permit an initializer for VLAs, so this function does the init -+ * instead. It is called in the wonky way so that DELCARE_COMMAND_BUFFER can -+ * still be a 'variable', and we so we don't require C11 mode. -+ */ -+static inline int _ioctl_init_cmdb(struct ibv_command_buffer *cmd, -+ uint16_t object_id, uint16_t method_id, -+ size_t num_attrs, -+ struct ibv_command_buffer *link) -+{ -+ *cmd = _COMMAND_BUFFER_INIT(cmd->hdr, object_id, method_id, num_attrs, -+ link); -+ return 0; -+} -+ -+/* -+ * Construct an IOCTL command buffer on the stack with enough space for -+ * _num_attrs elements. _num_attrs does not have to be a compile time constant. -+ * _link is a previous COMMAND_BUFFER in the call chain. -+ */ -+#ifndef __CHECKER__ -+#define DECLARE_COMMAND_BUFFER_LINK(_name, _object_id, _method_id, _num_attrs, \ -+ _link) \ -+ const unsigned int __##_name##total = \ -+ _ioctl_final_num_attrs(_num_attrs, _link); \ -+ struct ibv_command_buffer _name[_IOCTL_NUM_CMDB(__##_name##total)]; \ -+ int __attribute__((unused)) __##_name##dummy = _ioctl_init_cmdb( \ -+ _name, _object_id, _method_id, __##_name##total, _link) -+#else -+/* -+ * sparse enforces kernel rules which forbids VLAs. Make the VLA into a static -+ * array when running sparse. Don't actually run the sparse compile result. -+ */ -+#define DECLARE_COMMAND_BUFFER_LINK(_name, _object_id, _method_id, _num_attrs, \ -+ _link) \ -+ struct ibv_command_buffer _name[10]; \ -+ int __attribute__((unused)) __##_name##dummy = \ -+ _ioctl_init_cmdb(_name, _object_id, _method_id, 10, _link) -+#endif -+ -+#define DECLARE_COMMAND_BUFFER(_name, _object_id, _method_id, _num_attrs) \ -+ DECLARE_COMMAND_BUFFER_LINK(_name, _object_id, _method_id, _num_attrs, \ -+ NULL) -+ -+int execute_ioctl(struct ibv_context *context, struct ibv_command_buffer *cmd); -+ -+static inline struct ib_uverbs_attr * -+_ioctl_next_attr(struct ibv_command_buffer *cmd, uint16_t attr_id) -+{ -+ struct ib_uverbs_attr *attr; -+ -+ assert(cmd->next_attr < cmd->last_attr); -+ attr = cmd->next_attr++; -+ -+ *attr = (struct ib_uverbs_attr){ -+ .attr_id = attr_id, -+ /* -+ * All attributes default to mandatory. Wrapper the fill_* -+ * call in attr_optional() to make it optional. -+ */ -+ .flags = UVERBS_ATTR_F_MANDATORY, -+ }; -+ -+ return attr; -+} -+ -+/* -+ * This construction is insane, an expression with a side effect that returns -+ * from the calling function, but it is a non-invasive way to get the compiler -+ * to elide the IOCTL support in the backwards compat command functions -+ * without disturbing native ioctl support. -+ * -+ * A command function will set last_attr on the stack to NULL, and if it is -+ * coded properly, the compiler will prove that last_attr is never changed and -+ * elide the function. Unfortunately this penalizes native ioctl uses with the -+ * extra if overhead. -+ * -+ * For this reason, _ioctl_next_attr must never be called outside a fill -+ * function. -+ */ -+#if VERBS_WRITE_ONLY -+#define _ioctl_next_attr(cmd, attr_id) \ -+ ({ \ -+ if (!((cmd)->last_attr)) \ -+ return NULL; \ -+ _ioctl_next_attr(cmd, attr_id); \ -+ }) -+#endif -+ -+/* Make the attribute optional. */ -+static inline struct ib_uverbs_attr *attr_optional(struct ib_uverbs_attr *attr) -+{ -+ if (!attr) -+ return attr; -+ -+ attr->flags &= ~UVERBS_ATTR_F_MANDATORY; -+ return attr; -+} -+ -+/* Send attributes of kernel type UVERBS_ATTR_TYPE_IDR */ -+static inline struct ib_uverbs_attr * -+fill_attr_in_obj(struct ibv_command_buffer *cmd, uint16_t attr_id, uint32_t idr) -+{ -+ struct ib_uverbs_attr *attr = _ioctl_next_attr(cmd, attr_id); -+ -+ /* UVERBS_ATTR_TYPE_IDR uses a 64 bit value for the idr # */ -+ attr->data = idr; -+ return attr; -+} -+ -+static inline struct ib_uverbs_attr * -+fill_attr_out_obj(struct ibv_command_buffer *cmd, uint16_t attr_id) -+{ -+ return fill_attr_in_obj(cmd, attr_id, 0); -+} -+ -+static inline uint32_t read_attr_obj(uint16_t attr_id, -+ struct ib_uverbs_attr *attr) -+{ -+ assert(attr->attr_id == attr_id); -+ return attr->data; -+} -+ -+/* Send attributes of kernel type UVERBS_ATTR_TYPE_PTR_IN */ -+static inline struct ib_uverbs_attr * -+fill_attr_in(struct ibv_command_buffer *cmd, uint16_t attr_id, const void *data, -+ size_t len) -+{ -+ struct ib_uverbs_attr *attr = _ioctl_next_attr(cmd, attr_id); -+ -+ if (unlikely(len > UINT16_MAX)) -+ cmd->buffer_error = 1; -+ -+ attr->len = len; -+ if (len <= sizeof(uint64_t)) -+ memcpy(&attr->data, data, len); -+ else -+ attr->data = ioctl_ptr_to_u64(data); -+ -+ return attr; -+} -+ -+#define fill_attr_in_ptr(cmd, attr_id, ptr) \ -+ fill_attr_in(cmd, attr_id, ptr, sizeof(*ptr)) -+ -+/* Send attributes of various inline kernel types */ -+ -+static inline struct ib_uverbs_attr * -+fill_attr_in_uint64(struct ibv_command_buffer *cmd, uint16_t attr_id, -+ uint64_t data) -+{ -+ struct ib_uverbs_attr *attr = _ioctl_next_attr(cmd, attr_id); -+ -+ attr->len = sizeof(data); -+ attr->data = data; -+ -+ return attr; -+} -+ -+#define fill_attr_const_in(cmd, attr_id, _data) \ -+ fill_attr_in_uint64(cmd, attr_id, _data) -+ -+static inline struct ib_uverbs_attr * -+fill_attr_in_uint32(struct ibv_command_buffer *cmd, uint16_t attr_id, -+ uint32_t data) -+{ -+ struct ib_uverbs_attr *attr = _ioctl_next_attr(cmd, attr_id); -+ -+ attr->len = sizeof(data); -+ memcpy(&attr->data, &data, sizeof(data)); -+ -+ return attr; -+} -+ -+static inline struct ib_uverbs_attr * -+fill_attr_in_fd(struct ibv_command_buffer *cmd, uint16_t attr_id, int fd) -+{ -+ struct ib_uverbs_attr *attr; -+ -+ if (fd == -1) -+ return NULL; -+ -+ attr = _ioctl_next_attr(cmd, attr_id); -+ /* UVERBS_ATTR_TYPE_FD uses a 64 bit value for the idr # */ -+ attr->data = fd; -+ return attr; -+} -+ -+static inline struct ib_uverbs_attr * -+fill_attr_out_fd(struct ibv_command_buffer *cmd, uint16_t attr_id, int fd) -+{ -+ struct ib_uverbs_attr *attr = _ioctl_next_attr(cmd, attr_id); -+ -+ attr->data = 0; -+ return attr; -+} -+ -+static inline int read_attr_fd(uint16_t attr_id, struct ib_uverbs_attr *attr) -+{ -+ assert(attr->attr_id == attr_id); -+ /* The kernel cannot fail to create a FD here, it never returns -1 */ -+ return attr->data; -+} -+ -+/* Send attributes of kernel type UVERBS_ATTR_TYPE_PTR_OUT */ -+static inline struct ib_uverbs_attr * -+fill_attr_out(struct ibv_command_buffer *cmd, uint16_t attr_id, void *data, -+ size_t len) -+{ -+ struct ib_uverbs_attr *attr = _ioctl_next_attr(cmd, attr_id); -+ -+ if (unlikely(len > UINT16_MAX)) -+ cmd->buffer_error = 1; -+ -+ attr->len = len; -+ attr->data = ioctl_ptr_to_u64(data); -+ -+ return attr; -+} -+ -+#define fill_attr_out_ptr(cmd, attr_id, ptr) \ -+ fill_attr_out(cmd, attr_id, ptr, sizeof(*(ptr))) -+ -+/* If size*nelems overflows size_t this returns SIZE_MAX */ -+static inline size_t _array_len(size_t size, size_t nelems) -+{ -+ if (size != 0 && -+ SIZE_MAX / size <= nelems) -+ return SIZE_MAX; -+ return size * nelems; -+} -+ -+#define fill_attr_out_ptr_array(cmd, attr_id, ptr, nelems) \ -+ fill_attr_out(cmd, attr_id, ptr, _array_len(sizeof(*ptr), nelems)) -+ -+#define fill_attr_in_ptr_array(cmd, attr_id, ptr, nelems) \ -+ fill_attr_in(cmd, attr_id, ptr, _array_len(sizeof(*ptr), nelems)) -+ -+static inline size_t __check_divide(size_t val, unsigned int div) -+{ -+ assert(val % div == 0); -+ return val / div; -+} -+ -+static inline struct ib_uverbs_attr * -+fill_attr_in_enum(struct ibv_command_buffer *cmd, uint16_t attr_id, -+ uint8_t elem_id, const void *data, size_t len) -+{ -+ struct ib_uverbs_attr *attr; -+ -+ attr = fill_attr_in(cmd, attr_id, data, len); -+ attr->attr_data.enum_data.elem_id = elem_id; -+ -+ return attr; -+} -+ -+/* Send attributes of kernel type UVERBS_ATTR_TYPE_IDRS_ARRAY */ -+static inline struct ib_uverbs_attr * -+fill_attr_in_objs_arr(struct ibv_command_buffer *cmd, uint16_t attr_id, -+ const uint32_t *idrs_arr, size_t nelems) -+{ -+ return fill_attr_in(cmd, attr_id, idrs_arr, -+ _array_len(sizeof(*idrs_arr), nelems)); -+} -+ -+#endif -diff --git a/src/rc-compat/v37/config.h b/src/rc-compat/v37/config.h -new file mode 100644 -index 000000000000..4a63336a8a0d ---- /dev/null -+++ b/src/rc-compat/v37/config.h -@@ -0,0 +1,56 @@ -+#ifndef CONFIG_H_IN -+#define CONFIG_H_IN -+ -+#define HAVE_STATEMENT_EXPR 1 -+#define HAVE_BUILTIN_TYPES_COMPATIBLE_P 1 -+#define HAVE_TYPEOF 1 -+#define HAVE_ISBLANK 1 -+#define HAVE_BUILTIN_CLZ 1 -+#define HAVE_BUILTIN_CLZL 1 -+ -+//#define PACKAGE_VERSION "37.3" -+ -+// FIXME: Remove this, The cmake version hard-requires new style CLOEXEC support -+#define STREAM_CLOEXEC "e" -+ -+#define RDMA_CDEV_DIR "/dev/infiniband" -+ -+#define VERBS_PROVIDER_SUFFIX "-rdmav34.so" -+#define IBVERBS_PABI_VERSION 34 -+ -+// FIXME This has been supported in compilers forever, we should just fail to build on such old systems. -+#define HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE 1 -+ -+#define HAVE_FUNC_ATTRIBUTE_IFUNC 1 -+ -+/* #undef HAVE_FUNC_ATTRIBUTE_SYMVER */ -+ -+#define HAVE_WORKING_IF_H 1 -+ -+// Operating mode for symbol versions -+#define HAVE_FULL_SYMBOL_VERSIONS 1 -+/* #undef HAVE_LIMITED_SYMBOL_VERSIONS */ -+ -+#define SIZEOF_LONG 8 -+ -+#if 3 == 1 -+# define VERBS_IOCTL_ONLY 1 -+# define VERBS_WRITE_ONLY 0 -+#elif 3 == 2 -+# define VERBS_IOCTL_ONLY 0 -+# define VERBS_WRITE_ONLY 1 -+#elif 3 == 3 -+# define VERBS_IOCTL_ONLY 0 -+# define VERBS_WRITE_ONLY 0 -+#endif -+ -+// Configuration defaults -+ -+#define IBACM_SERVER_MODE_UNIX 0 -+#define IBACM_SERVER_MODE_LOOP 1 -+#define IBACM_SERVER_MODE_OPEN 2 -+#define IBACM_SERVER_MODE_DEFAULT IBACM_SERVER_MODE_UNIX -+ -+#define IBACM_ACME_PLUS_KERNEL_ONLY_DEFAULT 0 -+ -+#endif -diff --git a/src/rc-compat/v37/driver.h b/src/rc-compat/v37/driver.h -new file mode 100644 -index 000000000000..46406cc433f6 ---- /dev/null -+++ b/src/rc-compat/v37/driver.h -@@ -0,0 +1,755 @@ -+/* -+ * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. -+ * Copyright (c) 2005, 2006 Cisco Systems, Inc. All rights reserved. -+ * Copyright (c) 2005 PathScale, Inc. All rights reserved. -+ * Copyright (c) 2020 Intel Corporation. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#ifndef INFINIBAND_DRIVER_H -+#define INFINIBAND_DRIVER_H -+ -+#include -+#include -+#include "kern-abi.h" -+#include "cmd_ioctl.h" -+#include -+#include "config.h" -+#include -+#include -+#include "cmd_ioctl.h" -+#include -+ -+/* NOTE: Start of StarlingX addition */ -+#define IBV_DEVICE_LIBRARY_EXTENSION rdmav34 -+/* NOTE: End of StarlingX addition */ -+ -+struct verbs_device; -+ -+enum { -+ VERBS_LOG_LEVEL_NONE, -+ VERBS_LOG_ERR, -+ VERBS_LOG_WARN, -+ VERBS_LOG_INFO, -+ VERBS_LOG_DEBUG, -+}; -+ -+void __verbs_log(struct verbs_context *ctx, uint32_t level, -+ const char *fmt, ...); -+ -+#define verbs_log(ctx, level, format, arg...) \ -+do { \ -+ int tmp = errno; \ -+ __verbs_log(ctx, level, "%s: %s:%d: " format, \ -+ (ctx)->context.device->name, __func__, __LINE__, ##arg); \ -+ errno = tmp; \ -+} while (0) -+ -+#define verbs_debug(ctx, format, arg...) \ -+ verbs_log(ctx, VERBS_LOG_DEBUG, format, ##arg) -+ -+#define verbs_info(ctx, format, arg...) \ -+ verbs_log(ctx, VERBS_LOG_INFO, format, ##arg) -+ -+#define verbs_warn(ctx, format, arg...) \ -+ verbs_log(ctx, VERBS_LOG_WARN, format, ##arg) -+ -+#define verbs_err(ctx, format, arg...) \ -+ verbs_log(ctx, VERBS_LOG_ERR, format, ##arg) -+ -+#ifdef VERBS_DEBUG -+#define verbs_log_datapath(ctx, level, format, arg...) \ -+ verbs_log(ctx, level, format, ##arg) -+#else -+#define verbs_log_datapath(ctx, level, format, arg...) {} -+#endif -+ -+#define verbs_debug_datapath(ctx, format, arg...) \ -+ verbs_log_datapath(ctx, VERBS_LOG_DEBUG, format, ##arg) -+ -+#define verbs_info_datapath(ctx, format, arg...) \ -+ verbs_log_datapath(ctx, VERBS_LOG_INFO, format, ##arg) -+ -+#define verbs_warn_datapath(ctx, format, arg...) \ -+ verbs_log_datapath(ctx, VERBS_LOG_WARN, format, ##arg) -+ -+#define verbs_err_datapath(ctx, format, arg...) \ -+ verbs_log_datapath(ctx, VERBS_LOG_ERR, format, ##arg) -+ -+enum verbs_xrcd_mask { -+ VERBS_XRCD_HANDLE = 1 << 0, -+ VERBS_XRCD_RESERVED = 1 << 1 -+}; -+ -+enum create_cq_cmd_flags { -+ CREATE_CQ_CMD_FLAGS_TS_IGNORED_EX = 1 << 0, -+}; -+ -+struct verbs_xrcd { -+ struct ibv_xrcd xrcd; -+ uint32_t comp_mask; -+ uint32_t handle; -+}; -+ -+struct verbs_srq { -+ struct ibv_srq srq; -+ enum ibv_srq_type srq_type; -+ struct verbs_xrcd *xrcd; -+ struct ibv_cq *cq; -+ uint32_t srq_num; -+}; -+ -+enum verbs_qp_mask { -+ VERBS_QP_XRCD = 1 << 0, -+ VERBS_QP_EX = 1 << 1, -+}; -+ -+enum ibv_gid_type_sysfs { -+ IBV_GID_TYPE_SYSFS_IB_ROCE_V1, -+ IBV_GID_TYPE_SYSFS_ROCE_V2, -+}; -+ -+enum verbs_query_gid_attr_mask { -+ VERBS_QUERY_GID_ATTR_GID = 1 << 0, -+ VERBS_QUERY_GID_ATTR_TYPE = 1 << 1, -+ VERBS_QUERY_GID_ATTR_NDEV_IFINDEX = 1 << 2, -+}; -+ -+enum ibv_mr_type { -+ IBV_MR_TYPE_MR, -+ IBV_MR_TYPE_NULL_MR, -+ IBV_MR_TYPE_IMPORTED_MR, -+ IBV_MR_TYPE_DMABUF_MR, -+}; -+ -+struct verbs_mr { -+ struct ibv_mr ibv_mr; -+ enum ibv_mr_type mr_type; -+ int access; -+}; -+ -+static inline struct verbs_mr *verbs_get_mr(struct ibv_mr *mr) -+{ -+ return container_of(mr, struct verbs_mr, ibv_mr); -+} -+ -+struct verbs_qp { -+ union { -+ struct ibv_qp qp; -+ struct ibv_qp_ex qp_ex; -+ }; -+ uint32_t comp_mask; -+ struct verbs_xrcd *xrcd; -+}; -+static_assert(offsetof(struct ibv_qp_ex, qp_base) == 0, "Invalid qp layout"); -+ -+struct verbs_cq { -+ union { -+ struct ibv_cq cq; -+ struct ibv_cq_ex cq_ex; -+ }; -+}; -+ -+enum ibv_flow_action_type { -+ IBV_FLOW_ACTION_UNSPECIFIED, -+ IBV_FLOW_ACTION_ESP = 1, -+}; -+ -+struct verbs_flow_action { -+ struct ibv_flow_action action; -+ uint32_t handle; -+ enum ibv_flow_action_type type; -+}; -+ -+struct verbs_dm { -+ struct ibv_dm dm; -+ uint32_t handle; -+}; -+ -+enum { -+ VERBS_MATCH_SENTINEL = 0, -+ VERBS_MATCH_PCI = 1, -+ VERBS_MATCH_MODALIAS = 2, -+ VERBS_MATCH_DRIVER_ID = 3, -+}; -+ -+struct verbs_match_ent { -+ void *driver_data; -+ union { -+ const char *modalias; -+ uint64_t driver_id; -+ } u; -+ uint16_t vendor; -+ uint16_t device; -+ uint8_t kind; -+}; -+#define VERBS_DRIVER_ID(_id) \ -+ { \ -+ .u.driver_id = (_id), .kind = VERBS_MATCH_DRIVER_ID, \ -+ } -+/* Note: New drivers should only use VERBS_DRIVER_ID, the below are for legacy -+ * drivers -+ */ -+#define VERBS_PCI_MATCH(_vendor, _device, _data) \ -+ { \ -+ .driver_data = (void *)(_data), \ -+ .vendor = (_vendor), \ -+ .device = (_device), \ -+ .kind = VERBS_MATCH_PCI, \ -+ } -+ -+#define VERBS_MODALIAS_MATCH(_mod_str, _data) \ -+ { \ -+ .driver_data = (void *)(_data), \ -+ .u.modalias = (_mod_str), \ -+ .kind = VERBS_MATCH_MODALIAS, \ -+ } -+ -+/* Matching on the IB device name is STRONGLY discouraged. This will only -+ * match if there is no device/modalias file available, and it will eventually -+ * be disabled entirely if the kernel supports renaming. Use is strongly -+ * discouraged. -+ */ -+#define VERBS_NAME_MATCH(_name_prefix, _data) \ -+ { \ -+ .driver_data = (_data), \ -+ .u.modalias = "rdma_device:*N" _name_prefix "*", \ -+ .kind = VERBS_MATCH_MODALIAS, \ -+ } -+ -+enum { -+ VSYSFS_READ_MODALIAS = 1 << 0, -+ VSYSFS_READ_NODE_GUID = 1 << 1, -+}; -+ -+/* An rdma device detected in sysfs */ -+struct verbs_sysfs_dev { -+ struct list_node entry; -+ void *provider_data; -+ const struct verbs_match_ent *match; -+ unsigned int flags; -+ char sysfs_name[IBV_SYSFS_NAME_MAX]; -+ dev_t sysfs_cdev; -+ char ibdev_name[IBV_SYSFS_NAME_MAX]; -+ char ibdev_path[IBV_SYSFS_PATH_MAX]; -+ char modalias[512]; -+ uint64_t node_guid; -+ uint32_t driver_id; -+ enum ibv_node_type node_type; -+ int ibdev_idx; -+ uint32_t num_ports; -+ uint32_t abi_ver; -+ struct timespec time_created; -+}; -+ -+/* Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed */ -+struct verbs_device_ops { -+ const char *name; -+ -+ uint32_t match_min_abi_version; -+ uint32_t match_max_abi_version; -+ const struct verbs_match_ent *match_table; -+ const struct verbs_device_ops **static_providers; -+ -+ bool (*match_device)(struct verbs_sysfs_dev *sysfs_dev); -+ -+ struct verbs_context *(*alloc_context)(struct ibv_device *device, -+ int cmd_fd, -+ void *private_data); -+ struct verbs_context *(*import_context)(struct ibv_device *device, -+ int cmd_fd); -+ -+ struct verbs_device *(*alloc_device)(struct verbs_sysfs_dev *sysfs_dev); -+ void (*uninit_device)(struct verbs_device *device); -+}; -+ -+/* Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed */ -+struct verbs_device { -+ struct ibv_device device; /* Must be first */ -+ const struct verbs_device_ops *ops; -+ atomic_int refcount; -+ struct list_node entry; -+ struct verbs_sysfs_dev *sysfs; -+ uint64_t core_support; -+}; -+ -+struct verbs_counters { -+ struct ibv_counters counters; -+ uint32_t handle; -+}; -+ -+/* -+ * Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed. This is -+ * the union of every op the driver can support. If new elements are added to -+ * this structure then verbs_dummy_ops must also be updated. -+ * -+ * Keep sorted. -+ */ -+struct verbs_context_ops { -+ int (*advise_mr)(struct ibv_pd *pd, -+ enum ibv_advise_mr_advice advice, -+ uint32_t flags, -+ struct ibv_sge *sg_list, -+ uint32_t num_sges); -+ struct ibv_dm *(*alloc_dm)(struct ibv_context *context, -+ struct ibv_alloc_dm_attr *attr); -+ struct ibv_mw *(*alloc_mw)(struct ibv_pd *pd, enum ibv_mw_type type); -+ struct ibv_mr *(*alloc_null_mr)(struct ibv_pd *pd); -+ struct ibv_pd *(*alloc_parent_domain)( -+ struct ibv_context *context, -+ struct ibv_parent_domain_init_attr *attr); -+ struct ibv_pd *(*alloc_pd)(struct ibv_context *context); -+ struct ibv_td *(*alloc_td)(struct ibv_context *context, -+ struct ibv_td_init_attr *init_attr); -+ void (*async_event)(struct ibv_context *context, struct ibv_async_event *event); -+ int (*attach_counters_point_flow)(struct ibv_counters *counters, -+ struct ibv_counter_attach_attr *attr, -+ struct ibv_flow *flow); -+ int (*attach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid, -+ uint16_t lid); -+ int (*bind_mw)(struct ibv_qp *qp, struct ibv_mw *mw, -+ struct ibv_mw_bind *mw_bind); -+ int (*close_xrcd)(struct ibv_xrcd *xrcd); -+ void (*cq_event)(struct ibv_cq *cq); -+ struct ibv_ah *(*create_ah)(struct ibv_pd *pd, -+ struct ibv_ah_attr *attr); -+ struct ibv_counters *(*create_counters)(struct ibv_context *context, -+ struct ibv_counters_init_attr *init_attr); -+ struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe, -+ struct ibv_comp_channel *channel, -+ int comp_vector); -+ struct ibv_cq_ex *(*create_cq_ex)( -+ struct ibv_context *context, -+ struct ibv_cq_init_attr_ex *init_attr); -+ struct ibv_flow *(*create_flow)(struct ibv_qp *qp, -+ struct ibv_flow_attr *flow_attr); -+ struct ibv_flow_action *(*create_flow_action_esp)(struct ibv_context *context, -+ struct ibv_flow_action_esp_attr *attr); -+ struct ibv_qp *(*create_qp)(struct ibv_pd *pd, -+ struct ibv_qp_init_attr *attr); -+ struct ibv_qp *(*create_qp_ex)( -+ struct ibv_context *context, -+ struct ibv_qp_init_attr_ex *qp_init_attr_ex); -+ struct ibv_rwq_ind_table *(*create_rwq_ind_table)( -+ struct ibv_context *context, -+ struct ibv_rwq_ind_table_init_attr *init_attr); -+ struct ibv_srq *(*create_srq)(struct ibv_pd *pd, -+ struct ibv_srq_init_attr *srq_init_attr); -+ struct ibv_srq *(*create_srq_ex)( -+ struct ibv_context *context, -+ struct ibv_srq_init_attr_ex *srq_init_attr_ex); -+ struct ibv_wq *(*create_wq)(struct ibv_context *context, -+ struct ibv_wq_init_attr *wq_init_attr); -+ int (*dealloc_mw)(struct ibv_mw *mw); -+ int (*dealloc_pd)(struct ibv_pd *pd); -+ int (*dealloc_td)(struct ibv_td *td); -+ int (*dereg_mr)(struct verbs_mr *vmr); -+ int (*destroy_ah)(struct ibv_ah *ah); -+ int (*destroy_counters)(struct ibv_counters *counters); -+ int (*destroy_cq)(struct ibv_cq *cq); -+ int (*destroy_flow)(struct ibv_flow *flow); -+ int (*destroy_flow_action)(struct ibv_flow_action *action); -+ int (*destroy_qp)(struct ibv_qp *qp); -+ int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table); -+ int (*destroy_srq)(struct ibv_srq *srq); -+ int (*destroy_wq)(struct ibv_wq *wq); -+ int (*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid, -+ uint16_t lid); -+ void (*free_context)(struct ibv_context *context); -+ int (*free_dm)(struct ibv_dm *dm); -+ int (*get_srq_num)(struct ibv_srq *srq, uint32_t *srq_num); -+ struct ibv_dm *(*import_dm)(struct ibv_context *context, -+ uint32_t dm_handle); -+ struct ibv_mr *(*import_mr)(struct ibv_pd *pd, -+ uint32_t mr_handle); -+ struct ibv_pd *(*import_pd)(struct ibv_context *context, -+ uint32_t pd_handle); -+ int (*modify_cq)(struct ibv_cq *cq, struct ibv_modify_cq_attr *attr); -+ int (*modify_flow_action_esp)(struct ibv_flow_action *action, -+ struct ibv_flow_action_esp_attr *attr); -+ int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr, -+ int attr_mask); -+ int (*modify_qp_rate_limit)(struct ibv_qp *qp, -+ struct ibv_qp_rate_limit_attr *attr); -+ int (*modify_srq)(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr, -+ int srq_attr_mask); -+ int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr); -+ struct ibv_qp *(*open_qp)(struct ibv_context *context, -+ struct ibv_qp_open_attr *attr); -+ struct ibv_xrcd *(*open_xrcd)( -+ struct ibv_context *context, -+ struct ibv_xrcd_init_attr *xrcd_init_attr); -+ int (*poll_cq)(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc); -+ int (*post_recv)(struct ibv_qp *qp, struct ibv_recv_wr *wr, -+ struct ibv_recv_wr **bad_wr); -+ int (*post_send)(struct ibv_qp *qp, struct ibv_send_wr *wr, -+ struct ibv_send_wr **bad_wr); -+ int (*post_srq_ops)(struct ibv_srq *srq, struct ibv_ops_wr *op, -+ struct ibv_ops_wr **bad_op); -+ int (*post_srq_recv)(struct ibv_srq *srq, struct ibv_recv_wr *recv_wr, -+ struct ibv_recv_wr **bad_recv_wr); -+ int (*query_device_ex)(struct ibv_context *context, -+ const struct ibv_query_device_ex_input *input, -+ struct ibv_device_attr_ex *attr, -+ size_t attr_size); -+ int (*query_ece)(struct ibv_qp *qp, struct ibv_ece *ece); -+ int (*query_port)(struct ibv_context *context, uint8_t port_num, -+ struct ibv_port_attr *port_attr); -+ int (*query_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr, -+ int attr_mask, struct ibv_qp_init_attr *init_attr); -+ int (*query_qp_data_in_order)(struct ibv_qp *qp, enum ibv_wr_opcode op, -+ uint32_t flags); -+ int (*query_rt_values)(struct ibv_context *context, -+ struct ibv_values_ex *values); -+ int (*query_srq)(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr); -+ int (*read_counters)(struct ibv_counters *counters, -+ uint64_t *counters_value, -+ uint32_t ncounters, -+ uint32_t flags); -+ struct ibv_mr *(*reg_dm_mr)(struct ibv_pd *pd, struct ibv_dm *dm, -+ uint64_t dm_offset, size_t length, -+ unsigned int access); -+ struct ibv_mr *(*reg_dmabuf_mr)(struct ibv_pd *pd, uint64_t offset, -+ size_t length, uint64_t iova, -+ int fd, int access); -+ struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr, size_t length, -+ uint64_t hca_va, int access); -+ int (*req_notify_cq)(struct ibv_cq *cq, int solicited_only); -+ int (*rereg_mr)(struct verbs_mr *vmr, int flags, struct ibv_pd *pd, -+ void *addr, size_t length, int access); -+ int (*resize_cq)(struct ibv_cq *cq, int cqe); -+ int (*set_ece)(struct ibv_qp *qp, struct ibv_ece *ece); -+ void (*unimport_dm)(struct ibv_dm *dm); -+ void (*unimport_mr)(struct ibv_mr *mr); -+ void (*unimport_pd)(struct ibv_pd *pd); -+}; -+ -+static inline struct verbs_device * -+verbs_get_device(const struct ibv_device *dev) -+{ -+ return container_of(dev, struct verbs_device, device); -+} -+ -+typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path, -+ int abi_version); -+ -+/* Wire the IBVERBS_PRIVATE version number into the verbs_register_driver -+ * symbol name. This guarentees we link to the correct set of symbols even if -+ * statically linking or using a dynmic linker with symbol versioning turned -+ * off. -+ */ -+#define ___make_verbs_register_driver(x) verbs_register_driver_ ## x -+#define __make_verbs_register_driver(x) ___make_verbs_register_driver(x) -+#define verbs_register_driver __make_verbs_register_driver(IBVERBS_PABI_VERSION) -+ -+void verbs_register_driver(const struct verbs_device_ops *ops); -+ -+/* -+ * Macro for providers to use to supply verbs_device_ops to the core code. -+ * This creates a global symbol for the provider structure to be used by the -+ * ibv_static_providers() machinery, and a global constructor for the dlopen -+ * machinery. -+ */ -+#define PROVIDER_DRIVER(provider_name, drv_struct) \ -+ extern const struct verbs_device_ops verbs_provider_##provider_name \ -+ __attribute__((alias(stringify(drv_struct)))); \ -+ static __attribute__((constructor)) void drv##__register_driver(void) \ -+ { \ -+ verbs_register_driver(&drv_struct); \ -+ } -+ -+void *_verbs_init_and_alloc_context(struct ibv_device *device, int cmd_fd, -+ size_t alloc_size, -+ struct verbs_context *context_offset, -+ uint32_t driver_id); -+ -+#define verbs_init_and_alloc_context(ibdev, cmd_fd, drv_ctx_ptr, ctx_memb, \ -+ driver_id) \ -+ ((typeof(drv_ctx_ptr))_verbs_init_and_alloc_context( \ -+ ibdev, cmd_fd, sizeof(*drv_ctx_ptr), \ -+ &((typeof(drv_ctx_ptr))NULL)->ctx_memb, (driver_id))) -+ -+int verbs_init_context(struct verbs_context *context_ex, -+ struct ibv_device *device, int cmd_fd, -+ uint32_t driver_id); -+void verbs_uninit_context(struct verbs_context *context); -+void verbs_set_ops(struct verbs_context *vctx, -+ const struct verbs_context_ops *ops); -+ -+void verbs_init_cq(struct ibv_cq *cq, struct ibv_context *context, -+ struct ibv_comp_channel *channel, -+ void *cq_context); -+ -+struct ibv_context *verbs_open_device(struct ibv_device *device, -+ void *private_data); -+int ibv_cmd_get_context(struct verbs_context *context, -+ struct ibv_get_context *cmd, size_t cmd_size, -+ struct ib_uverbs_get_context_resp *resp, size_t resp_size); -+int ibv_cmd_query_context(struct ibv_context *ctx, -+ struct ibv_command_buffer *driver); -+int ibv_cmd_create_flow_action_esp(struct ibv_context *ctx, -+ struct ibv_flow_action_esp_attr *attr, -+ struct verbs_flow_action *flow_action, -+ struct ibv_command_buffer *driver); -+int ibv_cmd_modify_flow_action_esp(struct verbs_flow_action *flow_action, -+ struct ibv_flow_action_esp_attr *attr, -+ struct ibv_command_buffer *driver); -+int ibv_cmd_query_device_any(struct ibv_context *context, -+ const struct ibv_query_device_ex_input *input, -+ struct ibv_device_attr_ex *attr, size_t attr_size, -+ struct ib_uverbs_ex_query_device_resp *resp, -+ size_t *resp_size); -+int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num, -+ struct ibv_port_attr *port_attr, -+ struct ibv_query_port *cmd, size_t cmd_size); -+int ibv_cmd_alloc_async_fd(struct ibv_context *context); -+int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd, -+ struct ibv_alloc_pd *cmd, size_t cmd_size, -+ struct ib_uverbs_alloc_pd_resp *resp, size_t resp_size); -+int ibv_cmd_dealloc_pd(struct ibv_pd *pd); -+int ibv_cmd_open_xrcd(struct ibv_context *context, struct verbs_xrcd *xrcd, -+ int vxrcd_size, -+ struct ibv_xrcd_init_attr *attr, -+ struct ibv_open_xrcd *cmd, size_t cmd_size, -+ struct ib_uverbs_open_xrcd_resp *resp, size_t resp_size); -+int ibv_cmd_close_xrcd(struct verbs_xrcd *xrcd); -+int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length, -+ uint64_t hca_va, int access, -+ struct verbs_mr *vmr, struct ibv_reg_mr *cmd, -+ size_t cmd_size, -+ struct ib_uverbs_reg_mr_resp *resp, size_t resp_size); -+int ibv_cmd_rereg_mr(struct verbs_mr *vmr, uint32_t flags, void *addr, -+ size_t length, uint64_t hca_va, int access, -+ struct ibv_pd *pd, struct ibv_rereg_mr *cmd, -+ size_t cmd_sz, struct ib_uverbs_rereg_mr_resp *resp, -+ size_t resp_sz); -+int ibv_cmd_dereg_mr(struct verbs_mr *vmr); -+int ibv_cmd_query_mr(struct ibv_pd *pd, struct verbs_mr *vmr, -+ uint32_t mr_handle); -+int ibv_cmd_advise_mr(struct ibv_pd *pd, -+ enum ibv_advise_mr_advice advice, -+ uint32_t flags, -+ struct ibv_sge *sg_list, -+ uint32_t num_sge); -+int ibv_cmd_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, -+ uint64_t iova, int fd, int access, -+ struct verbs_mr *vmr); -+int ibv_cmd_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type, -+ struct ibv_mw *mw, struct ibv_alloc_mw *cmd, -+ size_t cmd_size, -+ struct ib_uverbs_alloc_mw_resp *resp, size_t resp_size); -+int ibv_cmd_dealloc_mw(struct ibv_mw *mw); -+int ibv_cmd_create_cq(struct ibv_context *context, int cqe, -+ struct ibv_comp_channel *channel, -+ int comp_vector, struct ibv_cq *cq, -+ struct ibv_create_cq *cmd, size_t cmd_size, -+ struct ib_uverbs_create_cq_resp *resp, size_t resp_size); -+int ibv_cmd_create_cq_ex(struct ibv_context *context, -+ const struct ibv_cq_init_attr_ex *cq_attr, -+ struct verbs_cq *cq, -+ struct ibv_create_cq_ex *cmd, -+ size_t cmd_size, -+ struct ib_uverbs_ex_create_cq_resp *resp, -+ size_t resp_size, -+ uint32_t cmd_flags); -+int ibv_cmd_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc); -+int ibv_cmd_req_notify_cq(struct ibv_cq *cq, int solicited_only); -+int ibv_cmd_resize_cq(struct ibv_cq *cq, int cqe, -+ struct ibv_resize_cq *cmd, size_t cmd_size, -+ struct ib_uverbs_resize_cq_resp *resp, size_t resp_size); -+int ibv_cmd_destroy_cq(struct ibv_cq *cq); -+int ibv_cmd_modify_cq(struct ibv_cq *cq, -+ struct ibv_modify_cq_attr *attr, -+ struct ibv_modify_cq *cmd, -+ size_t cmd_size); -+ -+int ibv_cmd_create_srq(struct ibv_pd *pd, -+ struct ibv_srq *srq, struct ibv_srq_init_attr *attr, -+ struct ibv_create_srq *cmd, size_t cmd_size, -+ struct ib_uverbs_create_srq_resp *resp, size_t resp_size); -+int ibv_cmd_create_srq_ex(struct ibv_context *context, -+ struct verbs_srq *srq, -+ struct ibv_srq_init_attr_ex *attr_ex, -+ struct ibv_create_xsrq *cmd, size_t cmd_size, -+ struct ib_uverbs_create_srq_resp *resp, size_t resp_size); -+int ibv_cmd_modify_srq(struct ibv_srq *srq, -+ struct ibv_srq_attr *srq_attr, -+ int srq_attr_mask, -+ struct ibv_modify_srq *cmd, size_t cmd_size); -+int ibv_cmd_query_srq(struct ibv_srq *srq, -+ struct ibv_srq_attr *srq_attr, -+ struct ibv_query_srq *cmd, size_t cmd_size); -+int ibv_cmd_destroy_srq(struct ibv_srq *srq); -+ -+int ibv_cmd_create_qp(struct ibv_pd *pd, -+ struct ibv_qp *qp, struct ibv_qp_init_attr *attr, -+ struct ibv_create_qp *cmd, size_t cmd_size, -+ struct ib_uverbs_create_qp_resp *resp, size_t resp_size); -+int ibv_cmd_create_qp_ex(struct ibv_context *context, -+ struct verbs_qp *qp, -+ struct ibv_qp_init_attr_ex *attr_ex, -+ struct ibv_create_qp *cmd, size_t cmd_size, -+ struct ib_uverbs_create_qp_resp *resp, size_t resp_size); -+int ibv_cmd_create_qp_ex2(struct ibv_context *context, -+ struct verbs_qp *qp, -+ struct ibv_qp_init_attr_ex *qp_attr, -+ struct ibv_create_qp_ex *cmd, -+ size_t cmd_size, -+ struct ib_uverbs_ex_create_qp_resp *resp, -+ size_t resp_size); -+int ibv_cmd_open_qp(struct ibv_context *context, -+ struct verbs_qp *qp, int vqp_sz, -+ struct ibv_qp_open_attr *attr, -+ struct ibv_open_qp *cmd, size_t cmd_size, -+ struct ib_uverbs_create_qp_resp *resp, size_t resp_size); -+int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *qp_attr, -+ int attr_mask, -+ struct ibv_qp_init_attr *qp_init_attr, -+ struct ibv_query_qp *cmd, size_t cmd_size); -+int ibv_cmd_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, -+ int attr_mask, -+ struct ibv_modify_qp *cmd, size_t cmd_size); -+int ibv_cmd_modify_qp_ex(struct ibv_qp *qp, struct ibv_qp_attr *attr, -+ int attr_mask, struct ibv_modify_qp_ex *cmd, -+ size_t cmd_size, -+ struct ib_uverbs_ex_modify_qp_resp *resp, -+ size_t resp_size); -+int ibv_cmd_destroy_qp(struct ibv_qp *qp); -+int ibv_cmd_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, -+ struct ibv_send_wr **bad_wr); -+int ibv_cmd_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr, -+ struct ibv_recv_wr **bad_wr); -+int ibv_cmd_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr, -+ struct ibv_recv_wr **bad_wr); -+int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah, -+ struct ibv_ah_attr *attr, -+ struct ib_uverbs_create_ah_resp *resp, -+ size_t resp_size); -+int ibv_cmd_destroy_ah(struct ibv_ah *ah); -+int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); -+int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); -+ -+int ibv_cmd_create_flow(struct ibv_qp *qp, -+ struct ibv_flow *flow_id, -+ struct ibv_flow_attr *flow_attr, -+ void *ucmd, -+ size_t ucmd_size); -+int ibv_cmd_destroy_flow(struct ibv_flow *flow_id); -+int ibv_cmd_create_wq(struct ibv_context *context, -+ struct ibv_wq_init_attr *wq_init_attr, -+ struct ibv_wq *wq, -+ struct ibv_create_wq *cmd, -+ size_t cmd_size, -+ struct ib_uverbs_ex_create_wq_resp *resp, -+ size_t resp_size); -+ -+int ibv_cmd_destroy_flow_action(struct verbs_flow_action *action); -+int ibv_cmd_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *attr, -+ struct ibv_modify_wq *cmd, size_t cmd_size); -+int ibv_cmd_destroy_wq(struct ibv_wq *wq); -+int ibv_cmd_create_rwq_ind_table(struct ibv_context *context, -+ struct ibv_rwq_ind_table_init_attr *init_attr, -+ struct ibv_rwq_ind_table *rwq_ind_table, -+ struct ib_uverbs_ex_create_rwq_ind_table_resp *resp, -+ size_t resp_size); -+int ibv_cmd_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table); -+int ibv_cmd_create_counters(struct ibv_context *context, -+ struct ibv_counters_init_attr *init_attr, -+ struct verbs_counters *vcounters, -+ struct ibv_command_buffer *link); -+int ibv_cmd_destroy_counters(struct verbs_counters *vcounters); -+int ibv_cmd_read_counters(struct verbs_counters *vcounters, -+ uint64_t *counters_value, -+ uint32_t ncounters, -+ uint32_t flags, -+ struct ibv_command_buffer *link); -+int ibv_dontfork_range(void *base, size_t size); -+int ibv_dofork_range(void *base, size_t size); -+int ibv_cmd_alloc_dm(struct ibv_context *ctx, -+ const struct ibv_alloc_dm_attr *dm_attr, -+ struct verbs_dm *dm, -+ struct ibv_command_buffer *link); -+int ibv_cmd_free_dm(struct verbs_dm *dm); -+int ibv_cmd_reg_dm_mr(struct ibv_pd *pd, struct verbs_dm *dm, -+ uint64_t offset, size_t length, -+ unsigned int access, struct verbs_mr *vmr, -+ struct ibv_command_buffer *link); -+ -+int __ibv_query_gid_ex(struct ibv_context *context, uint32_t port_num, -+ uint32_t gid_index, struct ibv_gid_entry *entry, -+ uint32_t flags, size_t entry_size, -+ uint32_t fallback_attr_mask); -+ -+/* -+ * sysfs helper functions -+ */ -+const char *ibv_get_sysfs_path(void); -+ -+int ibv_read_sysfs_file(const char *dir, const char *file, -+ char *buf, size_t size); -+int ibv_read_sysfs_file_at(int dirfd, const char *file, char *buf, size_t size); -+int ibv_read_ibdev_sysfs_file(char *buf, size_t size, -+ struct verbs_sysfs_dev *sysfs_dev, -+ const char *fnfmt, ...) -+ __attribute__((format(printf, 4, 5))); -+ -+static inline bool check_comp_mask(uint64_t input, uint64_t supported) -+{ -+ return (input & ~supported) == 0; -+} -+ -+int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num, -+ unsigned int index, enum ibv_gid_type_sysfs *type); -+ -+static inline int -+ibv_check_alloc_parent_domain(struct ibv_parent_domain_init_attr *attr) -+{ -+ /* A valid protection domain must be set */ -+ if (!attr->pd) { -+ errno = EINVAL; -+ return -1; -+ } -+ -+ return 0; -+} -+ -+/* -+ * Initialize the ibv_pd which is being used as a parent_domain. From the -+ * perspective of the core code the new ibv_pd is completely interchangeable -+ * with the passed contained_pd. -+ */ -+static inline void ibv_initialize_parent_domain(struct ibv_pd *parent_domain, -+ struct ibv_pd *contained_pd) -+{ -+ parent_domain->context = contained_pd->context; -+ parent_domain->handle = contained_pd->handle; -+} -+ -+#endif /* INFINIBAND_DRIVER_H */ -diff --git a/src/rc-compat/v37/ib_user_verbs.h b/src/rc-compat/v37/ib_user_verbs.h -new file mode 100644 -index 000000000000..7ee73a0652f1 ---- /dev/null -+++ b/src/rc-compat/v37/ib_user_verbs.h -@@ -0,0 +1,1301 @@ -+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ -+/* -+ * Copyright (c) 2005 Topspin Communications. All rights reserved. -+ * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. -+ * Copyright (c) 2005 PathScale, Inc. All rights reserved. -+ * Copyright (c) 2006 Mellanox Technologies. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#ifndef IB_USER_VERBS_H -+#define IB_USER_VERBS_H -+ -+#include -+ -+/* -+ * Increment this value if any changes that break userspace ABI -+ * compatibility are made. -+ */ -+#define IB_USER_VERBS_ABI_VERSION 6 -+#define IB_USER_VERBS_CMD_THRESHOLD 50 -+ -+enum ib_uverbs_write_cmds { -+ IB_USER_VERBS_CMD_GET_CONTEXT, -+ IB_USER_VERBS_CMD_QUERY_DEVICE, -+ IB_USER_VERBS_CMD_QUERY_PORT, -+ IB_USER_VERBS_CMD_ALLOC_PD, -+ IB_USER_VERBS_CMD_DEALLOC_PD, -+ IB_USER_VERBS_CMD_CREATE_AH, -+ IB_USER_VERBS_CMD_MODIFY_AH, -+ IB_USER_VERBS_CMD_QUERY_AH, -+ IB_USER_VERBS_CMD_DESTROY_AH, -+ IB_USER_VERBS_CMD_REG_MR, -+ IB_USER_VERBS_CMD_REG_SMR, -+ IB_USER_VERBS_CMD_REREG_MR, -+ IB_USER_VERBS_CMD_QUERY_MR, -+ IB_USER_VERBS_CMD_DEREG_MR, -+ IB_USER_VERBS_CMD_ALLOC_MW, -+ IB_USER_VERBS_CMD_BIND_MW, -+ IB_USER_VERBS_CMD_DEALLOC_MW, -+ IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, -+ IB_USER_VERBS_CMD_CREATE_CQ, -+ IB_USER_VERBS_CMD_RESIZE_CQ, -+ IB_USER_VERBS_CMD_DESTROY_CQ, -+ IB_USER_VERBS_CMD_POLL_CQ, -+ IB_USER_VERBS_CMD_PEEK_CQ, -+ IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, -+ IB_USER_VERBS_CMD_CREATE_QP, -+ IB_USER_VERBS_CMD_QUERY_QP, -+ IB_USER_VERBS_CMD_MODIFY_QP, -+ IB_USER_VERBS_CMD_DESTROY_QP, -+ IB_USER_VERBS_CMD_POST_SEND, -+ IB_USER_VERBS_CMD_POST_RECV, -+ IB_USER_VERBS_CMD_ATTACH_MCAST, -+ IB_USER_VERBS_CMD_DETACH_MCAST, -+ IB_USER_VERBS_CMD_CREATE_SRQ, -+ IB_USER_VERBS_CMD_MODIFY_SRQ, -+ IB_USER_VERBS_CMD_QUERY_SRQ, -+ IB_USER_VERBS_CMD_DESTROY_SRQ, -+ IB_USER_VERBS_CMD_POST_SRQ_RECV, -+ IB_USER_VERBS_CMD_OPEN_XRCD, -+ IB_USER_VERBS_CMD_CLOSE_XRCD, -+ IB_USER_VERBS_CMD_CREATE_XSRQ, -+ IB_USER_VERBS_CMD_OPEN_QP, -+}; -+ -+enum { -+ IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, -+ IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ, -+ IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP, -+ IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP, -+ IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, -+ IB_USER_VERBS_EX_CMD_DESTROY_FLOW, -+ IB_USER_VERBS_EX_CMD_CREATE_WQ, -+ IB_USER_VERBS_EX_CMD_MODIFY_WQ, -+ IB_USER_VERBS_EX_CMD_DESTROY_WQ, -+ IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, -+ IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, -+ IB_USER_VERBS_EX_CMD_MODIFY_CQ -+}; -+ -+/* -+ * Make sure that all structs defined in this file remain laid out so -+ * that they pack the same way on 32-bit and 64-bit architectures (to -+ * avoid incompatibility between 32-bit userspace and 64-bit kernels). -+ * Specifically: -+ * - Do not use pointer types -- pass pointers in __u64 instead. -+ * - Make sure that any structure larger than 4 bytes is padded to a -+ * multiple of 8 bytes. Otherwise the structure size will be -+ * different between 32-bit and 64-bit architectures. -+ */ -+ -+struct ib_uverbs_async_event_desc { -+ __aligned_u64 element; -+ __u32 event_type; /* enum ib_event_type */ -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_comp_event_desc { -+ __aligned_u64 cq_handle; -+}; -+ -+struct ib_uverbs_cq_moderation_caps { -+ __u16 max_cq_moderation_count; -+ __u16 max_cq_moderation_period; -+ __u32 reserved; -+}; -+ -+/* -+ * All commands from userspace should start with a __u32 command field -+ * followed by __u16 in_words and out_words fields (which give the -+ * length of the command block and response buffer if any in 32-bit -+ * words). The kernel driver will read these fields first and read -+ * the rest of the command struct based on these value. -+ */ -+ -+#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff -+#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u -+ -+struct ib_uverbs_cmd_hdr { -+ __u32 command; -+ __u16 in_words; -+ __u16 out_words; -+}; -+ -+struct ib_uverbs_ex_cmd_hdr { -+ __aligned_u64 response; -+ __u16 provider_in_words; -+ __u16 provider_out_words; -+ __u32 cmd_hdr_reserved; -+}; -+ -+struct ib_uverbs_get_context { -+ __aligned_u64 response; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_get_context_resp { -+ __u32 async_fd; -+ __u32 num_comp_vectors; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_query_device { -+ __aligned_u64 response; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_query_device_resp { -+ __aligned_u64 fw_ver; -+ __be64 node_guid; -+ __be64 sys_image_guid; -+ __aligned_u64 max_mr_size; -+ __aligned_u64 page_size_cap; -+ __u32 vendor_id; -+ __u32 vendor_part_id; -+ __u32 hw_ver; -+ __u32 max_qp; -+ __u32 max_qp_wr; -+ __u32 device_cap_flags; -+ __u32 max_sge; -+ __u32 max_sge_rd; -+ __u32 max_cq; -+ __u32 max_cqe; -+ __u32 max_mr; -+ __u32 max_pd; -+ __u32 max_qp_rd_atom; -+ __u32 max_ee_rd_atom; -+ __u32 max_res_rd_atom; -+ __u32 max_qp_init_rd_atom; -+ __u32 max_ee_init_rd_atom; -+ __u32 atomic_cap; -+ __u32 max_ee; -+ __u32 max_rdd; -+ __u32 max_mw; -+ __u32 max_raw_ipv6_qp; -+ __u32 max_raw_ethy_qp; -+ __u32 max_mcast_grp; -+ __u32 max_mcast_qp_attach; -+ __u32 max_total_mcast_qp_attach; -+ __u32 max_ah; -+ __u32 max_fmr; -+ __u32 max_map_per_fmr; -+ __u32 max_srq; -+ __u32 max_srq_wr; -+ __u32 max_srq_sge; -+ __u16 max_pkeys; -+ __u8 local_ca_ack_delay; -+ __u8 phys_port_cnt; -+ __u8 reserved[4]; -+}; -+ -+struct ib_uverbs_ex_query_device { -+ __u32 comp_mask; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_odp_caps { -+ __aligned_u64 general_caps; -+ struct { -+ __u32 rc_odp_caps; -+ __u32 uc_odp_caps; -+ __u32 ud_odp_caps; -+ } per_transport_caps; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_rss_caps { -+ /* Corresponding bit will be set if qp type from -+ * 'enum ib_qp_type' is supported, e.g. -+ * supported_qpts |= 1 << IB_QPT_UD -+ */ -+ __u32 supported_qpts; -+ __u32 max_rwq_indirection_tables; -+ __u32 max_rwq_indirection_table_size; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_tm_caps { -+ /* Max size of rendezvous request message */ -+ __u32 max_rndv_hdr_size; -+ /* Max number of entries in tag matching list */ -+ __u32 max_num_tags; -+ /* TM flags */ -+ __u32 flags; -+ /* Max number of outstanding list operations */ -+ __u32 max_ops; -+ /* Max number of SGE in tag matching entry */ -+ __u32 max_sge; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_ex_query_device_resp { -+ struct ib_uverbs_query_device_resp base; -+ __u32 comp_mask; -+ __u32 response_length; -+ struct ib_uverbs_odp_caps odp_caps; -+ __aligned_u64 timestamp_mask; -+ __aligned_u64 hca_core_clock; /* in KHZ */ -+ __aligned_u64 device_cap_flags_ex; -+ struct ib_uverbs_rss_caps rss_caps; -+ __u32 max_wq_type_rq; -+ __u32 raw_packet_caps; -+ struct ib_uverbs_tm_caps tm_caps; -+ struct ib_uverbs_cq_moderation_caps cq_moderation_caps; -+ __aligned_u64 max_dm_size; -+ __u32 xrc_odp_caps; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_query_port { -+ __aligned_u64 response; -+ __u8 port_num; -+ __u8 reserved[7]; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_query_port_resp { -+ __u32 port_cap_flags; /* see ib_uverbs_query_port_cap_flags */ -+ __u32 max_msg_sz; -+ __u32 bad_pkey_cntr; -+ __u32 qkey_viol_cntr; -+ __u32 gid_tbl_len; -+ __u16 pkey_tbl_len; -+ __u16 lid; -+ __u16 sm_lid; -+ __u8 state; -+ __u8 max_mtu; -+ __u8 active_mtu; -+ __u8 lmc; -+ __u8 max_vl_num; -+ __u8 sm_sl; -+ __u8 subnet_timeout; -+ __u8 init_type_reply; -+ __u8 active_width; -+ __u8 active_speed; -+ __u8 phys_state; -+ __u8 link_layer; -+ __u8 flags; /* see ib_uverbs_query_port_flags */ -+ __u8 reserved; -+}; -+ -+struct ib_uverbs_alloc_pd { -+ __aligned_u64 response; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_alloc_pd_resp { -+ __u32 pd_handle; -+ __u32 driver_data[0]; -+}; -+ -+struct ib_uverbs_dealloc_pd { -+ __u32 pd_handle; -+}; -+ -+struct ib_uverbs_open_xrcd { -+ __aligned_u64 response; -+ __u32 fd; -+ __u32 oflags; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_open_xrcd_resp { -+ __u32 xrcd_handle; -+ __u32 driver_data[0]; -+}; -+ -+struct ib_uverbs_close_xrcd { -+ __u32 xrcd_handle; -+}; -+ -+struct ib_uverbs_reg_mr { -+ __aligned_u64 response; -+ __aligned_u64 start; -+ __aligned_u64 length; -+ __aligned_u64 hca_va; -+ __u32 pd_handle; -+ __u32 access_flags; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_reg_mr_resp { -+ __u32 mr_handle; -+ __u32 lkey; -+ __u32 rkey; -+ __u32 driver_data[0]; -+}; -+ -+struct ib_uverbs_rereg_mr { -+ __aligned_u64 response; -+ __u32 mr_handle; -+ __u32 flags; -+ __aligned_u64 start; -+ __aligned_u64 length; -+ __aligned_u64 hca_va; -+ __u32 pd_handle; -+ __u32 access_flags; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_rereg_mr_resp { -+ __u32 lkey; -+ __u32 rkey; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_dereg_mr { -+ __u32 mr_handle; -+}; -+ -+struct ib_uverbs_alloc_mw { -+ __aligned_u64 response; -+ __u32 pd_handle; -+ __u8 mw_type; -+ __u8 reserved[3]; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_alloc_mw_resp { -+ __u32 mw_handle; -+ __u32 rkey; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_dealloc_mw { -+ __u32 mw_handle; -+}; -+ -+struct ib_uverbs_create_comp_channel { -+ __aligned_u64 response; -+}; -+ -+struct ib_uverbs_create_comp_channel_resp { -+ __u32 fd; -+}; -+ -+struct ib_uverbs_create_cq { -+ __aligned_u64 response; -+ __aligned_u64 user_handle; -+ __u32 cqe; -+ __u32 comp_vector; -+ __s32 comp_channel; -+ __u32 reserved; -+ __aligned_u64 driver_data[0]; -+}; -+ -+enum ib_uverbs_ex_create_cq_flags { -+ IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0, -+ IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1, -+}; -+ -+struct ib_uverbs_ex_create_cq { -+ __aligned_u64 user_handle; -+ __u32 cqe; -+ __u32 comp_vector; -+ __s32 comp_channel; -+ __u32 comp_mask; -+ __u32 flags; /* bitmask of ib_uverbs_ex_create_cq_flags */ -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_create_cq_resp { -+ __u32 cq_handle; -+ __u32 cqe; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_ex_create_cq_resp { -+ struct ib_uverbs_create_cq_resp base; -+ __u32 comp_mask; -+ __u32 response_length; -+}; -+ -+struct ib_uverbs_resize_cq { -+ __aligned_u64 response; -+ __u32 cq_handle; -+ __u32 cqe; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_resize_cq_resp { -+ __u32 cqe; -+ __u32 reserved; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_poll_cq { -+ __aligned_u64 response; -+ __u32 cq_handle; -+ __u32 ne; -+}; -+ -+enum ib_uverbs_wc_opcode { -+ IB_UVERBS_WC_SEND = 0, -+ IB_UVERBS_WC_RDMA_WRITE = 1, -+ IB_UVERBS_WC_RDMA_READ = 2, -+ IB_UVERBS_WC_COMP_SWAP = 3, -+ IB_UVERBS_WC_FETCH_ADD = 4, -+ IB_UVERBS_WC_BIND_MW = 5, -+ IB_UVERBS_WC_LOCAL_INV = 6, -+ IB_UVERBS_WC_TSO = 7, -+}; -+ -+struct ib_uverbs_wc { -+ __aligned_u64 wr_id; -+ __u32 status; -+ __u32 opcode; -+ __u32 vendor_err; -+ __u32 byte_len; -+ union { -+ __be32 imm_data; -+ __u32 invalidate_rkey; -+ } ex; -+ __u32 qp_num; -+ __u32 src_qp; -+ __u32 wc_flags; -+ __u16 pkey_index; -+ __u16 slid; -+ __u8 sl; -+ __u8 dlid_path_bits; -+ __u8 port_num; -+ __u8 reserved; -+}; -+ -+struct ib_uverbs_poll_cq_resp { -+ __u32 count; -+ __u32 reserved; -+ struct ib_uverbs_wc wc[0]; -+}; -+ -+struct ib_uverbs_req_notify_cq { -+ __u32 cq_handle; -+ __u32 solicited_only; -+}; -+ -+struct ib_uverbs_destroy_cq { -+ __aligned_u64 response; -+ __u32 cq_handle; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_destroy_cq_resp { -+ __u32 comp_events_reported; -+ __u32 async_events_reported; -+}; -+ -+struct ib_uverbs_global_route { -+ __u8 dgid[16]; -+ __u32 flow_label; -+ __u8 sgid_index; -+ __u8 hop_limit; -+ __u8 traffic_class; -+ __u8 reserved; -+}; -+ -+struct ib_uverbs_ah_attr { -+ struct ib_uverbs_global_route grh; -+ __u16 dlid; -+ __u8 sl; -+ __u8 src_path_bits; -+ __u8 static_rate; -+ __u8 is_global; -+ __u8 port_num; -+ __u8 reserved; -+}; -+ -+struct ib_uverbs_qp_attr { -+ __u32 qp_attr_mask; -+ __u32 qp_state; -+ __u32 cur_qp_state; -+ __u32 path_mtu; -+ __u32 path_mig_state; -+ __u32 qkey; -+ __u32 rq_psn; -+ __u32 sq_psn; -+ __u32 dest_qp_num; -+ __u32 qp_access_flags; -+ -+ struct ib_uverbs_ah_attr ah_attr; -+ struct ib_uverbs_ah_attr alt_ah_attr; -+ -+ /* ib_qp_cap */ -+ __u32 max_send_wr; -+ __u32 max_recv_wr; -+ __u32 max_send_sge; -+ __u32 max_recv_sge; -+ __u32 max_inline_data; -+ -+ __u16 pkey_index; -+ __u16 alt_pkey_index; -+ __u8 en_sqd_async_notify; -+ __u8 sq_draining; -+ __u8 max_rd_atomic; -+ __u8 max_dest_rd_atomic; -+ __u8 min_rnr_timer; -+ __u8 port_num; -+ __u8 timeout; -+ __u8 retry_cnt; -+ __u8 rnr_retry; -+ __u8 alt_port_num; -+ __u8 alt_timeout; -+ __u8 reserved[5]; -+}; -+ -+struct ib_uverbs_create_qp { -+ __aligned_u64 response; -+ __aligned_u64 user_handle; -+ __u32 pd_handle; -+ __u32 send_cq_handle; -+ __u32 recv_cq_handle; -+ __u32 srq_handle; -+ __u32 max_send_wr; -+ __u32 max_recv_wr; -+ __u32 max_send_sge; -+ __u32 max_recv_sge; -+ __u32 max_inline_data; -+ __u8 sq_sig_all; -+ __u8 qp_type; -+ __u8 is_srq; -+ __u8 reserved; -+ __aligned_u64 driver_data[0]; -+}; -+ -+enum ib_uverbs_create_qp_mask { -+ IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0, -+}; -+ -+enum { -+ IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE, -+}; -+ -+struct ib_uverbs_ex_create_qp { -+ __aligned_u64 user_handle; -+ __u32 pd_handle; -+ __u32 send_cq_handle; -+ __u32 recv_cq_handle; -+ __u32 srq_handle; -+ __u32 max_send_wr; -+ __u32 max_recv_wr; -+ __u32 max_send_sge; -+ __u32 max_recv_sge; -+ __u32 max_inline_data; -+ __u8 sq_sig_all; -+ __u8 qp_type; -+ __u8 is_srq; -+ __u8 reserved; -+ __u32 comp_mask; -+ __u32 create_flags; -+ __u32 rwq_ind_tbl_handle; -+ __u32 source_qpn; -+}; -+ -+struct ib_uverbs_open_qp { -+ __aligned_u64 response; -+ __aligned_u64 user_handle; -+ __u32 pd_handle; -+ __u32 qpn; -+ __u8 qp_type; -+ __u8 reserved[7]; -+ __aligned_u64 driver_data[0]; -+}; -+ -+/* also used for open response */ -+struct ib_uverbs_create_qp_resp { -+ __u32 qp_handle; -+ __u32 qpn; -+ __u32 max_send_wr; -+ __u32 max_recv_wr; -+ __u32 max_send_sge; -+ __u32 max_recv_sge; -+ __u32 max_inline_data; -+ __u32 reserved; -+ __u32 driver_data[0]; -+}; -+ -+struct ib_uverbs_ex_create_qp_resp { -+ struct ib_uverbs_create_qp_resp base; -+ __u32 comp_mask; -+ __u32 response_length; -+}; -+ -+/* -+ * This struct needs to remain a multiple of 8 bytes to keep the -+ * alignment of the modify QP parameters. -+ */ -+struct ib_uverbs_qp_dest { -+ __u8 dgid[16]; -+ __u32 flow_label; -+ __u16 dlid; -+ __u16 reserved; -+ __u8 sgid_index; -+ __u8 hop_limit; -+ __u8 traffic_class; -+ __u8 sl; -+ __u8 src_path_bits; -+ __u8 static_rate; -+ __u8 is_global; -+ __u8 port_num; -+}; -+ -+struct ib_uverbs_query_qp { -+ __aligned_u64 response; -+ __u32 qp_handle; -+ __u32 attr_mask; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_query_qp_resp { -+ struct ib_uverbs_qp_dest dest; -+ struct ib_uverbs_qp_dest alt_dest; -+ __u32 max_send_wr; -+ __u32 max_recv_wr; -+ __u32 max_send_sge; -+ __u32 max_recv_sge; -+ __u32 max_inline_data; -+ __u32 qkey; -+ __u32 rq_psn; -+ __u32 sq_psn; -+ __u32 dest_qp_num; -+ __u32 qp_access_flags; -+ __u16 pkey_index; -+ __u16 alt_pkey_index; -+ __u8 qp_state; -+ __u8 cur_qp_state; -+ __u8 path_mtu; -+ __u8 path_mig_state; -+ __u8 sq_draining; -+ __u8 max_rd_atomic; -+ __u8 max_dest_rd_atomic; -+ __u8 min_rnr_timer; -+ __u8 port_num; -+ __u8 timeout; -+ __u8 retry_cnt; -+ __u8 rnr_retry; -+ __u8 alt_port_num; -+ __u8 alt_timeout; -+ __u8 sq_sig_all; -+ __u8 reserved[5]; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_modify_qp { -+ struct ib_uverbs_qp_dest dest; -+ struct ib_uverbs_qp_dest alt_dest; -+ __u32 qp_handle; -+ __u32 attr_mask; -+ __u32 qkey; -+ __u32 rq_psn; -+ __u32 sq_psn; -+ __u32 dest_qp_num; -+ __u32 qp_access_flags; -+ __u16 pkey_index; -+ __u16 alt_pkey_index; -+ __u8 qp_state; -+ __u8 cur_qp_state; -+ __u8 path_mtu; -+ __u8 path_mig_state; -+ __u8 en_sqd_async_notify; -+ __u8 max_rd_atomic; -+ __u8 max_dest_rd_atomic; -+ __u8 min_rnr_timer; -+ __u8 port_num; -+ __u8 timeout; -+ __u8 retry_cnt; -+ __u8 rnr_retry; -+ __u8 alt_port_num; -+ __u8 alt_timeout; -+ __u8 reserved[2]; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_ex_modify_qp { -+ struct ib_uverbs_modify_qp base; -+ __u32 rate_limit; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_ex_modify_qp_resp { -+ __u32 comp_mask; -+ __u32 response_length; -+}; -+ -+struct ib_uverbs_destroy_qp { -+ __aligned_u64 response; -+ __u32 qp_handle; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_destroy_qp_resp { -+ __u32 events_reported; -+}; -+ -+/* -+ * The ib_uverbs_sge structure isn't used anywhere, since we assume -+ * the ib_sge structure is packed the same way on 32-bit and 64-bit -+ * architectures in both kernel and user space. It's just here to -+ * document the ABI. -+ */ -+struct ib_uverbs_sge { -+ __aligned_u64 addr; -+ __u32 length; -+ __u32 lkey; -+}; -+ -+enum ib_uverbs_wr_opcode { -+ IB_UVERBS_WR_RDMA_WRITE = 0, -+ IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, -+ IB_UVERBS_WR_SEND = 2, -+ IB_UVERBS_WR_SEND_WITH_IMM = 3, -+ IB_UVERBS_WR_RDMA_READ = 4, -+ IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, -+ IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, -+ IB_UVERBS_WR_LOCAL_INV = 7, -+ IB_UVERBS_WR_BIND_MW = 8, -+ IB_UVERBS_WR_SEND_WITH_INV = 9, -+ IB_UVERBS_WR_TSO = 10, -+ IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, -+ IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, -+ IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, -+ /* Review enum ib_wr_opcode before modifying this */ -+}; -+ -+struct ib_uverbs_send_wr { -+ __aligned_u64 wr_id; -+ __u32 num_sge; -+ __u32 opcode; /* see enum ib_uverbs_wr_opcode */ -+ __u32 send_flags; -+ union { -+ __be32 imm_data; -+ __u32 invalidate_rkey; -+ } ex; -+ union { -+ struct { -+ __aligned_u64 remote_addr; -+ __u32 rkey; -+ __u32 reserved; -+ } rdma; -+ struct { -+ __aligned_u64 remote_addr; -+ __aligned_u64 compare_add; -+ __aligned_u64 swap; -+ __u32 rkey; -+ __u32 reserved; -+ } atomic; -+ struct { -+ __u32 ah; -+ __u32 remote_qpn; -+ __u32 remote_qkey; -+ __u32 reserved; -+ } ud; -+ } wr; -+}; -+ -+struct ib_uverbs_post_send { -+ __aligned_u64 response; -+ __u32 qp_handle; -+ __u32 wr_count; -+ __u32 sge_count; -+ __u32 wqe_size; -+ struct ib_uverbs_send_wr send_wr[0]; -+}; -+ -+struct ib_uverbs_post_send_resp { -+ __u32 bad_wr; -+}; -+ -+struct ib_uverbs_recv_wr { -+ __aligned_u64 wr_id; -+ __u32 num_sge; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_post_recv { -+ __aligned_u64 response; -+ __u32 qp_handle; -+ __u32 wr_count; -+ __u32 sge_count; -+ __u32 wqe_size; -+ struct ib_uverbs_recv_wr recv_wr[0]; -+}; -+ -+struct ib_uverbs_post_recv_resp { -+ __u32 bad_wr; -+}; -+ -+struct ib_uverbs_post_srq_recv { -+ __aligned_u64 response; -+ __u32 srq_handle; -+ __u32 wr_count; -+ __u32 sge_count; -+ __u32 wqe_size; -+ struct ib_uverbs_recv_wr recv[0]; -+}; -+ -+struct ib_uverbs_post_srq_recv_resp { -+ __u32 bad_wr; -+}; -+ -+struct ib_uverbs_create_ah { -+ __aligned_u64 response; -+ __aligned_u64 user_handle; -+ __u32 pd_handle; -+ __u32 reserved; -+ struct ib_uverbs_ah_attr attr; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_create_ah_resp { -+ __u32 ah_handle; -+ __u32 driver_data[0]; -+}; -+ -+struct ib_uverbs_destroy_ah { -+ __u32 ah_handle; -+}; -+ -+struct ib_uverbs_attach_mcast { -+ __u8 gid[16]; -+ __u32 qp_handle; -+ __u16 mlid; -+ __u16 reserved; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_detach_mcast { -+ __u8 gid[16]; -+ __u32 qp_handle; -+ __u16 mlid; -+ __u16 reserved; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_flow_spec_hdr { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ /* followed by flow_spec */ -+ __aligned_u64 flow_spec_data[0]; -+}; -+ -+struct ib_uverbs_flow_eth_filter { -+ __u8 dst_mac[6]; -+ __u8 src_mac[6]; -+ __be16 ether_type; -+ __be16 vlan_tag; -+}; -+ -+struct ib_uverbs_flow_spec_eth { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_eth_filter val; -+ struct ib_uverbs_flow_eth_filter mask; -+}; -+ -+struct ib_uverbs_flow_ipv4_filter { -+ __be32 src_ip; -+ __be32 dst_ip; -+ __u8 proto; -+ __u8 tos; -+ __u8 ttl; -+ __u8 flags; -+}; -+ -+struct ib_uverbs_flow_spec_ipv4 { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_ipv4_filter val; -+ struct ib_uverbs_flow_ipv4_filter mask; -+}; -+ -+struct ib_uverbs_flow_tcp_udp_filter { -+ __be16 dst_port; -+ __be16 src_port; -+}; -+ -+struct ib_uverbs_flow_spec_tcp_udp { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_tcp_udp_filter val; -+ struct ib_uverbs_flow_tcp_udp_filter mask; -+}; -+ -+struct ib_uverbs_flow_ipv6_filter { -+ __u8 src_ip[16]; -+ __u8 dst_ip[16]; -+ __be32 flow_label; -+ __u8 next_hdr; -+ __u8 traffic_class; -+ __u8 hop_limit; -+ __u8 reserved; -+}; -+ -+struct ib_uverbs_flow_spec_ipv6 { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_ipv6_filter val; -+ struct ib_uverbs_flow_ipv6_filter mask; -+}; -+ -+struct ib_uverbs_flow_spec_action_tag { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ __u32 tag_id; -+ __u32 reserved1; -+}; -+ -+struct ib_uverbs_flow_spec_action_drop { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+}; -+ -+struct ib_uverbs_flow_spec_action_handle { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ __u32 handle; -+ __u32 reserved1; -+}; -+ -+struct ib_uverbs_flow_spec_action_count { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ __u32 handle; -+ __u32 reserved1; -+}; -+ -+struct ib_uverbs_flow_tunnel_filter { -+ __be32 tunnel_id; -+}; -+ -+struct ib_uverbs_flow_spec_tunnel { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_tunnel_filter val; -+ struct ib_uverbs_flow_tunnel_filter mask; -+}; -+ -+struct ib_uverbs_flow_spec_esp_filter { -+ __u32 spi; -+ __u32 seq; -+}; -+ -+struct ib_uverbs_flow_spec_esp { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_spec_esp_filter val; -+ struct ib_uverbs_flow_spec_esp_filter mask; -+}; -+ -+struct ib_uverbs_flow_gre_filter { -+ /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header: -+ * bit 0 - C - checksum bit. -+ * bit 1 - reserved. set to 0. -+ * bit 2 - key bit. -+ * bit 3 - sequence number bit. -+ * bits 4:12 - reserved. set to 0. -+ * bits 13:15 - GRE version. -+ */ -+ __be16 c_ks_res0_ver; -+ __be16 protocol; -+ __be32 key; -+}; -+ -+struct ib_uverbs_flow_spec_gre { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_gre_filter val; -+ struct ib_uverbs_flow_gre_filter mask; -+}; -+ -+struct ib_uverbs_flow_mpls_filter { -+ /* The field includes the entire MPLS label: -+ * bits 0:19 - label field. -+ * bits 20:22 - traffic class field. -+ * bits 23 - bottom of stack bit. -+ * bits 24:31 - ttl field. -+ */ -+ __be32 label; -+}; -+ -+struct ib_uverbs_flow_spec_mpls { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ }; -+ }; -+ struct ib_uverbs_flow_mpls_filter val; -+ struct ib_uverbs_flow_mpls_filter mask; -+}; -+ -+struct ib_uverbs_flow_attr { -+ __u32 type; -+ __u16 size; -+ __u16 priority; -+ __u8 num_of_specs; -+ __u8 reserved[2]; -+ __u8 port; -+ __u32 flags; -+ /* Following are the optional layers according to user request -+ * struct ib_flow_spec_xxx -+ * struct ib_flow_spec_yyy -+ */ -+ struct ib_uverbs_flow_spec_hdr flow_specs[0]; -+}; -+ -+struct ib_uverbs_create_flow { -+ __u32 comp_mask; -+ __u32 qp_handle; -+ struct ib_uverbs_flow_attr flow_attr; -+}; -+ -+struct ib_uverbs_create_flow_resp { -+ __u32 comp_mask; -+ __u32 flow_handle; -+}; -+ -+struct ib_uverbs_destroy_flow { -+ __u32 comp_mask; -+ __u32 flow_handle; -+}; -+ -+struct ib_uverbs_create_srq { -+ __aligned_u64 response; -+ __aligned_u64 user_handle; -+ __u32 pd_handle; -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 srq_limit; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_create_xsrq { -+ __aligned_u64 response; -+ __aligned_u64 user_handle; -+ __u32 srq_type; -+ __u32 pd_handle; -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 srq_limit; -+ __u32 max_num_tags; -+ __u32 xrcd_handle; -+ __u32 cq_handle; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_create_srq_resp { -+ __u32 srq_handle; -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 srqn; -+ __u32 driver_data[0]; -+}; -+ -+struct ib_uverbs_modify_srq { -+ __u32 srq_handle; -+ __u32 attr_mask; -+ __u32 max_wr; -+ __u32 srq_limit; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_query_srq { -+ __aligned_u64 response; -+ __u32 srq_handle; -+ __u32 reserved; -+ __aligned_u64 driver_data[0]; -+}; -+ -+struct ib_uverbs_query_srq_resp { -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 srq_limit; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_destroy_srq { -+ __aligned_u64 response; -+ __u32 srq_handle; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_destroy_srq_resp { -+ __u32 events_reported; -+}; -+ -+struct ib_uverbs_ex_create_wq { -+ __u32 comp_mask; -+ __u32 wq_type; -+ __aligned_u64 user_handle; -+ __u32 pd_handle; -+ __u32 cq_handle; -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 create_flags; /* Use enum ib_wq_flags */ -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_ex_create_wq_resp { -+ __u32 comp_mask; -+ __u32 response_length; -+ __u32 wq_handle; -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 wqn; -+}; -+ -+struct ib_uverbs_ex_destroy_wq { -+ __u32 comp_mask; -+ __u32 wq_handle; -+}; -+ -+struct ib_uverbs_ex_destroy_wq_resp { -+ __u32 comp_mask; -+ __u32 response_length; -+ __u32 events_reported; -+ __u32 reserved; -+}; -+ -+struct ib_uverbs_ex_modify_wq { -+ __u32 attr_mask; -+ __u32 wq_handle; -+ __u32 wq_state; -+ __u32 curr_wq_state; -+ __u32 flags; /* Use enum ib_wq_flags */ -+ __u32 flags_mask; /* Use enum ib_wq_flags */ -+}; -+ -+/* Prevent memory allocation rather than max expected size */ -+#define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d -+struct ib_uverbs_ex_create_rwq_ind_table { -+ __u32 comp_mask; -+ __u32 log_ind_tbl_size; -+ /* Following are the wq handles according to log_ind_tbl_size -+ * wq_handle1 -+ * wq_handle2 -+ */ -+ __u32 wq_handles[0]; -+}; -+ -+struct ib_uverbs_ex_create_rwq_ind_table_resp { -+ __u32 comp_mask; -+ __u32 response_length; -+ __u32 ind_tbl_handle; -+ __u32 ind_tbl_num; -+}; -+ -+struct ib_uverbs_ex_destroy_rwq_ind_table { -+ __u32 comp_mask; -+ __u32 ind_tbl_handle; -+}; -+ -+struct ib_uverbs_cq_moderation { -+ __u16 cq_count; -+ __u16 cq_period; -+}; -+ -+struct ib_uverbs_ex_modify_cq { -+ __u32 cq_handle; -+ __u32 attr_mask; -+ struct ib_uverbs_cq_moderation attr; -+ __u32 reserved; -+}; -+ -+#define IB_DEVICE_NAME_MAX 64 -+ -+#endif /* IB_USER_VERBS_H */ -diff --git a/src/rc-compat/v37/kern-abi.h b/src/rc-compat/v37/kern-abi.h -new file mode 100644 -index 000000000000..570b05fec462 ---- /dev/null -+++ b/src/rc-compat/v37/kern-abi.h -@@ -0,0 +1,322 @@ -+/* -+ * Copyright (c) 2005 Topspin Communications. All rights reserved. -+ * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. -+ * Copyright (c) 2005 PathScale, Inc. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#ifndef KERN_ABI_H -+#define KERN_ABI_H -+ -+#include -+#include -+#include -+ -+#include -+#include "kernel-abi_ib_user_verbs.h" -+ -+/* -+ * The minimum and maximum kernel ABI that we can handle. -+ */ -+#define IB_USER_VERBS_MIN_ABI_VERSION 3 -+#define IB_USER_VERBS_MAX_ABI_VERSION 6 -+ -+struct ex_hdr { -+ struct ib_uverbs_cmd_hdr hdr; -+ struct ib_uverbs_ex_cmd_hdr ex_hdr; -+}; -+ -+/* -+ * These macros expand to type names that refer to the ABI structure type -+ * associated with the given enum string. -+ */ -+#define IBV_ABI_REQ(_enum) _ABI_REQ_STRUCT_##_enum -+#define IBV_KABI_REQ(_enum) _KABI_REQ_STRUCT_##_enum -+#define IBV_KABI_RESP(_enum) _KABI_RESP_STRUCT_##_enum -+ -+#define IBV_ABI_ALIGN(_enum) _ABI_ALIGN_##_enum -+ -+/* -+ * Historically the code had copied the data in the kernel headers, modified -+ * it and placed them in structs. To avoid recoding eveything we continue to -+ * preserve the same struct layout, with the kernel struct 'loose' inside the -+ * modified userspace struct. -+ * -+ * This is automated with the make_abi_structs.py script which produces the -+ * _STRUCT_xx macro that produces a tagless version of the kernel struct. The -+ * tagless struct produces a layout that matches the original code. -+ */ -+#define DECLARE_CMDX(_enum, _name, _kabi, _kabi_resp) \ -+ struct _name { \ -+ struct ib_uverbs_cmd_hdr hdr; \ -+ union { \ -+ _STRUCT_##_kabi; \ -+ struct _kabi core_payload; \ -+ }; \ -+ }; \ -+ typedef struct _name IBV_ABI_REQ(_enum); \ -+ typedef struct _kabi IBV_KABI_REQ(_enum); \ -+ typedef struct _kabi_resp IBV_KABI_RESP(_enum); \ -+ enum { IBV_ABI_ALIGN(_enum) = 4 }; \ -+ static_assert(sizeof(struct _kabi_resp) % 4 == 0, \ -+ "Bad resp alignment"); \ -+ static_assert(_enum != -1, "Bad enum"); \ -+ static_assert(sizeof(struct _name) == \ -+ sizeof(struct ib_uverbs_cmd_hdr) + \ -+ sizeof(struct _kabi), \ -+ "Bad size") -+ -+#define DECLARE_CMD(_enum, _name, _kabi) \ -+ DECLARE_CMDX(_enum, _name, _kabi, _kabi##_resp) -+ -+#define DECLARE_CMD_EXX(_enum, _name, _kabi, _kabi_resp) \ -+ struct _name { \ -+ struct ex_hdr hdr; \ -+ union { \ -+ _STRUCT_##_kabi; \ -+ struct _kabi core_payload; \ -+ }; \ -+ }; \ -+ typedef struct _name IBV_ABI_REQ(_enum); \ -+ typedef struct _kabi IBV_KABI_REQ(_enum); \ -+ typedef struct _kabi_resp IBV_KABI_RESP(_enum); \ -+ enum { IBV_ABI_ALIGN(_enum) = 8 }; \ -+ static_assert(_enum != -1, "Bad enum"); \ -+ static_assert(sizeof(struct _kabi) % 8 == 0, "Bad req alignment"); \ -+ static_assert(sizeof(struct _kabi_resp) % 8 == 0, \ -+ "Bad resp alignment"); \ -+ static_assert(sizeof(struct _name) == \ -+ sizeof(struct ex_hdr) + sizeof(struct _kabi), \ -+ "Bad size"); \ -+ static_assert(sizeof(struct _name) % 8 == 0, "Bad alignment") -+#define DECLARE_CMD_EX(_enum, _name, _kabi) \ -+ DECLARE_CMD_EXX(_enum, _name, _kabi, _kabi##_resp) -+ -+/* Drivers may use 'empty' for _kabi to signal no struct */ -+struct empty {}; -+#define _STRUCT_empty struct {} -+ -+/* -+ * Define the ABI struct for use by the driver. The internal cmd APIs require -+ * this layout. The driver specifies the enum # they wish to define for and -+ * the base name, and the macros figure out the rest correctly. -+ * -+ * The static asserts check that the layout produced by the wrapper struct has -+ * no implicit padding in strange places, specifically between the core -+ * structure and the driver structure and between the driver structure and the -+ * end of the struct. -+ * -+ * Implicit padding can arise in various cases where the structs are not sizes -+ * to a multiple of 8 bytes. -+ */ -+#define DECLARE_DRV_CMD(_name, _enum, _kabi_req, _kabi_resp) \ -+ struct _name { \ -+ IBV_ABI_REQ(_enum) ibv_cmd; \ -+ union { \ -+ _STRUCT_##_kabi_req; \ -+ struct _kabi_req drv_payload; \ -+ }; \ -+ }; \ -+ struct _name##_resp { \ -+ IBV_KABI_RESP(_enum) ibv_resp; \ -+ union { \ -+ _STRUCT_##_kabi_resp; \ -+ struct _kabi_resp drv_payload; \ -+ }; \ -+ }; \ -+ static_assert(sizeof(IBV_KABI_REQ(_enum)) % \ -+ __alignof__(struct _kabi_req) == \ -+ 0, \ -+ "Bad kabi req struct length"); \ -+ static_assert(sizeof(struct _name) == \ -+ sizeof(IBV_ABI_REQ(_enum)) + \ -+ sizeof(struct _kabi_req), \ -+ "Bad req size"); \ -+ static_assert(sizeof(struct _name) % IBV_ABI_ALIGN(_enum) == 0, \ -+ "Bad kabi req alignment"); \ -+ static_assert(sizeof(IBV_KABI_RESP(_enum)) % \ -+ __alignof__(struct _kabi_resp) == \ -+ 0, \ -+ "Bad kabi resp struct length"); \ -+ static_assert(sizeof(struct _name##_resp) == \ -+ sizeof(IBV_KABI_RESP(_enum)) + \ -+ sizeof(struct _kabi_resp), \ -+ "Bad resp size"); \ -+ static_assert(sizeof(struct _name##_resp) % IBV_ABI_ALIGN(_enum) == 0, \ -+ "Bad kabi resp alignment"); -+ -+DECLARE_CMD(IB_USER_VERBS_CMD_ALLOC_MW, ibv_alloc_mw, ib_uverbs_alloc_mw); -+DECLARE_CMD(IB_USER_VERBS_CMD_ALLOC_PD, ibv_alloc_pd, ib_uverbs_alloc_pd); -+DECLARE_CMDX(IB_USER_VERBS_CMD_ATTACH_MCAST, ibv_attach_mcast, ib_uverbs_attach_mcast, empty); -+DECLARE_CMDX(IB_USER_VERBS_CMD_CLOSE_XRCD, ibv_close_xrcd, ib_uverbs_close_xrcd, empty); -+DECLARE_CMD(IB_USER_VERBS_CMD_CREATE_AH, ibv_create_ah, ib_uverbs_create_ah); -+DECLARE_CMD(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, ibv_create_comp_channel, ib_uverbs_create_comp_channel); -+DECLARE_CMD(IB_USER_VERBS_CMD_CREATE_CQ, ibv_create_cq, ib_uverbs_create_cq); -+DECLARE_CMD(IB_USER_VERBS_CMD_CREATE_QP, ibv_create_qp, ib_uverbs_create_qp); -+DECLARE_CMD(IB_USER_VERBS_CMD_CREATE_SRQ, ibv_create_srq, ib_uverbs_create_srq); -+DECLARE_CMDX(IB_USER_VERBS_CMD_CREATE_XSRQ, ibv_create_xsrq, ib_uverbs_create_xsrq, ib_uverbs_create_srq_resp); -+DECLARE_CMDX(IB_USER_VERBS_CMD_DEALLOC_MW, ibv_dealloc_mw, ib_uverbs_dealloc_mw, empty); -+DECLARE_CMDX(IB_USER_VERBS_CMD_DEALLOC_PD, ibv_dealloc_pd, ib_uverbs_dealloc_pd, empty); -+DECLARE_CMDX(IB_USER_VERBS_CMD_DEREG_MR, ibv_dereg_mr, ib_uverbs_dereg_mr, empty); -+DECLARE_CMDX(IB_USER_VERBS_CMD_DESTROY_AH, ibv_destroy_ah, ib_uverbs_destroy_ah, empty); -+DECLARE_CMD(IB_USER_VERBS_CMD_DESTROY_CQ, ibv_destroy_cq, ib_uverbs_destroy_cq); -+DECLARE_CMD(IB_USER_VERBS_CMD_DESTROY_QP, ibv_destroy_qp, ib_uverbs_destroy_qp); -+DECLARE_CMD(IB_USER_VERBS_CMD_DESTROY_SRQ, ibv_destroy_srq, ib_uverbs_destroy_srq); -+DECLARE_CMDX(IB_USER_VERBS_CMD_DETACH_MCAST, ibv_detach_mcast, ib_uverbs_detach_mcast, empty); -+DECLARE_CMD(IB_USER_VERBS_CMD_GET_CONTEXT, ibv_get_context, ib_uverbs_get_context); -+DECLARE_CMDX(IB_USER_VERBS_CMD_MODIFY_QP, ibv_modify_qp, ib_uverbs_modify_qp, empty); -+DECLARE_CMDX(IB_USER_VERBS_CMD_MODIFY_SRQ, ibv_modify_srq, ib_uverbs_modify_srq, empty); -+DECLARE_CMDX(IB_USER_VERBS_CMD_OPEN_QP, ibv_open_qp, ib_uverbs_open_qp, ib_uverbs_create_qp_resp); -+DECLARE_CMD(IB_USER_VERBS_CMD_OPEN_XRCD, ibv_open_xrcd, ib_uverbs_open_xrcd); -+DECLARE_CMD(IB_USER_VERBS_CMD_POLL_CQ, ibv_poll_cq, ib_uverbs_poll_cq); -+DECLARE_CMD(IB_USER_VERBS_CMD_POST_RECV, ibv_post_recv, ib_uverbs_post_recv); -+DECLARE_CMD(IB_USER_VERBS_CMD_POST_SEND, ibv_post_send, ib_uverbs_post_send); -+DECLARE_CMD(IB_USER_VERBS_CMD_POST_SRQ_RECV, ibv_post_srq_recv, ib_uverbs_post_srq_recv); -+DECLARE_CMD(IB_USER_VERBS_CMD_QUERY_DEVICE, ibv_query_device, ib_uverbs_query_device); -+DECLARE_CMD(IB_USER_VERBS_CMD_QUERY_PORT, ibv_query_port, ib_uverbs_query_port); -+DECLARE_CMD(IB_USER_VERBS_CMD_QUERY_QP, ibv_query_qp, ib_uverbs_query_qp); -+DECLARE_CMD(IB_USER_VERBS_CMD_QUERY_SRQ, ibv_query_srq, ib_uverbs_query_srq); -+DECLARE_CMD(IB_USER_VERBS_CMD_REG_MR, ibv_reg_mr, ib_uverbs_reg_mr); -+DECLARE_CMDX(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, ibv_req_notify_cq, ib_uverbs_req_notify_cq, empty); -+DECLARE_CMD(IB_USER_VERBS_CMD_REREG_MR, ibv_rereg_mr, ib_uverbs_rereg_mr); -+DECLARE_CMD(IB_USER_VERBS_CMD_RESIZE_CQ, ibv_resize_cq, ib_uverbs_resize_cq); -+ -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_CREATE_CQ, ibv_create_cq_ex, ib_uverbs_ex_create_cq); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_CREATE_FLOW, ibv_create_flow, ib_uverbs_create_flow); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_CREATE_QP, ibv_create_qp_ex, ib_uverbs_ex_create_qp); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, ibv_create_rwq_ind_table, ib_uverbs_ex_create_rwq_ind_table); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_CREATE_WQ, ibv_create_wq, ib_uverbs_ex_create_wq); -+DECLARE_CMD_EXX(IB_USER_VERBS_EX_CMD_DESTROY_FLOW, ibv_destroy_flow, ib_uverbs_destroy_flow, empty); -+DECLARE_CMD_EXX(IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, ibv_destroy_rwq_ind_table, ib_uverbs_ex_destroy_rwq_ind_table, empty); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_DESTROY_WQ, ibv_destroy_wq, ib_uverbs_ex_destroy_wq); -+DECLARE_CMD_EXX(IB_USER_VERBS_EX_CMD_MODIFY_CQ, ibv_modify_cq, ib_uverbs_ex_modify_cq, empty); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_MODIFY_QP, ibv_modify_qp_ex, ib_uverbs_ex_modify_qp); -+DECLARE_CMD_EXX(IB_USER_VERBS_EX_CMD_MODIFY_WQ, ibv_modify_wq, ib_uverbs_ex_modify_wq, empty); -+DECLARE_CMD_EX(IB_USER_VERBS_EX_CMD_QUERY_DEVICE, ibv_query_device_ex, ib_uverbs_ex_query_device); -+ -+/* -+ * Both ib_uverbs_create_qp and ib_uverbs_ex_create_qp start with the same -+ * structure, this function converts the ex version into the normal version -+ */ -+static inline struct ib_uverbs_create_qp * -+ibv_create_qp_ex_to_reg(struct ibv_create_qp_ex *cmd_ex) -+{ -+ /* -+ * user_handle is the start in both places, note that the ex -+ * does not have response located in the same place, so response -+ * cannot be touched. -+ */ -+ return container_of(&cmd_ex->user_handle, struct ib_uverbs_create_qp, -+ user_handle); -+} -+ -+/* -+ * This file contains copied data from the kernel's include/uapi/rdma/ib_user_verbs.h, -+ * now included above. -+ * -+ * Whenever possible use the definition from the kernel header and avoid -+ * copying from that header into this file. -+ */ -+ -+struct ibv_kern_ipv4_filter { -+ __u32 src_ip; -+ __u32 dst_ip; -+}; -+ -+struct ibv_kern_spec_ipv4 { -+ __u32 type; -+ __u16 size; -+ __u16 reserved; -+ struct ibv_kern_ipv4_filter val; -+ struct ibv_kern_ipv4_filter mask; -+}; -+ -+struct ibv_kern_spec { -+ union { -+ struct ib_uverbs_flow_spec_hdr hdr; -+ struct ib_uverbs_flow_spec_eth eth; -+ struct ibv_kern_spec_ipv4 ipv4; -+ struct ib_uverbs_flow_spec_ipv4 ipv4_ext; -+ struct ib_uverbs_flow_spec_esp esp; -+ struct ib_uverbs_flow_spec_tcp_udp tcp_udp; -+ struct ib_uverbs_flow_spec_ipv6 ipv6; -+ struct ib_uverbs_flow_spec_gre gre; -+ struct ib_uverbs_flow_spec_tunnel tunnel; -+ struct ib_uverbs_flow_spec_mpls mpls; -+ struct ib_uverbs_flow_spec_action_tag flow_tag; -+ struct ib_uverbs_flow_spec_action_drop drop; -+ struct ib_uverbs_flow_spec_action_handle handle; -+ struct ib_uverbs_flow_spec_action_count flow_count; -+ }; -+}; -+ -+struct ib_uverbs_modify_srq_v3 { -+ __u32 srq_handle; -+ __u32 attr_mask; -+ __u32 max_wr; -+ __u32 max_sge; -+ __u32 srq_limit; -+ __u32 reserved; -+}; -+#define _STRUCT_ib_uverbs_modify_srq_v3 -+enum { IB_USER_VERBS_CMD_MODIFY_SRQ_V3 = IB_USER_VERBS_CMD_MODIFY_SRQ }; -+DECLARE_CMDX(IB_USER_VERBS_CMD_MODIFY_SRQ_V3, ibv_modify_srq_v3, ib_uverbs_modify_srq_v3, empty); -+ -+struct ibv_create_qp_resp_v3 { -+ __u32 qp_handle; -+ __u32 qpn; -+}; -+ -+struct ibv_create_qp_resp_v4 { -+ __u32 qp_handle; -+ __u32 qpn; -+ __u32 max_send_wr; -+ __u32 max_recv_wr; -+ __u32 max_send_sge; -+ __u32 max_recv_sge; -+ __u32 max_inline_data; -+}; -+ -+struct ibv_create_srq_resp_v5 { -+ __u32 srq_handle; -+}; -+ -+#define _STRUCT_ib_uverbs_create_srq_v5 -+enum { IB_USER_VERBS_CMD_CREATE_SRQ_V5 = IB_USER_VERBS_CMD_CREATE_SRQ }; -+DECLARE_CMDX(IB_USER_VERBS_CMD_CREATE_SRQ_V5, ibv_create_srq_v5, ib_uverbs_create_srq, ibv_create_srq_resp_v5); -+ -+#define _STRUCT_ib_uverbs_create_qp_v4 -+enum { IB_USER_VERBS_CMD_CREATE_QP_V4 = IB_USER_VERBS_CMD_CREATE_QP }; -+DECLARE_CMDX(IB_USER_VERBS_CMD_CREATE_QP_V4, ibv_create_qp_v4, ib_uverbs_create_qp, ibv_create_qp_resp_v4); -+ -+#define _STRUCT_ib_uverbs_create_qp_v3 -+enum { IB_USER_VERBS_CMD_CREATE_QP_V3 = IB_USER_VERBS_CMD_CREATE_QP }; -+DECLARE_CMDX(IB_USER_VERBS_CMD_CREATE_QP_V3, ibv_create_qp_v3, ib_uverbs_create_qp, ibv_create_qp_resp_v3); -+#endif /* KERN_ABI_H */ -diff --git a/src/rc-compat/v37/kernel-abi_ib_user_verbs.h b/src/rc-compat/v37/kernel-abi_ib_user_verbs.h -new file mode 100644 -index 000000000000..fbe4ae635b84 ---- /dev/null -+++ b/src/rc-compat/v37/kernel-abi_ib_user_verbs.h -@@ -0,0 +1,1114 @@ -+#define _STRUCT_ib_uverbs_async_event_desc struct { \ -+__aligned_u64 element; \ -+__u32 event_type; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_comp_event_desc struct { \ -+__aligned_u64 cq_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_cq_moderation_caps struct { \ -+__u16 max_cq_moderation_count; \ -+__u16 max_cq_moderation_period; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_cmd_hdr struct { \ -+__u32 command; \ -+__u16 in_words; \ -+__u16 out_words; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_cmd_hdr struct { \ -+__aligned_u64 response; \ -+__u16 provider_in_words; \ -+__u16 provider_out_words; \ -+__u32 cmd_hdr_reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_get_context struct { \ -+__aligned_u64 response; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_get_context_resp struct { \ -+__u32 async_fd; \ -+__u32 num_comp_vectors; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_device struct { \ -+__aligned_u64 response; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_device_resp struct { \ -+__aligned_u64 fw_ver; \ -+__be64 node_guid; \ -+__be64 sys_image_guid; \ -+__aligned_u64 max_mr_size; \ -+__aligned_u64 page_size_cap; \ -+__u32 vendor_id; \ -+__u32 vendor_part_id; \ -+__u32 hw_ver; \ -+__u32 max_qp; \ -+__u32 max_qp_wr; \ -+__u32 device_cap_flags; \ -+__u32 max_sge; \ -+__u32 max_sge_rd; \ -+__u32 max_cq; \ -+__u32 max_cqe; \ -+__u32 max_mr; \ -+__u32 max_pd; \ -+__u32 max_qp_rd_atom; \ -+__u32 max_ee_rd_atom; \ -+__u32 max_res_rd_atom; \ -+__u32 max_qp_init_rd_atom; \ -+__u32 max_ee_init_rd_atom; \ -+__u32 atomic_cap; \ -+__u32 max_ee; \ -+__u32 max_rdd; \ -+__u32 max_mw; \ -+__u32 max_raw_ipv6_qp; \ -+__u32 max_raw_ethy_qp; \ -+__u32 max_mcast_grp; \ -+__u32 max_mcast_qp_attach; \ -+__u32 max_total_mcast_qp_attach; \ -+__u32 max_ah; \ -+__u32 max_fmr; \ -+__u32 max_map_per_fmr; \ -+__u32 max_srq; \ -+__u32 max_srq_wr; \ -+__u32 max_srq_sge; \ -+__u16 max_pkeys; \ -+__u8 local_ca_ack_delay; \ -+__u8 phys_port_cnt; \ -+__u8 reserved[4]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_query_device struct { \ -+__u32 comp_mask; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_odp_caps struct { \ -+__aligned_u64 general_caps; \ -+struct { \ -+__u32 rc_odp_caps; \ -+__u32 uc_odp_caps; \ -+__u32 ud_odp_caps; \ -+} per_transport_caps; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_rss_caps struct { \ -+/* Corresponding bit will be set if qp type from \ -+* 'enum ib_qp_type' is supported, e.g. \ -+* supported_qpts |= 1 << IB_QPT_UD \ -+*/ \ -+__u32 supported_qpts; \ -+__u32 max_rwq_indirection_tables; \ -+__u32 max_rwq_indirection_table_size; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_tm_caps struct { \ -+ \ -+__u32 max_rndv_hdr_size; \ -+ \ -+__u32 max_num_tags; \ -+ \ -+__u32 flags; \ -+ \ -+__u32 max_ops; \ -+ \ -+__u32 max_sge; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_query_device_resp struct { \ -+struct ib_uverbs_query_device_resp base; \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+struct ib_uverbs_odp_caps odp_caps; \ -+__aligned_u64 timestamp_mask; \ -+__aligned_u64 hca_core_clock; \ -+__aligned_u64 device_cap_flags_ex; \ -+struct ib_uverbs_rss_caps rss_caps; \ -+__u32 max_wq_type_rq; \ -+__u32 raw_packet_caps; \ -+struct ib_uverbs_tm_caps tm_caps; \ -+struct ib_uverbs_cq_moderation_caps cq_moderation_caps; \ -+__aligned_u64 max_dm_size; \ -+__u32 xrc_odp_caps; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_port struct { \ -+__aligned_u64 response; \ -+__u8 port_num; \ -+__u8 reserved[7]; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_port_resp struct { \ -+__u32 port_cap_flags; \ -+__u32 max_msg_sz; \ -+__u32 bad_pkey_cntr; \ -+__u32 qkey_viol_cntr; \ -+__u32 gid_tbl_len; \ -+__u16 pkey_tbl_len; \ -+__u16 lid; \ -+__u16 sm_lid; \ -+__u8 state; \ -+__u8 max_mtu; \ -+__u8 active_mtu; \ -+__u8 lmc; \ -+__u8 max_vl_num; \ -+__u8 sm_sl; \ -+__u8 subnet_timeout; \ -+__u8 init_type_reply; \ -+__u8 active_width; \ -+__u8 active_speed; \ -+__u8 phys_state; \ -+__u8 link_layer; \ -+__u8 flags; \ -+__u8 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_alloc_pd struct { \ -+__aligned_u64 response; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_alloc_pd_resp struct { \ -+__u32 pd_handle; \ -+__u32 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_dealloc_pd struct { \ -+__u32 pd_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_open_xrcd struct { \ -+__aligned_u64 response; \ -+__u32 fd; \ -+__u32 oflags; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_open_xrcd_resp struct { \ -+__u32 xrcd_handle; \ -+__u32 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_close_xrcd struct { \ -+__u32 xrcd_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_reg_mr struct { \ -+__aligned_u64 response; \ -+__aligned_u64 start; \ -+__aligned_u64 length; \ -+__aligned_u64 hca_va; \ -+__u32 pd_handle; \ -+__u32 access_flags; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_reg_mr_resp struct { \ -+__u32 mr_handle; \ -+__u32 lkey; \ -+__u32 rkey; \ -+__u32 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_rereg_mr struct { \ -+__aligned_u64 response; \ -+__u32 mr_handle; \ -+__u32 flags; \ -+__aligned_u64 start; \ -+__aligned_u64 length; \ -+__aligned_u64 hca_va; \ -+__u32 pd_handle; \ -+__u32 access_flags; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_rereg_mr_resp struct { \ -+__u32 lkey; \ -+__u32 rkey; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_dereg_mr struct { \ -+__u32 mr_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_alloc_mw struct { \ -+__aligned_u64 response; \ -+__u32 pd_handle; \ -+__u8 mw_type; \ -+__u8 reserved[3]; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_alloc_mw_resp struct { \ -+__u32 mw_handle; \ -+__u32 rkey; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_dealloc_mw struct { \ -+__u32 mw_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_comp_channel struct { \ -+__aligned_u64 response; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_comp_channel_resp struct { \ -+__u32 fd; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_cq struct { \ -+__aligned_u64 response; \ -+__aligned_u64 user_handle; \ -+__u32 cqe; \ -+__u32 comp_vector; \ -+__s32 comp_channel; \ -+__u32 reserved; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_cq struct { \ -+__aligned_u64 user_handle; \ -+__u32 cqe; \ -+__u32 comp_vector; \ -+__s32 comp_channel; \ -+__u32 comp_mask; \ -+__u32 flags; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_cq_resp struct { \ -+__u32 cq_handle; \ -+__u32 cqe; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_cq_resp struct { \ -+struct ib_uverbs_create_cq_resp base; \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+} -+ -+#define _STRUCT_ib_uverbs_resize_cq struct { \ -+__aligned_u64 response; \ -+__u32 cq_handle; \ -+__u32 cqe; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_resize_cq_resp struct { \ -+__u32 cqe; \ -+__u32 reserved; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_poll_cq struct { \ -+__aligned_u64 response; \ -+__u32 cq_handle; \ -+__u32 ne; \ -+} -+ -+#define _STRUCT_ib_uverbs_wc struct { \ -+__aligned_u64 wr_id; \ -+__u32 status; \ -+__u32 opcode; \ -+__u32 vendor_err; \ -+__u32 byte_len; \ -+union { \ -+__be32 imm_data; \ -+__u32 invalidate_rkey; \ -+} ex; \ -+__u32 qp_num; \ -+__u32 src_qp; \ -+__u32 wc_flags; \ -+__u16 pkey_index; \ -+__u16 slid; \ -+__u8 sl; \ -+__u8 dlid_path_bits; \ -+__u8 port_num; \ -+__u8 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_poll_cq_resp struct { \ -+__u32 count; \ -+__u32 reserved; \ -+struct ib_uverbs_wc wc[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_req_notify_cq struct { \ -+__u32 cq_handle; \ -+__u32 solicited_only; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_cq struct { \ -+__aligned_u64 response; \ -+__u32 cq_handle; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_cq_resp struct { \ -+__u32 comp_events_reported; \ -+__u32 async_events_reported; \ -+} -+ -+#define _STRUCT_ib_uverbs_global_route struct { \ -+__u8 dgid[16]; \ -+__u32 flow_label; \ -+__u8 sgid_index; \ -+__u8 hop_limit; \ -+__u8 traffic_class; \ -+__u8 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_ah_attr struct { \ -+struct ib_uverbs_global_route grh; \ -+__u16 dlid; \ -+__u8 sl; \ -+__u8 src_path_bits; \ -+__u8 static_rate; \ -+__u8 is_global; \ -+__u8 port_num; \ -+__u8 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_qp_attr struct { \ -+__u32 qp_attr_mask; \ -+__u32 qp_state; \ -+__u32 cur_qp_state; \ -+__u32 path_mtu; \ -+__u32 path_mig_state; \ -+__u32 qkey; \ -+__u32 rq_psn; \ -+__u32 sq_psn; \ -+__u32 dest_qp_num; \ -+__u32 qp_access_flags; \ -+ \ -+struct ib_uverbs_ah_attr ah_attr; \ -+struct ib_uverbs_ah_attr alt_ah_attr; \ -+ \ -+ \ -+__u32 max_send_wr; \ -+__u32 max_recv_wr; \ -+__u32 max_send_sge; \ -+__u32 max_recv_sge; \ -+__u32 max_inline_data; \ -+ \ -+__u16 pkey_index; \ -+__u16 alt_pkey_index; \ -+__u8 en_sqd_async_notify; \ -+__u8 sq_draining; \ -+__u8 max_rd_atomic; \ -+__u8 max_dest_rd_atomic; \ -+__u8 min_rnr_timer; \ -+__u8 port_num; \ -+__u8 timeout; \ -+__u8 retry_cnt; \ -+__u8 rnr_retry; \ -+__u8 alt_port_num; \ -+__u8 alt_timeout; \ -+__u8 reserved[5]; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_qp struct { \ -+__aligned_u64 response; \ -+__aligned_u64 user_handle; \ -+__u32 pd_handle; \ -+__u32 send_cq_handle; \ -+__u32 recv_cq_handle; \ -+__u32 srq_handle; \ -+__u32 max_send_wr; \ -+__u32 max_recv_wr; \ -+__u32 max_send_sge; \ -+__u32 max_recv_sge; \ -+__u32 max_inline_data; \ -+__u8 sq_sig_all; \ -+__u8 qp_type; \ -+__u8 is_srq; \ -+__u8 reserved; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_qp struct { \ -+__aligned_u64 user_handle; \ -+__u32 pd_handle; \ -+__u32 send_cq_handle; \ -+__u32 recv_cq_handle; \ -+__u32 srq_handle; \ -+__u32 max_send_wr; \ -+__u32 max_recv_wr; \ -+__u32 max_send_sge; \ -+__u32 max_recv_sge; \ -+__u32 max_inline_data; \ -+__u8 sq_sig_all; \ -+__u8 qp_type; \ -+__u8 is_srq; \ -+__u8 reserved; \ -+__u32 comp_mask; \ -+__u32 create_flags; \ -+__u32 rwq_ind_tbl_handle; \ -+__u32 source_qpn; \ -+} -+ -+#define _STRUCT_ib_uverbs_open_qp struct { \ -+__aligned_u64 response; \ -+__aligned_u64 user_handle; \ -+__u32 pd_handle; \ -+__u32 qpn; \ -+__u8 qp_type; \ -+__u8 reserved[7]; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_qp_resp struct { \ -+__u32 qp_handle; \ -+__u32 qpn; \ -+__u32 max_send_wr; \ -+__u32 max_recv_wr; \ -+__u32 max_send_sge; \ -+__u32 max_recv_sge; \ -+__u32 max_inline_data; \ -+__u32 reserved; \ -+__u32 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_qp_resp struct { \ -+struct ib_uverbs_create_qp_resp base; \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+} -+ -+#define _STRUCT_ib_uverbs_qp_dest struct { \ -+__u8 dgid[16]; \ -+__u32 flow_label; \ -+__u16 dlid; \ -+__u16 reserved; \ -+__u8 sgid_index; \ -+__u8 hop_limit; \ -+__u8 traffic_class; \ -+__u8 sl; \ -+__u8 src_path_bits; \ -+__u8 static_rate; \ -+__u8 is_global; \ -+__u8 port_num; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_qp struct { \ -+__aligned_u64 response; \ -+__u32 qp_handle; \ -+__u32 attr_mask; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_qp_resp struct { \ -+struct ib_uverbs_qp_dest dest; \ -+struct ib_uverbs_qp_dest alt_dest; \ -+__u32 max_send_wr; \ -+__u32 max_recv_wr; \ -+__u32 max_send_sge; \ -+__u32 max_recv_sge; \ -+__u32 max_inline_data; \ -+__u32 qkey; \ -+__u32 rq_psn; \ -+__u32 sq_psn; \ -+__u32 dest_qp_num; \ -+__u32 qp_access_flags; \ -+__u16 pkey_index; \ -+__u16 alt_pkey_index; \ -+__u8 qp_state; \ -+__u8 cur_qp_state; \ -+__u8 path_mtu; \ -+__u8 path_mig_state; \ -+__u8 sq_draining; \ -+__u8 max_rd_atomic; \ -+__u8 max_dest_rd_atomic; \ -+__u8 min_rnr_timer; \ -+__u8 port_num; \ -+__u8 timeout; \ -+__u8 retry_cnt; \ -+__u8 rnr_retry; \ -+__u8 alt_port_num; \ -+__u8 alt_timeout; \ -+__u8 sq_sig_all; \ -+__u8 reserved[5]; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_modify_qp struct { \ -+struct ib_uverbs_qp_dest dest; \ -+struct ib_uverbs_qp_dest alt_dest; \ -+__u32 qp_handle; \ -+__u32 attr_mask; \ -+__u32 qkey; \ -+__u32 rq_psn; \ -+__u32 sq_psn; \ -+__u32 dest_qp_num; \ -+__u32 qp_access_flags; \ -+__u16 pkey_index; \ -+__u16 alt_pkey_index; \ -+__u8 qp_state; \ -+__u8 cur_qp_state; \ -+__u8 path_mtu; \ -+__u8 path_mig_state; \ -+__u8 en_sqd_async_notify; \ -+__u8 max_rd_atomic; \ -+__u8 max_dest_rd_atomic; \ -+__u8 min_rnr_timer; \ -+__u8 port_num; \ -+__u8 timeout; \ -+__u8 retry_cnt; \ -+__u8 rnr_retry; \ -+__u8 alt_port_num; \ -+__u8 alt_timeout; \ -+__u8 reserved[2]; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_modify_qp struct { \ -+struct ib_uverbs_modify_qp base; \ -+__u32 rate_limit; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_modify_qp_resp struct { \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_qp struct { \ -+__aligned_u64 response; \ -+__u32 qp_handle; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_qp_resp struct { \ -+__u32 events_reported; \ -+} -+ -+#define _STRUCT_ib_uverbs_sge struct { \ -+__aligned_u64 addr; \ -+__u32 length; \ -+__u32 lkey; \ -+} -+ -+#define _STRUCT_ib_uverbs_send_wr struct { \ -+__aligned_u64 wr_id; \ -+__u32 num_sge; \ -+__u32 opcode; \ -+__u32 send_flags; \ -+union { \ -+__be32 imm_data; \ -+__u32 invalidate_rkey; \ -+} ex; \ -+union { \ -+struct { \ -+__aligned_u64 remote_addr; \ -+__u32 rkey; \ -+__u32 reserved; \ -+} rdma; \ -+struct { \ -+__aligned_u64 remote_addr; \ -+__aligned_u64 compare_add; \ -+__aligned_u64 swap; \ -+__u32 rkey; \ -+__u32 reserved; \ -+} atomic; \ -+struct { \ -+__u32 ah; \ -+__u32 remote_qpn; \ -+__u32 remote_qkey; \ -+__u32 reserved; \ -+} ud; \ -+} wr; \ -+} -+ -+#define _STRUCT_ib_uverbs_post_send struct { \ -+__aligned_u64 response; \ -+__u32 qp_handle; \ -+__u32 wr_count; \ -+__u32 sge_count; \ -+__u32 wqe_size; \ -+struct ib_uverbs_send_wr send_wr[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_post_send_resp struct { \ -+__u32 bad_wr; \ -+} -+ -+#define _STRUCT_ib_uverbs_recv_wr struct { \ -+__aligned_u64 wr_id; \ -+__u32 num_sge; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_post_recv struct { \ -+__aligned_u64 response; \ -+__u32 qp_handle; \ -+__u32 wr_count; \ -+__u32 sge_count; \ -+__u32 wqe_size; \ -+struct ib_uverbs_recv_wr recv_wr[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_post_recv_resp struct { \ -+__u32 bad_wr; \ -+} -+ -+#define _STRUCT_ib_uverbs_post_srq_recv struct { \ -+__aligned_u64 response; \ -+__u32 srq_handle; \ -+__u32 wr_count; \ -+__u32 sge_count; \ -+__u32 wqe_size; \ -+struct ib_uverbs_recv_wr recv[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_post_srq_recv_resp struct { \ -+__u32 bad_wr; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_ah struct { \ -+__aligned_u64 response; \ -+__aligned_u64 user_handle; \ -+__u32 pd_handle; \ -+__u32 reserved; \ -+struct ib_uverbs_ah_attr attr; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_ah_resp struct { \ -+__u32 ah_handle; \ -+__u32 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_ah struct { \ -+__u32 ah_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_attach_mcast struct { \ -+__u8 gid[16]; \ -+__u32 qp_handle; \ -+__u16 mlid; \ -+__u16 reserved; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_detach_mcast struct { \ -+__u8 gid[16]; \ -+__u32 qp_handle; \ -+__u16 mlid; \ -+__u16 reserved; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_hdr struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+ \ -+__aligned_u64 flow_spec_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_eth_filter struct { \ -+__u8 dst_mac[6]; \ -+__u8 src_mac[6]; \ -+__be16 ether_type; \ -+__be16 vlan_tag; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_eth struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_eth_filter val; \ -+struct ib_uverbs_flow_eth_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_ipv4_filter struct { \ -+__be32 src_ip; \ -+__be32 dst_ip; \ -+__u8 proto; \ -+__u8 tos; \ -+__u8 ttl; \ -+__u8 flags; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_ipv4 struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_ipv4_filter val; \ -+struct ib_uverbs_flow_ipv4_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_tcp_udp_filter struct { \ -+__be16 dst_port; \ -+__be16 src_port; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_tcp_udp struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_tcp_udp_filter val; \ -+struct ib_uverbs_flow_tcp_udp_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_ipv6_filter struct { \ -+__u8 src_ip[16]; \ -+__u8 dst_ip[16]; \ -+__be32 flow_label; \ -+__u8 next_hdr; \ -+__u8 traffic_class; \ -+__u8 hop_limit; \ -+__u8 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_ipv6 struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_ipv6_filter val; \ -+struct ib_uverbs_flow_ipv6_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_action_tag struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+__u32 tag_id; \ -+__u32 reserved1; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_action_drop struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_action_handle struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+__u32 handle; \ -+__u32 reserved1; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_action_count struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+__u32 handle; \ -+__u32 reserved1; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_tunnel_filter struct { \ -+__be32 tunnel_id; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_tunnel struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_tunnel_filter val; \ -+struct ib_uverbs_flow_tunnel_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_esp_filter struct { \ -+__u32 spi; \ -+__u32 seq; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_esp struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_spec_esp_filter val; \ -+struct ib_uverbs_flow_spec_esp_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_gre_filter struct { \ -+/* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header: \ -+* bit 0 - C - checksum bit. \ -+* bit 1 - reserved. set to 0. \ -+* bit 2 - key bit. \ -+* bit 3 - sequence number bit. \ -+* bits 4:12 - reserved. set to 0. \ -+* bits 13:15 - GRE version. \ -+*/ \ -+__be16 c_ks_res0_ver; \ -+__be16 protocol; \ -+__be32 key; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_gre struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_gre_filter val; \ -+struct ib_uverbs_flow_gre_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_mpls_filter struct { \ -+/* The field includes the entire MPLS label: \ -+* bits 0:19 - label field. \ -+* bits 20:22 - traffic class field. \ -+* bits 23 - bottom of stack bit. \ -+* bits 24:31 - ttl field. \ -+*/ \ -+__be32 label; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_spec_mpls struct { \ -+union { \ -+struct ib_uverbs_flow_spec_hdr hdr; \ -+struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 reserved; \ -+}; \ -+}; \ -+struct ib_uverbs_flow_mpls_filter val; \ -+struct ib_uverbs_flow_mpls_filter mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_flow_attr struct { \ -+__u32 type; \ -+__u16 size; \ -+__u16 priority; \ -+__u8 num_of_specs; \ -+__u8 reserved[2]; \ -+__u8 port; \ -+__u32 flags; \ -+/* Following are the optional layers according to user request \ -+* struct ib_flow_spec_xxx \ -+* struct ib_flow_spec_yyy \ -+*/ \ -+struct ib_uverbs_flow_spec_hdr flow_specs[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_flow struct { \ -+__u32 comp_mask; \ -+__u32 qp_handle; \ -+struct ib_uverbs_flow_attr flow_attr; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_flow_resp struct { \ -+__u32 comp_mask; \ -+__u32 flow_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_flow struct { \ -+__u32 comp_mask; \ -+__u32 flow_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_srq struct { \ -+__aligned_u64 response; \ -+__aligned_u64 user_handle; \ -+__u32 pd_handle; \ -+__u32 max_wr; \ -+__u32 max_sge; \ -+__u32 srq_limit; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_xsrq struct { \ -+__aligned_u64 response; \ -+__aligned_u64 user_handle; \ -+__u32 srq_type; \ -+__u32 pd_handle; \ -+__u32 max_wr; \ -+__u32 max_sge; \ -+__u32 srq_limit; \ -+__u32 max_num_tags; \ -+__u32 xrcd_handle; \ -+__u32 cq_handle; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_create_srq_resp struct { \ -+__u32 srq_handle; \ -+__u32 max_wr; \ -+__u32 max_sge; \ -+__u32 srqn; \ -+__u32 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_modify_srq struct { \ -+__u32 srq_handle; \ -+__u32 attr_mask; \ -+__u32 max_wr; \ -+__u32 srq_limit; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_srq struct { \ -+__aligned_u64 response; \ -+__u32 srq_handle; \ -+__u32 reserved; \ -+__aligned_u64 driver_data[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_query_srq_resp struct { \ -+__u32 max_wr; \ -+__u32 max_sge; \ -+__u32 srq_limit; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_srq struct { \ -+__aligned_u64 response; \ -+__u32 srq_handle; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_destroy_srq_resp struct { \ -+__u32 events_reported; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_wq struct { \ -+__u32 comp_mask; \ -+__u32 wq_type; \ -+__aligned_u64 user_handle; \ -+__u32 pd_handle; \ -+__u32 cq_handle; \ -+__u32 max_wr; \ -+__u32 max_sge; \ -+__u32 create_flags; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_wq_resp struct { \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+__u32 wq_handle; \ -+__u32 max_wr; \ -+__u32 max_sge; \ -+__u32 wqn; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_destroy_wq struct { \ -+__u32 comp_mask; \ -+__u32 wq_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_destroy_wq_resp struct { \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+__u32 events_reported; \ -+__u32 reserved; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_modify_wq struct { \ -+__u32 attr_mask; \ -+__u32 wq_handle; \ -+__u32 wq_state; \ -+__u32 curr_wq_state; \ -+__u32 flags; \ -+__u32 flags_mask; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_rwq_ind_table struct { \ -+__u32 comp_mask; \ -+__u32 log_ind_tbl_size; \ -+/* Following are the wq handles according to log_ind_tbl_size \ -+* wq_handle1 \ -+* wq_handle2 \ -+*/ \ -+__u32 wq_handles[0]; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_create_rwq_ind_table_resp struct { \ -+__u32 comp_mask; \ -+__u32 response_length; \ -+__u32 ind_tbl_handle; \ -+__u32 ind_tbl_num; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_destroy_rwq_ind_table struct { \ -+__u32 comp_mask; \ -+__u32 ind_tbl_handle; \ -+} -+ -+#define _STRUCT_ib_uverbs_cq_moderation struct { \ -+__u16 cq_count; \ -+__u16 cq_period; \ -+} -+ -+#define _STRUCT_ib_uverbs_ex_modify_cq struct { \ -+__u32 cq_handle; \ -+__u32 attr_mask; \ -+struct ib_uverbs_cq_moderation attr; \ -+__u32 reserved; \ -+} -+ -diff --git a/src/rc-compat/v37/rdma_user_ioctl_cmds.h b/src/rc-compat/v37/rdma_user_ioctl_cmds.h -new file mode 100644 -index 000000000000..38ab7accb7be ---- /dev/null -+++ b/src/rc-compat/v37/rdma_user_ioctl_cmds.h -@@ -0,0 +1,87 @@ -+/* -+ * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#ifndef RDMA_USER_IOCTL_CMDS_H -+#define RDMA_USER_IOCTL_CMDS_H -+ -+#include -+#include -+ -+/* Documentation/userspace-api/ioctl/ioctl-number.rst */ -+#define RDMA_IOCTL_MAGIC 0x1b -+#define RDMA_VERBS_IOCTL \ -+ _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr) -+ -+enum { -+ /* User input */ -+ UVERBS_ATTR_F_MANDATORY = 1U << 0, -+ /* -+ * Valid output bit should be ignored and considered set in -+ * mandatory fields. This bit is kernel output. -+ */ -+ UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1, -+}; -+ -+struct ib_uverbs_attr { -+ __u16 attr_id; /* command specific type attribute */ -+ __u16 len; /* only for pointers and IDRs array */ -+ __u16 flags; /* combination of UVERBS_ATTR_F_XXXX */ -+ union { -+ struct { -+ __u8 elem_id; -+ __u8 reserved; -+ } enum_data; -+ __u16 reserved; -+ } attr_data; -+ union { -+ /* -+ * ptr to command, inline data, idr/fd or -+ * ptr to __u32 array of IDRs -+ */ -+ __aligned_u64 data; -+ /* Used by FD_IN and FD_OUT */ -+ __s64 data_s64; -+ }; -+}; -+ -+struct ib_uverbs_ioctl_hdr { -+ __u16 length; -+ __u16 object_id; -+ __u16 method_id; -+ __u16 num_attrs; -+ __aligned_u64 reserved1; -+ __u32 driver_id; -+ __u32 reserved2; -+ struct ib_uverbs_attr attrs[0]; -+}; -+ -+#endif -diff --git a/src/rc-compat/v37/util/cl_qmap.h b/src/rc-compat/v37/util/cl_qmap.h -new file mode 100644 -index 000000000000..1a800f2c8fec ---- /dev/null -+++ b/src/rc-compat/v37/util/cl_qmap.h -@@ -0,0 +1,970 @@ -+/* -+ * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. -+ * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. -+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ * -+ */ -+ -+/* -+ * Abstract: -+ * Declaration of quick map, a binary tree where the caller always provides -+ * all necessary storage. -+ */ -+ -+#ifndef _CL_QMAP_H_ -+#define _CL_QMAP_H_ -+ -+#include -+#include -+#include -+#include -+ -+typedef struct _cl_list_item { -+ struct _cl_list_item *p_next; -+ struct _cl_list_item *p_prev; -+} cl_list_item_t; -+ -+typedef struct _cl_pool_item { -+ cl_list_item_t list_item; -+} cl_pool_item_t; -+ -+/****h* Component Library/Quick Map -+* NAME -+* Quick Map -+* -+* DESCRIPTION -+* Quick map implements a binary tree that stores user provided cl_map_item_t -+* structures. Each item stored in a quick map has a unique 64-bit key -+* (duplicates are not allowed). Quick map provides the ability to -+* efficiently search for an item given a key. -+* -+* Quick map does not allocate any memory, and can therefore not fail -+* any operations due to insufficient memory. Quick map can thus be useful -+* in minimizing the error paths in code. -+* -+* Quick map is not thread safe, and users must provide serialization when -+* adding and removing items from the map. -+* -+* The quick map functions operate on a cl_qmap_t structure which should be -+* treated as opaque and should be manipulated only through the provided -+* functions. -+* -+* SEE ALSO -+* Structures: -+* cl_qmap_t, cl_map_item_t, cl_map_obj_t -+* -+* Callbacks: -+* cl_pfn_qmap_apply_t -+* -+* Item Manipulation: -+* cl_qmap_set_obj, cl_qmap_obj, cl_qmap_key -+* -+* Initialization: -+* cl_qmap_init -+* -+* Iteration: -+* cl_qmap_end, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_prev -+* -+* Manipulation: -+* cl_qmap_insert, cl_qmap_get, cl_qmap_remove_item, cl_qmap_remove, -+* cl_qmap_remove_all, cl_qmap_merge, cl_qmap_delta, cl_qmap_get_next -+* -+* Search: -+* cl_qmap_apply_func -+* -+* Attributes: -+* cl_qmap_count, cl_is_qmap_empty, -+*********/ -+/****i* Component Library: Quick Map/cl_map_color_t -+* NAME -+* cl_map_color_t -+* -+* DESCRIPTION -+* The cl_map_color_t enumerated type is used to note the color of -+* nodes in a map. -+* -+* SYNOPSIS -+*/ -+typedef enum _cl_map_color { -+ CL_MAP_RED, -+ CL_MAP_BLACK -+} cl_map_color_t; -+/* -+* VALUES -+* CL_MAP_RED -+* The node in the map is red. -+* -+* CL_MAP_BLACK -+* The node in the map is black. -+* -+* SEE ALSO -+* Quick Map, cl_map_item_t -+*********/ -+ -+/****s* Component Library: Quick Map/cl_map_item_t -+* NAME -+* cl_map_item_t -+* -+* DESCRIPTION -+* The cl_map_item_t structure is used by maps to store objects. -+* -+* The cl_map_item_t structure should be treated as opaque and should -+* be manipulated only through the provided functions. -+* -+* SYNOPSIS -+*/ -+typedef struct _cl_map_item { -+ /* Must be first to allow casting. */ -+ cl_pool_item_t pool_item; -+ struct _cl_map_item *p_left; -+ struct _cl_map_item *p_right; -+ struct _cl_map_item *p_up; -+ cl_map_color_t color; -+ uint64_t key; -+#ifdef _DEBUG_ -+ struct _cl_qmap *p_map; -+#endif -+} cl_map_item_t; -+/* -+* FIELDS -+* pool_item -+* Used to store the item in a doubly linked list, allowing more -+* efficient map traversal. -+* -+* p_left -+* Pointer to the map item that is a child to the left of the node. -+* -+* p_right -+* Pointer to the map item that is a child to the right of the node. -+* -+* p_up -+* Pointer to the map item that is the parent of the node. -+* -+* color -+* Indicates whether a node is red or black in the map. -+* -+* key -+* Value that uniquely represents a node in a map. This value is -+* set by calling cl_qmap_insert and can be retrieved by calling -+* cl_qmap_key. -+* -+* NOTES -+* None of the fields of this structure should be manipulated by users, as -+* they are crititcal to the proper operation of the map in which they -+* are stored. -+* -+* To allow storing items in either a quick list, a quick pool, or a quick -+* map, the map implementation guarantees that the map item can be safely -+* cast to a pool item used for storing an object in a quick pool, or cast -+* to a list item used for storing an object in a quick list. This removes -+* the need to embed a map item, a list item, and a pool item in objects -+* that need to be stored in a quick list, a quick pool, and a quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_insert, cl_qmap_key, cl_pool_item_t, cl_list_item_t -+*********/ -+ -+/****s* Component Library: Quick Map/cl_map_obj_t -+* NAME -+* cl_map_obj_t -+* -+* DESCRIPTION -+* The cl_map_obj_t structure is used to store objects in maps. -+* -+* The cl_map_obj_t structure should be treated as opaque and should -+* be manipulated only through the provided functions. -+* -+* SYNOPSIS -+*/ -+typedef struct _cl_map_obj { -+ cl_map_item_t item; -+ const void *p_object; -+} cl_map_obj_t; -+/* -+* FIELDS -+* item -+* Map item used by internally by the map to store an object. -+* -+* p_object -+* User defined context. Users should not access this field directly. -+* Use cl_qmap_set_obj and cl_qmap_obj to set and retrieve the value -+* of this field. -+* -+* NOTES -+* None of the fields of this structure should be manipulated by users, as -+* they are crititcal to the proper operation of the map in which they -+* are stored. -+* -+* Use cl_qmap_set_obj and cl_qmap_obj to set and retrieve the object -+* stored in a map item, respectively. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_set_obj, cl_qmap_obj, cl_map_item_t -+*********/ -+ -+/****s* Component Library: Quick Map/cl_qmap_t -+* NAME -+* cl_qmap_t -+* -+* DESCRIPTION -+* Quick map structure. -+* -+* The cl_qmap_t structure should be treated as opaque and should -+* be manipulated only through the provided functions. -+* -+* SYNOPSIS -+*/ -+typedef struct _cl_qmap { -+ cl_map_item_t root; -+ cl_map_item_t nil; -+ size_t count; -+} cl_qmap_t; -+/* -+* PARAMETERS -+* root -+* Map item that serves as root of the map. The root is set up to -+* always have itself as parent. The left pointer is set to point -+* to the item at the root. -+* -+* nil -+* Map item that serves as terminator for all leaves, as well as -+* providing the list item used as quick list for storing map items -+* in a list for faster traversal. -+* -+* state -+* State of the map, used to verify that operations are permitted. -+* -+* count -+* Number of items in the map. -+* -+* SEE ALSO -+* Quick Map -+*********/ -+ -+/****d* Component Library: Quick Map/cl_pfn_qmap_apply_t -+* NAME -+* cl_pfn_qmap_apply_t -+* -+* DESCRIPTION -+* The cl_pfn_qmap_apply_t function type defines the prototype for -+* functions used to iterate items in a quick map. -+* -+* SYNOPSIS -+*/ -+typedef void -+ (*cl_pfn_qmap_apply_t) (cl_map_item_t * const p_map_item, void *context); -+/* -+* PARAMETERS -+* p_map_item -+* [in] Pointer to a cl_map_item_t structure. -+* -+* context -+* [in] Value passed to the callback function. -+* -+* RETURN VALUE -+* This function does not return a value. -+* -+* NOTES -+* This function type is provided as function prototype reference for the -+* function provided by users as a parameter to the cl_qmap_apply_func -+* function. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_apply_func -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_count -+* NAME -+* cl_qmap_count -+* -+* DESCRIPTION -+* The cl_qmap_count function returns the number of items stored -+* in a quick map. -+* -+* SYNOPSIS -+*/ -+static inline uint32_t cl_qmap_count(const cl_qmap_t * const p_map) -+{ -+ assert(p_map); -+ return ((uint32_t) p_map->count); -+} -+ -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure whose item count to return. -+* -+* RETURN VALUE -+* Returns the number of items stored in the map. -+* -+* SEE ALSO -+* Quick Map, cl_is_qmap_empty -+*********/ -+ -+/****f* Component Library: Quick Map/cl_is_qmap_empty -+* NAME -+* cl_is_qmap_empty -+* -+* DESCRIPTION -+* The cl_is_qmap_empty function returns whether a quick map is empty. -+* -+* SYNOPSIS -+*/ -+static inline bool cl_is_qmap_empty(const cl_qmap_t * const p_map) -+{ -+ assert(p_map); -+ -+ return (p_map->count == 0); -+} -+ -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure to test for emptiness. -+* -+* RETURN VALUES -+* TRUE if the quick map is empty. -+* -+* FALSE otherwise. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_count, cl_qmap_remove_all -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_set_obj -+* NAME -+* cl_qmap_set_obj -+* -+* DESCRIPTION -+* The cl_qmap_set_obj function sets the object stored in a map object. -+* -+* SYNOPSIS -+*/ -+static inline void -+cl_qmap_set_obj(cl_map_obj_t * const p_map_obj, -+ const void *const p_object) -+{ -+ assert(p_map_obj); -+ p_map_obj->p_object = p_object; -+} -+ -+/* -+* PARAMETERS -+* p_map_obj -+* [in] Pointer to a map object stucture whose object pointer -+* is to be set. -+* -+* p_object -+* [in] User defined context. -+* -+* RETURN VALUE -+* This function does not return a value. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_obj -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_obj -+* NAME -+* cl_qmap_obj -+* -+* DESCRIPTION -+* The cl_qmap_obj function returns the object stored in a map object. -+* -+* SYNOPSIS -+*/ -+static inline void *cl_qmap_obj(const cl_map_obj_t * const p_map_obj) -+{ -+ assert(p_map_obj); -+ return ((void *)p_map_obj->p_object); -+} -+ -+/* -+* PARAMETERS -+* p_map_obj -+* [in] Pointer to a map object stucture whose object pointer to return. -+* -+* RETURN VALUE -+* Returns the value of the object pointer stored in the map object. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_set_obj -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_key -+* NAME -+* cl_qmap_key -+* -+* DESCRIPTION -+* The cl_qmap_key function retrieves the key value of a map item. -+* -+* SYNOPSIS -+*/ -+static inline uint64_t cl_qmap_key(const cl_map_item_t * const p_item) -+{ -+ assert(p_item); -+ return (p_item->key); -+} -+ -+/* -+* PARAMETERS -+* p_item -+* [in] Pointer to a map item whose key value to return. -+* -+* RETURN VALUE -+* Returns the 64-bit key value for the specified map item. -+* -+* NOTES -+* The key value is set in a call to cl_qmap_insert. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_insert -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_init -+* NAME -+* cl_qmap_init -+* -+* DESCRIPTION -+* The cl_qmap_init function initialized a quick map for use. -+* -+* SYNOPSIS -+*/ -+void cl_qmap_init(cl_qmap_t * const p_map); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure to initialize. -+* -+* RETURN VALUES -+* This function does not return a value. -+* -+* NOTES -+* Allows calling quick map manipulation functions. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_insert, cl_qmap_remove -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_end -+* NAME -+* cl_qmap_end -+* -+* DESCRIPTION -+* The cl_qmap_end function returns the end of a quick map. -+* -+* SYNOPSIS -+*/ -+static inline const cl_map_item_t *cl_qmap_end(const cl_qmap_t * const p_map) -+{ -+ assert(p_map); -+ /* Nil is the end of the map. */ -+ return (&p_map->nil); -+} -+ -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure whose end to return. -+* -+* RETURN VALUE -+* Pointer to the end of the map. -+* -+* NOTES -+* cl_qmap_end is useful for determining the validity of map items returned -+* by cl_qmap_head, cl_qmap_tail, cl_qmap_next, or cl_qmap_prev. If the -+* map item pointer returned by any of these functions compares to the end, -+* the end of the map was encoutered. -+* When using cl_qmap_head or cl_qmap_tail, this condition indicates that -+* the map is empty. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_prev -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_head -+* NAME -+* cl_qmap_head -+* -+* DESCRIPTION -+* The cl_qmap_head function returns the map item with the lowest key -+* value stored in a quick map. -+* -+* SYNOPSIS -+*/ -+static inline cl_map_item_t *cl_qmap_head(const cl_qmap_t * const p_map) -+{ -+ assert(p_map); -+ return ((cl_map_item_t *) p_map->nil.pool_item.list_item.p_next); -+} -+ -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure whose item with the lowest -+* key is returned. -+* -+* RETURN VALUES -+* Pointer to the map item with the lowest key in the quick map. -+* -+* Pointer to the map end if the quick map was empty. -+* -+* NOTES -+* cl_qmap_head does not remove the item from the map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_tail, cl_qmap_next, cl_qmap_prev, cl_qmap_end, -+* cl_qmap_item_t -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_tail -+* NAME -+* cl_qmap_tail -+* -+* DESCRIPTION -+* The cl_qmap_tail function returns the map item with the highest key -+* value stored in a quick map. -+* -+* SYNOPSIS -+*/ -+static inline cl_map_item_t *cl_qmap_tail(const cl_qmap_t * const p_map) -+{ -+ assert(p_map); -+ return ((cl_map_item_t *) p_map->nil.pool_item.list_item.p_prev); -+} -+ -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure whose item with the -+* highest key is returned. -+* -+* RETURN VALUES -+* Pointer to the map item with the highest key in the quick map. -+* -+* Pointer to the map end if the quick map was empty. -+* -+* NOTES -+* cl_qmap_end does not remove the item from the map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_head, cl_qmap_next, cl_qmap_prev, cl_qmap_end, -+* cl_qmap_item_t -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_next -+* NAME -+* cl_qmap_next -+* -+* DESCRIPTION -+* The cl_qmap_next function returns the map item with the next higher -+* key value than a specified map item. -+* -+* SYNOPSIS -+*/ -+static inline cl_map_item_t *cl_qmap_next(const cl_map_item_t * const p_item) -+{ -+ assert(p_item); -+ return ((cl_map_item_t *) p_item->pool_item.list_item.p_next); -+} -+ -+/* -+* PARAMETERS -+* p_item -+* [in] Pointer to a map item whose successor to return. -+* -+* RETURN VALUES -+* Pointer to the map item with the next higher key value in a quick map. -+* -+* Pointer to the map end if the specified item was the last item in -+* the quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_head, cl_qmap_tail, cl_qmap_prev, cl_qmap_end, -+* cl_map_item_t -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_prev -+* NAME -+* cl_qmap_prev -+* -+* DESCRIPTION -+* The cl_qmap_prev function returns the map item with the next lower -+* key value than a precified map item. -+* -+* SYNOPSIS -+*/ -+static inline cl_map_item_t *cl_qmap_prev(const cl_map_item_t * const p_item) -+{ -+ assert(p_item); -+ return ((cl_map_item_t *) p_item->pool_item.list_item.p_prev); -+} -+ -+/* -+* PARAMETERS -+* p_item -+* [in] Pointer to a map item whose predecessor to return. -+* -+* RETURN VALUES -+* Pointer to the map item with the next lower key value in a quick map. -+* -+* Pointer to the map end if the specifid item was the first item in -+* the quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_end, -+* cl_map_item_t -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_insert -+* NAME -+* cl_qmap_insert -+* -+* DESCRIPTION -+* The cl_qmap_insert function inserts a map item into a quick map. -+* NOTE: Only if such a key does not alerady exist in the map !!!! -+* -+* SYNOPSIS -+*/ -+cl_map_item_t *cl_qmap_insert(cl_qmap_t * const p_map, -+ const uint64_t key, -+ cl_map_item_t * const p_item); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure into which to add the item. -+* -+* key -+* [in] Value to assign to the item. -+* -+* p_item -+* [in] Pointer to a cl_map_item_t stucture to insert into the quick map. -+* -+* RETURN VALUE -+* Pointer to the item in the map with the specified key. If insertion -+* was successful, this is the pointer to the item. If an item with the -+* specified key already exists in the map, the pointer to that item is -+* returned - but the new key is NOT inserted... -+* -+* NOTES -+* Insertion operations may cause the quick map to rebalance. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_remove, cl_map_item_t -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_get -+* NAME -+* cl_qmap_get -+* -+* DESCRIPTION -+* The cl_qmap_get function returns the map item associated with a key. -+* -+* SYNOPSIS -+*/ -+cl_map_item_t *cl_qmap_get(const cl_qmap_t * const p_map, -+ const uint64_t key); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure from which to retrieve the -+* item with the specified key. -+* -+* key -+* [in] Key value used to search for the desired map item. -+* -+* RETURN VALUES -+* Pointer to the map item with the desired key value. -+* -+* Pointer to the map end if there was no item with the desired key value -+* stored in the quick map. -+* -+* NOTES -+* cl_qmap_get does not remove the item from the quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_get_next, cl_qmap_remove -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_get_next -+* NAME -+* cl_qmap_get_next -+* -+* DESCRIPTION -+* The cl_qmap_get_next function returns the first map item associated with a -+* key > the key specified. -+* -+* SYNOPSIS -+*/ -+cl_map_item_t *cl_qmap_get_next(const cl_qmap_t * const p_map, -+ const uint64_t key); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure from which to retrieve the -+* first item with a key > the specified key. -+* -+* key -+* [in] Key value used to search for the desired map item. -+* -+* RETURN VALUES -+* Pointer to the first map item with a key > the desired key value. -+* -+* Pointer to the map end if there was no item with a key > the desired key -+* value stored in the quick map. -+* -+* NOTES -+* cl_qmap_get_next does not remove the item from the quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_get, cl_qmap_remove -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_remove_item -+* NAME -+* cl_qmap_remove_item -+* -+* DESCRIPTION -+* The cl_qmap_remove_item function removes the specified map item -+* from a quick map. -+* -+* SYNOPSIS -+*/ -+void -+cl_qmap_remove_item(cl_qmap_t * const p_map, -+ cl_map_item_t * const p_item); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure from which to -+* remove item. -+* -+* p_item -+* [in] Pointer to a map item to remove from its quick map. -+* -+* RETURN VALUES -+* This function does not return a value. -+* -+* In a debug build, cl_qmap_remove_item asserts that the item being removed -+* is in the specified map. -+* -+* NOTES -+* Removes the map item pointed to by p_item from its quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_remove, cl_qmap_remove_all, cl_qmap_insert -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_remove -+* NAME -+* cl_qmap_remove -+* -+* DESCRIPTION -+* The cl_qmap_remove function removes the map item with the specified key -+* from a quick map. -+* -+* SYNOPSIS -+*/ -+cl_map_item_t *cl_qmap_remove(cl_qmap_t * const p_map, -+ const uint64_t key); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure from which to remove the item -+* with the specified key. -+* -+* key -+* [in] Key value used to search for the map item to remove. -+* -+* RETURN VALUES -+* Pointer to the removed map item if it was found. -+* -+* Pointer to the map end if no item with the specified key exists in the -+* quick map. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_remove_item, cl_qmap_remove_all, cl_qmap_insert -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_remove_all -+* NAME -+* cl_qmap_remove_all -+* -+* DESCRIPTION -+* The cl_qmap_remove_all function removes all items in a quick map, -+* leaving it empty. -+* -+* SYNOPSIS -+*/ -+static inline void cl_qmap_remove_all(cl_qmap_t * const p_map) -+{ -+ assert(p_map); -+ -+ p_map->root.p_left = &p_map->nil; -+ p_map->nil.pool_item.list_item.p_next = &p_map->nil.pool_item.list_item; -+ p_map->nil.pool_item.list_item.p_prev = &p_map->nil.pool_item.list_item; -+ p_map->count = 0; -+} -+ -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure to empty. -+* -+* RETURN VALUES -+* This function does not return a value. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_remove, cl_qmap_remove_item -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_merge -+* NAME -+* cl_qmap_merge -+* -+* DESCRIPTION -+* The cl_qmap_merge function moves all items from one map to another, -+* excluding duplicates. -+* -+* SYNOPSIS -+*/ -+void -+cl_qmap_merge(cl_qmap_t * const p_dest_map, -+ cl_qmap_t * const p_src_map); -+/* -+* PARAMETERS -+* p_dest_map -+* [out] Pointer to a cl_qmap_t structure to which items should be added. -+* -+* p_src_map -+* [in/out] Pointer to a cl_qmap_t structure whose items to add -+* to p_dest_map. -+* -+* RETURN VALUES -+* This function does not return a value. -+* -+* NOTES -+* Items are evaluated based on their keys only. -+* -+* Upon return from cl_qmap_merge, the quick map referenced by p_src_map -+* contains all duplicate items. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_delta -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_delta -+* NAME -+* cl_qmap_delta -+* -+* DESCRIPTION -+* The cl_qmap_delta function computes the differences between two maps. -+* -+* SYNOPSIS -+*/ -+void -+cl_qmap_delta(cl_qmap_t * const p_map1, -+ cl_qmap_t * const p_map2, -+ cl_qmap_t * const p_new, cl_qmap_t * const p_old); -+/* -+* PARAMETERS -+* p_map1 -+* [in/out] Pointer to the first of two cl_qmap_t structures whose -+* differences to compute. -+* -+* p_map2 -+* [in/out] Pointer to the second of two cl_qmap_t structures whose -+* differences to compute. -+* -+* p_new -+* [out] Pointer to an empty cl_qmap_t structure that contains the -+* items unique to p_map2 upon return from the function. -+* -+* p_old -+* [out] Pointer to an empty cl_qmap_t structure that contains the -+* items unique to p_map1 upon return from the function. -+* -+* RETURN VALUES -+* This function does not return a value. -+* -+* NOTES -+* Items are evaluated based on their keys. Items that exist in both -+* p_map1 and p_map2 remain in their respective maps. Items that -+* exist only p_map1 are moved to p_old. Likewise, items that exist only -+* in p_map2 are moved to p_new. This function can be useful in evaluating -+* changes between two maps. -+* -+* Both maps pointed to by p_new and p_old must be empty on input. This -+* requirement removes the possibility of failures. -+* -+* SEE ALSO -+* Quick Map, cl_qmap_merge -+*********/ -+ -+/****f* Component Library: Quick Map/cl_qmap_apply_func -+* NAME -+* cl_qmap_apply_func -+* -+* DESCRIPTION -+* The cl_qmap_apply_func function executes a specified function -+* for every item stored in a quick map. -+* -+* SYNOPSIS -+*/ -+void -+cl_qmap_apply_func(const cl_qmap_t * const p_map, -+ cl_pfn_qmap_apply_t pfn_func, -+ const void *const context); -+/* -+* PARAMETERS -+* p_map -+* [in] Pointer to a cl_qmap_t structure. -+* -+* pfn_func -+* [in] Function invoked for every item in the quick map. -+* See the cl_pfn_qmap_apply_t function type declaration for -+* details about the callback function. -+* -+* context -+* [in] Value to pass to the callback functions to provide context. -+* -+* RETURN VALUE -+* This function does not return a value. -+* -+* NOTES -+* The function provided must not perform any map operations, as these -+* would corrupt the quick map. -+* -+* SEE ALSO -+* Quick Map, cl_pfn_qmap_apply_t -+*********/ -+ -+#endif /* _CL_QMAP_H_ */ -diff --git a/src/rc-compat/v37/util/compiler.h b/src/rc-compat/v37/util/compiler.h -new file mode 100644 -index 000000000000..dfce82f18841 ---- /dev/null -+++ b/src/rc-compat/v37/util/compiler.h -@@ -0,0 +1,54 @@ -+/* GPLv2 or OpenIB.org BSD (MIT) See COPYING file */ -+#ifndef UTIL_COMPILER_H -+#define UTIL_COMPILER_H -+ -+/* Use to tag a variable that causes compiler warnings. Use as: -+ int uninitialized_var(sz) -+ -+ This is only enabled for old compilers. gcc 6.x and beyond have excellent -+ static flow analysis. If code solicits a warning from 6.x it is almost -+ certainly too complex for a human to understand. For some reason powerpc -+ uses a different scheme than gcc for flow analysis. -+*/ -+#if (__GNUC__ >= 6 && !defined(__powerpc__)) || defined(__clang__) -+#define uninitialized_var(x) x -+#else -+#define uninitialized_var(x) x = x -+#endif -+ -+#ifndef likely -+#ifdef __GNUC__ -+#define likely(x) __builtin_expect(!!(x), 1) -+#else -+#define likely(x) (x) -+#endif -+#endif -+ -+#ifndef unlikely -+#ifdef __GNUC__ -+#define unlikely(x) __builtin_expect(!!(x), 0) -+#else -+#define unlikely(x) (x) -+#endif -+#endif -+ -+#ifdef HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE -+#define ALWAYS_INLINE __attribute__((always_inline)) -+#else -+#define ALWAYS_INLINE -+#endif -+ -+/* Use to mark fall through on switch statements as desired. */ -+#if __GNUC__ >= 7 -+#define SWITCH_FALLTHROUGH __attribute__ ((fallthrough)) -+#else -+#define SWITCH_FALLTHROUGH -+#endif -+ -+#ifdef __CHECKER__ -+# define __force __attribute__((force)) -+#else -+# define __force -+#endif -+ -+#endif -diff --git a/src/rc-compat/v37/util/mmio.h b/src/rc-compat/v37/util/mmio.h -new file mode 100644 -index 000000000000..101af9dd332d ---- /dev/null -+++ b/src/rc-compat/v37/util/mmio.h -@@ -0,0 +1,267 @@ -+/* GPLv2 or OpenIB.org BSD (MIT) See COPYING file -+ -+ These accessors always map to PCI-E TLPs in predictable ways. Translation -+ to other buses should follow similar definitions. -+ -+ write32(mem, 1) -+ Produce a 4 byte MemWr TLP with bit 0 of DW byte offset 0 set -+ write32_be(mem, htobe32(1)) -+ Produce a 4 byte MemWr TLP with bit 0 of DW byte offset 3 set -+ write32_le(mem, htole32(1)) -+ Produce a 4 byte MemWr TLP with bit 0 of DW byte offset 0 set -+ -+ For ordering these accessors are similar to the Kernel's concept of -+ writel_relaxed(). When working with UC memory the following hold: -+ -+ 1) Strong ordering is required when talking to the same device (eg BAR), -+ and combining is not permitted: -+ -+ write32(mem, 1); -+ write32(mem + 4, 1); -+ write32(mem, 1); -+ -+ Must produce three TLPs, in order. -+ -+ 2) Ordering ignores all pthread locking: -+ -+ pthread_spin_lock(&lock); -+ write32(mem, global++); -+ pthread_spin_unlock(&lock); -+ -+ When run concurrently on all CPUs the device must observe all stores, -+ but the data value will not be strictly increasing. -+ -+ 3) Interaction with DMA is not ordered. Explicit use of a barrier from -+ udma_barriers is required: -+ -+ *dma_mem = 1; -+ udma_to_device_barrier(); -+ write32(mem, GO_DMA); -+ -+ 4) Access out of program order (eg speculation), either by the CPU or -+ compiler is not permitted: -+ -+ if (cond) -+ read32(); -+ -+ Must not issue a read TLP if cond is false. -+ -+ If these are used with WC memory then #1 and #4 do not apply, and all WC -+ accesses must be bracketed with mmio_wc_start() // mmio_flush_writes() -+*/ -+ -+#ifndef __UTIL_MMIO_H -+#define __UTIL_MMIO_H -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+/* The first step is to define the 'raw' accessors. To make this very safe -+ with sparse we define two versions of each, a le and a be - however the -+ code is always identical. -+*/ -+#ifdef __s390x__ -+#include -+#include -+ -+/* s390 requires a privileged instruction to access IO memory, these syscalls -+ perform that instruction using a memory buffer copy semantic. -+*/ -+static inline void s390_mmio_write(void *mmio_addr, const void *val, -+ size_t length) -+{ -+ // FIXME: Check for error and call abort? -+ syscall(__NR_s390_pci_mmio_write, mmio_addr, val, length); -+} -+ -+static inline void s390_mmio_read(const void *mmio_addr, void *val, -+ size_t length) -+{ -+ // FIXME: Check for error and call abort? -+ syscall(__NR_s390_pci_mmio_read, mmio_addr, val, length); -+} -+ -+#define MAKE_WRITE(_NAME_, _SZ_) \ -+ static inline void _NAME_##_be(void *addr, __be##_SZ_ value) \ -+ { \ -+ s390_mmio_write(addr, &value, sizeof(value)); \ -+ } \ -+ static inline void _NAME_##_le(void *addr, __le##_SZ_ value) \ -+ { \ -+ s390_mmio_write(addr, &value, sizeof(value)); \ -+ } -+#define MAKE_READ(_NAME_, _SZ_) \ -+ static inline __be##_SZ_ _NAME_##_be(const void *addr) \ -+ { \ -+ __be##_SZ_ res; \ -+ s390_mmio_read(addr, &res, sizeof(res)); \ -+ return res; \ -+ } \ -+ static inline __le##_SZ_ _NAME_##_le(const void *addr) \ -+ { \ -+ __le##_SZ_ res; \ -+ s390_mmio_read(addr, &res, sizeof(res)); \ -+ return res; \ -+ } -+ -+static inline void mmio_write8(void *addr, uint8_t value) -+{ -+ s390_mmio_write(addr, &value, sizeof(value)); -+} -+ -+static inline uint8_t mmio_read8(const void *addr) -+{ -+ uint8_t res; -+ s390_mmio_read(addr, &res, sizeof(res)); -+ return res; -+} -+ -+#else /* __s390x__ */ -+ -+#define MAKE_WRITE(_NAME_, _SZ_) \ -+ static inline void _NAME_##_be(void *addr, __be##_SZ_ value) \ -+ { \ -+ atomic_store_explicit((_Atomic(uint##_SZ_##_t) *)addr, \ -+ (__force uint##_SZ_##_t)value, \ -+ memory_order_relaxed); \ -+ } \ -+ static inline void _NAME_##_le(void *addr, __le##_SZ_ value) \ -+ { \ -+ atomic_store_explicit((_Atomic(uint##_SZ_##_t) *)addr, \ -+ (__force uint##_SZ_##_t)value, \ -+ memory_order_relaxed); \ -+ } -+#define MAKE_READ(_NAME_, _SZ_) \ -+ static inline __be##_SZ_ _NAME_##_be(const void *addr) \ -+ { \ -+ return (__force __be##_SZ_)atomic_load_explicit( \ -+ (_Atomic(uint##_SZ_##_t) *)addr, memory_order_relaxed); \ -+ } \ -+ static inline __le##_SZ_ _NAME_##_le(const void *addr) \ -+ { \ -+ return (__force __le##_SZ_)atomic_load_explicit( \ -+ (_Atomic(uint##_SZ_##_t) *)addr, memory_order_relaxed); \ -+ } -+ -+static inline void mmio_write8(void *addr, uint8_t value) -+{ -+ atomic_store_explicit((_Atomic(uint8_t) *)addr, value, -+ memory_order_relaxed); -+} -+static inline uint8_t mmio_read8(const void *addr) -+{ -+ return atomic_load_explicit((_Atomic(uint32_t) *)addr, -+ memory_order_relaxed); -+} -+#endif /* __s390x__ */ -+ -+MAKE_WRITE(mmio_write16, 16) -+MAKE_WRITE(mmio_write32, 32) -+ -+MAKE_READ(mmio_read16, 16) -+MAKE_READ(mmio_read32, 32) -+ -+#if SIZEOF_LONG == 8 -+MAKE_WRITE(mmio_write64, 64) -+MAKE_READ(mmio_read64, 64) -+#else -+void mmio_write64_be(void *addr, __be64 val); -+static inline void mmio_write64_le(void *addr, __le64 val) -+{ -+ mmio_write64_be(addr, (__be64 __force)val); -+} -+ -+/* There is no way to do read64 atomically, rather than provide some sketchy -+ implementation we leave these functions undefined, users should not call -+ them if SIZEOF_LONG != 8, but instead implement an appropriate version. -+*/ -+__be64 mmio_read64_be(const void *addr); -+__le64 mmio_read64_le(const void *addr); -+#endif /* SIZEOF_LONG == 8 */ -+ -+#undef MAKE_WRITE -+#undef MAKE_READ -+ -+/* Now we can define the host endian versions of the operator, this just includes -+ a call to htole. -+*/ -+#define MAKE_WRITE(_NAME_, _SZ_) \ -+ static inline void _NAME_(void *addr, uint##_SZ_##_t value) \ -+ { \ -+ _NAME_##_le(addr, htole##_SZ_(value)); \ -+ } -+#define MAKE_READ(_NAME_, _SZ_) \ -+ static inline uint##_SZ_##_t _NAME_(const void *addr) \ -+ { \ -+ return le##_SZ_##toh(_NAME_##_le(addr)); \ -+ } -+ -+/* This strictly guarantees the order of TLP generation for the memory copy to -+ be in ascending address order. -+*/ -+#ifdef __s390x__ -+static inline void mmio_memcpy_x64(void *dest, const void *src, size_t bytecnt) -+{ -+ s390_mmio_write(dest, src, bytecnt); -+} -+#else -+ -+/* Transfer is some multiple of 64 bytes */ -+static inline void mmio_memcpy_x64(void *dest, const void *src, size_t bytecnt) -+{ -+ uintptr_t *dst_p = dest; -+ -+ /* Caller must guarantee: -+ assert(bytecnt != 0); -+ assert((bytecnt % 64) == 0); -+ assert(((uintptr_t)dest) % __alignof__(*dst) == 0); -+ assert(((uintptr_t)src) % __alignof__(*dst) == 0); -+ */ -+ -+ /* Use the native word size for the copy */ -+ if (sizeof(*dst_p) == 8) { -+ const __be64 *src_p = src; -+ -+ do { -+ /* Do 64 bytes at a time */ -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ mmio_write64_be(dst_p++, *src_p++); -+ -+ bytecnt -= 8 * sizeof(*dst_p); -+ } while (bytecnt > 0); -+ } else if (sizeof(*dst_p) == 4) { -+ const __be32 *src_p = src; -+ -+ do { -+ mmio_write32_be(dst_p++, *src_p++); -+ mmio_write32_be(dst_p++, *src_p++); -+ bytecnt -= 2 * sizeof(*dst_p); -+ } while (bytecnt > 0); -+ } -+} -+#endif -+ -+MAKE_WRITE(mmio_write16, 16) -+MAKE_WRITE(mmio_write32, 32) -+MAKE_WRITE(mmio_write64, 64) -+ -+MAKE_READ(mmio_read16, 16) -+MAKE_READ(mmio_read32, 32) -+MAKE_READ(mmio_read64, 64) -+ -+#undef MAKE_WRITE -+#undef MAKE_READ -+ -+#endif -diff --git a/src/rc-compat/v37/util/node_name_map.h b/src/rc-compat/v37/util/node_name_map.h -new file mode 100644 -index 000000000000..e78d274b116e ---- /dev/null -+++ b/src/rc-compat/v37/util/node_name_map.h -@@ -0,0 +1,19 @@ -+/* Copyright (c) 2019 Mellanox Technologies. All rights reserved. -+ * -+ * Connect to opensm's cl_nodenamemap.h if it is available. -+ */ -+#ifndef __LIBUTIL_NODE_NAME_MAP_H__ -+#define __LIBUTIL_NODE_NAME_MAP_H__ -+ -+#include -+ -+struct nn_map; -+typedef struct nn_map nn_map_t; -+ -+nn_map_t *open_node_name_map(const char *node_name_map); -+void close_node_name_map(nn_map_t *map); -+/* NOTE: parameter "nodedesc" may be modified here. */ -+char *remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc); -+char *clean_nodedesc(char *nodedesc); -+ -+#endif -diff --git a/src/rc-compat/v37/util/rdma_nl.h b/src/rc-compat/v37/util/rdma_nl.h -new file mode 100644 -index 000000000000..9c0916978283 ---- /dev/null -+++ b/src/rc-compat/v37/util/rdma_nl.h -@@ -0,0 +1,52 @@ -+/* -+ * Copyright (c) 2019, Mellanox Technologies. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+#ifndef UTIL_RDMA_NL_H -+#define UTIL_RDMA_NL_H -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+extern struct nla_policy rdmanl_policy[RDMA_NLDEV_ATTR_MAX]; -+struct nl_sock *rdmanl_socket_alloc(void); -+int rdmanl_get_devices(struct nl_sock *nl, nl_recvmsg_msg_cb_t cb_func, -+ void *data); -+int rdmanl_get_chardev(struct nl_sock *nl, int ibidx, const char *name, -+ nl_recvmsg_msg_cb_t cb_func, void *data); -+bool get_copy_on_fork(void); -+int rdmanl_get_copy_on_fork(struct nl_sock *nl, nl_recvmsg_msg_cb_t cb_func, -+ void *data); -+ -+#endif -diff --git a/src/rc-compat/v37/util/symver.h b/src/rc-compat/v37/util/symver.h -new file mode 100644 -index 000000000000..eb14c57ebdc1 ---- /dev/null -+++ b/src/rc-compat/v37/util/symver.h -@@ -0,0 +1,107 @@ -+/* GPLv2 or OpenIB.org BSD (MIT) See COPYING file -+ -+ These definitions help using the ELF symbol version feature, and must be -+ used in conjunction with the library's map file. -+ */ -+ -+#ifndef __UTIL_SYMVER_H -+#define __UTIL_SYMVER_H -+ -+#include -+#include -+ -+/* -+ These macros should only be used if the library is defining compatibility -+ symbols, eg: -+ -+ 213: 000000000000a650 315 FUNC GLOBAL DEFAULT 13 ibv_get_device_list@IBVERBS_1.0 -+ 214: 000000000000b020 304 FUNC GLOBAL DEFAULT 13 ibv_get_device_list@@IBVERBS_1.1 -+ -+ Symbols which have only a single implementation should use a normal extern -+ function and be placed in the correct stanza in the linker map file. -+ -+ Follow this pattern to use this feature: -+ public.h: -+ struct ibv_device **ibv_get_device_list(int *num_devices); -+ foo.c: -+ // Implement the latest version -+ LATEST_SYMVER_FUNC(ibv_get_device_list, 1_1, "IBVERBS_1.1", -+ struct ibv_device **, -+ int *num_devices) -+ { -+ ... -+ } -+ -+ // Implement the compat version -+ COMPAT_SYMVER_FUNC(ibv_get_device_list, 1_0, "IBVERBS_1.0", -+ struct ibv_device_1_0 **, -+ int *num_devices) -+ { -+ ... -+ } -+ -+ As well as matching information in the map file. -+ -+ These macros deal with the various uglyness in gcc surrounding symbol -+ versions -+ -+ - The internal name __public_1_x is synthesized by the macro -+ - A prototype for the internal name is created by the macro -+ - If statically linking the latest symbol expands into a normal function -+ definition -+ - If statically linking the compat symbols expand into unused static -+ functions are are discarded by the compiler. -+ - The prototype of the latest symbol is checked against the public -+ prototype (only when compiling statically) -+ -+ The extra prototypes are included only to avoid -Wmissing-prototypes -+ warnings. See also Documentation/versioning.md -+*/ -+ -+#if HAVE_FUNC_ATTRIBUTE_SYMVER -+#define _MAKE_SYMVER(_local_sym, _public_sym, _ver_str) \ -+ __attribute__((__symver__(#_public_sym "@" _ver_str))) -+#else -+#define _MAKE_SYMVER(_local_sym, _public_sym, _ver_str) \ -+ asm(".symver " #_local_sym "," #_public_sym "@" _ver_str); -+#endif -+#define _MAKE_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ _ret __##_public_sym##_##_uniq(__VA_ARGS__); \ -+ _MAKE_SYMVER(__##_public_sym##_##_uniq, _public_sym, _ver_str) \ -+ _ret __##_public_sym##_##_uniq(__VA_ARGS__) -+ -+#if defined(HAVE_FULL_SYMBOL_VERSIONS) && !defined(_STATIC_LIBRARY_BUILD_) -+ -+ // Produce all symbol versions for dynamic linking -+ -+# define COMPAT_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ _MAKE_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, __VA_ARGS__) -+# define LATEST_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ _MAKE_SYMVER_FUNC(_public_sym, _uniq, "@" _ver_str, _ret, __VA_ARGS__) -+ -+#elif defined(HAVE_LIMITED_SYMBOL_VERSIONS) && !defined(_STATIC_LIBRARY_BUILD_) -+ -+ /* Produce only implemenations for the latest symbol and tag it with the -+ * correct symbol versions. This supports dynamic linkers that do not -+ * understand symbol versions -+ */ -+# define COMPAT_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ static inline _ret __##_public_sym##_##_uniq(__VA_ARGS__) -+# define LATEST_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ _MAKE_SYMVER_FUNC(_public_sym, _uniq, "@" _ver_str, _ret, __VA_ARGS__) -+ -+#else -+ -+ // Static linking, or linker does not support symbol versions -+#define COMPAT_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ static inline __attribute__((unused)) \ -+ _ret __##_public_sym##_##_uniq(__VA_ARGS__) -+#define LATEST_SYMVER_FUNC(_public_sym, _uniq, _ver_str, _ret, ...) \ -+ static __attribute__((unused)) \ -+ _ret __##_public_sym##_##_uniq(__VA_ARGS__) \ -+ __attribute__((alias(stringify(_public_sym)))); \ -+ extern _ret _public_sym(__VA_ARGS__) -+ -+#endif -+ -+#endif -diff --git a/src/rc-compat/v37/util/udma_barrier.h b/src/rc-compat/v37/util/udma_barrier.h -new file mode 100644 -index 000000000000..5730576e6356 ---- /dev/null -+++ b/src/rc-compat/v37/util/udma_barrier.h -@@ -0,0 +1,267 @@ -+/* -+ * Copyright (c) 2005 Topspin Communications. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * 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. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#ifndef __UTIL_UDMA_BARRIER_H -+#define __UTIL_UDMA_BARRIER_H -+ -+#include -+ -+/* Barriers for DMA. -+ -+ These barriers are expliclty only for use with user DMA operations. If you -+ are looking for barriers to use with cache-coherent multi-threaded -+ consitency then look in stdatomic.h. If you need both kinds of synchronicity -+ for the same address then use an atomic operation followed by one -+ of these barriers. -+ -+ When reasoning about these barriers there are two objects: -+ - CPU attached address space (the CPU memory could be a range of things: -+ cached/uncached/non-temporal CPU DRAM, uncached MMIO space in another -+ device, pMEM). Generally speaking the ordering is only relative -+ to the local CPU's view of the system. Eg if the local CPU -+ is not guaranteed to see a write from another CPU then it is also -+ OK for the DMA device to also not see the write after the barrier. -+ - A DMA initiator on a bus. For instance a PCI-E device issuing -+ MemRd/MemWr TLPs. -+ -+ The ordering guarantee is always stated between those two streams. Eg what -+ happens if a MemRd TLP is sent in via PCI-E relative to a CPU WRITE to the -+ same memory location. -+ -+ The providers have a very regular and predictable use of these barriers, -+ to make things very clear each narrow use is given a name and the proper -+ name should be used in the provider as a form of documentation. -+*/ -+ -+/* Ensure that the device's view of memory matches the CPU's view of memory. -+ This should be placed before any MMIO store that could trigger the device -+ to begin doing DMA, such as a device doorbell ring. -+ -+ eg -+ *dma_buf = 1; -+ udma_to_device_barrier(); -+ mmio_write(DO_DMA_REG, dma_buf); -+ Must ensure that the device sees the '1'. -+ -+ This is required to fence writes created by the libibverbs user. Those -+ writes could be to any CPU mapped memory object with any cachability mode. -+ -+ NOTE: x86 has historically used a weaker semantic for this barrier, and -+ only fenced normal stores to normal memory. libibverbs users using other -+ memory types or non-temporal stores are required to use SFENCE in their own -+ code prior to calling verbs to start a DMA. -+*/ -+#if defined(__i386__) -+#define udma_to_device_barrier() asm volatile("" ::: "memory") -+#elif defined(__x86_64__) -+#define udma_to_device_barrier() asm volatile("" ::: "memory") -+#elif defined(__PPC64__) -+#define udma_to_device_barrier() asm volatile("sync" ::: "memory") -+#elif defined(__PPC__) -+#define udma_to_device_barrier() asm volatile("sync" ::: "memory") -+#elif defined(__ia64__) -+#define udma_to_device_barrier() asm volatile("mf" ::: "memory") -+#elif defined(__sparc_v9__) -+#define udma_to_device_barrier() asm volatile("membar #StoreStore" ::: "memory") -+#elif defined(__aarch64__) -+#define udma_to_device_barrier() asm volatile("dsb st" ::: "memory"); -+#elif defined(__sparc__) || defined(__s390x__) -+#define udma_to_device_barrier() asm volatile("" ::: "memory") -+#elif defined(__loongarch__) -+#define udma_to_device_barrier() asm volatile("dbar 0" ::: "memory") -+#else -+#error No architecture specific memory barrier defines found! -+#endif -+ -+/* Ensure that all ordered stores from the device are observable from the -+ CPU. This only makes sense after something that observes an ordered store -+ from the device - eg by reading a MMIO register or seeing that CPU memory is -+ updated. -+ -+ This guarantees that all reads that follow the barrier see the ordered -+ stores that preceded the observation. -+ -+ For instance, this would be used after testing a valid bit in a memory -+ that is a DMA target, to ensure that the following reads see the -+ data written before the MemWr TLP that set the valid bit. -+*/ -+#if defined(__i386__) -+#define udma_from_device_barrier() asm volatile("lock; addl $0,0(%%esp) " ::: "memory") -+#elif defined(__x86_64__) -+#define udma_from_device_barrier() asm volatile("lfence" ::: "memory") -+#elif defined(__PPC64__) -+#define udma_from_device_barrier() asm volatile("lwsync" ::: "memory") -+#elif defined(__PPC__) -+#define udma_from_device_barrier() asm volatile("sync" ::: "memory") -+#elif defined(__ia64__) -+#define udma_from_device_barrier() asm volatile("mf" ::: "memory") -+#elif defined(__sparc_v9__) -+#define udma_from_device_barrier() asm volatile("membar #LoadLoad" ::: "memory") -+#elif defined(__aarch64__) -+#define udma_from_device_barrier() asm volatile("dsb ld" ::: "memory"); -+#elif defined(__sparc__) || defined(__s390x__) -+#define udma_from_device_barrier() asm volatile("" ::: "memory") -+#elif defined(__loongarch__) -+#define udma_from_device_barrier() asm volatile("dbar 0" ::: "memory") -+#else -+#error No architecture specific memory barrier defines found! -+#endif -+ -+/* Order writes to CPU memory so that a DMA device cannot view writes after -+ the barrier without also seeing all writes before the barrier. This does -+ not guarantee any writes are visible to DMA. -+ -+ This would be used in cases where a DMA buffer might have a valid bit and -+ data, this barrier is placed after writing the data but before writing the -+ valid bit to ensure the DMA device cannot observe a set valid bit with -+ unwritten data. -+ -+ Compared to udma_to_device_barrier() this barrier is not required to fence -+ anything but normal stores to normal malloc memory. Usage should be: -+ -+ write_wqe -+ udma_to_device_barrier(); // Get user memory ready for DMA -+ wqe->addr = ...; -+ wqe->flags = ...; -+ udma_ordering_write_barrier(); // Guarantee WQE written in order -+ wqe->valid = 1; -+*/ -+#define udma_ordering_write_barrier() udma_to_device_barrier() -+ -+/* Promptly flush writes to MMIO Write Cominbing memory. -+ This should be used after a write to WC memory. This is both a barrier -+ and a hint to the CPU to flush any buffers to reduce latency to TLP -+ generation. -+ -+ This is not required to have any effect on CPU memory. -+ -+ If done while holding a lock then the ordering of MMIO writes across CPUs -+ must be guaranteed to follow the natural ordering implied by the lock. -+ -+ This must also act as a barrier that prevents write combining, eg -+ *wc_mem = 1; -+ mmio_flush_writes(); -+ *wc_mem = 2; -+ Must always produce two MemWr TLPs, '1' and '2'. Without the barrier -+ the CPU is allowed to produce a single TLP '2'. -+ -+ Note that there is no order guarantee for writes to WC memory without -+ barriers. -+ -+ This is intended to be used in conjunction with WC memory to generate large -+ PCI-E MemWr TLPs from the CPU. -+*/ -+#if defined(__i386__) -+#define mmio_flush_writes() asm volatile("lock; addl $0,0(%%esp) " ::: "memory") -+#elif defined(__x86_64__) -+#define mmio_flush_writes() asm volatile("sfence" ::: "memory") -+#elif defined(__PPC64__) -+#define mmio_flush_writes() asm volatile("sync" ::: "memory") -+#elif defined(__PPC__) -+#define mmio_flush_writes() asm volatile("sync" ::: "memory") -+#elif defined(__ia64__) -+#define mmio_flush_writes() asm volatile("fwb" ::: "memory") -+#elif defined(__sparc_v9__) -+#define mmio_flush_writes() asm volatile("membar #StoreStore" ::: "memory") -+#elif defined(__aarch64__) -+#define mmio_flush_writes() asm volatile("dsb st" ::: "memory"); -+#elif defined(__sparc__) || defined(__s390x__) -+#define mmio_flush_writes() asm volatile("" ::: "memory") -+#elif defined(__loongarch__) -+#define mmio_flush_writes() asm volatile("dbar 0" ::: "memory") -+#else -+#error No architecture specific memory barrier defines found! -+#endif -+ -+/* Prevent WC writes from being re-ordered relative to other MMIO -+ writes. This should be used before a write to WC memory. -+ -+ This must act as a barrier to prevent write re-ordering from different -+ memory types: -+ *mmio_mem = 1; -+ mmio_flush_writes(); -+ *wc_mem = 2; -+ Must always produce a TLP '1' followed by '2'. -+ -+ This barrier implies udma_to_device_barrier() -+ -+ This is intended to be used in conjunction with WC memory to generate large -+ PCI-E MemWr TLPs from the CPU. -+*/ -+#define mmio_wc_start() mmio_flush_writes() -+ -+/* Keep MMIO writes in order. -+ Currently we lack writel macros that universally guarantee MMIO -+ writes happen in order, like the kernel does. Even worse many -+ providers haphazardly open code writes to MMIO memory omitting even -+ volatile. -+ -+ Until this can be fixed with a proper writel macro, this barrier -+ is a stand in to indicate places where MMIO writes should be switched -+ to some future writel. -+*/ -+#define mmio_ordered_writes_hack() mmio_flush_writes() -+ -+/* Write Combining Spinlock primitive -+ -+ Any access to a multi-value WC region must ensure that multiple cpus do not -+ write to the same values concurrently, these macros make that -+ straightforward and efficient if the choosen exclusion is a spinlock. -+ -+ The spinlock guarantees that the WC writes issued within the critical -+ section are made visible as TLP to the device. The TLP must be seen by the -+ device strictly in the order that the spinlocks are acquired, and combining -+ WC writes between different sections is not permitted. -+ -+ Use of these macros allow the fencing inside the spinlock to be combined -+ with the fencing required for DMA. -+ */ -+static inline void mmio_wc_spinlock(pthread_spinlock_t *lock) -+{ -+ pthread_spin_lock(lock); -+#if !defined(__i386__) && !defined(__x86_64__) -+ /* For x86 the serialization within the spin lock is enough to -+ * strongly order WC and other memory types. */ -+ mmio_wc_start(); -+#endif -+} -+ -+static inline void mmio_wc_spinunlock(pthread_spinlock_t *lock) -+{ -+ /* It is possible that on x86 the atomic in the lock is strong enough -+ * to force-flush the WC buffers quickly, and this SFENCE can be -+ * omitted too. */ -+ mmio_flush_writes(); -+ pthread_spin_unlock(lock); -+} -+ -+#endif -diff --git a/src/rc-compat/v37/util/util.h b/src/rc-compat/v37/util/util.h -new file mode 100644 -index 000000000000..45f50658519a ---- /dev/null -+++ b/src/rc-compat/v37/util/util.h -@@ -0,0 +1,93 @@ -+/* GPLv2 or OpenIB.org BSD (MIT) See COPYING file */ -+#ifndef UTIL_UTIL_H -+#define UTIL_UTIL_H -+ -+#include -+#include -+#include -+#include -+ -+/* Return true if the snprintf succeeded, false if there was truncation or -+ * error */ -+static inline bool __good_snprintf(size_t len, int rc) -+{ -+ return (rc < len && rc >= 0); -+} -+ -+#define check_snprintf(buf, len, fmt, ...) \ -+ __good_snprintf(len, snprintf(buf, len, fmt, ##__VA_ARGS__)) -+ -+/* a CMP b. See also the BSD macro timercmp(). */ -+#define ts_cmp(a, b, CMP) \ -+ (((a)->tv_sec == (b)->tv_sec) ? \ -+ ((a)->tv_nsec CMP (b)->tv_nsec) : \ -+ ((a)->tv_sec CMP (b)->tv_sec)) -+ -+#define offsetofend(_type, _member) \ -+ (offsetof(_type, _member) + sizeof(((_type *)0)->_member)) -+ -+#define BITS_PER_LONG (8 * sizeof(long)) -+#define BITS_PER_LONG_LONG (8 * sizeof(long long)) -+ -+#define GENMASK(h, l) \ -+ (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) -+#define GENMASK_ULL(h, l) \ -+ (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) -+ -+#define BIT(nr) (1UL << (nr)) -+#define BIT_ULL(nr) (1ULL << (nr)) -+ -+#define __bf_shf(x) (__builtin_ffsll(x) - 1) -+ -+/** -+ * FIELD_PREP() - prepare a bitfield element -+ * @_mask: shifted mask defining the field's length and position -+ * @_val: value to put in the field -+ * -+ * FIELD_PREP() masks and shifts up the value. The result should -+ * be combined with other fields of the bitfield using logical OR. -+ */ -+#define FIELD_PREP(_mask, _val) \ -+ ({ \ -+ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \ -+ }) -+ -+/** -+ * FIELD_GET() - extract a bitfield element -+ * @_mask: shifted mask defining the field's length and position -+ * @_reg: value of entire bitfield -+ * -+ * FIELD_GET() extracts the field specified by @_mask from the -+ * bitfield passed in as @_reg by masking and shifting it down. -+ */ -+#define FIELD_GET(_mask, _reg) \ -+ ({ \ -+ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ -+ }) -+ -+static inline unsigned long align(unsigned long val, unsigned long align) -+{ -+ return (val + align - 1) & ~(align - 1); -+} -+ -+static inline unsigned long align_down(unsigned long val, unsigned long _align) -+{ -+ return align(val - (_align - 1), _align); -+} -+ -+static inline uint64_t roundup_pow_of_two(uint64_t n) -+{ -+ return n == 1 ? 1 : 1ULL << ilog64(n - 1); -+} -+ -+static inline unsigned long DIV_ROUND_UP(unsigned long n, unsigned long d) -+{ -+ return (n + d - 1) / d; -+} -+ -+int set_fd_nonblock(int fd, bool nonblock); -+ -+int open_cdev(const char *devname_hint, dev_t cdev); -+ -+unsigned int get_random(void); -+#endif --- -2.29.2 - diff --git a/userspace/broadcom/libbnxt_re/centos/patches/0003-configure.ac-Detect-rdma-core-v36-and-v37-too.patch b/userspace/broadcom/libbnxt_re/centos/patches/0003-configure.ac-Detect-rdma-core-v36-and-v37-too.patch deleted file mode 100644 index b7056f53..00000000 --- a/userspace/broadcom/libbnxt_re/centos/patches/0003-configure.ac-Detect-rdma-core-v36-and-v37-too.patch +++ /dev/null @@ -1,118 +0,0 @@ -From ffd1f85f70551c897e6e62b89acf8b170c1c82ea Mon Sep 17 00:00:00 2001 -From: "M. Vefa Bicakci" -Date: Thu, 31 Mar 2022 16:14:22 -0400 -Subject: [PATCH] configure.ac: Detect rdma-core v36 and v37 too - -This commit makes the configure.ac script detect rdma-core v36 and v37 -as well. Of these, we are only interested in v37, because Mellanox's -OpenFabrics Enterprise Distribution is based on rdma-core v37. - -Signed-off-by: M. Vefa Bicakci ---- - configure.ac | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 75 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 9e4e980886d4..3ece437e664a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -68,6 +68,10 @@ m4_define([rcore_version],[m4_esyscmd(rc=$(grep -o \ - _ibv_device_ops verbsincpath/include/infiniband/verbs.h | \ - tail -1); \ - if test ! -z "$rc"; then \ -+ rcverv37=$(grep "IBV_WC_DRIVER3" \ -+ verbsincpath/include/infiniband/verbs.h|tail -1); \ -+ rcverv36=$(grep "ibv_query_qp_data_in_order" \ -+ verbsincpath/include/infiniband/verbs.h|tail -1); \ - rcverv35=$(grep "ibv_is_fork_initialized" \ - verbsincpath/include/infiniband/verbs.h|tail -1); \ - rcverv34=$(grep "ibv_reg_dmabuf_mr" \ -@@ -90,7 +94,11 @@ m4_define([rcore_version],[m4_esyscmd(rc=$(grep -o \ - verbsincpath/include/infiniband/verbs.h|tail -1); \ - rcverv17=$(grep -o ibv_alloc_td \ - verbsincpath/include/infiniband/verbs.h|tail -1); \ -- if test ! -z "$rcverv35"; then \ -+ if test ! -z "$rcverv37"; then \ -+ echo -n "v37"; \ -+ elif test ! -z "$rcverv36"; then \ -+ echo -n "v36"; \ -+ elif test ! -z "$rcverv35"; then \ - echo -n "v35"; \ - elif test ! -z "$rcverv34"; then \ - echo -n "v34"; \ -@@ -175,6 +183,72 @@ if test "$rc" != ""; then - AC_DEFINE([HAVE_IBV_CMD_MODIFY_QP_EX],[1],[ibv_cmd_modify_qp_ex supported]) - RDMA_CORE_HEADERS=`echo -n __include_path__` - case "$(echo -n rcore_version)" in -+ v37) -+ AC_MSG_RESULT(yes using v37) -+ AC_DEFINE([IBV_WC_DRIVER3_IN_IBV_WC_OPCODE],[1], -+ [Rdma-Core Package has IBV_WC_DRIVER3 in ibv_wc_opcode enum]) -+ AC_DEFINE([IBV_WC_DRIVER2_IN_IBV_WC_OPCODE],[1], -+ [Rdma-Core Package has IBV_WC_DRIVER2 in ibv_wc_opcode enum]) -+ AC_DEFINE([IBV_QUERY_QP_DATA_IN_ORDER_IN_CONTEXT_OPS],[1], -+ [Rdma-Core Package has query_qp_data_in_order in verbs_context_ops]) -+ AC_DEFINE([VERBS_ONLY_QUERY_DEVICE_EX_DEFINED],[1], -+ [Rdma-Core Package has only query_device_ex]) -+ AC_DEFINE([IBV_CMD_MODIFY_QP_EX_HAS_7_ARG],[1], -+ [Rdma-Core Package ibv_cmd_modify_qp_ex has 7 arguments]) -+ AC_DEFINE([IBV_FREE_CONTEXT_IN_CONTEXT_OPS],[1], -+ [Rdma-Core Package has free context in ibv_context_ops]) -+ AC_DEFINE([REG_MR_VERB_HAS_5_ARG],[1], -+ [Rdma-Core Package reg_mr has 5 argument]) -+ AC_DEFINE([IBV_CMD_ALLOC_MW_HAS_1_ARG],[1], -+ [Rdma-Core Package ibv_cmd_alloc_mw has single argument]) -+ AC_DEFINE([PROVIDER_DRIVER_HAS_2_ARGS],[1], -+ [Rdma-Core Package PROVIDER_DRIVER macro has 2 arguments]) -+ AC_DEFINE([ALLOC_CONTEXT_HAS_PRIVATE_DATA],[1], -+ [Rdma-Core Package alloc_context has private data]) -+ AC_DEFINE([VERBS_MR_DEFINED],[1], -+ [Rdma-Core Package has verbs_mr defined]) -+ AC_DEFINE([VERBS_INIT_AND_ALLOC_CONTEXT_HAS_5_ARG],[1], -+ [Rdma-Core Package has 5 Arg for verbs_init_and_alloc_context macro]) -+ AC_DEFINE([RCP_HAS_PROVIDER_DRIVER],[1], -+ [Rdma-Core Package has PROVIDER_DRIVER macro]) -+ AC_DEFINE([RCP_USE_IB_UVERBS],[1], -+ [Rdma-Core Package uses IB user verbs API]) -+ AC_DEFINE([RCP_USE_ALLOC_CONTEXT],[1], -+ [Rdma-Core Package uses alloc_context instead of init_context]) -+ rc=`grep -o ibv_read_sysfs_file src/rc-compat/v37/driver.h|tail -1` -+ ;; -+ v36) -+ AC_MSG_RESULT(yes using v36) -+ AC_DEFINE([IBV_WC_DRIVER2_IN_IBV_WC_OPCODE],[1], -+ [Rdma-Core Package has IBV_WC_DRIVER2 in ibv_wc_opcode enum]) -+ AC_DEFINE([IBV_QUERY_QP_DATA_IN_ORDER_IN_CONTEXT_OPS],[1], -+ [Rdma-Core Package has query_qp_data_in_order in verbs_context_ops]) -+ AC_DEFINE([VERBS_ONLY_QUERY_DEVICE_EX_DEFINED],[1], -+ [Rdma-Core Package has only query_device_ex]) -+ AC_DEFINE([IBV_CMD_MODIFY_QP_EX_HAS_7_ARG],[1], -+ [Rdma-Core Package ibv_cmd_modify_qp_ex has 7 arguments]) -+ AC_DEFINE([IBV_FREE_CONTEXT_IN_CONTEXT_OPS],[1], -+ [Rdma-Core Package has free context in ibv_context_ops]) -+ AC_DEFINE([REG_MR_VERB_HAS_5_ARG],[1], -+ [Rdma-Core Package reg_mr has 5 argument]) -+ AC_DEFINE([IBV_CMD_ALLOC_MW_HAS_1_ARG],[1], -+ [Rdma-Core Package ibv_cmd_alloc_mw has single argument]) -+ AC_DEFINE([PROVIDER_DRIVER_HAS_2_ARGS],[1], -+ [Rdma-Core Package PROVIDER_DRIVER macro has 2 arguments]) -+ AC_DEFINE([ALLOC_CONTEXT_HAS_PRIVATE_DATA],[1], -+ [Rdma-Core Package alloc_context has private data]) -+ AC_DEFINE([VERBS_MR_DEFINED],[1], -+ [Rdma-Core Package has verbs_mr defined]) -+ AC_DEFINE([VERBS_INIT_AND_ALLOC_CONTEXT_HAS_5_ARG],[1], -+ [Rdma-Core Package has 5 Arg for verbs_init_and_alloc_context macro]) -+ AC_DEFINE([RCP_HAS_PROVIDER_DRIVER],[1], -+ [Rdma-Core Package has PROVIDER_DRIVER macro]) -+ AC_DEFINE([RCP_USE_IB_UVERBS],[1], -+ [Rdma-Core Package uses IB user verbs API]) -+ AC_DEFINE([RCP_USE_ALLOC_CONTEXT],[1], -+ [Rdma-Core Package uses alloc_context instead of init_context]) -+ rc=`grep -o ibv_read_sysfs_file src/rc-compat/v36/driver.h|tail -1` -+ ;; - v35) - AC_MSG_RESULT(yes using v35) - AC_DEFINE([VERBS_ONLY_QUERY_DEVICE_EX_DEFINED],[1], --- -2.29.2 - diff --git a/userspace/broadcom/libbnxt_re/centos/srpm_path b/userspace/broadcom/libbnxt_re/centos/srpm_path deleted file mode 100644 index 6228409d..00000000 --- a/userspace/broadcom/libbnxt_re/centos/srpm_path +++ /dev/null @@ -1 +0,0 @@ -repo:stx/downloads/libbnxt_re-220.0.5.0-rhel7u9.src.rpm diff --git a/userspace/mellanox/mlnx-tools/centos/build_srpm.data b/userspace/mellanox/mlnx-tools/centos/build_srpm.data deleted file mode 100644 index 42f44216..00000000 --- a/userspace/mellanox/mlnx-tools/centos/build_srpm.data +++ /dev/null @@ -1,6 +0,0 @@ -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=19ca0df55a7c905dc062008862b7b76b577a2354 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=19ca0df55a7c905dc062008862b7b76b577a2354 -PKG_BASE_SRCREV=19ca0df55a7c905dc062008862b7b76b577a2354 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/userspace/mellanox/mlnx-tools/centos/meta_patches/0001-Support-STX-system.patch b/userspace/mellanox/mlnx-tools/centos/meta_patches/0001-Support-STX-system.patch deleted file mode 100644 index 3669301e..00000000 --- a/userspace/mellanox/mlnx-tools/centos/meta_patches/0001-Support-STX-system.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 6c8e7bc564ccf4d2b4160f65b725a1550006ccd6 Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sat, 29 Jan 2022 01:04:14 -0800 -Subject: [PATCH] Support STX system - -Signed-off-by: Jiping Ma ---- - mlnx-tools.spec | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/SPECS/mlnx-tools.spec b/SPECS//mlnx-tools.spec -index 196721f..6535863 100644 ---- a/SPECS/mlnx-tools.spec -+++ b/SPECS/mlnx-tools.spec -@@ -25,11 +25,16 @@ - # and/or other materials provided with the distribution. - # - # -+%if "%{_tis_build_type}" == "rt" -+%define bt_ext -rt -+%else -+%undefine bt_ext -+%endif - - Summary: Mellanox userland tools and scripts - Name: mlnx-tools - Version: 5.2.0 --Release: 0%{?_dist}.55103 -+Release: 0.55103%{?_tis_dist}.%{tis_patch_ver} - License: GPLv2 - Url: https://github.com/Mellanox/mlnx-tools - Group: Applications/System --- -2.31.1 - diff --git a/userspace/mellanox/mlnx-tools/centos/meta_patches/PATCH_ORDER b/userspace/mellanox/mlnx-tools/centos/meta_patches/PATCH_ORDER deleted file mode 100644 index 66dcffa2..00000000 --- a/userspace/mellanox/mlnx-tools/centos/meta_patches/PATCH_ORDER +++ /dev/null @@ -1 +0,0 @@ -0001-Support-STX-system.patch diff --git a/userspace/mellanox/mlnx-tools/centos/srpm_path b/userspace/mellanox/mlnx-tools/centos/srpm_path deleted file mode 100644 index b5d7e13a..00000000 --- a/userspace/mellanox/mlnx-tools/centos/srpm_path +++ /dev/null @@ -1 +0,0 @@ -repo:stx/downloads/mlnx-tools-5.2.0-0.55103.src.rpm diff --git a/userspace/mellanox/mstflint/centos/build_srpm.data b/userspace/mellanox/mstflint/centos/build_srpm.data deleted file mode 100644 index 69abd61b..00000000 --- a/userspace/mellanox/mstflint/centos/build_srpm.data +++ /dev/null @@ -1 +0,0 @@ -TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/userspace/mellanox/mstflint/centos/meta_patches/0001-Support-STX-system.patch b/userspace/mellanox/mstflint/centos/meta_patches/0001-Support-STX-system.patch deleted file mode 100644 index 1092386c..00000000 --- a/userspace/mellanox/mstflint/centos/meta_patches/0001-Support-STX-system.patch +++ /dev/null @@ -1,36 +0,0 @@ -From fc5a6b7d5332b3ef8b81fbfb37c179fe7d0d6f1c Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sat, 29 Jan 2022 02:05:24 -0800 -Subject: [PATCH] Support STX system - -Signed-off-by: Jiping Ma ---- - mstflint.spec | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/SPECS/mstflint.spec b/SPECS/mstflint.spec -index bc7f89b..bcf69cf 100644 ---- a/SPECS/mstflint.spec -+++ b/SPECS/mstflint.spec -@@ -1,3 +1,9 @@ -+%if "%{_tis_build_type}" == "rt" -+%define bt_ext -rt -+%else -+%undefine bt_ext -+%endif -+ - %{!?ibmadlib: %define ibmadlib libibmad-devel} - %{!?name: %define name mstflint} - %{!?version: %define version 4.16.0} -@@ -20,7 +26,7 @@ - Summary: Mellanox firmware burning application - Name: %{name} - Version: 4.16.0 --Release: 1.55103 -+Release: 1.55103%{?_tis_dist}.%{tis_patch_ver} - License: GPL/BSD - Url: http://openfabrics.org - Group: System Environment/Base --- -2.31.1 - diff --git a/userspace/mellanox/mstflint/centos/meta_patches/PATCH_ORDER b/userspace/mellanox/mstflint/centos/meta_patches/PATCH_ORDER deleted file mode 100644 index 66dcffa2..00000000 --- a/userspace/mellanox/mstflint/centos/meta_patches/PATCH_ORDER +++ /dev/null @@ -1 +0,0 @@ -0001-Support-STX-system.patch diff --git a/userspace/mellanox/mstflint/centos/srpm_path b/userspace/mellanox/mstflint/centos/srpm_path deleted file mode 100644 index 1ab25ad0..00000000 --- a/userspace/mellanox/mstflint/centos/srpm_path +++ /dev/null @@ -1 +0,0 @@ -repo:stx/downloads/mstflint-4.16.0-1.55103.src.rpm diff --git a/userspace/mellanox/rdma-core/centos/build_srpm.data b/userspace/mellanox/rdma-core/centos/build_srpm.data deleted file mode 100644 index 42f44216..00000000 --- a/userspace/mellanox/rdma-core/centos/build_srpm.data +++ /dev/null @@ -1,6 +0,0 @@ -OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std -OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=19ca0df55a7c905dc062008862b7b76b577a2354 -BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=19ca0df55a7c905dc062008862b7b76b577a2354 -PKG_BASE_SRCREV=19ca0df55a7c905dc062008862b7b76b577a2354 -TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT diff --git a/userspace/mellanox/rdma-core/centos/meta_patches/0001-Support-STX-system.patch b/userspace/mellanox/rdma-core/centos/meta_patches/0001-Support-STX-system.patch deleted file mode 100644 index a48271b1..00000000 --- a/userspace/mellanox/rdma-core/centos/meta_patches/0001-Support-STX-system.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 3be2d62d2671002aaf14eae0a9759ee99f1d8eae Mon Sep 17 00:00:00 2001 -From: Jiping Ma -Date: Sat, 29 Jan 2022 01:49:48 -0800 -Subject: [PATCH] Support STX system - -Signed-off-by: Jiping Ma ---- - rdma-core.spec | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/SPECS/rdma-core.spec b/SPECS/rdma-core.spec -index 7f1a9ee..5b1e337 100644 ---- a/SPECS/rdma-core.spec -+++ b/SPECS/rdma-core.spec -@@ -1,3 +1,9 @@ -+%if "%{_tis_build_type}" == "rt" -+%define bt_ext -rt -+%else -+%undefine bt_ext -+%endif -+ - %{!?cmake: %global cmake cmake} - %{!?make_jobs: %global make_jobs make VERBOSE=1 %{?_smp_mflags}} - %{!?cmake_install: %global cmake_install DESTDIR=%{buildroot} make install} -@@ -27,7 +33,7 @@ - - Name: rdma-core - Version: 55mlnx37 --Release: 1%{?dist}.55103 -+Release: 1.55103%{?_tis_dist}.%{tis_patch_ver} - Summary: RDMA core userspace libraries and daemons - Group: System Environment/Libraries - -@@ -97,6 +103,7 @@ BuildRequires: python-docutils - BuildRequires: perl-generators - %endif - -+BuildRequires: cmake - # Red Hat/Fedora previously shipped redhat/ as a stand-alone - # package called 'rdma', which we're supplanting here. - Provides: rdma = %{version}-%{release} --- -2.31.1 - diff --git a/userspace/mellanox/rdma-core/centos/meta_patches/PATCH_ORDER b/userspace/mellanox/rdma-core/centos/meta_patches/PATCH_ORDER deleted file mode 100644 index 66dcffa2..00000000 --- a/userspace/mellanox/rdma-core/centos/meta_patches/PATCH_ORDER +++ /dev/null @@ -1 +0,0 @@ -0001-Support-STX-system.patch diff --git a/userspace/mellanox/rdma-core/centos/srpm_path b/userspace/mellanox/rdma-core/centos/srpm_path deleted file mode 100644 index ea9b8fa8..00000000 --- a/userspace/mellanox/rdma-core/centos/srpm_path +++ /dev/null @@ -1 +0,0 @@ -repo:stx/downloads/rdma-core-55mlnx37-1.55103.src.rpm