Skip to content

tee: optee: Fix FF-A offset handling on 64 KiB pages - #553

Open
mahantesh-nvidia wants to merge 1 commit into
NVIDIA:26.04_linux-nvidia-bosfrom
mahantesh-nvidia:optee_os_bf4_integration_fix_bos
Open

tee: optee: Fix FF-A offset handling on 64 KiB pages#553
mahantesh-nvidia wants to merge 1 commit into
NVIDIA:26.04_linux-nvidia-bosfrom
mahantesh-nvidia:optee_os_bf4_integration_fix_bos

Conversation

@mahantesh-nvidia

Copy link
Copy Markdown

FF-A memory objects use 4 KiB pages, but the kernel page size may be larger. On systems with 64 KiB pages, offsets beyond the first 4 KiB must be encoded in offs_low and offs_high instead of internal_offs.

Fixes: 4615e5a ("optee: add FF-A support")

@mahantesh-nvidia

Copy link
Copy Markdown
Author

This patch is needed for Bluefield-4 product/project. This fix is part of an effort to integrate OP-TEE OS as a Secure Partition running under Hafnium (SEL2).

Link to Feature Request: (Redmine) https://redmine.mellanox.com/issues/4654738

Due to project deadlines and customer requests prioritizing the submission here and will soon submit the patch for upstream as well.

@nirmoy

nirmoy commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

BaseOS Kernel Review

Tip

✅ Review passed

No issues found across the reviewed commits.

Findings: none

🔍 Review artifacts

📦 Kernel deb builds — 🟢 2/2 passed

Note

Build reports and debs are retained for 10 days after the PR closes.

Review metadata
  • Reviewed head: 5ee4a19150e2
  • Overall status: passed
  • Architectures: 2/2 successful

This comment is maintained by BaseOS Reviewer and updated when the GitHub watcher publishes a newer review.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ❌ Errors found

Details
Checking 1 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5ee4a19150e2 │ [SAUCE] [26.04_linux-nvidia-bos] nvidia: vr: sauce: tee: optee:  │ N/A        │ N/A     │ mahantes                  │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint results:
W: 5ee4a19150e2 ("[26.04_linux-nvidia-bos] NVIDIA: VR: SAUCE: tee: o"): subject 96 chars (>72)
E: 5ee4a19150e2 ("[26.04_linux-nvidia-bos] NVIDIA: VR: SAUCE: tee: o"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)

PR metadata:
W: PR title missing [<branch>] prefix: "tee: optee: Fix FF-A offset handling on 64 KiB pages"
E: PR targets 26.04_linux-nvidia-bos but body has no https://bugs.launchpad.net/... link

@nvmochs

nvmochs commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

My comments from here still apply to this PR: #552 (comment)

@mahantesh-nvidia

Copy link
Copy Markdown
Author

My comments from here still apply to this PR: #552 (comment)

Ack, I will submit this patch upstream and include the LKML link as recommended.

@clsotog

clsotog commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

like matt said the PR needs the tag: "NVIDIA: VR: SAUCE:"

@jamieNguyenNVIDIA jamieNguyenNVIDIA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two concerns with moving the page prefix into the normal FF-A offset fields.

Comment thread drivers/tee/optee/ffa_abi.c Outdated
Comment thread drivers/tee/optee/ffa_abi.c
@mahantesh-nvidia

Copy link
Copy Markdown
Author

Two concerns with moving the page prefix into the normal FF-A offset fields.

Thanks for the review and observations.

@mahantesh-nvidia

Copy link
Copy Markdown
Author

like matt said the PR needs the tag: "NVIDIA: VR: SAUCE:"

Ack, I will add them. Thanks

@mahantesh-nvidia
mahantesh-nvidia force-pushed the optee_os_bf4_integration_fix_bos branch from b62fa27 to 50cb9b9 Compare September 1, 2026 19:19
…et handling on 64 KiB pages

OP-TEE FF-A memory objects use 4 KiB pages, while the kernel page
size may be larger. Consequently, tee_shm::offset can be greater than
or equal to FFA_PAGE_SIZE, but OP-TEE rejects such a value in
internal_offs.

Do not encode the excess page offset in offs_low/offs_high. Those
fields describe the logical memref offset and are copied back into
tee_param::shm_offs on return. Folding the page offset into them breaks
parameter round trips when a memref is reused. They are also ignored by
the OPTEE_RPC_CMD_SHM_ALLOC response path, which uses only global_id and
internal_offs to construct the shared-memory mobj.

Instead, start the FF-A descriptor at the 4 KiB page containing the
shared buffer. Store the remaining in-page offset in internal_offs and
preserve shm_offs in offs_low/offs_high. This keeps internal_offs within
the FF-A page size, maps RPC allocations at the correct address, and
preserves normal memref offsets across repeated invocations.

Fixes: 4615e5a ("optee: add FF-A support")
Signed-off-by: Mahantesh Salimath <[email protected]>
@mahantesh-nvidia
mahantesh-nvidia force-pushed the optee_os_bf4_integration_fix_bos branch from 50cb9b9 to 5ee4a19 Compare September 1, 2026 21:03
@clsotog

clsotog commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Hey @mahantesh-nvidia
for the commit title we just need this:
NVIDIA: VR: SAUCE: tee: optee: Fix FF-A offset handling on 64 KiB pages
you can remove the [26.04_linux-nvidia-bos]

At the beginning of the title of the PR, can you add the: [26.04_linux-nvidia-bos]
You can check other PRs titles how other people did.

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

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants