Mali-450 support by lima

I have no idea is it posible. By definition regulator is power supply that can be controlled or not. So if I understand correct then CPU main regulator is used to power CPU and GPU at same. It can be controlled with cpu mhz settings, in beginning of .dtsi file. I have no idea how kernel software regulator framework work. It maybe posible that framework is just right place to power/unpower gpu. But it can power on when module loads on unpower when unloads. Is it enough?

:thinking: Very strange, because R2’s mali has no pmu :sunglasses:

[   11.496536] lima 13040000.gpu: IRQ pmu not found

But without devmem or writel? And what does ./devmem2 0x1000301C sows?

I can try without them…had also changed to module and maybe added regulator at same time. At least 5.4 works at boot-time,4.19 needs module reload

edit: ok, works without pmu-patch in 5.4

My current lima module dosn’t need devmem tweak because it do it alone (writel). After module unload it restore gpu poweroff. It is good enough for me.

But module need to be loaded twice, first time it fails in dte write test second time it success. I tryed in module code load it twice but it don’t work yet. It crash:

WARNING: CPU: 1 PID: 655 at drivers/reset/core.c:419 __reset_control_get_internal+0xf8/0x10c

And there is unbalanced_pm runtime error

devmem2 0x1000301C
00000FFE
rmmod lima
devmem2 0x1000301C
00000FFE

Hmm, new bug before twice-load code it worked, need to check, maybe 
just find why twice loading dosn't work..

Found atleast one bug, in: lima_pdev_probe

err_out1:
        drm_dev_unref(ddev);
err_out0:
        lima_device_fini(ldev);

Was error handling in wrong order. I think first need to remove drm_dev, then shutdown others.

There is something odd in error handling. Changing order result unbootable system. Ok there is drm_dev_unregister / drm_dev_register pair and need to test:

err_out1:
        drm_dev_unregister(ddev);
err_out0:
        lima_device_fini(ldev);
        drm_dev_unref(ddev);

It dosn’t like it then crash whole module. Need to strip powermanagement stuff away and put it orginal order. It is sure it leaves something behaind when error occur.

fixed in 5.4

323 err_out2:
324         lima_device_fini(ldev);
325 err_out1:
326         drm_dev_put(ddev);
327 err_out0:
328         lima_sched_slab_fini();
329         return err;

Now when cleaning powermanagement and unneeded stuff then:

Boot, lima loads and fails
devmem2 0x1000301C
00000FFE
rmmod lima
devmem2 0x1000301C
00000FFE
modprobe lima (success)
devmem2 0x1000301C
00000FFE
rmmod lima
devmem2 0x1000301C
00000FFF
modprobe lima (success)
devmem2 0x1000301C
00000FFE
rmmod lima
devmem2 0x1000301C
00000FFF
etc..

So poweroff/on works when module loads/unloads without error. Error handling is broken. It may explain why second modprobe success.

And there is no definition in whole kernel tree GCPU poweron/poweroff/status register/bits. Only GCPU reset bit is defined. It maybe posible to tweak through pericfg somehow but I don’t know how to do it.

And Frank you can grep “ioremap” from device tree and grep “writel” from device tree and see how common they are. It is normal way to do things. If don’t like it then try implement some regulator stuff. I don’t do extra work. Lima in my 4.19-main tree is usable enough. I’ll continue back to llvm & clang lima support etc.

Can you show your current changes?

Ofcourse. Previous changes are documented in my posts, only lima_device.c is undocumented:

void lima_device_fini(

        int i;
        #ifdef CONFIG_MTK_COMBO_CHIP_CONSYS_7623
        void __iomem *powerdown_register;
        #endif
--clip--
        lima_ttm_fini(ldev);

        #ifdef CONFIG_MTK_COMBO_CHIP_CONSYS_7623
        powerdown_register = ioremap(0x1000300C , 0x04); // powerdown register
        writel(0x00000001,powerdown_register); // this may be wrong, may need bitbang 0th bit to 1
        iounmap(powerdown_register);
        #endif

Just wondering, is it a power-supply option(what if SoC can do that, and i dont know :wink: )?

BTW, to start X server i had to add:

bpi-r2-gentoo ~ # cat /etc/X11/xorg.conf.d/40-serverflags.conf 
Section "ServerFlags"
        Option "AutoAddGPU" "off"
EndSection

Otherwise it shows:

[ 30369.505] (EE) Cannot run in framebuffer mode. Please specify busIDs        for all framebuffer devices

Also if someone know how to specify busID on arm, without PCI, please share your knowledge :slight_smile:

hi,

bootup without fixed regulator but with eros register-code seems to work, lima gets initialized.

power consumption goes to 9.4w, but does not go down on unload module…Register is 0xFFF again

x-server does not start too :frowning: same error about busIds

Try serverflags - it was sufficient for me.

I find:

On systems where both an integrated GPU and a PCI slot are present, setting the "BusID" option to "AXI" selects the integrated GPU. 

Have anybody idea in gentoo I try to emerge mesa 19.3.2 and set VIDEO_CARDS=“lima” but ebuilds show lima unactive (-lima). How to debug it?

Also masked succesfully llvm:9 and it build 9hrs. But cant get clang:9 masked correctly. How get package debencys from clang:9 so get all needed to masked???

Intresting maybe need to ask from Mediatek why their poweroff register dosn’t effect power consumption. Who is correct person?

Btw what you use to get wattage? Simple multimeter…? Some ina219…?

It is a basic wattmeter reichelt kd-302:

https://m.reichelt.de/Energiemessgeraete/KD-302/6/index.html?ACTION=6&GROUPID=4033&ARTICLE=88135

It seems there is no english manual…

i know only @ryder.lee working on lima (and some other in graphics-hdmi related)…maybe he can ask other from gpu-team.

Hmm it seems to be command: equery depgraph clang. And in my case need to mask sys-libs/compiler-rt-9.0.1 and sys-libs/compiler-rt-sanitizers-9.0.1 and sys-libs/libomp-9.0.1 ~arm

sys-libs/libcxx seems to be in remove list and posible unneeded pack. How to remove it from clang:9 depencys. Brr…

Ok I got idea I can buy similiar for 15eur or something. There is also posibility to use INA219 and monitor board 12V consumption. It gives some more decimals. It can be handy if power board from 12v battery (UPS), solar systems etc.

Btw based avatar icon Ryder maybe she?

i don’t think so… https://www.linkedin.com/in/ryder-lee-87188a138/

i hope he read it…was not online here in forum since mid december

btw. debian have no xorg.conf…i tried to gernate one by using this commands…but get this error:

No devices to configure.  Configuration failed.                                 
(EE) Server terminated with error (2). Closing log file.

if i run startx/lightdm start, my x-server is running well

added folder and file for this

mkdir /etc/X11/xorg.conf.d
nano /etc/X11/xorg.conf.d/20-dri.conf

with this content

Section "ServerFlags"
  Option "AutoAddGPU" "off"
#  Option "BusID" "AXI" 
EndSection

this is Alex’ way…can’t get the BusId working…seems it have to be in device-section…but i have none and don’t know how to define it the right way (needs also driver)

try to add device section with busid

Section "Device"
   Identifier   "My Graphics Card"
   Driver       "lima"
   ...
EndSection