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

From
Jiaxun Yang <jiaxun.yang@flygoat.com>
Date
2020-08-17 03:50:06
Also in
kvm, lkml
Reply to
Jiaxun Yang, 2020-08-17
When INTIMER is disabled by host, the GT compare interrupt
will be ignored.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 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
Thread (11 messages) 11 messages, 3 authors, last reply 2020-08-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help