Repository navigation
ambarella: s3l: enable CONFIG_LBDAF in s3l.generic.config - #2763
Conversation
The prebuilt S3L osdrv modules (ambarella-osdrv-s3l: iav.ko, dsp.ko, ...) were built against Ambarella's ambarella_s3l_defconfig, which has CONFIG_LBDAF=y. s3l.generic.config had it disabled. LBDAF makes blkcnt_t 64-bit, which grows struct inode and moves the fields after i_blocks: inode.i_cdev is at 0x110 with LBDAF and 0x108 without. iav.ko is compiled for the LBDAF layout, so with the generic config every ioctl on /dev/iav oopses on a NULL file->private_data. With CONFIG_LBDAF=y the offsets match and the IAV stack (DSP boot, VIN, H.264 encode) works on an S3L board.
PR Summary by QodoMatch S3L kernel layout to prebuilt osdrv modules
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can turn these tips off under Display > Comment parts |
openipc-ai
left a comment
There was a problem hiding this comment.
The fix is correct and addresses the real cause.
Verified
iav_openin the shippediav.koisldr r3, [r0, #0x110]; str r3, [r1, #0x70], so it takesfile->private_datafrominode+0x110, as you describe.CONFIG_LBDAF=yis set inambarella_s3l_defconfig, both in the Ambarella SDK and on theambarella-s3lkernel branch, and in the SDK's builts3lm_oliveconfig.- The vermagic doesn't record this option, which is why the modules load and only fail at the first ioctl.
- I compared
s3l.generic.configwith the SDK's built config. 117 options differ, and I checked them against the SDK kernel headers and the symbols the modules import. I found no other mismatch that reaches the modules.CONFIG_NET_NSchangesstruct sock, butiav_netlink.ctreats the socket as opaque.
Not verified here
- I didn't measure 0x108 on a kernel without LBDAF; that is your number, though it fits the NULL
private_dataoops. - CI doesn't build S3L, so your build is the only proof that this compiles.
- Nobody has measured the kernel growth on the 8 MB target that
s3l_lite_defconfigsets. It should be small, but it's worth checking.
Separate from this PR, not blockers
general/package/legacy/ambarella-osdrv-s3l/files/script/load_ambarellais 0 bytes, soS70vendorloads nothing and a stock image won't bring the drivers up.s3l_lite_defconfigsetsBR2_cortex_a7andBR2_ARM_FPU_NEON_VFPV4, but thecpuinfoin OpenIPC/ipctool#266 shows a Cortex-A9 withvfpv3. I haven't tested this, but binaries built that way could hit illegal instructions.
A request: could you also run current ipctool on this camera? OpenIPC/ipctool#267 added Ambarella detection, and sensor probing hasn't run on hardware yet. With this kernel and the video stream running, your setup is the best test we have. Please post the result on OpenIPC/ipctool#266.
|
Thanks for the thorough review. On the open points:
|
|
Thanks, that closes all three points. The 8-byte shift, the build, and the headroom (about 460 KiB, or 400 KiB with the fixed slot) are what I was missing. The two follow-ups from my review are now in #2764, and I have a few questions, since it hasn't run on a camera:
|
|
1. Microcode. Yes, 2. Module order. By hand, via a dev script: Beyond the module load, these were needed for video on this board, and they're not in
I'm planning to PR all of these as I get them working: the board's device tree, the microcode loader, the 3A/VIN setup, and an Ambarella S3L HAL for Divinus as the streamer (there's no Majestic build for S3L). The ISP configuration and the microcode are vendor data, so for those I'll only send the code that loads them; how they're shipped is the same licensing question. Status: H.264 streams after a warm reboot. A cold power-on boot doesn't stream yet (the DSP never programs the VIN controller); I'm still on that. 3. Toolchain. My own Buildroot internal toolchain from a board defconfig: |
|
This is very useful, thanks. Your order, node numbers and Your list also corrects what I wrote in #2764: the microcode is only one of several missing pieces, so the PR now says the script alone won't give video. I've made the nodes root-only and handled a stored An open-source One decision to check: #2764 and #2765 target musl with softfp ( |
Problem
The prebuilt S3L osdrv kernel modules (
ambarella-osdrv-s3l:iav.ko,dsp.ko, ...) were builtagainst Ambarella's
ambarella_s3l_defconfig, which hasCONFIG_LBDAF=y.s3l.generic.confighasit disabled.
CONFIG_LBDAFmakesblkcnt_t64-bit, which growsstruct inodeand moves every field afteri_blocks. For example,inode.i_cdevis at 0x110 with LBDAF and 0x108 without.iav.kois compiledfor the LBDAF layout, so on a kernel built from the generic config the modules load fine, but every
ioctl on
/dev/iavoopses on a NULLfile->private_data.Fix
Set
CONFIG_LBDAF=yinbr-ext-chip-ambarella/board/s3l/s3l.generic.config, matching the config themodules were built with.
Testing
On an Amcrest IP4M-1026E (Ambarella S3L, OV4689), 3.10.104 kernel built from
s3l.generic.config,with the prebuilt S3L modules:
insmodsucceeds; the first/dev/iavioctl oopses (NULLprivate_data)(decoded with ffprobe)
I measured the offsets with a throwaway module built against each config, and compared the result with
the layout
iav.kouses. The vermagic (3.10.104 preempt mod_unload ARMv7) is unchanged.