zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.72k stars 6.55k forks source link

[Backport v3.5] drivers: virtualization: Crash when using ivshmem-v2 #65894

Closed gramsay0 closed 10 months ago

gramsay0 commented 10 months ago

Note: The fix has been already been merged, adding a ticket to allow a backport to the 3.5-branch. Below is my original comment for reference


Hi, my Jailhouse hypervisor ivshmem stopped working, I bisected to this commit https://github.com/zephyrproject-rtos/zephyr/commit/c9b534c4ebca8c3d02bc7d783c79771f1409d096.

It crashes here dc_ops("ivac", start_addr);

addr 0xa0000000, size 1044480, mapped/virt 0xfc5ef000

Unhandled data write at 0xa0000000(1)

FATAL: unhandled trap (exception class 0x24)
Cell state before exception:
 pc: 00000000fc00034c   lr: 00000000fc00034c spsr: 600000c5     EL1
 sp: 00000000fc0712d0  elr: 00000000fc00034c  esr: 24 1 000014f
 x0: 00000000fc042f90   x1: 0000000000000000   x2: 00000000fc02e488
 x3: 0000000000000000   x4: 0000000000000066   x5: 0000000000000000
 x6: 0000000000000000   x7: 0000000000000000   x8: 00000000fc0712c0
 x9: ffffff80fffffff8  x10: aaaaaaaaaaaaaaaa  x11: aaaaaaaaaaaaaaaa
x12: aaaaaaaaaaaaaaaa  x13: aaaaaaaaaaaaaaaa  x14: aaaaaaaaaaaaaaaa
x15: aaaaaaaaaaaaaaaa  x16: aaaaaaaaaaaaaaaa  x17: aaaaaaaaaaaaaaaa
x18: aaaaaaaaaaaaaaaa  x19: 00000000fc5ef000  x20: 0000000000000040
x21: 00000000fc6ee000  x22: 00000000fc6ee000  x23: 00000000fc07fe90
x24: 0000000000000000  x25: 0000000000000040  x26: 0000000000000000
x27: 0000000000000000  x28: 0000000000000000  x29: 00000000fc0712f0

Maybe something to do with part of this memory being read-only and DC IVAC requiring write access?

DC IVAC, requires write permission or else a permission fault is generated

https://developer.arm.com/documentation/den0024/a/Caches/Cache-maintenance

Although I get the same crash even without K_MEM_PERM_RW

Any thoughts/ideas on this?

henrikbrixandersen commented 10 months ago

Closing since https://github.com/zephyrproject-rtos/zephyr/pull/65812 was merged.