Skip to content

load_hisilicon (cv300): insmod cma_osal.ko but only hi_osal.ko shipped #2061

@widgetii

Description

@widgetii

Summary

load_hisilicon on hi3516cv300 references a cma_osal.ko that the firmware never builds or ships. When the kernel cmdline contains mmz=… (which the qemu-hisilicon machine emulator and most production U-Boots do), insert_osal takes the CMA branch:

insmod: can't insert 'cma_osal.ko': No such file or directory
******* Error: There's something wrong, please check! *****

load_hisilicon then report_error → exit 1 and zero modules load.

The cv300 rootfs ships hi_osal.ko only (verified in /lib/modules/4.9.37/hisilicon/ of openipc.hi3516cv300-nor-lite.tgz); there is no cma_osal.ko anywhere in the build.

This bug pre-dates #2059 — it was hidden on cv300 because load_hisilicon used to bail at the os_mem= guard before ever reaching insert_osal. Post-#2060, the guard is correct and the cma_osal call now runs.

Where

general/package/hisilicon-osdrv-hi3516cv300/files/script/load_hisilicon, lines 58 / 60:

insert_osal() {
    MMZ=$(awk -F '=' '$1=="mmz"{print $2}' RS=" " /proc/cmdline)
    if [ -z "$MMZ" ]; then
        insmod hi_osal.ko anony=1 mmz_allocator=hisi mmz=anonymous,0,$mmz_start,$mmz_size || report_error
    else
        insmod cma_osal.ko anony=1 mmz_allocator=cma mmz=$MMZ || report_error    # <-- file doesn't exist
    fi
}

Suggested fix

Two options, pick one:

  1. Use hi_osal.ko in both branches, passing the right args. The cv300 OSAL module already has mmz_allocator= parameter support; passing mmz_allocator=cma mmz=$MMZ to hi_osal.ko should drive the same code path the (hypothetical) cma_osal.ko would. Tracking issue mmz: fail allocator init when every configured zone is rejected openhisilicon#73 made the V3 cma allocator init fail fast on register error, so this path is exercised correctly upstream.

  2. Build and ship cma_osal.ko as a separate module from openhisilicon for V3 / cv300, and add it to hisilicon-osdrv-hi3516cv300's install list.

Option 1 is the smaller change and keeps cv300's rootfs footprint identical.

CI hardcoding to undo once fixed

OpenIPC/openhisilicon/.github/workflows/build.yml qemu-boot matrix has:

- machine: hi3516cv300
  firmware: hi3516cv300
  mem: 128M
  allow-failure: true                # <-- remove this line
  append: "console=ttyAMA0,115200 mem=32M root=/dev/ram0 rootfstype=squashfs"

After this issue is fixed and a new latest firmware release is published:

  1. Drop the allow-failure: true line from the cv300 matrix entry.
  2. Optionally add min_modules: N to gate the lsmod count assertion.
  3. Drop the explanatory comment block above the cv300 row.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions