[BPI-R2] Kernel Development

4.19 has second gmac…so put up eth1 first.

What happens if you add patches from 5.3-lima to 5.4?

I found this in drivers/thermal/mtk_thermal.c . Commented out returnvalue, then recompile modules and cputemps works. Hmm, 5.4.12 run hotter (50C) than 4.19.

Noticed also hdparm -Tt /dev/sda

/dev/sda: Timing cached reads: 1442 MB in 2.00 seconds = 721.12 MB/sec Timing buffered disk reads: 640 MB in 3.00 seconds = 213.19 MB/sec

So cache runs faster than 4.19 cache (~500MB/s).

direct after boot i have:

root@bpi-r2:~# cat /sys/class/thermal/thermal_zone0/temp                        
28442

tried adding lima patches but don’t see anything in dmesg…

dts contains compatibles “mediatek,mt7623-mali” and “arm,mali-450”

the second should be picked up by driver

./drivers/gpu/drm/lima/lima_drv.c:346: { .compatible = "arm,mali-450", .data = (void *)lima_gpu_mali450 },

0004-defconfig-add-lima-driver.patch (710 Bytes) 0003-defconfig-add-CONFIG_VIDEO_MEDIATEK_JPEG.patch (924 Bytes) 0002-arm-dts-drop-larb3.patch (1,5 KB) 0001-arm-dts-mt7623-add-Mali-450-device-nodes.patch (2,5 KB)

Oh, forgot that I say rc-update del net.eth1 because it was incompatible with 5.4.12. I’ll test it now. Yes. It works…!

So I should test 5.3-lima first to see how it works…? Taking patch and putting them in newer kernel is something I not yet have skills to do(…?)

Based 4.19 mali/lima, 4.20-lima, 5.4.12 mali/lima, and Arm mali 450 drivers + 4.19, there is no mali chip found. So I think something is wrong. Maybe mt7623 need some special init before mali starts to work…? I’ll try compile ARM mali driver with debug mode. Maybe it gives some hints… Well it is not very helpful:

[ 1348.097924] mali: loading out-of-tree module taints kernel. [ 1348.148917] Mali<2>: [ 1348.148929] Inserting Mali v900 device driver. [ 1348.148937] Mali<2>: [ 1348.148940] Compiled: Jan 16 2020, time: 22:15:35. [ 1348.148943] Mali<2>: [ 1348.148945] Driver revision: r10p0-00rel0 [ 1348.148947] Mali<2>: [ 1348.148948] mali_module_init() registering driver [ 1348.149234] Mali: [ 1348.149238] Mali device driver loaded

There is these lines in readme: The kernel needs to be provided with a platform_device struct for the Mali GPU device. See the mali_utgard.h header file for how to set up the Mali GPU resources. In that file is so much defines to addresses that I can’t do anything. Need some mt7623 mali manual to check everything is correct…?

That will be a start…if it detects mali-chip you can try patches from my previous post on top of 5.4-main…i only skipped documentation patch because it is incompatible (moved from txt to yaml). I don’t know how to include it the right way

During night it compiles 5.3 and there is something in dmesg:

[    5.279750] lima 13040000.gpu: get core clk failed -517
[    5.285065] lima 13040000.gpu: clk init fail -517
[    5.289776] lima 13040000.gpu: Fatal error during GPU init
[    7.471625] lima 13040000.gpu: get core clk failed -517
[    7.477001] lima 13040000.gpu: clk init fail -517
[    7.481801] lima 13040000.gpu: Fatal error during GPU init
[    7.871798] lima 13040000.gpu: get core clk failed -517
[    7.884729] lima 13040000.gpu: clk init fail -517
[    7.897048] lima 13040000.gpu: Fatal error during GPU init
[    7.943544] lima 13040000.gpu: get core clk failed -517
[    7.956430] lima 13040000.gpu: clk init fail -517
[    7.968647] lima 13040000.gpu: Fatal error during GPU init
[   18.407713] lima 13040000.gpu: get core clk failed -517
[   18.407730] lima 13040000.gpu: clk init fail -517
[   18.407737] lima 13040000.gpu: Fatal error during GPU init
[   18.484041] lima 13040000.gpu: get core clk failed -517
[   18.484056] lima 13040000.gpu: clk init fail -517
[   18.484063] lima 13040000.gpu: Fatal error during GPU init
[   18.611961] lima 13040000.gpu: get core clk failed -517
[   18.611974] lima 13040000.gpu: clk init fail -517
[   19.304542] lima 13040000.gpu: get core clk failed -517
[   19.304556] lima 13040000.gpu: clk init fail -517
[   19.304564] lima 13040000.gpu: Fatal error during GPU init
[   18.611982] lima 13040000.gpu: Fatal error during GPU init

