Geramy / athp

freebsd ath10k port, this repository is a fork of the master, most of my development is done here and then merged in to master. Please make sure to use erikarn's athp repository if you are looking to make changes and want to be on the most current stable master. Most Recent Branch: https://github.com/Geramy/athp/tree/NEW_ATHP_ARVIF_LOCK
14 stars 3 forks source link

Build Issue(s) with recent source(s) 12-STABLE / 13-STABLE / 14-CURRENT #4

Open thesunexpress opened 2 years ago

thesunexpress commented 2 years ago

Howdy, Having issue(s) building the module, that's got me miffed. I am experiencing the exact same issue whether on, and using src from, 12- / 13-STABLE & CURRENT. Using branch: NEW_ATHP_ARVIF_LOCK

Snafu:

/usr/home/my-spiffy-username/Downloads/ath/athp/otus/freebsd/src/sys/modules/athp/../../dev/athp/athp_idr.c:521:34: error: result of '2^30' is 28; did you mean '1 << 30' (1073741824)? [-Werror,-Wxor-used-as-pow] int max = end > 0 ? end - 1 : (2^30); /* XXX */ ~^~~ 1 << 30 /usr/home/my-spiffy-username/Downloads/ath/athp/otus/freebsd/src/sys/modules/athp/../../dev/athp/athp_idr.c:521:34: note: replace expression with '0x2 ^ 30' to silence this warning 1 error generated. *** Error code 1

Stop. make: stopped in /usr/home/my-spiffy-username/Downloads/ath/athp/otus/freebsd/src/sys/modules/athp

Doing as suggested, modifying the code with 0x2 ^ 30 does suppress that initial error & compilation carries on a bit, but breaks again with the following output:

/usr/home/my-spiffy-username/Downloads/ath/athp/otus/freebsd/src/sys/modules/athp/../../dev/athp/if_athp_debug_stats.c:560:17: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] printf("%s\n", buf); ~~ ^~~ 1 error generated. *** Error code 1

Stop. make: stopped in /usr/home/my-spiffy-username/Downloads/ath/athp/otus/freebsd/src/sys/modules/athp

Have you any pointers as to what I should try next? I didn't want to mess with the source too much, before asking you for advice. I'd really like to get this driver to some basic functionality, so I can do some work on debugging the Qualcomm Atheros QCA6174 onboard chip in my laptop. I'm toying with the idea of making a significant push in the form of funding, to get FreeBSD up to speed with the 802.11ac standards & in the meantime help wherever I can. Thanks!

Geramy commented 2 years ago

Hey, I have not touched my repository for many moons, I will download my repo and open it up on my dev environment and take a few cracks at it. Give me a few hours to fix this bug so that you can get back to compiling it. We would appreciate funding for this driver if it was available. I believe there have been a few people working on it in recent months, myself the ath master erikarn and I believe a few other people such as bzfbd have been working on it. I could also put more time in, my workload recently has become a lot less.

thesunexpress commented 2 years ago

Hint: that last build break can be solved by switching the indicated void to a char & the build carries on fine on 14-CURRENT. But again, I don't want to mess with your source. I am just a mildly competent hacker & not proficient at C/C++ at all. I will now try my hand at getting somewhere similar on 13-STABLE; where I actually need it to work. Haven't tried KLDloading any of this yet, will report back on that.

Geramy commented 2 years ago

Sounds good is PFSense on 13-Stable now?

thesunexpress commented 2 years ago

Nope, on my personal workstations. I can't remember the last time I touched a pfSense deployment. Next baby steps: Built your branch on 13-STABLE & 14-CURRENT desktop workstation, both with a somewhat custom kernel & also with a GENERIC kernel, without much complaints. I KLDloaded the firmware(s) & if_athp.ko, this succeeded each time without complaint as well. No spam to the console. Crucially, I used this box just to build the module(s), but do not have any QCA98xx / QCA99xx / QCA6174 device installed. On my laptop with soldered-on-board QCA6174 device, doing the same results in kernel panics seconds after KLDloading if_athp.ko --- Note 1, no complaints when I first KLDload the firmware before if_athp.ko. --- Note 2, the modules are cleanly built each time. Kernel panic output follows.

