提交 250be9d6 编写于 作者: S Shanker Donthineni 提交者: Christoffer Dall

KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE

In AArch64/AArch32, the virtual counter uses a fixed virtual offset
of zero in the following situations as per ARMv8 specifications:

1) HCR_EL2.E2H is 1, and CNTVCT_EL0/CNTVCT are read from EL2.
2) HCR_EL2.{E2H, TGE} is {1, 1}, and either:
   — CNTVCT_EL0 is read from Non-secure EL0 or EL2.
   — CNTVCT is read from Non-secure EL0.

So, no need to zero CNTVOFF_EL2/CNTVOFF for VHE case.
Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
Acked-by: NChristoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: NShanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
上级 b9fb1739
...@@ -541,8 +541,10 @@ void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu) ...@@ -541,8 +541,10 @@ void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu)
* The kernel may decide to run userspace after calling vcpu_put, so * The kernel may decide to run userspace after calling vcpu_put, so
* we reset cntvoff to 0 to ensure a consistent read between user * we reset cntvoff to 0 to ensure a consistent read between user
* accesses to the virtual counter and kernel access to the physical * accesses to the virtual counter and kernel access to the physical
* counter. * counter of non-VHE case. For VHE, the virtual counter uses a fixed
* virtual offset of zero, so no need to zero CNTVOFF_EL2 register.
*/ */
if (!has_vhe())
set_cntvoff(0); set_cntvoff(0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册