There is also line that like to see in other kernels: [ 6.795336] [drm] forcing HDMI-A-1 connector on

in 5.3-lima build.sh is broken (dpkg not found)

Anyway duckducking error message gives this:

So need to read all and transfer lima talk to correct thread or keep it in frank kernel?? I think it is good to get default kernel support lima??

at least it would be better using separate thread…

build.sh is not broken…only not adjusted for non-debian systems :stuck_out_tongue:

just patch out the checkdeps-function and you should can use it

just leave only “return 0” line inside this function

It works in 4.19 and 5.4. I can do by hand where it don’t work. Ofcourse it is posible to “emerge” dpkg to system or copy newer build.sh from 5.4… I’m quite new with R2 and gentoo. Moustly used dpkg based systems… For R2 gentoo is good to take all optimizations from hardware…

Back to lima, so it seems that @JohnnyWednesday have not shared codes yet…?

ARM offical driver fail to compile in 5.3: driver/src/devicedrv/mali/linux/mali_osk_time.c:57:2: error: implicit declaration of function ‘get_monotonic_boottime’; did you mean ‘getboottime’? [-Werror=implicit-function-declaration] get_monotonic_boottime(&tsval);

Maybe easy to fix but don’t know enough from kernel functions so don’t know is suggested substitution ok…?

Edit: Substitution seems to be ok, but there rises more errors so this driver is for 4.19 etc. kernels only /or someone needs to hack needed fixes. Maybe ARM people in future?

So lima is near to functional only some inits is missing…?

maybe build.sh is broken there…just use 5.4-main with patches i posted above… then you have same state (except doc-patch). and you don’t need to care about build.sh…use 5.3-lima/4.20-mali only as reference. do not spend any additional work to these older branches

and yes, i still did not get any code from johnny…i asked multiple times, but none yet…else i had included it in my repo anyhow.

so start your work on 5.4 and try to get it working there…

I just found that your 4.20-lima dosn’t configure by default CONFIG_DRM_LIMA. When add it to configuration compilation dosn’t work:

