Skip to content

Commit 0f78355

Browse files
chenhuacaibonzini
authored andcommitted
KVM: MIPS: Enable KVM support for Loongson-3
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. Acked-by: Thomas Bogendoerfer <[email protected]> Reviewed-by: Aleksandar Markovic <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Co-developed-by: Jiaxun Yang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent dc6d95b commit 0f78355

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@ config CPU_LOONGSON64
14041404
select MIPS_L1_CACHE_SHIFT_6
14051405
select GPIOLIB
14061406
select SWIOTLB
1407+
select HAVE_KVM
14071408
help
14081409
The Loongson GSx64(GS264/GS464/GS464E/GS464V) series of processor
14091410
cores implements the MIPS64R2 instruction set with many extensions,

arch/mips/kernel/cpu-probe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,6 +2076,7 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
20762076
c->writecombine = _CACHE_UNCACHED_ACCELERATED;
20772077
c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM |
20782078
MIPS_ASE_LOONGSON_EXT | MIPS_ASE_LOONGSON_EXT2);
2079+
c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is incomplete */
20792080
break;
20802081
case PRID_IMP_LOONGSON_64G:
20812082
c->cputype = CPU_LOONGSON64;

arch/mips/kvm/vz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ static int kvm_vz_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
26972697
* prevents a SC on the next VCPU from succeeding by matching a LL on
26982698
* the previous VCPU.
26992699
*/
2700-
if (cpu_guest_has_rw_llb)
2700+
if (vcpu->kvm->created_vcpus > 1)
27012701
write_gc0_lladdr(0);
27022702

27032703
return 0;

0 commit comments

Comments
 (0)