Microsemi / switchtec-kernel

A kernel module for the Microsemi PCIe switch
GNU General Public License v2.0
45 stars 31 forks source link

Compilation Error on later kernels and RHEL 8.3 #98

Open NateThornton opened 3 years ago

NateThornton commented 3 years ago

Looks like commit 6736a6ffcc576a761f73f9498c4602ffab4f33a2 introduced AER code which is incompatible with kernel versions beyond 5.7.0 as a name change from pci_cleanup_aer_uncorrect_error_status() to pci_aer_clear_nonfatal_status() at https://github.com/torvalds/linux/commit/894020fdd88c1e9a74c60b67c0f19f1c7696ba2f

Build fails with

[root switchtec-kernel]# make

make -C /lib/modules/4.18.0-240.10.1.el8_3.x86_64/build M=$PWD modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-240.10.1.el8_3.x86_64'
  CC [M]  /usr/src/switchtec-kernel/switchtec.o
/usr/src/switchtec-kernel/switchtec.c: In function ‘switchtec_pci_error_resume’:
/usr/src/switchtec-kernel/switchtec.c:1790:2: error: implicit declaration of function ‘pci_cleanup_aer_uncorrect_error_status’ [-Werror=implicit-function-declaration]
  pci_cleanup_aer_uncorrect_error_status(pdev);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This also affects RHEL 8.3, which accepted that patch

I would propose the following patch

#if KERNEL_VERSION(5,7,0) <= LINUX_VERSION_CODE || \
      defined(RHEL_MAJOR) && RHEL_RELEASE_VERSION(8,3) <= RHEL_RELEASE_CODE
    pci_aer_clear_nonfatal_status(pdev);
#else
    pci_cleanup_aer_uncorrect_error_status(pdev);
#endif
kelvin-cao commented 3 years ago

Thanks for reporting this! As of now branch main/devel are working on 5.4/5.6 kernels. Will move them to support later kernels (with kernel API update) and create back port branch for 5.6.

jborz27 commented 3 years ago

There's a need to fix this for RedHat/CentOS 8.3. Kernel 4.18.0-240.15.1 which is included in RedHat also uses the new API.