aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2015-09-02 02:31:21 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2015-09-17 08:13:27 -0400
commitef748917b529847277f07c98c55e1c0ce416449f (patch)
treef121d6fefff690152f4e8257c67ad7d807fa991b
parent34c3faa353db8f5d3ce9966cf854d5643c64c4db (diff)
arm/arm64: KVM: Remove 'config KVM_ARM_MAX_VCPUS'
This patch removes config option of KVM_ARM_MAX_VCPUS, and like other ARCHs, just choose the maximum allowed value from hardware, and follows the reasons: 1) from distribution view, the option has to be defined as the max allowed value because it need to meet all kinds of virtulization applications and need to support most of SoCs; 2) using a bigger value doesn't introduce extra memory consumption, and the help text in Kconfig isn't accurate because kvm_vpu structure isn't allocated until request of creating VCPU is sent from QEMU; 3) the main effect is that the field of vcpus[] in 'struct kvm' becomes a bit bigger(sizeof(void *) per vcpu) and need more cache lines to hold the structure, but 'struct kvm' is one generic struct, and it has worked well on other ARCHs already in this way. Also, the world switch frequecy is often low, for example, it is ~2000 when running kernel building load in VM from APM xgene KVM host, so the effect is very small, and the difference can't be observed in my test at all. Cc: Dann Frazier <dann.frazier@canonical.com> Signed-off-by: Ming Lei <ming.lei@canonical.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm/include/asm/kvm_host.h8
-rw-r--r--arch/arm/kvm/Kconfig11
-rw-r--r--arch/arm64/include/asm/kvm_host.h8
-rw-r--r--arch/arm64/kvm/Kconfig11
-rw-r--r--include/kvm/arm_vgic.h6
-rw-r--r--virt/kvm/arm/vgic-v3.c2
6 files changed, 6 insertions, 40 deletions
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index dcba0fa5176e..c8c226a19dbe 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -29,12 +29,6 @@
29 29
30#define __KVM_HAVE_ARCH_INTC_INITIALIZED 30#define __KVM_HAVE_ARCH_INTC_INITIALIZED
31 31
32#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
33#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
34#else
35#define KVM_MAX_VCPUS 0
36#endif
37
38#define KVM_USER_MEM_SLOTS 32 32#define KVM_USER_MEM_SLOTS 32
39#define KVM_PRIVATE_MEM_SLOTS 4 33#define KVM_PRIVATE_MEM_SLOTS 4
40#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 34#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
@@ -44,6 +38,8 @@
44 38
45#include <kvm/arm_vgic.h> 39#include <kvm/arm_vgic.h>
46 40
41#define KVM_MAX_VCPUS VGIC_V2_MAX_CPUS
42
47u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode); 43u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
48int __attribute_const__ kvm_target_cpu(void); 44int __attribute_const__ kvm_target_cpu(void);
49int kvm_reset_vcpu(struct kvm_vcpu *vcpu); 45int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index bfb915d05665..210eccadb69a 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -45,15 +45,4 @@ config KVM_ARM_HOST
45 ---help--- 45 ---help---
46 Provides host support for ARM processors. 46 Provides host support for ARM processors.
47 47
48config KVM_ARM_MAX_VCPUS
49 int "Number maximum supported virtual CPUs per VM"
50 depends on KVM_ARM_HOST
51 default 4
52 help
53 Static number of max supported virtual CPUs per VM.
54
55 If you choose a high number, the vcpu structures will be quite
56 large, so only choose a reasonable number that you expect to
57 actually use.
58
59endif # VIRTUALIZATION 48endif # VIRTUALIZATION
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 415938dc45cf..3fb58ea944eb 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -30,12 +30,6 @@
30 30
31#define __KVM_HAVE_ARCH_INTC_INITIALIZED 31#define __KVM_HAVE_ARCH_INTC_INITIALIZED
32 32
33#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
34#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
35#else
36#define KVM_MAX_VCPUS 0
37#endif
38
39#define KVM_USER_MEM_SLOTS 32 33#define KVM_USER_MEM_SLOTS 32
40#define KVM_PRIVATE_MEM_SLOTS 4 34#define KVM_PRIVATE_MEM_SLOTS 4
41#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 35#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
@@ -43,6 +37,8 @@
43#include <kvm/arm_vgic.h> 37#include <kvm/arm_vgic.h>
44#include <kvm/arm_arch_timer.h> 38#include <kvm/arm_arch_timer.h>
45 39
40#define KVM_MAX_VCPUS VGIC_V3_MAX_CPUS
41
46#define KVM_VCPU_MAX_FEATURES 3 42#define KVM_VCPU_MAX_FEATURES 3
47 43
48int __attribute_const__ kvm_target_cpu(void); 44int __attribute_const__ kvm_target_cpu(void);
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index bfffe8f4bd53..5c7e920e4861 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -41,15 +41,4 @@ config KVM_ARM_HOST
41 ---help--- 41 ---help---
42 Provides host support for ARM processors. 42 Provides host support for ARM processors.
43 43
44config KVM_ARM_MAX_VCPUS
45 int "Number maximum supported virtual CPUs per VM"
46 depends on KVM_ARM_HOST
47 default 4
48 help
49 Static number of max supported virtual CPUs per VM.
50
51 If you choose a high number, the vcpu structures will be quite
52 large, so only choose a reasonable number that you expect to
53 actually use.
54
55endif # VIRTUALIZATION 44endif # VIRTUALIZATION
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index d901f1a47be6..4e14dac282bb 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -35,11 +35,7 @@
35#define VGIC_V3_MAX_LRS 16 35#define VGIC_V3_MAX_LRS 16
36#define VGIC_MAX_IRQS 1024 36#define VGIC_MAX_IRQS 1024
37#define VGIC_V2_MAX_CPUS 8 37#define VGIC_V2_MAX_CPUS 8
38 38#define VGIC_V3_MAX_CPUS 255
39/* Sanity checks... */
40#if (KVM_MAX_VCPUS > 255)
41#error Too many KVM VCPUs, the VGIC only supports up to 255 VCPUs for now
42#endif
43 39
44#if (VGIC_NR_IRQS_LEGACY & 31) 40#if (VGIC_NR_IRQS_LEGACY & 31)
45#error "VGIC_NR_IRQS must be a multiple of 32" 41#error "VGIC_NR_IRQS must be a multiple of 32"
diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c
index afbf925b00f4..7dd5d62f10a1 100644
--- a/virt/kvm/arm/vgic-v3.c
+++ b/virt/kvm/arm/vgic-v3.c
@@ -288,7 +288,7 @@ int vgic_v3_probe(struct device_node *vgic_node,
288 288
289 vgic->vctrl_base = NULL; 289 vgic->vctrl_base = NULL;
290 vgic->type = VGIC_V3; 290 vgic->type = VGIC_V3;
291 vgic->max_gic_vcpus = KVM_MAX_VCPUS; 291 vgic->max_gic_vcpus = VGIC_V3_MAX_CPUS;
292 292
293 kvm_info("%s@%llx IRQ%d\n", vgic_node->name, 293 kvm_info("%s@%llx IRQ%d\n", vgic_node->name,
294 vcpu_res.start, vgic->maint_irq); 294 vcpu_res.start, vgic->maint_irq);