Khadas vim3 general questions

Hi everyone.
I have a problem with the suspend in the vim3, when I run systemctl suspend it get freeze and I have to restart the board to make it work again.
I already enable all modules from the kernel but, I think I’m missing something, maybe some config in the device-tree or u-boot.

Thank you,
Frank

Hello @Veins_of_Games

Could you tell us which image you used?

Thanks.

Hi @numbqq

I’m using Buildroot to create a custom minimal Linux version with kernel 6.3.

For testing purposes, I use the Ubuntu 24.04 Base Image, and the suspend functionality works perfectly there. This leads me to believe I might be missing something, possibly in the kernel configuration or the device tree source (DTS).

You use the 6.x kernel which is from the upstream, maybe have issues with the suspend. Can you also check with 6.9 kernel ?

Thank you @numbqq for your answer.

I installed kernel 6.9 successfully, and it suspends correctly. The problem now is that it freezes when I wake it up again. Here are the logs:

**--SUSPEND SYSTEM---**
# systemctl suspend
# [  169.036911] PM: suspend entry (deep)
[  169.168478] Filesystems sync: 0.131 seconds
[  169.168940] Freezing user space processes
[  169.172017] Freezing user space processes completed (elapsed 0.000 seconds)
[  169.177975] OOM killer disabled.
[  169.181172] Freezing remaining freezable tasks
[  169.186834] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[  169.192969] printk: Suspending console(s) (use no_console_suspend to debug)
bl30 get wakeup sources!
process command 00000006
bl30 enter suspend!
Little core clk suspend rate 1000000000
Big core clk suspend rate 24000000
store restore gp0 pll
suspend_counter: 1
Enter ddr suspend
ddr suspend time: 15us
alarm=0S
process command 00000001
cec ver:2018/04/29
CEC cfg:0x0000
use vddee new table!
**---END SUSPEND---**

**---WAKE UP---**
use vddee new table!
exit_reason:0x06
Enter ddr resume
ddr resume time: 121us
store restore gp0 pll
cfg15 3b00000
cfg15 63b00000
Little core clk resume rate 1000000000
Big core clk resume rate 50000000
[  169.226893] rtc-hym8563 0-0051: no valid clock/calendar values available
[  169.353447] Disabling non-boot CPUs ...
[  169.355371] psci: CPU1 killed (polled 0 ms)
[  169.357719] psci: CPU2 killed (polled 0 ms)
[  169.359917] psci: CPU3 killed (polled 4 ms)
[  169.362407] psci: CPU4 killed (polled 0 ms)
[  169.363924] psci: CPU5 killed (polled 4 ms)
[  169.364897] Enabling non-boot CPUs ...
[  169.365325] Detected VIPT I-cache on CPU1
[  169.365400] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[  169.366030] CPU1 is up
[  169.366867] Detected VIPT I-cache on CPU2
[  169.366928] arch_timer: CPU2: Trapping CNTVCT acc

**Get freeze right here.**

Hey @numbqq, any news about this?
Thank you!

Hello @Veins_of_Games

Sorry for the late reply, this maybe an issue of the Mainline kernel, need to dig more about it.

Hi @numbqq
I noticed in the downstream kernel that there is a configuration option, AMLOGIC_GX_SUSPEND, which is not present in the mainline kernel. Could this be the reason why suspend is not working correctly for me?

Additionally, to compile the downstream kernel (GitHub - khadas/linux: Linux kernel for Khadas VIMs & Edges) , branch khadas-vims-5.4.y should I use the Fenix tool, or can I compile it directly? I tried to do it using the Buildroot toolchain, but I encountered errors from drivers, so I am unsure how to compile this kernel directly.

It is easy to use fenix to build the kernel, anyway, you can build kernel directly, but you need to setup the toolchains. And you can follow the steps:

export PATH=$KERNEL_COMPILER_PATH:$PATH
make ARCH=arm64 CROSS_COMPILE="${KERNEL_COMPILER}" kvims_defconfig
make -j8 ARCH=arm64 CROSS_COMPILE="${KERNEL_COMPILER}" Image dtbs  modules

You need to setup:

  • KERNEL_COMPILER_PATH
  • KERNEL_COMPILER

Thank you @numbqq for the guidance on building the kernel. I have a couple of questions:

  1. Which toolchain should I use for this process?
  2. Can I compile from a WSL, or do I need to use an Ubuntu host machine? Is Ubuntu 24.04 okay for this purpose?

Thank you!

For Fenix, we use gcc-arm-aarch64-none-linux-gnu-mainline-12.2.rel1.

WSL not tested, but for Ubuntu it should be fine.

Thank you @numbqq I have tried everything, but I am still unable to run the Khadas kernel on my Buildroot setup. I’m running out of options, and we really want to use the VIM3 in our product, as suspend functionality is crucial for our project. Do you have any suggestions on how to get suspend working?

Hi @numbqq
I was able to run Buildroot with the kernel khadas-vims-6.1.y and U-Boot 2021.04. Now, I have encountered a different error. I’m quite confident that I’m close to resolving the issue since I’m using the same kernel and U-Boot as the Ubuntu image (vim3-ubuntu-22.04-server-linux-6.1-fenix-1.4-221229.img) where suspend works perfectly.

I get this error, check:

