Skip to content

anyka: EV200: osmem 40M, the rest of the 64 MiB is video memory - #112

Merged
dimerr merged 1 commit into
openipc-anykafrom
anyka/ev200-osmem
Nov 8, 2026
Merged

dimerr merged 1 commit into
openipc-anykafrom
anyka/ev200-osmem

Conversation

@dimerr

@dimerr dimerr commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Default osmem to 40M on the AK3918EV200; EV300 and EV330 keep all of their DDR.

OpenIPC's EV200 kernel (OpenIPC/linux#186) now runs from the bottom of DDR and gives the ISP and the encoder the DDR above mem=, totalmem - osmem, as the other OpenIPC SoCs do. With osmem=64M there is no video memory left. 40M is the split the vendor firmware uses: Linux 40 MiB, video 24 of the 64. Boards already in the field get the same value from the firmware's load_anyka on first boot. The mem= note in CLAUDE.md is updated to match.

Verified on qemu-hisilicon ak3918ev200: this U-Boot with an empty environment plus an OpenIPC/firmware ak3918ev200_lite image boots with mem=40M, the kernel reserves 24 MiB at 0x82800000 for video, and it reaches the login prompt. The image is 232764 bytes.

OpenIPC's EV200 kernel now runs from the bottom of DDR and gives the
ISP and the encoder the DDR above mem=, totalmem - osmem, as the other
OpenIPC SoCs do. With mem=64M there is none. Default osmem to 40M on
the EV200, the split the vendor firmware uses (24 of the 64 MiB for
video). The EV300 and EV330 keep all of it.

Verified on qemu-hisilicon ak3918ev200: this U-Boot with an empty
environment and an OpenIPC/firmware ak3918ev200_lite image boots with
mem=40M, the kernel reserves 24 MiB at 0x82800000 for video, and it
reaches the login prompt.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Reserve 24 MiB of EV200 DDR for video

🐞 Bug fix 📝 Documentation 🕐 Less than 10 minutes

Grey Divider

AI Description

• Default EV200 osmem to 40 MiB so its kernel leaves 24 MiB for video.
• Keep existing full-DDR defaults for EV300 and EV330, and document the EV200 exception.
Diagram

graph TD
  A["EV200 config"] --> B["osmem 40M"] --> C["mem=40M"] --> D["EV200 kernel"] --> E[("24 MiB video")]
  D --> F["40 MiB Linux"]
Loading
High-Level Assessment

The target-specific default in the shared configuration is appropriate: it changes only EV200 while retaining the existing size-based defaults elsewhere. Runtime DDR detection would add complexity without addressing a need shown by this change.

Files changed (2) +11 / -4

Bug fix (1) +7 / -3
openipc-common.hSet EV200's default osmem to 40M +7/-3

Set EV200's default osmem to 40M

• Adds an EV200-specific 'OPENIPC_OSMEM' default before the existing DDR-size branches. EV300 and EV330 retain their 64M or 128M defaults; the comment explains why EV200 needs video memory above 'mem='.

include/configs/openipc-common.h

Documentation (1) +4 / -1
CLAUDE.mdDocument the EV200 kernel and video DDR split +4/-1

Document the EV200 kernel and video DDR split

• Clarifies that EV200 passes 40 MiB through 'mem=' and leaves the remaining 24 MiB of its 64 MiB DDR for the ISP and encoder. Other targets retain the documented full-DDR behavior.

CLAUDE.md

@dimerr
dimerr merged commit 05de81c into openipc-anyka Nov 8, 2026
2 checks passed
@dimerr
dimerr deleted the anyka/ev200-osmem branch November 8, 2026 07:30
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Existing cameras lose video memory 🐞 Bug ≡ Correctness
Description
OPENIPC_OSMEM changes the compiled EV200 default to 40M, but openipc_helper() does not migrate a
valid saved environment containing the previous 64M value. When an existing camera boots with that
environment, bootflash passes its persisted osmem=64M as mem=, leaving none of the 64 MiB DDR
above it for video.
Code

include/configs/openipc-common.h[33]

+#define OPENIPC_OSMEM		"40M"
Evidence
The new value initializes only the compiled default environment. A valid flash environment is
imported instead, and the helper's save-on-first-start condition does not update it; the normal boot
command then expands the retained osmem into the kernel arguments.

include/configs/openipc-common.h[32-37]
include/configs/openipc-common.h[77-79]
include/configs/openipc-common.h[98-106]
include/configs/openipc-common.h[130-135]
env/common.c[309-318]
common/openipc.c[750-762]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Existing EV200 cameras with a valid saved environment retain the former `osmem=64M` value, so changing the compiled default alone does not reserve video memory for them.

## Fix Focus Areas
- include/configs/openipc-common.h[32-34]
- common/openipc.c[750-762]

## Recommended Fix
Add an EV200-specific migration for the previous saved `osmem=64M` default before boot, while preserving other explicitly configured values. Account for saved boot arguments that may contain a literal memory value, and persist the migration so subsequent boots use 40M.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: Auto: ⚖️ Balanced: Changes boot-time memory split for deployed EV200 boards; not trivial, not dense.

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@dimerr

dimerr commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

On the Qodo finding (saved environments keep osmem=64M): intended. Cameras already in the field are migrated by the firmware, not here. load_anyka -i (OpenIPC/firmware#2796) runs at boot, lowers an osmem that leaves video less than 24 MiB, and reboots once. That keeps the policy in the image that needs it, and an older OpenIPC image on the same U-Boot keeps the 64M it expects. This PR only sets what a fresh environment starts with, so new boards skip that reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant