Assistance needed getting Alpine onto s905x/s905x-v2

The distro server images are confirmed working. There’s another problem with your setup if they don’t boot. Either you’re flashing incorrectly or the power is insufficient.

That’s what log I had. It is not working consistently, and the HDMI output fails every time. And the Raspbian image does not consistently boot. Given it’s multiple SD cards, up to 7.5A available, and the same writing tools I use with success daily, you’d have to tell me why. It either dies in EFI, or if EFI goes relatively slow, it has about a 50/50 shot of dying at RTC. Could be contacts need cleaned from all the swapping of SD cards, could be I’m hitting a weird firmware fault? I don’t know.

Anyways, regardless of all that, I have successful bring-up as of this afternoon. But I’m getting a crash and I’m presuming the information I need’s behind NDA.

GXL:BL1:9ac50e:bb16dc;FEAT:ADFC318C:0;POC:0;RCY:0;USB:0;SPI:0;CHK:A7;EMMC:400;NAND:81;SD:0;READ:0;0.0;CHK:0;
no sdio debug board detected 
TE: 1806370

BL2 Built : 15:21:18, Aug 28 2019. gxl g1bf2b53 - luan.yuan@droid15-sz

set vcck to 1120 mv
set vddee to 1000 mv
Board ID = 3
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
DDR3 chl: Rank0+1 @ 912MHz
bist_test rank: 0 1a 04 31 27 13 3c 17 00 2f 2b 14 43 17 00 2f 28 12 3f 18 01 2f 2b 14 42 693  rank: 1 18 06 2b 26 12 3b 16 00 2d 2b 14 43 18S

Rank0: 1024MB(auto)-2T-13

Rank1: 1024MB(auto)-2T-13
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x00004000, part: 0
New fip structure!
Load bl30 from SD, src: 0x00010200, des: 0x013c0000, size: 0x0000d600, part: 0
Load bl31 from SD, src: 0x00020200, des: 0x05100000, size: 0x0001b800, part: 0
Load bl33 from SD, src: 0x0003c200, des: 0x01000000, size: 0x00086a00, part: 0
NOTICE:  BL31: v1.3(release):c3714b49be
NOTICE:  BL31: Built : 09:23:36, Jun 20 2023. gxl bl-3.5.0 gc3714b49be - jenkins@walle02-sh
NOTICE:  BL3-1: GXL normal boot!
NOTICE:  BL31: BL33 decompress pass
mpu_config_enable:system pre init ok
OPS=0x84
dmc sec lock
[Image: gxl_v1.1.3509-d977ed20a4 2023-06-20 09:43:46 jenkins@walle02-sh]
21 0d 84 00 92 31 1d 4a 8a 1d 30 96 80 89 47 92 
[2.373746 Inits done]
secure task start!
high task start!
low task start!
ERROR:   Error initializing runtime service opteed_fast


U-Boot 2023.07+ (Jul 25 2023 - 14:59:49 -0400) Libre Computer AML-S905X-CC

Model: Libre Computer AML-S905X-CC
SoC:   Amlogic Meson GXL (S905X) Revision 21:d (84:2)
DRAM:  2 GiB
Core:  175 devices, 30 uclasses, devicetree: separate
WDT:   Not starting watchdog@98d0
MMC:   mmc@72000: 1, mmc@74000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc1:1... 
Error (-2): cannot determine file size
[BL31]: tee size: 0
[BL31]: tee size: 0
starting USB...
Bus usb@c9000000: dwc3_meson_gxl_get_phys: usb2 ports: 2
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus usb@c9000000 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
Scanning for bootflows in all bootdevs
Seq  Method       State   Uclass    Part  Name                      Filename
---  -----------  ------  --------  ----  ------------------------  ----------------
Scanning global bootmeth 'efi_mgr':
Scanning bootdev 'mmc@74000.bootdev':
Scanning bootdev 'mmc@72000.bootdev':
  0  extlinux     ready   mmc          1  mmc@72000.bootdev.part_1  /extlinux/extlinux.conf
** Booting bootflow 'mmc@72000.bootdev.part_1' with extlinux
1:      Linux Alpine 3.18
Retrieving file: /extlinux/../vmlinuz-lts
Retrieving file: /extlinux/../initramfs-lts
... all normal, nothing out of sorts or unusual ...
[    1.108142] irq_meson_gpio: 110 to 8 gpio interrupt mux initialized
[    1.154439] soc soc0: Amlogic Meson GXL (S905X) Revision 21:d (84:2) Detected
    1.167628] c81004c0.serial: ttyAML0 at MMIO 0xc81004c0 (irq = 18, base_baud = 1500000) is a meson_uart
