On 2015/5/30 1:37, Pavel Fedin wrote:
>  Hi!
> 
>> Well KVM side should be fixed instead of driving us along wrong route.
> 
>  I have studied the question a bit more, and i discovered that MPIDR access 
> on ARM is not
> trapped by KVM. And guest would always get the same value as host would. 
> Theoretically you

Yes, it doesn't trap but there is one register "vmpidr_el2" which is
used for virtualization. When guest reads mpidr, it will get the value
of vmpidr_el2. And when context switching, hyp will restore the value of
vmpidr_el2 and the value is got from MPIDR_EL1 which is set by
reset_mpidr().

hyp.s:

.macro restore_sysregs // x2: base address for cpu context
        // x3: tmp register
        add     x3, x2, #CPU_SYSREG_OFFSET(MPIDR_EL1)
----cut----
        msr     vmpidr_el2,     x4
----cut----
.endm


-- 
Shannon


Reply via email to