athp icon indicating copy to clipboard operation
athp copied to clipboard

"MA_NOTOWNED undefined" and cannot find files after kernel compilation

Open Emrion opened this issue 5 years ago • 63 comments

I think they are obvious problems but... I can't make it to work.

The script build_modules seems to need a 13 kernel version not a 12 (it complains about undefined symbols: MA_NOTOWNED and MA_OWNED)... Is it possible to use it with a 12 version?

With a 13 kernel, I follow the instructions (no errors): running ./build_modules, building the kernel and installing it... But I can't find any file .ko or .bin in athp/otus/freebsd/src/sys/modules/athpfw/.

What I did wrong?

Emrion avatar Mar 20 '19 20:03 Emrion

I found where lie the compiled files (and it was actually obvious). Nevertheless, I still get stuck on trying to compile this code on a 12 kernel version.

Emrion avatar Mar 22 '19 19:03 Emrion

Sorry we havn't gotten back to you, I will review your issue later today and see what I can come up with.

Geramy avatar Mar 22 '19 20:03 Geramy

For your information, on a 13-CURRENT, I get a kernel page fault when I load if_athp. It also complains that it cannot load some firmwares; it's very close to what bradleythughes got. I tried master, NEW_ATHP_ARVIF_LOCK (same as master?) and tx_power_change branches. Same results each time.

I have a QCA6174, so I copy only the .ko and .bin from the corresponding folders. Is this ok so? I saw that it tried to load the 3.0 firmwares.

pciconf -lv: none3@pci0:1:0:0: class=0x028000 card=0x86cd1043 chip=0x003e168c rev=0x32 hdr=0x00 vendor = 'Qualcomm Atheros' device = 'QCA6174 802.11ac Wireless Network Adapter' class = network

Emrion avatar Mar 27 '19 21:03 Emrion

Is this a Surface Go? I can solve these issues, you need a specific board.bin, board-2.bin and firmware-6.bin.

Geramy avatar Mar 30 '19 02:03 Geramy

Try these files: https://drive.google.com/file/d/107PePJLBYtp8AhbbDAKTpDERePvMO5x5/view?usp=sharing Also remove the hw2.0 folder.

Geramy avatar Mar 30 '19 02:03 Geramy

Is this a Surface Go? I can solve these issues, you need a specific board.bin, board-2.bin and firmware-6.bin.

No. It's a PC based on Asus H170I-PRO / i3 7100T. My goal is to make use the QCA6174 device by pfSense (build on a 12 FreeBSD version) as host access point. But to be clear, up to now, I only tried to compile athp under pure FreeBSD.

There is only one file in your link (board.bin), shall I place it in /boot/module? Do I have to rename it?

Reading the error generated when it loads if_athp under 13-CURRENT, I see:

  • Try loading athp_cal-pci-athp0.bin but this file doesn't exist.
  • Loads athp_QCA6174_hw3.0_board.bin (no complain).
  • Try to load athp_QCA6174_hw3.0_firmare-5.bin but this file doesn't exist.
  • Try loading athp_QCA6174_hw3.0/athp_QCA6174_hw3.0_firmare-5.bin. This file doen't exist.
  • Loads athp_QCA6174_hw3.0_firmare-4.bin (no complain).

Then, it crashes soon after with a page fault.

But I would like to compile athp under a 12-RELEASE. This is my main concern at the moment.

Emrion avatar Mar 30 '19 12:03 Emrion

Can you get me a full log please.

Geramy avatar Mar 30 '19 16:03 Geramy

Did you replace the board file in the athp_QCA6174_hw3.0_board folder when you compiled, or after you compiled? You need to replace the file before you compile so that it compiles the .ko for that board file.

Geramy avatar Mar 30 '19 16:03 Geramy

So, I wiped out all my precedent trials to be sure to take the master branch. I copied the file you provided board.bin in athp/otus/freebsd/src/sys/modules/athpfw/athp_QCA6174_hw3.0_board. Then, I compiled athp. After that, I copied in /boot/modules and /boot/kernel the *.ko and *.bin files from athp/otus/freebsd/src/sys/modules/athpfw/athp_QCA6174_hw3.0_board and athp/otus/freebsd/src/sys/modules/athpfw/athp_QCA6174_hw3.0_firmware-4. Finally, I typed: kldload if_athp. The kernel crashes as well but the error isn't the same as before. Now, it's a general protection fault. I can't take all the output in a single picture (sorry for the poor quality, can't do better with my phone). Tell me if something important is missing.

