From ca99b3d34022301a54d55d8ca4d00d5721832431 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Mon, 25 Apr 2011 22:07:19 +0400 Subject: [PATCH] kvm tools: Add NR_CPUS definition in case of non-configured kernel sources Pekka reported | | I see this if I ignore the reject: | | penberg@tiger:~/linux/tools/kvm$ make | In file included from mptable.c:10: | ../../arch/x86/include/asm/mpspec_def.h:20:6: error: "NR_CPUS" is not defined This is because the source linux kernel might not be configured (bare sources) so we add own definition in case if there is no NR_CPUS defined. [ penberg@kernel.org: fix up compilation error ] Reported-by: Pekka Enberg Signed-off-by: Cyrill Gorcunov Signed-off-by: Pekka Enberg --- include/kvm/kvm.h | 2 ++ kvm-run.c | 2 -- mptable.c | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h index 6543b35..327a1ab 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -7,6 +7,8 @@ #include #include +#define KVM_NR_CPUS (255) + struct kvm { int sys_fd; /* For system ioctls(), i.e. /dev/kvm */ int vm_fd; /* For VM ioctls() */ diff --git a/kvm-run.c b/kvm-run.c index aa0f248..13e7662 100644 --- a/kvm-run.c +++ b/kvm-run.c @@ -40,8 +40,6 @@ #define MIN_RAM_SIZE_MB (64ULL) #define MIN_RAM_SIZE_BYTE (MIN_RAM_SIZE_MB << MB_SHIFT) -#define KVM_NR_CPUS (255) - static struct kvm *kvm; static struct kvm_cpu *kvm_cpus[KVM_NR_CPUS]; static __thread struct kvm_cpu *current_kvm_cpu; diff --git a/mptable.c b/mptable.c index 368db65..5bbe7ea 100644 --- a/mptable.c +++ b/mptable.c @@ -6,6 +6,14 @@ #include +/* + * If kernel is not configured yet this macro + * might not be defined, fix it by own definition + */ +#ifndef NR_CPUS +#define NR_CPUS KVM_NR_CPUS +#endif + #include /*