aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2016-12-13 17:39:39 -0500
committerJames Hogan <james.hogan@imgtec.com>2017-02-03 10:21:34 -0500
commit12ed1faece3f141c2604b5b3a8377ba71d23ec9d (patch)
tree44812ac2820a6a3d95dba98964c9733cdba3707d
parentad58d4d4a274e9290725188c557d16e7d0cd1b3d (diff)
KVM: MIPS: Allow multiple VCPUs to be created
Increase the maximum number of MIPS KVM VCPUs to 8, and implement the KVM_CAP_NR_VCPUS and KVM_CAP_MAX_CPUS capabilities which expose the recommended and maximum number of VCPUs to userland. The previous maximum of 1 didn't allow for any form of SMP guests. We calculate the values similarly to ARM, recommending as many VCPUs as there are CPUs online in the system. This will allow userland to know how many VCPUs it is possible to create. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Radim Krčmář" <rkrcmar@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org
-rw-r--r--arch/mips/include/asm/kvm_host.h2
-rw-r--r--arch/mips/kvm/mips.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index ebcc55963941..05e785fc061d 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -65,7 +65,7 @@
65#define KVM_REG_MIPS_CP0_KSCRATCH6 MIPS_CP0_64(31, 7) 65#define KVM_REG_MIPS_CP0_KSCRATCH6 MIPS_CP0_64(31, 7)
66 66
67 67
68#define KVM_MAX_VCPUS 1 68#define KVM_MAX_VCPUS 8
69#define KVM_USER_MEM_SLOTS 8 69#define KVM_USER_MEM_SLOTS 8
70/* memory slots that does not exposed to userspace */ 70/* memory slots that does not exposed to userspace */
71#define KVM_PRIVATE_MEM_SLOTS 0 71#define KVM_PRIVATE_MEM_SLOTS 0
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index 9338aec08790..31ee5ee0010b 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -1026,6 +1026,12 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
1026 case KVM_CAP_COALESCED_MMIO: 1026 case KVM_CAP_COALESCED_MMIO:
1027 r = KVM_COALESCED_MMIO_PAGE_OFFSET; 1027 r = KVM_COALESCED_MMIO_PAGE_OFFSET;
1028 break; 1028 break;
1029 case KVM_CAP_NR_VCPUS:
1030 r = num_online_cpus();
1031 break;
1032 case KVM_CAP_MAX_VCPUS:
1033 r = KVM_MAX_VCPUS;
1034 break;
1029 case KVM_CAP_MIPS_FPU: 1035 case KVM_CAP_MIPS_FPU:
1030 /* We don't handle systems with inconsistent cpu_has_fpu */ 1036 /* We don't handle systems with inconsistent cpu_has_fpu */
1031 r = !!raw_cpu_has_fpu; 1037 r = !!raw_cpu_has_fpu;