aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/virtual/kvm/api.txt11
-rw-r--r--arch/x86/include/asm/kvm_host.h3
-rw-r--r--arch/x86/kvm/x86.c3
-rw-r--r--include/linux/kvm.h3
4 files changed, 16 insertions, 4 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index b0e4b9cd6a6..75cd8fba0cd 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -175,10 +175,17 @@ Parameters: vcpu id (apic id on x86)
175Returns: vcpu fd on success, -1 on error 175Returns: vcpu fd on success, -1 on error
176 176
177This API adds a vcpu to a virtual machine. The vcpu id is a small integer 177This API adds a vcpu to a virtual machine. The vcpu id is a small integer
178in the range [0, max_vcpus). You can use KVM_CAP_NR_VCPUS of the 178in the range [0, max_vcpus).
179KVM_CHECK_EXTENSION ioctl() to determine the value for max_vcpus at run-time. 179
180The recommended max_vcpus value can be retrieved using the KVM_CAP_NR_VCPUS of
181the KVM_CHECK_EXTENSION ioctl() at run-time.
182The maximum possible value for max_vcpus can be retrieved using the
183KVM_CAP_MAX_VCPUS of the KVM_CHECK_EXTENSION ioctl() at run-time.
184
180If the KVM_CAP_NR_VCPUS does not exist, you should assume that max_vcpus is 4 185If the KVM_CAP_NR_VCPUS does not exist, you should assume that max_vcpus is 4
181cpus max. 186cpus max.
187If the KVM_CAP_MAX_VCPUS does not exist, you should assume that max_vcpus is
188same as the value returned from KVM_CAP_NR_VCPUS.
182 189
183On powerpc using book3s_hv mode, the vcpus are mapped onto virtual 190On powerpc using book3s_hv mode, the vcpus are mapped onto virtual
184threads in one or more virtual CPU cores. (This is because the 191threads in one or more virtual CPU cores. (This is because the
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index dd51c83aa5d..c00ec28e714 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -26,7 +26,8 @@
26#include <asm/mtrr.h> 26#include <asm/mtrr.h>
27#include <asm/msr-index.h> 27#include <asm/msr-index.h>
28 28
29#define KVM_MAX_VCPUS 64 29#define KVM_MAX_VCPUS 254
30#define KVM_SOFT_MAX_VCPUS 64
30#define KVM_MEMORY_SLOTS 32 31#define KVM_MEMORY_SLOTS 32
31/* memory slots that does not exposed to userspace */ 32/* memory slots that does not exposed to userspace */
32#define KVM_PRIVATE_MEM_SLOTS 4 33#define KVM_PRIVATE_MEM_SLOTS 4
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2b76ae3cb50..41dfebea621 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2086,6 +2086,9 @@ int kvm_dev_ioctl_check_extension(long ext)
2086 r = !kvm_x86_ops->cpu_has_accelerated_tpr(); 2086 r = !kvm_x86_ops->cpu_has_accelerated_tpr();
2087 break; 2087 break;
2088 case KVM_CAP_NR_VCPUS: 2088 case KVM_CAP_NR_VCPUS:
2089 r = KVM_SOFT_MAX_VCPUS;
2090 break;
2091 case KVM_CAP_MAX_VCPUS:
2089 r = KVM_MAX_VCPUS; 2092 r = KVM_MAX_VCPUS;
2090 break; 2093 break;
2091 case KVM_CAP_NR_MEMSLOTS: 2094 case KVM_CAP_NR_MEMSLOTS:
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index aace6b8691a..20697987788 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -463,7 +463,7 @@ struct kvm_ppc_pvinfo {
463#define KVM_CAP_VAPIC 6 463#define KVM_CAP_VAPIC 6
464#define KVM_CAP_EXT_CPUID 7 464#define KVM_CAP_EXT_CPUID 7
465#define KVM_CAP_CLOCKSOURCE 8 465#define KVM_CAP_CLOCKSOURCE 8
466#define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */ 466#define KVM_CAP_NR_VCPUS 9 /* returns recommended max vcpus per vm */
467#define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */ 467#define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */
468#define KVM_CAP_PIT 11 468#define KVM_CAP_PIT 11
469#define KVM_CAP_NOP_IO_DELAY 12 469#define KVM_CAP_NOP_IO_DELAY 12
@@ -553,6 +553,7 @@ struct kvm_ppc_pvinfo {
553#define KVM_CAP_SPAPR_TCE 63 553#define KVM_CAP_SPAPR_TCE 63
554#define KVM_CAP_PPC_SMT 64 554#define KVM_CAP_PPC_SMT 64
555#define KVM_CAP_PPC_RMA 65 555#define KVM_CAP_PPC_RMA 65
556#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
556#define KVM_CAP_S390_GMAP 71 557#define KVM_CAP_S390_GMAP 71
557 558
558#ifdef KVM_CAP_IRQ_ROUTING 559#ifdef KVM_CAP_IRQ_ROUTING