20190331_200509

Emrion avatar Mar 31 '19 18:03 Emrion

hm, looks like it's crashing inside rx_ring_fill_n; i wonder why. can you get a kernel coredump and use gdb on it to figure out the line number?

kgdb /boot/kernel/kernel /var/crash/core.X

then when it loads, do "bt"

-a

erikarn avatar Mar 31 '19 18:03 erikarn

That stuff below is more important if you can get me an image of the rx ring calls at the bottom I would like that.

Geramy avatar Mar 31 '19 18:03 Geramy

I reloaded if_athp but the error changed and returned to "page fault". I have no file in /var/crash (I set dumpdev="AUTO" in rc.conf) except minfree. I attach two pictures, hoping they will have the informations you need.

20190331_204927 20190331_205021

Emrion avatar Mar 31 '19 19:03 Emrion

Do me a favour, Try my branch out. https://github.com/Geramy/athp/tree/NEW_ATHP_ARVIF_LOCK it looks like wmi is using the conf lock. I have removed the conf lock from wmi it will be in master once we confirm it's working 100% I tested it last night and it was working. Let me know if this fixes the issue.

Geramy avatar Mar 31 '19 19:03 Geramy

I already tried this branch. But this time, I used your board.bin. Here is what I get:

20190331_204927 20190331_220358

Emrion avatar Mar 31 '19 20:03 Emrion

As of last night I did new commits, as of when did you try this branch, and have you tried the parent master branch, please make sure your on the latest revision.

Geramy avatar Mar 31 '19 20:03 Geramy

I cloned your code just before with: git clone --branch NEW_ATHP_ARVIF_LOCK https://github.com/Geramy/athp

Should I try without adding board.bin?

Emrion avatar Mar 31 '19 20:03 Emrion

You could give that a shot but I have a feeling that the card isnt finishing one of the startup procedures and we either arnt sleeping on something we need to or something like that. This is a lock issue. I'll have to purchase that card to verify. Can you provide me the cards model and manufacturer? When I get home in 20 minutes I'll try to patch my branch with a fix also I might be able to find it in a few trys with what you sent me.

Geramy avatar Mar 31 '19 21:03 Geramy

I tried NEW_ATHP_ARVIF_LOCK without adding build.bin but it crashed with the same error as above. The wifi module is embedded in the motherboard (Asus H170I-PRO). I believe it is this hardware: https://www.qualcomm.com/products/qca6174a-dual-band-wi-fi

Many thanks for all you do to get it works.

Emrion avatar Apr 01 '19 17:04 Emrion

Hey were you able to compile this for freebsd 12? I was able to get it to compile with some changes. But there are no iw tools for pfsense.

Geramy avatar Apr 04 '19 04:04 Geramy

Alas, no. Always these symbols undefined (they should for they come from sys/mutex.h, IIRC). Do you have a branch compilable under freebsd 12? If not, can you tell me the changes you made? I would like to test it just to be sure that the crash doesn't come from an instable feature in freebsd CURRENT.

Also, I tried to enable the bluetooth module (I disabled it at the base), but no dice again under freebsd 13.

I don't know precisely concerning iw tools but one can set a host AP with pfSense (I thought it used iw). I just lack a suitable interface up to now. :-)

Emrion avatar Apr 04 '19 11:04 Emrion

I'm doing something that can interrest you: a debian 9.8 install. It have the driver but it doesn't work because some firmware files are missing. Could it be just that?

Seems, concerning debian, I have to install a package that provide them: firmware-atheros.

debian

Emrion avatar Apr 04 '19 19:04 Emrion

I have submitted the changes to get it to compile for freebsd 12.0 https://github.com/Geramy/athp/tree/NEW_ATHP_ARVIF_LOCK

Geramy avatar Apr 05 '19 01:04 Geramy

@Emrion have you compiled pfsense before? if_athp also requires alq.so module just so you know. I am working on compiling pfsense from source i'm not sure how exactly but i'll get through it.

Geramy avatar Apr 05 '19 03:04 Geramy

Concerning FreeBSD 12: the good new is it compiles now like a charm; the bad one is I get the same crash when I load if_athp. Anyway, it generated a core file and here is the result of kgdb / bt:

