diff options
| author | Tzafrir Cohen <tzafrir@debian.org> | 2025-04-06 08:08:44 +0300 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2025-04-07 22:37:05 +0000 |
| commit | 50ff098ee9a25f02de54a9782776d57c897a1adb (patch) | |
| tree | 74b83bb6fcada0de2ac0348425b20c98a8e07630 | |
| parent | ec5a4b704ae5bd8f1e65fa1ef5ec135c089eaca5 (diff) | |
| parent | 21c18ccae9df231204ebbd9467b967fb291fed25 (diff) | |
4.31.0+1-3 (patches applied)applied/4.31.0+1-3
Imported using git-ubuntu import.
| -rw-r--r-- | debian/changelog | 11 | ||||
| -rw-r--r-- | debian/control | 19 | ||||
| -rw-r--r-- | debian/mstflint-dkms.dkms | 11 | ||||
| -rw-r--r-- | debian/mstflint-dkms.install | 1 | ||||
| -rw-r--r-- | debian/mstflint.install | 26 | ||||
| -rw-r--r-- | debian/patches/kernel_fallthrough.patch | 21 | ||||
| -rw-r--r-- | debian/patches/kernel_ioremap_check_null.patch | 30 | ||||
| -rw-r--r-- | debian/patches/kernel_statify.patch | 55 | ||||
| -rw-r--r-- | debian/patches/series | 5 | ||||
| -rwxr-xr-x | debian/rules | 8 | ||||
| -rw-r--r-- | kernel/mst_main.c | 17 |
11 files changed, 197 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog index 62d5ff6..de08aed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +mstflint (4.31.0+1-3) unstable; urgency=medium + + * Add dkms subpackage + * Add 3 fixes to the kernel code: + - kernel_fallthrough.patch + - kernel_ioremap_check_null.patch + - kernel_statify.patch + * rules: Keep kernel/Makefile, that is manually-generated + + -- Tzafrir Cohen <tzafrir@debian.org> Sun, 06 Apr 2025 08:08:44 +0300 + mstflint (4.31.0+1-2) unstable; urgency=medium * Remove unused override diff --git a/debian/control b/debian/control index 11034df..ebec412 100644 --- a/debian/control +++ b/debian/control @@ -5,6 +5,7 @@ Maintainer: Debian HPC Team <debian-hpc@lists.debian.org> Uploaders: Mehdi Dogguy <mehdi@debian.org>, Tzafrir Cohen <tzafrir@debian.org> Build-Depends: debhelper-compat (= 13), + dh-sequence-dkms, libboost-filesystem-dev, libboost-regex-dev, libboost-system-dev, @@ -37,3 +38,21 @@ Description: Mellanox firmware burning application and diagnostics tools HCA/NIC cards. Using it with cards manufactured by other vendors may be harmful to the cards (due to different configurations). Using the diagnostic tools is normally safe for all HCAs/NICs. + . + This package includes userspace tools. Kernel support is required. + Some of the functionality is supported through fwctl interface (for kernels + >= 6.15). Otherwise the kernel module mstflint_access is needed. + It is included e.g. through the package mstflint-dkms. + +Package: mstflint-dkms +Architecture: all +Section: kernel +Depends: ${misc:Depends}, +Enhances: mstlint +Description: kernel module for Nvidia (formly Mellanox) firmware buring tool + mstflint contains a burning tool and diagnostic tools for Nvidia (formly + Mellanox) manufactured host channel adapters (HCA) and network interface + cards (NIC). + . + This package contains the kernel module mstflint_access in a DKMS package + (source built at install time using the DKMS framework). diff --git a/debian/mstflint-dkms.dkms b/debian/mstflint-dkms.dkms new file mode 100644 index 0000000..94bb097 --- /dev/null +++ b/debian/mstflint-dkms.dkms @@ -0,0 +1,11 @@ +kernelver=${kernelver:-$(uname -r)} +kernel_source_dir=${kernel_source_dir:-/lib/modules/$kernelver/build} + +PACKAGE_NAME="mstflint" +PACKAGE_VERSION="#MODULES_VERSION#" +BUILT_MODULE_NAME[0]="mstflint_access" +BUILT_MODULE_LOCATION[0]="./" +DEST_MODULE_LOCATION[0]="/kernel/../misc/" +MAKE="make KPVER=$kernelver KSRC=$kernel_source_dir all" +CLEAN="make clean" +AUTOINSTALL="yes" diff --git a/debian/mstflint-dkms.install b/debian/mstflint-dkms.install new file mode 100644 index 0000000..657274b --- /dev/null +++ b/debian/mstflint-dkms.install @@ -0,0 +1 @@ +usr/src/mstflint-*/* diff --git a/debian/mstflint.install b/debian/mstflint.install new file mode 100644 index 0000000..f596209 --- /dev/null +++ b/debian/mstflint.install @@ -0,0 +1,26 @@ +usr/bin/mstconfig +usr/bin/mstcongestion +usr/bin/mstdevices_info +usr/bin/mstflint +usr/bin/mstfwctrl +usr/bin/mstfwreset +usr/bin/mstfwtrace +usr/bin/mstlink +usr/bin/mstmcra +usr/bin/mstmget_temp +usr/bin/mstmread +usr/bin/mstmtserver +usr/bin/mstmwrite +usr/bin/mstprivhost +usr/bin/mstreg +usr/bin/mstregdump +usr/bin/mstresourcedump +usr/bin/mstresourceparse +usr/bin/mstvpd +usr/include/mstflint/* +usr/lib/*/libmtcr_ul.a +usr/lib/*/mstflint/libmtcr_ul.a +usr/lib/*/mstflint/python_tools +usr/lib/*/mstflint/sdk/libresource_dump_sdk.so +usr/share/man/man1/* +usr/share/mstflint/* diff --git a/debian/patches/kernel_fallthrough.patch b/debian/patches/kernel_fallthrough.patch new file mode 100644 index 0000000..1640148 --- /dev/null +++ b/debian/patches/kernel_fallthrough.patch @@ -0,0 +1,21 @@ +From: Tzafrir Cohen <nvidia@cohens.org.il> +Subject: kernel: Explicit fallthrough + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index 06d6f89..fc4a4a0 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -212,10 +212,13 @@ enum { + switch (*address_space) { + case AS_ICMD_EXT: + *address_space = AS_PCI_ICMD; ++ fallthrough; + + case AS_ND_CRSPACE: ++ fallthrough; + case AS_CR_SPACE: + *address_space = AS_PCI_CRSPACE; ++ fallthrough; + + case AS_ICMD: + *address_space = AS_PCI_ALL_ICMD; diff --git a/debian/patches/kernel_ioremap_check_null.patch b/debian/patches/kernel_ioremap_check_null.patch new file mode 100644 index 0000000..77b33d3 --- /dev/null +++ b/debian/patches/kernel_ioremap_check_null.patch @@ -0,0 +1,30 @@ +From: Tzafrir Cohen <nvidia@cohens.org.il> +Subject: Test return of ioremap with non-NULL + +Don't consider the result of ioremap a pointer that can include an errno +(was that the rationale?). + +Avoids an error of considering a pointer as an int. + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index 06d6f89..d39a4e6 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -1502,7 +1502,7 @@ static int mst_ioctl(struct inode* inode, struct file* file, unsigned int opcode + + dev->hw_addr = ioremap(resource_start, MST_MEMORY_SIZE); + +- if (dev->hw_addr <= 0) { ++ if (!dev->hw_addr) { + mst_err("could not map device memory\n"); + res = -EFAULT; + goto fin; +@@ -1780,7 +1780,7 @@ static struct mst_dev_data* mst_device_create(enum dev_type type, struct pci_dev + dev->data_reg = 0; /* invalid */ + dev->bar = 0; + dev->hw_addr = ioremap(pci_resource_start(pdev, dev->bar), MST_MEMORY_SIZE); +- if (dev->hw_addr <= 0) { ++ if (!dev->hw_addr) { + mst_err("could not map device memory, BAR: %x\n", dev->bar); + goto out; + } diff --git a/debian/patches/kernel_statify.patch b/debian/patches/kernel_statify.patch new file mode 100644 index 0000000..21835ba --- /dev/null +++ b/debian/patches/kernel_statify.patch @@ -0,0 +1,55 @@ +From: Tzafrir Cohen <nvidia@cohens.org.il> +Subject: statify local functions + +Declare functions that are not exported as local. Otherwise we get an +error that they don't have a pre-declaration. + +diff --git a/kernel/mst_main.c b/kernel/mst_main.c +index 06d6f89..d39a4e6 100644 +--- a/kernel/mst_main.c ++++ b/kernel/mst_main.c +@@ -212,7 +212,7 @@ enum { + #define VSEC_FULLY_SUPPORTED(dev) \ + (((dev)->functional_vsc_offset) && ((dev)->spaces_support_status == SS_ALL_SPACES_SUPPORTED)) + +-void swap_pci_address_space(int* address_space) ++static void swap_pci_address_space(int* address_space) + { + switch (*address_space) { + case AS_ICMD_EXT: +@@ -263,7 +263,7 @@ void swap_pci_address_space(int* address_space) + } + + +-int get_syndrome_code(struct mst_dev_data* dev, u_int8_t* syndrome_code) ++static int get_syndrome_code(struct mst_dev_data* dev, u_int8_t* syndrome_code) + { + /* In case syndrome is set, if syndrome_code is 0x3 (address_out_of_range), return the syndrome_code, so that the */ + /* ioctl will fail and then we'll retry with PCI space. */ +@@ -618,7 +618,7 @@ static int read4_vsec(struct mst_dev_data* dev, int address_space, unsigned int + return 0; /* OPERATIONAL and LOGICAL success (PCI VSC address_spaces not supported) */ + } + +-int pciconf_read4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int* data) ++static int pciconf_read4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int* data) + { + int res = 0; + unsigned int new_offset = offset; +@@ -646,7 +646,7 @@ int pciconf_read4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned + return 0; + } + +-int pciconf_write4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int data) ++static int pciconf_write4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int data) + { + int res = 0; + +@@ -753,7 +753,7 @@ static int get_space_support_status(struct mst_dev_data* dev) + + #define WO_REG_ADDR_DATA 0xbadacce5 + #define DEVID_OFFSET 0xf0014 +-int is_wo_gw(struct pci_dev* pcidev, unsigned int addr_reg) ++static int is_wo_gw(struct pci_dev* pcidev, unsigned int addr_reg) + { + int ret; + unsigned int data = 0; diff --git a/debian/patches/series b/debian/patches/series index 585728d..0201551 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -11,3 +11,8 @@ revert_runtime_test.patch fwctrl-include-missing-function-declarations.patch fwctrl-fix-reg-status-typo.patch dev_mgt-include-missing-function-declaration.patch + +# Kernel fixes: +kernel_fallthrough.patch +kernel_ioremap_check_null.patch +kernel_statify.patch diff --git a/debian/rules b/debian/rules index 9ae83f5..6000490 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,8 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk +export DEB_VERSION_UPSTREAM + export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: @@ -20,6 +23,7 @@ override_dh_clean: find . -name .libs | xargs -r rm -rf # Skip ext_libs/ @for Makefile in `find . -name Makefile`; do \ + if [ $$Makefile = ./kernel/Makefile ]; then continue; fi; \ if [ ! -e $$Makefile.in ]; then \ rm -fv $$Makefile; \ fi; \ @@ -45,3 +49,7 @@ override_dh_auto_install: # Unused unless fw-mgr is enabled: rm -rf debian/mstflint/usr/share/man/man1/mstarchive.1* \ debian/mstflint/usr/share/man/man1/mstfwmanager.1* + make -C kernel DESTDIR=$(CURDIR)/debian/tmp install-dkms DKMS_SRC_DIR=/usr/src/mstflint-$(DEB_VERSION_UPSTREAM) + +override_dh_dkms: + dh_dkms -V $(DEB_VERSION_UPSTREAM) diff --git a/kernel/mst_main.c b/kernel/mst_main.c index 06d6f89..fc4a4a0 100644 --- a/kernel/mst_main.c +++ b/kernel/mst_main.c @@ -212,15 +212,18 @@ enum { #define VSEC_FULLY_SUPPORTED(dev) \ (((dev)->functional_vsc_offset) && ((dev)->spaces_support_status == SS_ALL_SPACES_SUPPORTED)) -void swap_pci_address_space(int* address_space) +static void swap_pci_address_space(int* address_space) { switch (*address_space) { case AS_ICMD_EXT: *address_space = AS_PCI_ICMD; + fallthrough; case AS_ND_CRSPACE: + fallthrough; case AS_CR_SPACE: *address_space = AS_PCI_CRSPACE; + fallthrough; case AS_ICMD: *address_space = AS_PCI_ALL_ICMD; @@ -263,7 +266,7 @@ void swap_pci_address_space(int* address_space) } -int get_syndrome_code(struct mst_dev_data* dev, u_int8_t* syndrome_code) +static int get_syndrome_code(struct mst_dev_data* dev, u_int8_t* syndrome_code) { /* In case syndrome is set, if syndrome_code is 0x3 (address_out_of_range), return the syndrome_code, so that the */ /* ioctl will fail and then we'll retry with PCI space. */ @@ -618,7 +621,7 @@ static int read4_vsec(struct mst_dev_data* dev, int address_space, unsigned int return 0; /* OPERATIONAL and LOGICAL success (PCI VSC address_spaces not supported) */ } -int pciconf_read4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int* data) +static int pciconf_read4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int* data) { int res = 0; unsigned int new_offset = offset; @@ -646,7 +649,7 @@ int pciconf_read4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned return 0; } -int pciconf_write4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int data) +static int pciconf_write4_legacy(struct mst_dev_data* dev, unsigned int offset, unsigned int data) { int res = 0; @@ -753,7 +756,7 @@ static int get_space_support_status(struct mst_dev_data* dev) #define WO_REG_ADDR_DATA 0xbadacce5 #define DEVID_OFFSET 0xf0014 -int is_wo_gw(struct pci_dev* pcidev, unsigned int addr_reg) +static int is_wo_gw(struct pci_dev* pcidev, unsigned int addr_reg) { int ret; unsigned int data = 0; @@ -1502,7 +1505,7 @@ static int mst_ioctl(struct inode* inode, struct file* file, unsigned int opcode dev->hw_addr = ioremap(resource_start, MST_MEMORY_SIZE); - if (dev->hw_addr <= 0) { + if (!dev->hw_addr) { mst_err("could not map device memory\n"); res = -EFAULT; goto fin; @@ -1780,7 +1783,7 @@ static struct mst_dev_data* mst_device_create(enum dev_type type, struct pci_dev dev->data_reg = 0; /* invalid */ dev->bar = 0; dev->hw_addr = ioremap(pci_resource_start(pdev, dev->bar), MST_MEMORY_SIZE); - if (dev->hw_addr <= 0) { + if (!dev->hw_addr) { mst_err("could not map device memory, BAR: %x\n", dev->bar); goto out; } |