thesunexpress commented 2 years ago

Kernel panic:

kernel: athp_pci_attach: msicount=8, msixcount=0 kernel: athp0: athp_pci_attach: 8 MSI interrupts kernel: athp0: ath10k_pci_alloc_pipes: WARNING: configuring 4k dmamap size for pipe 5; figure out what to do instead kernel: athp0: ath10k_pci_alloc_pipes: WARNING: configuring 4k dmamap size for pipe 6; figure out what to do instead kernel: athp0: athp_pci_attach: chipid: 0x00340aff kernel: athp0: ath10k_fetch_fw_file: firmware_get: athp_cal-pci-athp0.bin kernel: athp_cal-pci-athp0.bin: could not load firmware image, error 2 kernel: athp0: ath10k_fetch_fw_file: firmware_get: athp_QCA6174_hw3.0_board.bin kernel: athp0: ath10k_fetch_fw_file: firmware_get: athp_QCA6174_hw3.0_firmware-5.bin kernel: athp_QCA6174_hw3.0_firmware-5.bin: could not load firmware image, error 2 kernel: athp0: could not fetch firmware file 'athp_QCA6174_hw3.0/firmware-5.bin': -1 kernel: athp0: ath10k_fetch_fw_file: firmware_get: athp_QCA6174_hw3.0_firmware-4.bin kernel: athp0: ath10k_core_init_firmware_features: hardware crypto kernel: athp0: ath10k_download_cal_dt: TODO: device tree check kernel: athp0: ath10k_wmi_event_service_ready_work: TODO: EEPROM code: 0x0000006c kernel: kernel: Fatal trap 9: general protection fault while in kernel mode kernel: cpuid = 7; apic id = 07 kernel: instruction pointer = 0x20:0xffffffff823eac9d kernel: stack pointer = 0x28:0xfffffe00d3e04cf0 kernel: frame pointer = 0x28:0xfffffe00d3e04d20 kernel: code segment = base 0x0, limit 0xfffff, type 0x1b kernel: = DPL 0, pres 1, long 1, def32 0, gran 1 kernel: processor eflags = interrupt enabled, resume, IOPL = 0 kernel: current process = 0 (athp0 ath10k_at_wq) kernel: trap number = 9 kernel: panic: general protection fault kernel: cpuid = 7 kernel: time = 1640755319 kernel: KDB: stack backtrace: kernel: #0 0xffffffff80924e85 at kdb_backtrace+0x65 kernel: #1 0xffffffff808d743f at vpanic+0x17f kernel: #2 0xffffffff808d72b3 at panic+0x43 kernel: #3 0xffffffff80c881b5 at trap_fatal+0x385 kernel: #4 0xffffffff80c5f3b8 at calltrap+0x8 kernel: #5 0xffffffff823e886b at ath10k_htt_rx_ring_fill_n+0x1b kernel: #6 0xffffffff823e87ff at ath10k_htt_rx_ring_refill+0x5f kernel: #7 0xffffffff823b8f7c at ath10k_core_start+0x57c kernel: #8 0xffffffff823ba280 at ath10k_core_probe_fw+0x260 kernel: #9 0xffffffff823bd098 at attempt_ath10k_core_probe_fw+0x18 kernel: #10 0xffffffff823bb494 at ath10k_core_register_work+0x24 kernel: #11 0xffffffff80939441 at taskqueue_run_locked+0x181 kernel: #12 0xffffffff8093a752 at taskqueue_thread_loop+0xc2 kernel: #13 0xffffffff808945de at fork_exit+0x7e kernel: #14 0xffffffff80c6042e at fork_trampoline+0xe

