8devices / qcacld-2.0

Drivers for BLUE bean and RED bean modules
8 stars 13 forks source link

Driver tries to load non-existent firmware binaries #18

Closed chhitz closed 3 years ago

chhitz commented 3 years ago

We use branch linux-5.4.y_CNSS.LEA.NRT_3.0

After startup the driver tries to load two non-existent firmware binaries athsetup.bin and wlan/wlan_mac.bin. This delays the availability of the WLAN driver by over two minutes. After the wait time the WLAN module works as expected.

How can we avoid the long wait time?

[ 10.356686] wlan_usb: loading driver v4.5.20.037 [ 10.367058] hif_usb_probe [ 10.370325] Enter:hif_usb_disable_lpm,Line:127 [ 10.378738] hif_usb_disable_lpm: LPM isn't enabled [ 10.383700] Exit:hif_usb_disable_lpm,Line:154 [ 10.431709] NUM_DEV=1 FWMODE=0x2 FWSUBMODE=0x0 FWBR_BUF 0 [ 10.441456] Board extended Data download address: 0x0 [ 10.464212] ol_download_firmware: Using 0x1234 for the remainder of init [ 10.518196] ol_transfer_bin_file: Loading setup file athsetup.bin [ 10.526805] usb 1-1.3: Direct firmware load for athsetup.bin failed with error -2 [ 10.542804] usb 1-1.3: Falling back to sysfs fallback for: athsetup.bin [ 70.706972] ol_transfer_bin_file: Failed to get athsetup.bin [ 70.706975] cfg80211: failed to load regulatory.db [ 71.904467] WDA_open-4688: WMA --> wmi_unified_attach - success [ 71.910469] ol_if_dfs_attach: called; ptr=00000000e8ff06f9, radar_info=000000008e031719 [ 71.919658] is_full_reorder_offloaded? 0 [ 71.923948] TX HTT OFF, ep -1 size 0 [ 71.927621] htt_tx_attach:htt_desc_start:0x00000000e945c095 htt_desc_end:0x000000002e43065e [ 71.937449] wma_pre_start-5056: WMA --> wmi_unified_connect_htc_service - success [ 71.945083] wma_mc_process_msg-21967: McThread: WNI_CFG_DNLD_REQ [ 71.953476] __wmi_control_rx: WMI UNIFIED SERVICE READY event [ 71.959317] wma_rx_service_ready_event-24799: WMA <-- WMI_SERVICE_READY_EVENTID [ 71.966842] wma_rx_service_ready_event-24914: WMA --> WMI_INIT_CMDID [ 71.980093] __wmi_control_rx: WMI UNIFIED READY event [ 71.985279] wma_rx_ready_event-24943: WMA <-- WMI_READY_EVENTID [ 71.992231] usb 1-1.3: Direct firmware load for wlan/wlan_mac.bin failed with error -2 [ 72.000344] usb 1-1.3: Falling back to sysfs fallback for: wlan/wlan_mac.bin [ 72.980489] Enter:usb_hif_start_recv_pipes,Line:958 [ 72.985494] Post URBs to RX_DATA_PIPE: 32 [ 72.989900] Exit:usb_hif_start_recv_pipes,Line:994 [ 132.147757] session id - 0, AddSta session - 0 [ 132.152386] target uses HTT version 3.27; host uses 3.23 [ 132.153168] wma_vdev_attach-5904: vdev_id 0, txrx_vdev_handle = 00000000ebdb5975 [ 132.158518] *** Warning: host/target HTT versions are different, though compatible! [ 132.166643] session id - 1, AddSta session - 0 [ 132.178026] wma_vdev_attach-5904: vdev_id 1, txrx_vdev_handle = 0000000077ef8ee6 [ 132.185685] wma_vdev_attach-5969: P2P Device: creating self peer c6:93:00:a4:36:e4, vdev_id 1 [ 132.201833] Host SW:4.5.20.037, FW:0.0.0.41, HW:QCA9377_REV1_1 [ 132.207842] wlan_logging_sock_activate_svc: Initalizing FEConsoleLog = 0 NumBuff = 32 [ 132.216183] wlan_logging_sock_activate_svc: Activated wlan_logging svc [ 132.223176] usbcore: registered new interface driver hif_usb [ 132.229301] wlan_usb: driver loaded

valinskas commented 3 years ago
[ 10.383700] Exit:hif_usb_disable_lpm,Line:154
[ 10.431709] NUM_DEV=1 FWMODE=0x2 FWSUBMODE=0x0 FWBR_BUF 0
[ 10.441456] Board extended Data download address: 0x0
[ 10.464212] ol_download_firmware: Using 0x1234 for the remainder of init
[ 10.518196] ol_transfer_bin_file: Loading setup file athsetup.bin

Driver requests a  /lib/firmware/athsetup.bin -- which is missing, -2 == ENOENT, No such file or directory

[ 10.526805] usb 1-1.3: Direct firmware load for athsetup.bin failed with error -2 <--- error

 <---- initiates fallback .... a userpace is "requested" to provide that file"

[ 10.542804] usb 1-1.3: Falling back to sysfs fallback for: athsetup.bin. 
[ 70.706972] ol_transfer_bin_file: Failed to get athsetup.bin

Now as to why it taske 60sec for a userspace to load that file i can't tell.

Which OS you are running ? Can you make a /lib/firmware/athsetup.bin present on rootfs (assuming embedded system).

chhitz commented 3 years ago

As I wrote, the files athsetup.bin and wlan/wlan_mac.bin are both not present on the roofs (where would they come from, they are not part of this repository?)

I'm running a custom OS based on buildroot.

valinskas commented 3 years ago

It's part of git repository. Blue Bean binary target firmware images: https://github.com/8devices/qcacld-2.0/tree/CNSS.LEA.NRT_3.0/firmware_bin/usb/

chhitz commented 3 years ago

Looking at your provided link, I can see neither athsetup.bin nor wlan/wlan_mac.bin. Are they checked in with different file names?

Nevinskas commented 3 years ago

Neither athsetup.bin or wlan_mac.bin is manditory. These binaries are only used in production testing. Driver only checks if it exist, but does not fail to load.

valinskas commented 3 years ago

it does load "athwlan.bin", i did not look at driver code, but if it fails to find such file it falls back on other files. Blue Bean needs athwlan.bin. Other files that are important : fakeboar.bin , utf.bin (it's just for testing, not needed on runtime).

Please check the source code/

chhitz commented 3 years ago

Neither athsetup.bin or wlan_mac.bin is manditory. These binaries are only used in production testing. Driver only checks if it exist, but does not fail to load.

That is also what I can observe: the files are not present and the driver will work anyway.

My issue is that trying to load these files delays the driver by ~2 minutes before it becomes active.

chhitz commented 3 years ago

We have found the origin of the problem: Our kernel has the configuration CONFIG_FW_LOADER_USER_HELPER enabled. With this option enabled the kernel will defer to user-space for loading the non-existent firmware files. By disabling the option, the driver starts without the observed 120s delay.