diff options
author | Matt Evans <matt@ozlabs.org> | 2011-12-07 11:55:57 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-05 07:52:38 -0500 |
commit | b5434032fcfd7490c6453feb397fb781762b6f09 (patch) | |
tree | a0fade79c7b73169c1af134459392f489b025c56 | |
parent | 03cdab5340b423ec88fc18eb158a62a8a7b94d7f (diff) |
KVM: PPC: Add KVM_CAP_NR_VCPUS and KVM_CAP_MAX_VCPUS
PPC KVM lacks these two capabilities, and as such a userland system must assume
a max of 4 VCPUs (following api.txt). With these, a userland can determine
a more realistic limit.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 25171037a36c..f4380cb264e0 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -249,6 +249,22 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
249 | r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0; | 249 | r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0; |
250 | break; | 250 | break; |
251 | #endif | 251 | #endif |
252 | case KVM_CAP_NR_VCPUS: | ||
253 | /* | ||
254 | * Recommending a number of CPUs is somewhat arbitrary; we | ||
255 | * return the number of present CPUs for -HV (since a host | ||
256 | * will have secondary threads "offline"), and for other KVM | ||
257 | * implementations just count online CPUs. | ||
258 | */ | ||
259 | #ifdef CONFIG_KVM_BOOK3S_64_HV | ||
260 | r = num_present_cpus(); | ||
261 | #else | ||
262 | r = num_online_cpus(); | ||
263 | #endif | ||
264 | break; | ||
265 | case KVM_CAP_MAX_VCPUS: | ||
266 | r = KVM_MAX_VCPUS; | ||
267 | break; | ||
252 | default: | 268 | default: |
253 | r = 0; | 269 | r = 0; |
254 | break; | 270 | break; |