[BPI-R64] PCIe issues

@frank-w

I tried to compile the kernel using the Ref https://github.com/frank-w/BPI-R2-4.14/tree/5.4-r64-dsa. The kernel got compiled and using package option, the package was successfully created. And tried to replace existing /boot/bananapi/bpi-r64/linux/uImage and /boot/bananapi/bpi-r64/linux/dtb/bpi-r64.dtb.

However, the boot folder on my banana pi R64 doesnot contain uImage.

I am a newbie to the linux kernel, so you please let me know the steps to load a kernel image

You have folder-structure in /boot? this depends on the os-image you are using…The first Partition of sdcard (/dev/mmcblk1p1) should be mounted to /boot. If not (and /boot is empty) try to mount it…

mount /dev/mmcblk1p1 /boot

it is more secure using external computer to rename old uImage/dtb and add new…

if folders existing which files are there? Maybe your image is configured to use another file…maybe there is a uEnv.txt where a variable named kernel is set to a filename

If you don’t get it working please make new topic for kernel-replace with infos about image,uenv.txt and kernelversion. I recommend a debug-uart so that you not dig in the dark and see messages from uboot

@frank-w, I have modified the folders on SD card as suggested. When I try to boot the BananaPi R64 using that SD card, the following error appears.
(Attaching a log file too as the message is appearing on forum in misaligned formbootupLog.txt (2.1 KB) )

Partition Map for MMC device 1 – Partition Type: DOS

Part Start Sector Num Sectors UUID Type 1 204800 524288 1f9b70ec-01 0c 2 729088 14211072 1f9b70ec-02 83 mmc1 is available Interface: MMC Device 1: Vendor: Man 000003 Snr f7d58e01 Rev: 8.5 Prod: WP256€ Type: Removable Hard Disk Capacity: 244016.0 MB = 238.2 GB (499744768 x 512) Filesystem: FAT32 "BPI-BOOT " Boot from SD reading bananapi/bpi-r64/linux/uEnv.txt 1016 bytes read in 5 ms (198.2 KiB/s) Loaded environment from uEnv.txt Banana Pi bpi-r64 chip: mt7622 Service: linux reading bananapi/bpi-r64/linux/dtb/mt7622-bananapi-bpi-r64.dtb 24258 bytes read in 8 ms (2.9 MiB/s) reading bananapi/bpi-r64/linux/uImage_nodt 8716360 bytes read in 570 ms (14.6 MiB/s) reading bananapi/berryboot.img ** Unable to read file bananapi/berryboot.img ** bootm flag=0, states=70f

Booting kernel from Legacy Image at 44000000 …

Image Name: Linux Kernel 5.4.0 Image Type: AArch64 Linux Kernel Image (uncompressed) Data Size: 8716296 Bytes = 8.3 MiB Load Address: 40080000 Entry Point: 40080000 Verifying Checksum … OK Unsupported Architecture 0x16 ERROR: can’t get kernel image! reading bananapi/bpi-r64/linux/uImage_nodt FAT: Misaligned buffer address (4007ff28) 8716360 bytes read in 5123 ms (1.6 MiB/s) bootm flag=0, states=70f

Booting kernel from Legacy Image at 4007ff28 …

Image Name: Linux Kernel 5.4.0 Image Type: AArch64 Linux Kernel Image (uncompressed) Data Size: 8716296 Bytes = 8.3 MiB Load Address: 40080000 Entry Point: 40080000 Verifying Checksum … OK Unsupported Architecture 0x16 ERROR: can’t get kernel image! bootm flag=0, states=70f

Booting kernel from Legacy Image at 4007ff28 …

Image Name: Linux Kernel 5.4.0 Image Type: AArch64 Linux Kernel Image (uncompressed) Data Size: 8716296 Bytes = 8.3 MiB Load Address: 40080000 Entry Point: 40080000 Verifying Checksum … OK Unsupported Architecture 0x16 ERROR: can’t get kernel image! BPI-IoT>

