[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/15] KVM: MIPS: Enable KVM support for Loongson-3
From: |
Huacai Chen |
Subject: |
[PATCH 15/15] KVM: MIPS: Enable KVM support for Loongson-3 |
Date: |
Mon, 13 Apr 2020 15:30:24 +0800 |
This patch enable KVM support for Loongson-3 by selecting HAVE_KVM, but
only enable KVM/VZ on Loongson-3A R4+ (because VZ of early processors
are incomplete). Besides, Loongson-3 support SMP guests, so we clear the
linked load bit of LLAddr in kvm_vz_vcpu_load() if the guest has more
than one VCPUs.
Signed-off-by: Huacai Chen <address@hidden>
Co-developed-by: Jiaxun Yang <address@hidden>
---
arch/mips/Kconfig | 1 +
arch/mips/kernel/cpu-probe.c | 1 +
arch/mips/kvm/vz.c | 2 +-
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a1f973c..e9a1389 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1465,6 +1465,7 @@ config CPU_LOONGSON64
select MIPS_L1_CACHE_SHIFT_6
select GPIOLIB
select SWIOTLB
+ select HAVE_KVM
help
The Loongson GSx64(GS264/GS464/GS464E/GS464V) series of
processor
cores implements the MIPS64R2 instruction set with many
extensions,
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 5bf0821..c46724e 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1958,6 +1958,7 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips
*c, unsigned int cpu)
c->writecombine = _CACHE_UNCACHED_ACCELERATED;
c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM |
MIPS_ASE_LOONGSON_EXT | MIPS_ASE_LOONGSON_EXT2);
+ c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is
incomplete */
break;
case PRID_IMP_LOONGSON_64G:
c->cputype = CPU_LOONGSON64;
diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c
index 2ea1f13..cddd5b0 100644
--- a/arch/mips/kvm/vz.c
+++ b/arch/mips/kvm/vz.c
@@ -2666,7 +2666,7 @@ static int kvm_vz_vcpu_load(struct kvm_vcpu *vcpu, int
cpu)
* prevents a SC on the next VCPU from succeeding by matching a LL on
* the previous VCPU.
*/
- if (cpu_guest_has_rw_llb)
+ if (vcpu->kvm->created_vcpus > 1)
write_gc0_lladdr(0);
return 0;
--
2.7.0
- [PATCH 07/15] KVM: MIPS: Introduce and use cpu_guest_has_ldpte, (continued)
- [PATCH 07/15] KVM: MIPS: Introduce and use cpu_guest_has_ldpte, Huacai Chen, 2020/04/13
- [PATCH 08/15] KVM: MIPS: Use root tlb to control guest's CCA for Loongson-3, Huacai Chen, 2020/04/13
- [PATCH 09/15] KVM: MIPS: Let indexed cacheops cause guest exit on Loongson-3, Huacai Chen, 2020/04/13
- [PATCH 10/15] KVM: MIPS: Add more types of virtual interrupts, Huacai Chen, 2020/04/13
- [PATCH 11/15] KVM: MIPS: Add Loongson-3 Virtual IPI interrupt support, Huacai Chen, 2020/04/13
- [PATCH 12/15] KVM: MIPS: Add CPUCFG emulation for Loongson-3, Huacai Chen, 2020/04/13
- [PATCH 13/15] KVM: MIPS: Add CONFIG6 and DIAG registers emulation, Huacai Chen, 2020/04/13
- [PATCH 14/15] KVM: MIPS: Add more MMIO load/store instructions emulation, Huacai Chen, 2020/04/13
- [PATCH 15/15] KVM: MIPS: Enable KVM support for Loongson-3,
Huacai Chen <=
- Re: [PATCH 0/15] KVM: MIPS: Add Loongson-3 support (Host Side), Jiaxun Yang, 2020/04/13