blackmagic-io module doesn't compile on kernel 5.13

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

goldyfruit

  • Posts: 20
  • Joined: Mon Apr 26, 2021 6:47 pm
  • Real Name: Gaëtan Trellu

blackmagic-io module doesn't compile on kernel 5.13

PostThu Jul 22, 2021 12:24 pm

Hi,

I got a kernel update on my desktop, and during the DKMS process, the "blackmagic-io" module didn't compile on kernel 5.13 (which is pretty new I know). I got all the kernel headers, etc...

On kernel 5.12.19 everything works fine.

Here is the trace:
Code: Select all
DKMS make.log for blackmagic-io-12.1a9 for kernel 5.13.4-xanmod1 (x86_64)
Thu Jul 22 08:18:32 AM EDT 2021
touch .blackmagic.o.cmd
make -C /lib/modules/5.13.4-xanmod1/build M=/var/lib/dkms/blackmagic-io/12.1a9/build
make[1]: Entering directory '/usr/src/linux-headers-5.13.4-xanmod1'
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_client.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_dev.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_device.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_driver.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_export.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_pci_ids.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_locks.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_mm.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_pci.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_util.o
  SHIPPED /var/lib/dkms/blackmagic-io/12.1a9/build/blackmagic.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_audio.o
/var/lib/dkms/blackmagic-io/12.1a9/build/bm_mm.c: In function ‘bm_dma_get_physical_segment’:
/var/lib/dkms/blackmagic-io/12.1a9/build/bm_mm.c:331:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  331 |  addr64_t startAddr = dlist->addrs[page_n] + page_offset;
      |  ^~~~~~~~
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c: In function ‘bmio_serial_remove’:
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c:267:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  267 |  struct tty_struct *tty = tty_port_tty_get(&serial->port);
      |  ^~~~~~
  LD [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/snd_blackmagic-io.o
  LD [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/blackmagic-io.o
  MODPOST /var/lib/dkms/blackmagic-io/12.1a9/build/Module.symvers
ERROR: modpost: "X86_FEATURE_LA57" [/var/lib/dkms/blackmagic-io/12.1a9/build/blackmagic-io.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:150: /var/lib/dkms/blackmagic-io/12.1a9/build/Module.symvers] Error 1
make[2]: *** Deleting file '/var/lib/dkms/blackmagic-io/12.1a9/build/Module.symvers'
make[1]: *** [Makefile:1768: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.13.4-xanmod1'
make: *** [Makefile:47: all] Error 2

Cheers,

Gaëtan
Offline

pwrzec

  • Posts: 3
  • Joined: Wed Aug 12, 2020 3:03 pm
  • Real Name: Piotr Wrzeciono

Re: blackmagic-io module doesn't compile on kernel 5.13

PostWed Jul 28, 2021 7:15 am

I have the same problem with kernel 5.13.2 and 5.13.4. I'm using openSUSE Thumbleed. The driver (12.1a9) compilation works fine in kernel below 5.13, e.g., 5.12.
I'm not particularly good at writing kernel modules, but I found something.
The constant "X86_FEATURE_LA57" is defined in <asm/cpufeatures.h>. You can find it here too: https://elixir.bootlin.com/linux/v5.13. ... res.h#L360
X86_FEATURE_LA57 is only present in object files: bm_util.o and blackmagic-io.o. There is nowhere in the source code.

I think that "postmode error: undefined" is in some way connected to the linking problem.
Is maybe someone who can help to solve this problem?

Cheers,
Piotr Wrzeciono
openSUSE Tumbleweed, Ryzen 7 3700, Intensity Pro 4K, OBS Studio, Moodle, BigBlueButton, Ardour, Kdenlive
Offline

goldyfruit

  • Posts: 20
  • Joined: Mon Apr 26, 2021 6:47 pm
  • Real Name: Gaëtan Trellu

Re: blackmagic-io module doesn't compile on kernel 5.13

PostTue Aug 03, 2021 10:53 pm

pwrzec wrote:I have the same problem with kernel 5.13.2 and 5.13.4. I'm using openSUSE Thumbleed. The driver (12.1a9) compilation works fine in kernel below 5.13, e.g., 5.12.
I'm not particularly good at writing kernel modules, but I found something.
The constant "X86_FEATURE_LA57" is defined in <asm/cpufeatures.h>. You can find it here too: https://elixir.bootlin.com/linux/v5.13. ... res.h#L360
X86_FEATURE_LA57 is only present in object files: bm_util.o and blackmagic-io.o. There is nowhere in the source code.

I think that "postmode error: undefined" is in some way connected to the linking problem.
Is maybe someone who can help to solve this problem?

Cheers,
Piotr Wrzeciono

We will have to wait until a new version of Desktop Video will be released. For now I just rolled back to 5.12.
Offline

dpinson

  • Posts: 2
  • Joined: Thu May 14, 2020 4:55 pm
  • Real Name: David Pinson

Re: blackmagic-io module doesn't compile on kernel 5.13

PostTue Aug 24, 2021 1:19 pm

This has to do with 5-level paging. There is/was a kernel compilation selection (CONFIG_X86_5LEVEL) that has to be selected to get X86_FEATURE_LA57 to show up. Hopefully, this information will help to get the changes needed quickly. Need this now!
Offline

goldyfruit

  • Posts: 20
  • Joined: Mon Apr 26, 2021 6:47 pm
  • Real Name: Gaëtan Trellu

Re: blackmagic-io module doesn't compile on kernel 5.13

PostMon Sep 06, 2021 5:12 pm

dpinson wrote:This has to do with 5-level paging. There is/was a kernel compilation selection (CONFIG_X86_5LEVEL) that has to be selected to get X86_FEATURE_LA57 to show up. Hopefully, this information will help to get the changes needed quickly. Need this now!

Hope it will help.
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 361
  • Joined: Mon Sep 04, 2017 4:05 am

Re: blackmagic-io module doesn't compile on kernel 5.13

PostFri Sep 10, 2021 5:46 am

Hi Gaëtan,

To build blackmagic-io 12.1 module against kernel 5.13, please download the attached patch file

To apply the patch:
Code: Select all
cd /usr/src/blackmagic-io-12.1a9
sudo patch < ~/Downloads/bm_util.c_5.13.4-200.fc34.x86_64.patch
sudo dkms install -m blackmagic-io -v 12.1a9

This fix will be in a future Desktop Video release. I hope this helps.

Regards
Cameron
Attachments
bm_util.c_5.13.4-200.fc34.x86_64.patch.zip
(1.19 KiB) Downloaded 38 times
Offline

pwrzec

  • Posts: 3
  • Joined: Wed Aug 12, 2020 3:03 pm
  • Real Name: Piotr Wrzeciono

Re: blackmagic-io module doesn't compile on kernel 5.13

PostFri Sep 10, 2021 6:22 pm

The patch works fine in kernel 5.13. But the pointer's errors occurred in kernel 5.14, both in "blackmagic" and "blackmagic-io" modules.

blackmagic kernel module:
Code: Select all
DKMS make.log for blackmagic-12.1a9 for kernel 5.14.0-1-default (x86_64)
pią, 10 wrz 2021, 20:10:40 CEST
touch .bmd-support.o.cmd
make -C /lib/modules/5.14.0-1-default/build M=/var/lib/dkms/blackmagic/12.1a9/build
make[1]: Wejście do katalogu '/usr/src/linux-5.14.0-1-obj/x86_64/default'
  CC [M]  /var/lib/dkms/blackmagic/12.1a9/build/blackmagic_serial.o
  CC [M]  /var/lib/dkms/blackmagic/12.1a9/build/blackmagic_lib.o
  CC [M]  /var/lib/dkms/blackmagic/12.1a9/build/blackmagic_core.o
  CC [M]  /var/lib/dkms/blackmagic/12.1a9/build/blackmagic_dma.o
  SHIPPED /var/lib/dkms/blackmagic/12.1a9/build/bmd-support.o
  CC [M]  /var/lib/dkms/blackmagic/12.1a9/build/blackmagic_gate.o
/var/lib/dkms/blackmagic/12.1a9/build/blackmagic_serial.c:520:23: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  520 |         .write_room = blackmagic_serial_write_room,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/blackmagic/12.1a9/build/blackmagic_serial.c:520:23: note: (near initialization for ‘blackmagic_tty_ops.write_room’)
/var/lib/dkms/blackmagic/12.1a9/build/blackmagic_serial.c:521:28: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  521 |         .chars_in_buffer = blackmagic_serial_chars_in_buffer,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/blackmagic/12.1a9/build/blackmagic_serial.c:521:28: note: (near initialization for ‘blackmagic_tty_ops.chars_in_buffer’)
cc1: some warnings being treated as errors
make[3]: *** [/usr/src/linux-5.14.0-1/scripts/Makefile.build:272: /var/lib/dkms/blackmagic/12.1a9/build/blackmagic_serial.o] Błąd 1
make[3]: *** Oczekiwanie na niezakończone zadania....
make[2]: *** [/usr/src/linux-5.14.0-1/Makefile:1865: /var/lib/dkms/blackmagic/12.1a9/build] Błąd 2
make[1]: *** [../../../linux-5.14.0-1/Makefile:220: __sub-make] Błąd 2
make[1]: Opuszczenie katalogu '/usr/src/linux-5.14.0-1-obj/x86_64/default'
make: *** [Makefile:44: all] Błąd 2



blackmagic-io kernel module:
Code: Select all
DKMS make.log for blackmagic-io-12.1a9 for kernel 5.14.0-1-default (x86_64)
pią, 10 wrz 2021, 20:17:43 CEST
touch .blackmagic.o.cmd
make -C /lib/modules/5.14.0-1-default/build M=/var/lib/dkms/blackmagic-io/12.1a9/build
make[1]: Wejście do katalogu '/usr/src/linux-5.14.0-1-obj/x86_64/default'
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_client.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_dev.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_device.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_driver.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_export.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_pci_ids.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_locks.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_mm.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_pci.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bm_util.o
  SHIPPED /var/lib/dkms/blackmagic-io/12.1a9/build/blackmagic.o
  CC [M]  /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_audio.o
/var/lib/dkms/blackmagic-io/12.1a9/build/bm_mm.c: In function ‘bm_dma_get_physical_segment’:
/var/lib/dkms/blackmagic-io/12.1a9/build/bm_mm.c:331:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  331 |         addr64_t startAddr = dlist->addrs[page_n] + page_offset;
      |         ^~~~~~~~
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c:173:23: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  173 |         .write_room = serial_write_room,
      |                       ^~~~~~~~~~~~~~~~~
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c:173:23: note: (near initialization for ‘serial_ops.write_room’)
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c:174:28: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  174 |         .chars_in_buffer = serial_chars_in_buffer,
      |                            ^~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c:174:28: note: (near initialization for ‘serial_ops.chars_in_buffer’)
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c: In function ‘bmio_serial_remove’:
/var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.c:267:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  267 |         struct tty_struct *tty = tty_port_tty_get(&serial->port);
      |         ^~~~~~
cc1: some warnings being treated as errors
make[3]: *** [/usr/src/linux-5.14.0-1/scripts/Makefile.build:272: /var/lib/dkms/blackmagic-io/12.1a9/build/bmio_serial.o] Błąd 1
make[3]: *** Oczekiwanie na niezakończone zadania....
make[2]: *** [/usr/src/linux-5.14.0-1/Makefile:1865: /var/lib/dkms/blackmagic-io/12.1a9/build] Błąd 2
make[1]: *** [../../../linux-5.14.0-1/Makefile:220: __sub-make] Błąd 2
make[1]: Opuszczenie katalogu '/usr/src/linux-5.14.0-1-obj/x86_64/default'
make: *** [Makefile:47: all] Błąd 2



I hope those errors can be removed soon.

Piotr Wrzeciono
openSUSE Tumbleweed, Ryzen 7 3700, Intensity Pro 4K, OBS Studio, Moodle, BigBlueButton, Ardour, Kdenlive
Offline

goldyfruit

  • Posts: 20
  • Joined: Mon Apr 26, 2021 6:47 pm
  • Real Name: Gaëtan Trellu

Re: blackmagic-io module doesn't compile on kernel 5.13

PostFri Sep 10, 2021 6:57 pm

Cameron Nichols wrote:Hi Gaëtan,

To build blackmagic-io 12.1 module against kernel 5.13, please download the attached patch file

To apply the patch:
Code: Select all
cd /usr/src/blackmagic-io-12.1a9
sudo patch < ~/Downloads/bm_util.c_5.13.4-200.fc34.x86_64.patch
sudo dkms install -m blackmagic-io -v 12.1a9

This fix will be in a future Desktop Video release. I hope this helps.

Regards
Cameron

Thanks, the patched worked like a charm, I just had to uninstall the module before

Code: Select all
╰─λ uname -r
5.13.15-xanmod1
╰─λ lsmod | grep blackm
blackmagic_io        1916928  2
Offline

NVieville

  • Posts: 3
  • Joined: Tue Mar 12, 2019 9:29 am
  • Real Name: Nicolas Viéville

Re: blackmagic-io module doesn't compile on kernel 5.13

PostThu Sep 16, 2021 12:22 pm

Hello,

Maybe the patch provided will be helpful in order to build blackmagic-io 12.1 module against kernel 5.13.x (at least on Fedora 34 here) without issues and warnings.

Cordially,

--
NVieville
Attachments
blackmagic-io-12.1a9-001-fix_5.13.14_build.zip
(973 Bytes) Downloaded 3 times
Offline

goldyfruit

  • Posts: 20
  • Joined: Mon Apr 26, 2021 6:47 pm
  • Real Name: Gaëtan Trellu

Re: blackmagic-io module doesn't compile on kernel 5.13

PostFri Sep 17, 2021 3:43 pm

NVieville wrote:Hello,

Maybe the patch provided will be helpful in order to build blackmagic-io 12.1 module against kernel 5.13.x (at least on Fedora 34 here) without issues and warnings.

Cordially,

--
NVieville

A patch has been already provided by Blackmagic: viewtopic.php?f=12&t=144876#p788448
This is the patch content:
Code: Select all
--- bm_util.old.c   2021-05-17 15:44:36.000000000 +1000
+++ bm_util.c   2021-07-26 14:46:37.088542000 +1000
@@ -24,7 +24,6 @@
 ** DEALINGS IN THE SOFTWARE.
 ** -LICENSE-END-
 */
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/hash.h>
 #include <linux/interrupt.h>
@@ -41,6 +40,7 @@
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
 #include <linux/wait.h>
+#include <asm/io.h>
 #include "bm_version.h"
 #if KERNEL_VERSION_OR_LATER(2, 6, 20)
    #include <linux/freezer.h>

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 1 guest