drivers/gpu/drm/lima/lima_drv.c: In function ‘lima_ioctl_gem_submit’:
drivers/gpu/drm/lima/lima_drv.c:105:10: error: ‘struct drm_lima_gem_submit_in’ has no member named ‘flags’
  if (args->flags & ~(LIMA_SUBMIT_FLAG_EXPLICIT_FENCE |
          ^~
drivers/gpu/drm/lima/lima_drv.c:105:22: error: ‘LIMA_SUBMIT_FLAG_EXPLICIT_FENCE’ undeclared (first use in this function); did you mean ‘LIMA_SUBMIT_BO_WRITE’?
  if (args->flags & ~(LIMA_SUBMIT_FLAG_EXPLICIT_FENCE |

In 4.19 there is no such option. I just try compile Alex 4.16 and it compile gpu part ok with CONFIG_DRM_LIMA=y. Maybe you can get patches from it on drop then 4.19-main? (or 4.19-lima?)

I have not tested it yet, need compile rest & modules & reboot…

I keep important that there is atleast one lima/mali working kernel that can use comparsion. 5.4 is good direction but need to start from working codebase?
And 2nd I have not yet skills to get patches from github and put in new kernel. Maybe some day…

in 5.3.0-rc1-bpi-r2 there is severe error:

[22176.859874] Buffer I/O error on dev sda2, logical block 0, lost sync page write
[22176.859895] EXT4-fs (sda2): I/O error while writing superblock
[22176.860024] EXT4-fs error (device sda2): __ext4_find_entry:1531: inode #7355111: comm make: reading directory lblock 0
[22176.860078] Buffer I/O error on dev sda2, logical block 0, lost sync page write
[22176.860097] EXT4-fs (sda2): I/O error while writing superblock
[22176.860257] EXT4-fs error (device sda2): __ext4_find_entry:1531: inode #7092414: comm make: reading directory lblock 0
[22176.860316] Buffer I/O error on dev sda2, logical block 0, lost sync page write
[22176.860337] EXT4-fs (sda2): I/O error while writing superblock
[22176.860475] EXT4-fs error (device sda2): __ext4_find_entry:1531: inode #7881299: comm make: reading directory lblock 0
[22176.860529] Buffer I/O error on dev sda2, logical block 0, lost sync page write
[22176.860550] EXT4-fs (sda2): I/O error while writing superblock
[22176.860675] EXT4-fs error (device sda2): __ext4_find_entry:1531: inode #7223390: comm make: reading directory lblock 0
[22176.860730] Buffer I/O error on dev sda2, logical block 0, lost sync page write
[22176.860750] EXT4-fs (sda2): I/O error while writing superblock
[22176.860867] EXT4-fs error (device sda2): __ext4_find_entry:1531: inode #8560318: comm make: reading directory lblock 0
[22176.860921] Buffer I/O error on dev sda2, logical block 0, lost sync page write
[22176.860941] EXT4-fs (sda2): I/O error while writing superblock

Need to boot 4.19 & do fsck

is @DeadMeat s 4.16-lima working? imho no public repo had working lima…but you can test it and report if it’s working and compare to 5.4-lima

It is not working and wlan&BT stuff need to disable because compile error. Lima dosn’t detect, same error than 5.3-lima:

[    1.238006] lima 13040000.gpu: get core clk failed -517
[    1.243301] lima 13040000.gpu: clk init fail -517
[    1.247977] lima 13040000.gpu: Fatal error during GPU init
[    3.415826] lima 13040000.gpu: get core clk failed -517
[    3.421189] lima 13040000.gpu: clk init fail -517
[    3.425974] lima 13040000.gpu: Fatal error during GPU init
[   12.891693] lima 13040000.gpu: get core clk failed -517
[   12.891708] lima 13040000.gpu: clk init fail -517
[   12.891715] lima 13040000.gpu: Fatal error during GPU init
[   12.907644] lima 13040000.gpu: get core clk failed -517
[   12.907658] lima 13040000.gpu: clk init fail -517
[   12.907665] lima 13040000.gpu: Fatal error during GPU init
[   12.975271] lima 13040000.gpu: get core clk failed -517
[   12.975288] lima 13040000.gpu: clk init fail -517
[   12.975294] lima 13040000.gpu: Fatal error during GPU init
[   13.004238] lima 13040000.gpu: get core clk failed -517
[   13.004255] lima 13040000.gpu: clk init fail -517

Were it try to get gpu clock, from dts??

It should give lines like:

[    8.492918] lima 13040000.gpu: bus rate = 500500000
[    8.492930] lima 13040000.gpu: mod rate = 500500000

please make separate lima-thread (maybe any exists already).

where did you get the lines? as i said, there is no working lima-kernel, so you can start with 5.4-main and my above patches and start debugging there…clocks and other setting are selected by dts (read and assigned by driver)

These lima lines are from Alex first post Mali-450 support by lima

So need to dig dts and put somewhere 50050000 and 500500000. They are maybe hex or converted decimal by driver? Maybe in mt7623n-bananapi-bpi-r2.dts? or mt7623.dtsi?

i guess there are hex…and imho it’s better to continue this thread and asking alex…

No, pls, see Mali-450 support by lima thread

Which compile-errors and which compiler/version? Imho it should compile till gcc 8 without errors

BPI-R2-4.14-4.20-lima

drivers/gpu/drm/lima/lima_drv.c: At top level: ./include/drm/drm_ioctl.h:159:16: error: ‘DRM_IOCTL_LIMA_GEM_MOD’ undeclared here (not in a function); did you mean ‘DRM_IOCTL_LIMA_GEM_VA’? [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \

And gcc 7.3 CONFIG_COMMON_CLK_MT2701_G3DSYS=y CONFIG_DRM_LIMA=y

i meant why you need to disable wifi/bt…in my tree there is no working lima…only tests…so just start with 5.4-main, and further discuss in lima-thread

Lost more more time, of try to compile kernel from sources under MacOS Catalina… Maybe anybody need for notes how to do it: In my MacOS, by default system volume AFPS with case insensitive (WTF???), when receive from git or unzip, I received answer of need to rewrite some files: xt_connmark.h xt_dscp.h xt_mark.h xt_rateest.h xt_tcpmss.h ipt_ecn.h ipt_ttl.h ip6t_hl.h xt_dscp.c xt_hl.c xt_rateest.c xt_tcpmss.c but agree to rewrite. Them I don`t understand why received errors while try to compile kernel… WHAT TO DO: create virtual volume(dmg file) 5Gb size with CASE SENSITIVE from Disk Utility, and work with kernel sources in this Volume. Start compile from docker container under MacOS: Mount your created volume(dmg file) and run:

  1. docker build /Volumes/$NAME_YOUR_VOLUME/$KERNEL_SOURCES/utils/docker --tag bpi-cross-compile:1
  2. mkdir /Volumes/$NAME_YOUR_VOLUME/$KERNEL_SOURCES/SD
  3. docker run -it -v “/Volumes/$NAME_YOUR_VOLUME/$KERNEL_SOURCES/SD”:/SD -v “/Volumes/$NAME_YOUR_VOLUME/$KERNEL_SOURCES”:/srv --tag bpi-cross-compile:1 /bin/bash
  4. And in docker run: ./build.sh importconfig || ./build.sh
1 Like