#0  __curthread () at ./machine/pcpu.h:230
#1  doadump (textdump=<optimized out>) at /usr/src/sys/kern/kern_shutdown.c:366
#2  0xffffffff80b9b14b in kern_reboot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:446
#3  0xffffffff80b9b5c3 in vpanic (fmt=<optimized out>, ap=0xfffffe004e8ea310) at /usr/src/sys/kern/kern_shutdown.c:872
#4  0xffffffff80b9b3b3 in panic (fmt=<unavailable>) at /usr/src/sys/kern/kern_shutdown.c:799
#5  0xffffffff8107496f in trap_fatal (frame=0xfffffe004e8ea500, eva=0) at /usr/src/sys/amd64/amd64/trap.c:929
#6  0xffffffff810749c9 in trap_pfault (frame=0xfffffe004e8ea500, usermode=0) at /usr/src/sys/amd64/amd64/trap.c:765
#7  0xffffffff81073fee in trap (frame=0xfffffe004e8ea500) at /usr/src/sys/amd64/amd64/trap.c:441
#8  <signal handler called>
#9  0xffffffff83376189 in __ath10k_htt_rx_ring_fill_n () from /boot/kernel/if_athp.ko
#10 0xffffffff8337373b in ath10k_htt_rx_ring_fill_n () from /boot/kernel/if_athp.ko
#11 0xffffffff833736c5 in ath10k_htt_rx_ring_refill () from /boot/kernel/if_athp.ko
#12 0xffffffff8333e16c in ath10k_core_start () from /boot/kernel/if_athp.ko
#13 0xffffffff8333f837 in ath10k_core_probe_fw () from /boot/kernel/if_athp.ko
#14 0xffffffff83342c88 in attempt_ath10k_core_probe_fw () from /boot/kernel/if_athp.ko
#15 0xffffffff83340c97 in ath10k_core_register_work () from /boot/kernel/if_athp.ko
#16 0xffffffff80bf9cb4 in taskqueue_run_locked (queue=0xfffff800049bc700) at /usr/src/sys/kern/subr_taskqueue.c:465
#17 0xffffffff80bfae18 in taskqueue_thread_loop (arg=<optimized out>) at /usr/src/sys/kern/subr_taskqueue.c:757
#18 0xffffffff80b5bf33 in fork_exit (callout=0xffffffff80bfad80 <taskqueue_thread_loop>, arg=0xfffffe00003b40f0, 
    frame=0xfffffe004e8ea9c0) at /usr/src/sys/kern/kern_fork.c:1057

I don't know if it'll be of some use.

About pfSense: I never compiled it. I think it isn't easy. However, my first trial would be to load the driver compiled under pure FreeBSD 12 into pfSense (the development version which is based on a 12 FreeBSD).

Emrion avatar Apr 05 '19 19:04 Emrion

It's the same issue I'll have to think about this more.

Geramy avatar Apr 06 '19 23:04 Geramy

I think the firmware probe is still failing, I did a checkup on the failure and it looks like it could be because the firmware fails to load. Maybe try another board, can you get the firmware files from the original driver or operating system?

Geramy avatar Apr 10 '19 03:04 Geramy

Try one of these qca6174 bin files one is a board-1 the smaller one and one is board-2 the bigger file. https://drive.google.com/folderview?id=1jSiXYUCR6TtTdveW4dD7NzF1rwh4jdEo

Geramy avatar Apr 10 '19 04:04 Geramy

Thanks but I can't dl them. It asks me a google account... Can you make them public? Where should I place the file I'm testing? I have to recompile athp?

PS: I somewhat solved my problem by a bhyve VM with debian as guest. It receives the device QCA6174 as passthru and connects it on virtual bridges. But I would prefer a driver that can work under pfSense (upcoming version based on 12.0 FreeBSD).

Emrion avatar Apr 10 '19 19:04 Emrion

https://drive.google.com/open?id=1jSiXYUCR6TtTdveW4dD7NzF1rwh4jdEo fixed

Geramy avatar Apr 10 '19 23:04 Geramy

20190513_220416 Screenshot_20190513-220349_Settings

Tnx for your hard work, it's working on my freebsd 12 after following all your directions here, now i need to find a way to port this on pfsense somehow, it's not working if i move the modules on my pfsense box, missing alq and firmware say "image firmware table full", @Geramy were you able to compile the kernel for pfsense?

kiokoman avatar May 13 '19 20:05 kiokoman