Skip to content

zephyr: vpage: add checks against invalid vpage config - #11323

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202610-vpage-init-fix
Open

kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202610-vpage-init-fix

Conversation

@kv2019i

@kv2019i kv2019i commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

The calculation of 'remaining_ram' ended up overflowing if the configuration did not allow for enough space for vpage region. Catch this case and disable vpage safely.

Also add a separate check to ensure vpage is not allocated beyond physical memory. This is a temporary limitation as Zephyr TLB driver only maps the cached alias when a page is mapped at runtime, and this leads to faults when vpage is used via a coherent alias (leading to e.g. "EXCCAUSE 29 (store prohibited)").

Co-developed-by: Liam Girdwood liam.r.girdwood@linux.intel.com

@kv2019i
kv2019i requested review from lgirdwood and a balanced review from Copilot October 20, 2026 11:10
@kv2019i

kv2019i commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

FYI @lgirdwood @harajend This PR is a subset/alternative to #11303 . Tested on target hardware and passes the test.

Additionally, with #11322 vpage can be enabled again on this target.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The fallback can discard an in-L2 library reservation and register overlapping vpage memory.

1 open issue
What changed in this PR

Adds configuration checks to Zephyr’s vpage allocator to prevent size underflow and keep mappings within physical L2 memory.

Changes:

  • Reject allocation and free operations when no vpage region exists.
  • Validate available space before registering the region.
File Description
zephyr/​lib/​vpage.c Adds region-availability guards and initialization bounds checks.

Review effort: Balanced

Comment thread zephyr/lib/vpage.c Outdated
* physical L2 size for now until support is added to
* Zephyr mm_drv_intel_adsp_mtl_tlb.c and friends
*/
end = l2_end;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, fixed in V2.

Comment thread zephyr/lib/vpage.c
/*
* TODO: on demand mapping currently only supports
* cached mappings, so we need to limit vpages to
* physical L2 size for now until support is added to

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related Zephyr PR to address this limitation zephyrproject-rtos/zephyr#122801

@intel-sofci

intel-sofci commented Oct 21, 2026 •

Copy link
Copy Markdown

PR 11323: test results

Run date: 2026-10-21 18:34 UTC

Tested commit: 094223665204347d915ac112f85b4945c5335f9d

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@kv2019i

kv2019i commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

V2 pushed:

  • addressed copilot review comment

@kv2019i

kv2019i commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@lgirdwood One option is to just drop this immediate version and directly go with your #11303 (when the Zephyr dependency is in place).

The calculation of 'remaining_ram' ended up overflowing if
the configuration did not allow for enough space for vpage
region. Catch this case and disable vpage safely.

Also add a separate check to ensure vpage is not allocated beyond
physical memory. This is a temporary limitation as Zephyr TLB
driver only maps the cached alias when a page is mapped at runtime,
and this leads to faults when vpage is used via a coherent alias
(leading to e.g. "EXCCAUSE 29 (store prohibited)").

Co-developed-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i
kv2019i force-pushed the 202610-vpage-init-fix branch from 2f904d0 to 0942236 Compare October 21, 2026 17:54
@kv2019i

kv2019i commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

V3 pushed:

  • simplified even further

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.

4 participants