Geramy commented 2 years ago

I will take a look at the code following the wmi comment. Is this based on my recent master changes?

thesunexpress commented 2 years ago

Hardware: none6@pci0:2:0:0: class=0x028000 rev=0x32 hdr=0x00 vendor=0x168c device=0x003e subvendor=0x1a56 subdevice=0x143a vendor = 'Qualcomm Atheros' device = 'QCA6174 802.11ac Wireless Network Adapter' class = network

thesunexpress commented 2 years ago

Both your master & erikarn's master fails to build with lots of compilation errors. Your NEW_ATHP_ARVIF_LOCK branch builds & KLDloads fine, except when KLDloading in the case of the actual laptop that has the QCA6174 device installed.

Geramy commented 2 years ago

Have you verified which firmware file is recommended with your chipset? If you were to look around the Linux forums and posts on their athp driver does it use the same firmware file as us? For example it looks like its using athp_QCA6174_hw3.0_firmware-4.bin is this hardware version the same as yours?

thesunexpress commented 2 years ago

I was just thinking about exactly that... due to the erroneous indications that the needed firmware(s) aren't found. Time to grab an Arch Linux live disk image & see how Linux identifies this device. I'll report back in a bit to see what I find.

Geramy commented 2 years ago

That would be great, I believe the athp driver will tell you what firmware its using. I am working on the development environment once I get building to work I can get master to compile. One problem is that I believe we are up to version with HEAD of freebsd and we need to downgrade to a lesser version. The problem with doing that is HEAD freebsd is what supports some of the newer features in this driver I believe. I need to check to see how we can get it to work for FreeBSD 13 with no compile errors or even 12 maybe.

thesunexpress commented 2 years ago

I'll have a quick look at both yours & erikarn's master to see if I can find a bit more info on what exactly breaks the compilation, while I dig around in Linux to see what firmware is used there.

thesunexpress commented 2 years ago

Arch Linux reports as:

ath10k_pci 0000:02:00.0: enabling device (0000 -> 0002) ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0 ath10k_pci 0000:02:00.0: qca6174 hw3.2 target 0x05030000 chip_id 0x00340aff sub 1a56:143a ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 0 testmode 0 ath10k_pci 0000:02:00.0: firmware ver WLAN.RM.4.4.1-00157-QCARMSWPZ-1 api 6 features wowlan,ignore-otp,mfp crc32 90eebefb ath10k_pci 0000:02:00.0: board_file api 2 bmi_id N/A crc32 318825bf ath10k_pci 0000:02:00.0: htt-ver 3.60 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1 ath: EEPROM regdomain: 0x6c ath: EEPROM indicates we should expect a direct regpair map ath: Country alpha2 being used: 00 ath: Regpair used: 0x6c ath: EEPROM regdomain: 0x8348 ath: EEPROM indicates we should expect a country code ath: doing EEPROM country->regdmn map search ath: country maps to regdmn code: 0x3a ath: Country alpha2 being used: US ath: Regpair used: 0x3a ath: regdomain 0x8348 dynamically updated by country element

Looks like I might need to do some hunting for (newer) firmware...

lspci: 02:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)

thesunexpress commented 2 years ago

I managed to successfully build your master branch on 13-STABLE. There was an error / typo in line 730 of master/otus/freebsd/src/sys/dev/athp/if_athp_pci.c

Where: "beacon buf", 4, ATH10K_BEACON_BUF_LEN);

Needs to be changed to: "beacon buf", 4, ATH10K_BEACON_SENT);

The resulting modules & bins still reward my efforts with instant kernel panic, exactly the same as when I tried NEW_ATHP_ARVIF_LOCK

I'll keep digging and see what I can come up with.

Geramy commented 2 years ago

I have submitted a new code to fix the buffer length correctly, please pull the latest master. There was a missing include in the file.

Geramy commented 2 years ago

