Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mmap/unmmap in guest VM when enabled optee virtualization? #7197

Open
myspark104 opened this issue Dec 26, 2024 · 1 comment
Open

Comments

@myspark104
Copy link

Dear all,

I have already enabled the OP-TEE virtualization feature with CFG_VIRTUALIZATION=y in OP-TEE 3.18 on the device.
Now I use the core_mmu_add_mapping()/core_mmu_remove_mapping() to mmap/unmmap in optee guest VM. It used ok when mapping the PA, but it will panic when unmmap the matched VA.

E/TC:1 ? 0 tee_unmmap_region:70 core_mmu_remove_mapping() failed: 0xffff0000, va(0x71800000), size(0x1000)
D/TC:1 ? 0 tee_ta_invoke_command:916 Error: 8 of 4
D/TC:1 ? 0 check_pa_matches_va:2150 va 0x71a00000 unmapped, expect 0x1a6000000
E/TC:1 7 0 Panic at core/mm/core_mmu.c:2151 <check_pa_matches_va>
E/TC:1 7 0 TEE load address @ 0x71000000
E/TC:1 7 0 Call stack:
E/TC:1 7 0  0x71008988
E/TC:1 7 0  0x71014450
E/TC:1 7 0  0x7101e114

I found it only updates the global static_memory_map when calling core_mmu_add_mapping(), but the memory mmap table of guest VM is a new memory and copy from static_memory_map when creating guest VM, it doesn't update the memory mmap table of guest VM, so it can't find PA through the matched VA. Does it provide other APIs to mmap/unmmap in guest VM?

Thank you for your help!

@jenswi-linaro
Copy link
Contributor

The code doesn't support unmapping with virtualization enabled after exiting to the normal world for the first time. We'll need to add support for that at some point.

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

No branches or pull requests

2 participants