^^^ obviously things are looking good here
... more normal ...
[    1.346428] Run /init as init process
[    1.398678] Alpine Init 3.8.1-r0
[    1.399945] Loading boot drivers...
[    1.428891] loop: module loaded
[    1.457164] SCSI subsystem initialized
[    1.534959] usbcore: registered new interface driver usbfs
[    1.535106] usbcore: registered new interface driver hub
[    1.540222] usbcore: registered new device driver usb
[    1.557531] usbcore: registered new interface driver usb-storage
[    1.693580] [drm] Initialized simpledrm 1.0.0 20200625 for 7fe5b000.framebuffer on minor 0
[    1.697272] fbcon: Deferring console take-over
[    1.700644] simple-framebuffer 7fe5b000.framebuffer: [drm] fb0: simpledrmdrmfb frame buffer device
[    1.724094] Loading boot drivers: ok.
[    1.731453] Mounting boot media...
[    2.036945] meson-gx-mmc d0072000.mmc: Got CD GPIO
[    2.107238] mmc0: new high speed SDHC card at address 5048
!!! Reproducible crash occurs here !!!
[    2.136138] lima d00c0000.gpu: gp - mali450 version major 0 minor 0
[    2.136957] lima d00c0000.gpu: pp0 - mali450 version major 0 minor 0
[    2.143216] lima d00c0000.gpu: pp1 - mali450 version major 0 minor 0
[    2.149463] lima d00c0000.gpu: pp2 - mali450 version major 0 minor 0
[    2.155712] lima d00c0000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[    2.163788] lima d00c0000.gpu: l2 cache 64K, 4-way, 64byte cache line, 128bit external bus
[    2.172599] lima d00c0000.gpu: bus rate = 166666667
[    2.176862] lima d00c0000.gpu: mod rate = 24000000
[    2.181735] lima d00c0000.gpu: error -ENODEV: _opp_set_regulators: no regulator (mali) found
[    2.198989] lima d00c0000.gpu: devfreq_add_device: Unable to find governor for the device
[    2.201699] lima d00c0000.gpu: Couldn't initialize GPU devfreq
[    2.207334] lima d00c0000.gpu: Fatal error during devfreq init
[    2.213424] lima: probe of d00c0000.gpu failed with error -22
[    2.219685] Internal error: synchronous external abort: 0000000096000210 [#1] SMP <-----
[    2.226198] Modules linked in: lima(+) gpu_sched meson_gx_mmc mmc_core gpio_regulator display_connector simpledrm drm_shmem_helper drm_kmsp
[    2.256642] CPU: 2 PID: 506 Comm: nlplug-findfs Not tainted 6.1.42-0-lts #1-Alpine
[    2.264144] Hardware name: Libre Computer AML-S905X-CC (DT)
[    2.269665] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    2.276564] pc : lima_pp_irq_handler+0x2c/0xf0 [lima]
[    2.281566] lr : free_irq+0x330/0x4c4
[    2.285189] sp : ffff80000a7fb7a0
[    2.288466] x29: ffff80000a7fb7a0 x28: ffff80000a7fbc00 x27: 0000000000000000
[    2.295538] x26: 0000000000000000 x25: ffff000073f8d268 x24: ffff0000741fac60
[    2.302611] x23: ffff0000741facdc x22: ffff0000741fad90 x21: 000000000000001c
[    2.309683] x20: ffff000073f8d080 x19: ffff000073f8d268 x18: 0000000000000000
[    2.316756] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[    2.323828] x14: 0000000000000000 x13: 32322d20726f7272 x12: 6520687469772064
[    2.330901] x11: 656c696166207570 x10: 0000000000000000 x9 : ffff800008153ad0
[    2.337974] x8 : ffff80000a7fb6a0 x7 : 0000000000000000 x6 : 0000000000000000
[    2.345046] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
[    2.352118] x2 : ffff80000ac4d02c x1 : ffff000073f8d268 x0 : 000000000000102c
[    2.359192] Call trace:
[    2.361608]  lima_pp_irq_handler+0x2c/0xf0 [lima]
[    2.366265]  free_irq+0x330/0x4c4
[    2.369541]  devm_irq_release+0x28/0x50
[    2.373336]  devres_release_all+0xe4/0x1ec
[    2.377390]  device_unbind_cleanup+0x24/0x84
[    2.381616]  really_probe+0x210/0x404
[    2.385239]  __driver_probe_device+0x84/0x17c
[    2.389551]  driver_probe_device+0x4c/0x134
[    2.393691]  __driver_attach+0x140/0x270
[    2.397573]  bus_for_each_dev+0x84/0xf4
[    2.401367]  driver_attach+0x34/0x60
[    2.404904]  bus_add_driver+0x1bc/0x274
[    2.408699]  driver_register+0x7c/0x170
[    2.412494]  __platform_driver_register+0x38/0x60
[    2.417151]  lima_platform_driver_init+0x34/0x1000 [lima]
[    2.422499]  do_one_initcall+0x60/0x29c
[    2.426294]  do_init_module+0x50/0x210
[    2.430003]  load_module+0x1c3c/0x21f0
[    2.433711]  __do_sys_init_module+0x1f8/0x230
[    2.438024]  __arm64_sys_init_module+0x28/0x50
[    2.442423]  invoke_syscall+0x8c/0x134
[    2.446131]  el0_svc_common.constprop.0+0x60/0x13c
[    2.450875]  do_el0_svc+0x40/0xe0
[    2.454153]  el0_svc+0x34/0xf4
[    2.457171]  el0t_64_sync_handler+0x114/0x140
[    2.461484]  el0t_64_sync+0x18c/0x190
[    2.465112] Code: d2820580 f9400a62 f9400274 8b000042 (b9400041) 
[    2.471147] ---[ end trace 0000000000000000 ]---
[    2.475716] note: nlplug-findfs[506] exited with irqs disabled
[  260.516242] random: crng init done <-- extremely long crng?
[ 1716.672770] mmc0: card 5048 removed <-- showing system still responsive after crash
[ 1848.576396] mmc0: new high speed SDHC card at address 5048

I have a feeling the solution to this is behind NDA, because it’s crashing due to lima_pp_irq_handler() being called after the mali init failure. The only cited workaround from the 5.x train was the ondemand governor, which is enabled in Alpine. (MESON is also a y at line 54.)

The behavior is definitely very odd to my eyes. I haven’t looked at the mali driver in depth before, but version major 0 version minor 0 looks like a failure populating the lima_device struct. Nominally I’d chalk it up to board failure but both boards do it. And so does Raspbian when it boots.

[    9.468171] [drm] Initialized meson 1.0.0 20161109 for d0100000.vpu on minor 0
[    9.480867] lima d00c0000.gpu: Looking up mali-supply from device tree
[    9.480888] lima d00c0000.gpu: Looking up mali-supply property in node /soc/apb@d0000000/gpu@c0000 failed
[    9.486709] lima d00c0000.gpu: gp - mali450 version major 0 minor 0
[    9.486807] lima d00c0000.gpu: pp0 - mali450 version major 0 minor 0
[    9.486900] lima d00c0000.gpu: pp1 - mali450 version major 0 minor 0
[    9.486981] lima d00c0000.gpu: pp2 - mali450 version major 0 minor 0
[    9.487027] lima d00c0000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[    9.487039] lima d00c0000.gpu: l2 cache 64K, 4-way, 64byte cache line, 128bit external bus
[    9.516525] lima d00c0000.gpu: bus rate = 166666667
[    9.516547] lima d00c0000.gpu: mod rate = 24000000
[    9.516708] lima d00c0000.gpu: Looking up mali-supply from device tree
[    9.516723] lima d00c0000.gpu: Looking up mali-supply property in node /soc/apb@d0000000/gpu@c0000 failed
[    9.516754] lima d00c0000.gpu: error -ENODEV: _opp_set_regulators: no regulator (mali) found
[    9.518525] [drm] Initialized lima 1.1.0 20191231 for d00c0000.gpu on minor 1

The only real difference is Raspbian finding the governor. However, the dtb files between Alpine and Raspbian are identical. Both come from the kernel under the amlogic tree. So why is 6.1.42 unable to find the governor leading to the async abort?

Assuming this is using our kernel/initramfs, You don’t have the kernel modules install in your Alpine Linux path since you took only the kernel and initramfs but not the modules. When the GPU driver probe, it can’t find devfreq governor module from the disk and crashes as expected. This doesn’t mean our HDMI doesn’t work. The kernel cannot find its modules to init everything.

You don’t have the kernel modules install in your Alpine Linux path since you took only the kernel and initramfs but not the modules. When the GPU driver probe, it can’t find devfreq governor module from the disk and crashes as expected. This doesn’t mean our HDMI doesn’t work. The kernel cannot find its modules to init everything.

The HDMI problem is still present with both images, so that has to be a UEFI/u-boot issue especially since it occurs as soon as UEFI is completed. It reproduces for me on Raspbian, CoreELEC, and Alpine. Maybe a regression with EDID stuff and this particular adapter?

Anyway, I now have full kernel bringup on Alpine with 6.1.42 all the way through root mount after adding ARM_MEDIATEK_CPUFREQ=y and MEDIATEK_CCI_DEVFREQ=m. Would not have thought the Mali wants MediaTek but hey. It (mostly) works.
MMC seems to be the only remaining problem. Root by UUID and PARTUUID both fail to find the root volume unexpectedly, and by device path /dev/mmcblk0p2 mounts but the board immediately dies with the last message being [BL31]: tee size: 0

[    1.319210] Run /init as init process
[    1.372190] Alpine Init 3.8.1-r0
[    1.373366] Loading boot drivers...
[    1.413472] SCSI subsystem initialized
[    1.490440] usbcore: registered new interface driver usbfs
[    1.490542] usbcore: registered new interface driver hub
[    1.495690] usbcore: registered new device driver usb
[    1.513058] usbcore: registered new interface driver usb-storage
[    1.642748] loop: module loaded
[    1.780217] [drm] Initialized simpledrm 1.0.0 20200625 for 7fe5b000.framebuffer on minor 0
[    1.783850] fbcon: Deferring console take-over
[    1.787289] simple-framebuffer 7fe5b000.framebuffer: [drm] fb0: simpledrmdrmfb frame buffer device
[    1.813828] Loading boot drivers: ok.
[    1.820979] Mounting root...
[    2.091615] meson-gx-mmc d0072000.mmc: Got CD GPIO
[    2.159863] mmc0: new high speed SDHC card at address 5048
[    2.176966] lima d00c0000.gpu: gp - mali450 version major 0 minor 0
[    2.177694] lima d00c0000.gpu: pp0 - mali450 version major 0 minor 0
[    2.184001] lima d00c0000.gpu: pp1 - mali450 version major 0 minor 0
[    2.190301] lima d00c0000.gpu: pp2 - mali450 version major 0 minor 0
[    2.196549] lima d00c0000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[    2.204610] lima d00c0000.gpu: l2 cache 64K, 4-way, 64byte cache line, 128bit external bus
[    2.213360] lima d00c0000.gpu: bus rate = 166666667
[    2.217676] lima d00c0000.gpu: mod rate = 24000000
[    2.222560] lima d00c0000.gpu: error -ENODEV: _opp_set_regulators: no regulator (mali) found
[    2.243884] lima d00c0000.gpu: Failed to register cooling device
[    2.244809] [drm] Initialized lima 1.1.0 20191231 for d00c0000.gpu on minor 1
[    2.318950] meson-drm d0100000.vpu: Queued 2 outputs on vpu
[    2.422540] meson-dw-hdmi c883a000.hdmi-tx: Detected HDMI TX controller v2.01a with HDCP (meson_dw_hdmi_phy)
[    2.427245] meson-dw-hdmi c883a000.hdmi-tx: registered DesignWare HDMI I2C bus driver
[    2.434964] meson-drm d0100000.vpu: bound c883a000.hdmi-tx (ops meson_dw_hdmi_ops [meson_dw_hdmi])
[    2.444504] [drm] Initialized meson 1.0.0 20161109 for d0100000.vpu on minor 2
[    2.456182] fbcon: Deferring console take-over
[    2.456225] meson-drm d0100000.vpu: [drm] fb0: mesondrmfb frame buffer device
[    2.629323] mmcblk0: mmc0:5048 SD16G 14.4 GiB 
[    2.632863]  mmcblk0: p1 p2
[    3.188733] EXT4-fs (mmcblk0p2): orphan cleanup on readonly fs
[    3.189225] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Quota mode: none.
[    3.198393] Mounting root: ok.
[BL31]: tee size: 0

No idea what’s going on there, as I can’t find any reference to BL31 and I presume any documentation is in the NDA’d materials. And I don’t see any other modules present in Raspbian that are not present in Alpine.

CoreELEC uses a completely different kernel than we do. They’re using the Amlogic kernel where as we’re using the upstream kernel. Not sure what exactly you’re doing here or what exactly you’re reproducing. Given that the kernels are in our images and tested across every board, if it doesn’t work for you, it means some setup is not right.

Our kernel and defconfig are all that’s needed to boot with full support. This is the same kernel in our images that has proven to work across multiple distros. There’s no need to add or remove configs.

This is an issue with whatever customizations you have in your kernel. The official images all boot via UUID. The below is taken from Raspbian and works: linux /boot/vmlinuz-6.1.42-08242-g1ca3e35555cd root=UUID=7940c4d1-4894-4442-9df8-da2c0311ee5e ro noquiet