# systemctl suspend
# [  118.508183] PM: suspend entry (deep)
[  118.594141] Filesystems sync: 0.085 seconds
[  118.597255] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  118.599809] OOM killer disabled.
[  118.603012] Freezing remaining freezable tasks ... (elapsed 0.000 seconds) done.
[  118.611279] meson-gx-mmc ffe03000.sd: missing suspend/resume ops for non-removable SDIO card
[  118.744802] rtc-hym8563 4-0051: no valid clock/calendar values available
[  118.747106] Disabling non-boot CPUs ...
[  118.751271] psci: CPU1 killed (polled 0 ms)
[  118.755435] psci: CPU2 killed (polled 0 ms)
[  118.759479] psci: CPU3 killed (polled 0 ms)
[  118.763578] psci: CPU4 killed (polled 0 ms)
[  118.767977] psci: CPU5 killed (polled 4 ms)
bl30 get wakeup sources!
process command 00000006
bl30 enter suspend!
Little core clk suspend rate 1000000000
Big core clk suspend rate 24000000
store restore gp0 pll
suspend_counter: 1
Enter ddr suspend
DMC_DRAM_STAT11: 0x544
ddr suspend time: 2177us
alarm=0S
process command 00000001
cec ver:2018/04/29
CEC cfg:0x0000
use vddee new table!
customer pwrkeys for IR is NULL, use defaults!

The line [ 118.611279] meson-gx-mmc ffe03000.sd: missing suspend/resume ops for non-removable SDIO card seems to be the problem.

Do you have any idea on how to solve this or why I am encountering this error?

Thank you for your assistance!

Best regards,
Franco

Hello @Electr1

Could you help to check this issue?

Cheers.

1 Like

@Veins_of_Games Is this log from your buildroot image ?
Are you running it from eMMC or SD card.

Hi!
Yes,this is from my buildroot image, and right now I’m working with SD card

Could you try running the image from the eMMC to see if it works fine ?

Ok, now it’s booting from the eMMC and I have the same error:

# systemctl suspend
# [   10.275778] PM: suspend entry (deep)
[   10.300628] Filesystems sync: 0.024 seconds
[   10.314478] Freezing user space processes ... (elapsed 0.000 seconds) done.
[   10.316532] OOM killer disabled.
[   10.319745] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[   10.327268] meson-gx-mmc ffe03000.sd: missing suspend/resume ops for non-removable SDIO card
[   10.362202] rtc-hym8563 4-0051: no valid clock/calendar values available
[   10.364262] Disabling non-boot CPUs ...
[   10.368689] psci: CPU1 killed (polled 0 ms)
[   10.372813] psci: CPU2 killed (polled 0 ms)
[   10.376828] psci: CPU3 killed (polled 0 ms)
[   10.380945] psci: CPU4 killed (polled 0 ms)
[   10.385384] psci: CPU5 killed (polled 0 ms)
bl30 get wakeup sources!
process command 00000006
bl30 enter suspend!
Little core clk suspend rate 1000000000
Big core clk suspend rate 24000000
store restore gp0 pll
suspend_counter: 1
Enter ddr suspend
ddr suspend time: 15us
alarm=0S
process command 00000001
cec ver:2018/04/29
CEC cfg:0x0000
use vddee new table!

-----------------------END SUSPEND ----------------------

 ----------------------START WAKE UP  ----------------------

use vddee new table!
exit_reason:0x06
Enter ddr resume
ddr resume time: 123us
store restore gp0 pll
cfg15 3b00000
cfg15 63b00000
Li[   10.388681] Enabling non-boot CPUs ...
[   10.389164] Detected VIPT I-cache on CPU1
[   10.389259] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[   10.389749] CPU1 is up
[   10.400635] Detected VIPT I-cache on CPU2
[   10.400720] CPU2: Booted secondary processor 0x0000000100 [0x410fd092]
[   10.401049] cpufreq: cpufreq_online: CPU2: Running at unlisted initial frequency: 2100000 KHz, changing to: 2108000 KHz
[   10.421371] CPU2 is up
[   10.423480] Detected VIPT I-cache on CPU3
[   10.423526] CPU3: Booted secondary processor 0x0000000101 [0x410fd092]
[   10.423843] CPU3 is up
[   10.436224] Detected VIPT I-cache on CPU4
[   10.436270] CPU4: Booted secondary processor 0x0000000102 [0x410fd092]
[   10.436594] CPU4 is up
[   10.448983] Detected VIPT I-cache on CPU5
[   10.449029] CPU5: Booted secondary processor 0x0000000103 [0x410fd092]
[   10.449383] CPU5 is up
[   10.464604] rtc-hym8563 4-0051: no valid clock/calendar values available
ttle core clk resume rate 1000000000
Big core clk resume rate 50000000
[   10.835925] OOM killer enabled.
[   10.836150] Restarting tasks ... done.

- -----------------------END WAKE UP AND GET FREEZE  ------------------------

Ok I found the problem, it was the scaling governor, the default has to be set on performance, now it suspend and resumes perfect.

Thank you all for your time and help!

2 Likes

Ok guys I have bad news, it seems the wake up works well but, it laggy the complete system, I tried with the official Ubuntu images provided by Khadas and it have the same behavior, the wake up lag the complete system.

Any idea on how to solve it?