2020-08-17 03:52:52

by Jiaxun Yang

[permalink] [raw]
Subject: [PATCH 7/7] MIPS: KVM: Don't use htimer when INTIMER is disabled

When INTIMER is disabled by host, the GT compare interrupt
will be ignored.

Signed-off-by: Jiaxun Yang <[email protected]>
---
arch/mips/kvm/vz.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c
index 9d03bd0a604a..1d2140f7461a 100644
--- a/arch/mips/kvm/vz.c
+++ b/arch/mips/kvm/vz.c
@@ -341,6 +341,12 @@ static bool kvm_vz_should_use_htimer(struct kvm_vcpu *vcpu)
if (kvm_mips_count_disabled(vcpu))
return false;

+ if (cpu_has_extimer) {
+ /* Guest htimer compare interrupt will be ignored if INTIMER is disabled */
+ if (!(read_c0_config6() & LOONGSON_CONF6_INTIMER))
+ return false;
+ }
+
/* Chosen frequency must match real frequency */
if (mips_hpt_frequency != vcpu->arch.count_hz)
return false;
--
2.28.0.rc1