I have uploaded the binaries compiled for 13-STABLE

thesunexpress commented 2 years ago

Excellent work. I tried doing something of a dirty hack last night, to include the firmware that Linux seems to indicate this device needs. This got me kernel panics & dumps too. However, I can confirm that with the hardware disabled in BIOS/UEFI, no panics nor dumps occur. The firmware Linux uses, appears to be: https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/4.4.1/firmware-6.bin_WLAN.RM.4.4.1-00157-QCARMSWPZ-1 As far as I can tell....

I'll give your latest updates a go right now & report back.

thesunexpress commented 2 years ago

p.s. I'll pop open the laptop as well & take a close-up shot of the QCA6174 chip, to get a better idea what actual hardware model/revision by Atheros this actually is.

Geramy commented 2 years ago

I just did some changes and fixes to my repo on master, I have reuploaded the release and fixed the kernel crash problem if_athp_binaries_FREEBSD_13.0_RELEASE.zip .

thesunexpress commented 2 years ago

Tried your binaries package, but that results in a hard-lock; which I expect to happen, built on 13-RELEASE?

Right now, both your master & erikarn's master results in a bunch of: athp/otus/freebsd/src/sys/modules/athp/../../dev/athp/if_athp_main.c:158:2: error: use of undeclared identifier 'MA_OWNED' ATHP_CONF_LOCK_ASSERT(ar); I'm assuming this would need the NEW_ATHP_ARVIF_LOCK fixes...

I need to figure out & learn how to add the new(er) firmware to this build.

Geramy commented 2 years ago

I just submitted some new commits to the branch main and it should be working. I am having troubles myself and I believe I will start over from the latest parent branch master. Basically I will destroy my repo and re make it.

On Wed, Dec 29, 2021 at 5:00 PM thesunexpress @.***> wrote:

Tried your binaries package, but that results in a hard-lock; which I expect to happen, built on 13-RELEASE?

Right now, both your master & erikarn's master results in a bunch of: athp/otus/freebsd/src/sys/modules/athp/../../dev/athp/if_athp_main.c:158:2: error: use of undeclared identifier 'MA_OWNED' ATHP_CONF_LOCK_ASSERT(ar); I'm assuming this would need the NEW_ATHP_ARVIF_LOCK fixes...

I need to figure out & learn how to add the new(er) firmware to this build.

— Reply to this email directly, view it on GitHub https://github.com/Geramy/athp/issues/4#issuecomment-1002818114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAWBBRMIXCAW5DY3VNZP3UTOOLLANCNFSM5K4UZTXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

--

Geramy L. Loveless Founder & Chief Innovation Officer

JQluv.net, Inc. Site: JQluv.com http://www.jqluv.com/ Mobile: 559.999.1557Office: 1 (877) 44 JQluv

thesunexpress commented 2 years ago

Here's an image of the irritating little chip: https://imgur.com/a/Ljc8nVb

thesunexpress commented 2 years ago

Do please keep the NEW_ATHP_ARVIF_LOCK branch archived for posterity.

Geramy commented 2 years ago

I am trying to find the best way to do this. I think I’ll just painfully remove some of my work from main and bring it to the same level as the parent GitHub and tomorrow I’ll work on fixing any more bugs I find on that branch and get it to a good stable point.

On Wed, Dec 29, 2021 at 5:43 PM thesunexpress @.***> wrote:

Do please keep the NEW_ATHP_ARVIF_LOCK branch archived for posterity.

— Reply to this email directly, view it on GitHub https://github.com/Geramy/athp/issues/4#issuecomment-1002826759, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAWBFAAUUOADJCS3KTEQ3UTOTJRANCNFSM5K4UZTXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

--

Geramy L. Loveless Founder & Chief Innovation Officer

JQluv.net, Inc. Site: JQluv.com http://www.jqluv.com/ Mobile: 559.999.1557Office: 1 (877) 44 JQluv