state of TTBR0/1 wrt to multiple guests in case of virtualization in arm

老子叫甜甜 提交于 2020-01-01 18:37:26

问题


TTBR0/1 are CP15 registers which are programmed by PL1 OS. Now If PL1 OS1 programs TTBR0 and then on the same core the PL1 OS2 is scheduled, would the PL1 OS2 see the value of TTBR0/1 set the OS1

I am sure there is someway that the sanity is maintained, is the following is true?

While switching between guests the hypervisor saves all cp15 regs in guest context and later restores before switching the guest

if yes then wouldnt it be time consuming for hypervisor as the list of cp15 regs would be very long


回答1:


You can read the description of the registers in the ARMv7-AR Architecture Reference Manual - downloadable with registration from here.

In summary, yes - TTBR0/TTBR1 exist in only one copy (each), which is updated by the hypervisor when switching guests. The hypervisor itself has the VTTBR for its own use. This is of course the only way it is possible to host an unlimited number of guests. (The AArch64 model is somewhat different, but the same basic fact remains true.)

Clearly this is a costly operation, and not the only one required on switching guests, so you certainly don't want to do it too frequently. But the list of registers that need preserving may be shorter than you think.

You can see the actual implementation for KVM here.



来源:https://stackoverflow.com/questions/20315788/state-of-ttbr0-1-wrt-to-multiple-guests-in-case-of-virtualization-in-arm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!