if using old uboot (i guess so because new is in testing state and not available in any ready-to use image) you need a 32bit uImage (arm). On my dsa-tree the option for arm64 exists but is disabled by default…i guess you’ve changed it,right?

But please discuss this in new thread if it is not working after changing mkimage-type

btw. for output of any kind please use code formatting (select text and click on “<>” button) for better readability

@frank-w

Thanks for you input.

I could load the kernel image by commenting uimagearch=arm64 in build.conf .

Have few queries related to this setup.

  1. We wish to load a kernel module gasket.ko & apex.ko which is need by Google coral which we plan to interface on Minipcie slot.When I try to load that module, it gives “Invalid module format”. Running a $file apex.ko -> ELF 64bit LSB Relocatable. Any idea whether this module can be loaded on the compiled kernel 5.4 kernel(32 bit ) .

  2. Can you share a U-boot with 64bit functionality enabled if possible

Please note, I didn’t start a new thread though suggested by you, as my queries are related to your Git repository reference that I have been using

kernel itself is 64bit, but container (mkimage) for uboot have to be 32bit when using old uboot. New uboot is currently in testing (https://github.com/frank-w/u-boot/tree/2020-01-bpi-r64-v2) and without ethernet. you need new ATF to load it directly and you cannot load 32bit containers. imho you should wait till it is ready :slight_smile:

but you can use uboot-binary (2020-01 v2 1G) and ATF (mt7622_ATF_32_64_release.img) from my gdrive: https://drive.google.com/open?id=1-EJgBZrPFQbacLxFvLopyqKqEDCxwj8k

your module needs to be same arch (arm64/aarch64)…i don’t know how you have compiled it, but this stuff for new thread…

@frank,

I have started a new thread for installing kernel headers issue. Can you please help me with it new thread

Hi @frank-w

Based on our discussion with Google on the PCIe issue on 5.4 kernel, it seems that the BAR0 for the pcie bridge didn’t get memory range assigned, which is preventing the coral from accessing the host’s memory.

can you please suggest how can we fix this?

Below is the dmesg log:

[    1.604440] pci 0000:01:00.0: [1ac1:089a] type 00 class 0x0000ff [    1.610743] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit pref] [    1.618078] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x000fffff 64bit pref] [    1.626285] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0000:00:00.0 (capable of 4.000 Gb/s with 5 GT/s x1 link) [    1.641429] pci_bus 0000:01: fixups for bus [    1.645617] pci_bus 0000:01: bus scan returning with max=01 [    1.651195] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01 [    1.657816] pci_bus 0000:00: bus scan returning with max=01 [    1.663407] pci 0000:00:00.0: BAR 0: no space for [mem size 0x200000000 64bit pref] [    1.671071] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x200000000 64bit pref] [    1.679079] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x201fffff] [    1.685872] pci 0000:00:00.0: PCI bridge to [bus 01] [    1.690846] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x201fffff] 

-Gaurav

Maybe ranges is wrong

wrong assumption

And it looks like start-adress is same for pcie0+1 (overlapping) and size too big

//pcie0
ranges = <0x82000000 0 0x20000000  0x0 0x20000000  0 0x8000000>;
//pcie1
ranges = <0x82000000 0 0x28000000  0x0 0x28000000  0 0x8000000>;

i’m no dts-expert,but i think ot should be more like this:

//pcie0
ranges = <0x82000000 0 0x2000000  0x0 0x20000000  0 0x8000000>;
//pcie1
ranges = <0x84000000 0 0x2000000  0x0 0x28000000  0 0x8000000>;

if i interprete values right:

  • pcie0 size #1 is 512Mb - removed one 0 - now 32mb
  • Pcie1-size #1 is 640mb - removed 8 - also 32mb
  • start-address #1 of both was same - moved start after end of pcie0

I guess second bar is also wrong (128mb). R64 has only 1GB :slight_smile:

but maybe only the 3rd param is offset and 4th the size for pcie-memory

this was change suggested for splitting pcie-controller:

-	ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>;
+	ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>;

so size was splitted into 2 equal parts of 128MB starting from 512MB

this is huge memory-block for device that has 1GB…maybe anything is overlapping

Hi Frank,

I am facing similar issue. I have made modifications to the [mt7622.dtsi|attachment](upload://ljQRVgMu9DidPen3euRbbo4IV4F.dtsi) (25.0 KB) 
After making these modifications to the mt7622.dtsi file, it still shows error as 

 gasket: loading out-of-tree module taints kernel.
[  183.107996] apex 0000:01:00.0: assign IRQ: got 140
[  183.108043] pci 0000:00:00.0: enabling device (0000 -> 0002)
[  183.108058] pci 0000:00:00.0: enabling bus mastering
[  183.108082] apex 0000:01:00.0: can't enable device: BAR 0 [mem 0x00000000-0x00003fff 64bit pref] not claimed
[  183.108100] apex 0000:01:00.0: BAR 2: assigned [mem 0x20000000-0x200fffff 64bit pref]
[  183.108193] apex 0000:01:00.0: BAR 0: assigned [mem 0x20100000-0x20103fff 64bit pref]
[  183.108310] apex 0000:01:00.0: enabling device (0000 -> 0002)
[  183.108363] apex 0000:01:00.0: enabling bus mastering
**[  195.906661] apex 0000:01:00.0: RAM did not enable within timeout (12000 ms)**

Can you please suggest how can we fix this?

I guess my conclusions are wrong and ranges are correct…i also find no overlapping node. Imho we need some vendor info here

Thanks for your prompt response.

Can you please elaborate what kind of vendor info do we need ?

The “how to fix” :slight_smile:

I asked employee from mtk by whom i got the pcie-splitting code

@frank-w, which Qualcomm Atheros chip do you have? Have you try the ath10k-ct driver?

I have a Compex WLE900VX QCA9880 pcie wifi module, If I use the ath10k driver, I have the same error with you. If I use the ath10k-ct driver, the driver can startup correctly, but can’t connect to the QCA9880 hardware, it seems WLE900VX need usb interface in the minipcie, but the CN25 minipcie port isn’t have the usb interface.

I used ath10k driver and see wifi-interface…did not made further tests due to less time

Which wifi module do you use? and which board do you use? BPI-R64 or BPI-R2?

my tests here are basing on r64 v1. Tested my qualcom card on both slots and it’s only recognized on cn25 and got wifi interface there but have not run hostapd on it

How do you fix that problem? I got the same problem. openwrt + BPI-R64 + Compex WLE900VX QCA9880. kmod-ath10k driver and firmware, the system will crash.

[   28.373475] ath10k_pci 0000:01:00.0: no of_node; not parsing pinctrl DT
[   28.380465] ath10k_pci 0000:01:00.0: assign IRQ: got 136
[   28.386680] pci 0000:00:00.0: enabling device (0000 -> 0002)
[   28.392554] pci 0000:00:00.0: enabling bus mastering
[   28.397685] ath10k_pci 0000:01:00.0: enabling device (0000 -> 0002)
[   28.404209] ath10k_pci 0000:01:00.0: enabling bus mastering
[   28.410396] Unable to handle kernel paging request at virtual address ffffff800892f0c0
[   28.418560] Mem abort info:
[   28.421476]   ESR = 0x96000047
[   28.424624]   Exception class = DABT (current EL), IL = 32 bits
[   28.430736]   SET = 0, FnV = 0
[   28.433883]   EA = 0, S1PTW = 0
[   28.437119] Data abort info:
[   28.440101]   ISV = 0, ISS = 0x00000047
[   28.444052]   CM = 0, WnR = 1
[   28.447110] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 0000000092d32cfe
[   28.454207] [ffffff800892f0c0] pgd=000000007fffe003, pud=000000007fffe003, pmd=000000007fffb003, pte=0000000000000000
[   28.465166] Internal error: Oops: 96000047 [#1] SMP
[   28.470190] Modules linked in: ath10k_pci(+) ath10k_core ath 
[   28.776245] Process kmodloader (pid: 1064, stack limit = 0x00000000e97ecadb)
[   28.783513] CPU: 1 PID: 1064 Comm: kmodloader Not tainted 4.19.72 #0
[   28.790059] Hardware name: Bananapi BPI-R64 (DT)
[   28.794815] pstate: 00000005 (nzcv daif -PAN -UAO)
[   28.799759] pc : queued_spin_lock_slowpath+0x180/0x288
[   28.805057] lr : __mutex_lock.isra.7+0x1b8/0x520
[   28.809812] sp : ffffff8009d736b0
[   28.813224] x29: ffffff8009d736b0 x28: ffffff8009d738d0
[   28.818698] x27: 0000000000080000 x26: ffffff8009d738d0
[   28.824172] x25: 0000000000000089 x24: ffffff800895c8c8
[   28.829646] x23: ffffffc03e442908 x22: ffffffc03e442910
[   28.835121] x21: ffffff8008946000 x20: 0000000000000002
[   28.840596] x19: ffffffc03e442908 x18: 0000000000000000
[   28.846070] x17: 0000000000000000 x16: ffffffbf00d7a600
[   28.851544] x15: 0000000000000000 x14: 0000000000006af0
[   28.857018] x13: 00000000000001a4 x12: 0000000000000038
[   28.862492] x11: ffffffc03ffc77e8 x10: 00000000000007b0
[   28.867966] x9 : 0000000000000000 x8 : ffffffc03ffcc0c0
[   28.873439] x7 : 0000000000080000 x6 : 0000000000000000
[   28.878913] x5 : 0000000000000000 x4 : ffffff800892f0c0
[   28.884387] x3 : ffffffc03ffcc0c8 x2 : ffffff800892f000
[   28.889860] x1 : ffffffc03ffcc0c0 x0 : ffffffc03e442910
[   28.895335] Call trace:
[   28.897857]  queued_spin_lock_slowpath+0x180/0x288
[   28.902793]  __mutex_lock_slowpath+0x10/0x18
[   28.907194]  mutex_lock+0x30/0x38
[   28.910613]  mtk_pcie_irq_domain_alloc+0x44/0xd8
[   28.915373]  irq_domain_alloc_irqs_parent+0x1c/0x30
[   28.920401]  msi_domain_alloc+0x84/0x148
[   28.924441]  __irq_domain_alloc_irqs+0x13c/0x270
[   28.929198]  msi_domain_alloc_irqs+0x80/0x278
[   28.933686]  pci_msi_setup_msi_irqs+0x28/0x40
[   28.938174]  __pci_enable_msi_range+0x1f8/0x410
[   28.942841]  pci_enable_msi+0x18/0x28
[   28.946618]  ath10k_pci_setup_resource+0x60c/0x940 [ath10k_pci]
[   28.952721]  pci_device_probe+0x9c/0x138
[   28.956762]  really_probe+0x150/0x2b0
[   28.960533]  driver_probe_device+0xbc/0x108
[   28.964842]  __driver_attach+0xa8/0xe0
[   28.968707]  bus_for_each_dev+0x4c/0x98
[   28.972657]  driver_attach+0x20/0x28
[   28.976339]  bus_add_driver+0xe8/0x208
[   28.980201]  driver_register+0xb0/0xf8
[   28.984065]  __pci_register_driver+0x40/0x48
[   28.988471]  init_module+0x2c/0x1000 [ath10k_pci]
[   28.993323]  do_one_initcall+0x78/0x170
[   28.997277]  do_init_module+0x58/0x1a0
[   29.001138]  load_module+0x19bc/0x1ff0
[   29.004999]  __do_sys_init_module+0x148/0x1a8
[   29.009486]  __arm64_sys_init_module+0x14/0x20
[   29.014065]  el0_svc_common+0x8c/0xf0
[   29.017836]  el0_svc_handler+0x6c/0x78
[   29.021696]  el0_svc+0x8/0xc
[   29.024661] Code: 8b030084 91002103 f865d929 d2800005 (f8296888)

If use the kmod-ath10-ct driver and firmware, the system will not crash, but the driver can’t work correctly.

[   28.322762] ath10k_pci 0000:01:00.0: no of_node; not parsing pinctrl DT
[   28.329733] ath10k_pci 0000:01:00.0: assign IRQ: got 136
[   28.335226] ath10k 4.19 driver, optimized for CT firmware, probing pci device: 0x3c.
[   28.343959] pci 0000:00:00.0: enabling device (0000 -> 0002)
[   28.349831] pci 0000:00:00.0: enabling bus mastering
[   28.354966] ath10k_pci 0000:01:00.0: enabling device (0000 -> 0002)
[   28.361494] ath10k_pci 0000:01:00.0: enabling bus mastering
[   28.367778] ath10k_pci 0000:01:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[   31.831565] firmware ath10k!fwcfg-pci-0000:01:00.0.txt: firmware_loading_store: map pages failed
[   31.846045] firmware ath10k!pre-cal-pci-0000:01:00.0.bin: firmware_loading_store: map pages failed
[   31.860734] firmware ath10k!cal-pci-0000:01:00.0.bin: firmware_loading_store: map pages failed
[   31.875653] firmware ath10k!QCA988X!hw2.0!ct-firmware-5.bin: firmware_loading_store: map pages failed
[   31.890581] firmware ath10k!QCA988X!hw2.0!ct-firmware-2.bin: firmware_loading_store: map pages failed
[   31.905266] firmware ath10k!QCA988X!hw2.0!firmware-6.bin: firmware_loading_store: map pages failed
[   31.919882] firmware ath10k!QCA988X!hw2.0!firmware-5.bin: firmware_loading_store: map pages failed
[   31.934292] firmware ath10k!QCA988X!hw2.0!firmware-4.bin: firmware_loading_store: map pages failed
[   31.948735] firmware ath10k!QCA988X!hw2.0!firmware-3.bin: firmware_loading_store: map pages failed
[   32.003210] ath10k_pci 0000:01:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[   32.012751] ath10k_pci 0000:01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   32.022646] ath10k_pci 0000:01:00.0: firmware ver 10.1-ct-8x-__fW-022-fa250764 api 2 features wmi-10.x,has-wmi-mgmt-tx,mfp,txstatus-noack,wmi-10.x-CT,ratemask-CT,txrate-CT,get-temp-CT,tx-rc-CT,cust-stats-CT,retry-gt2-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT crc32 26a1777b
[   32.080996] firmware ath10k!QCA988X!hw2.0!board-2.bin: firmware_loading_store: map pages failed
[   32.090420] ath10k_pci 0000:01:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[   34.088464] ath10k_pci 0000:01:00.0: failed to receive control response completion, polling..
[   35.128464] ath10k_pci 0000:01:00.0: Service connect timeout
[   35.134298] ath10k_pci 0000:01:00.0: failed to connect htt (-110)
[   35.250231] ath10k_pci 0000:01:00.0: could not init core (-110)
[   35.256358] ath10k_pci 0000:01:00.0: could not probe fw (-110)

Have you added the pci interrupt patch to your kernel and pci controller splitting?

This looks like my mutex lock issue which was gone in my tests after adding these 2 Patches and reboot

I’m not sure whether openwrt include the pci interrupt patch and pci controller splitting. Could you please give me the patch info to me? My linux kernel is 4.19.72.