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 <penberg@kernel.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Cyrill Gorcunov
2015-06-01 16:39:42 +01:00
committed by Will Deacon
parent 62219c717e
commit ca99b3d340
3 changed files with 10 additions and 2 deletions
+2
View File
@@ -7,6 +7,8 @@
#include <stdint.h>
#include <time.h>
#define KVM_NR_CPUS (255)
struct kvm {
int sys_fd; /* For system ioctls(), i.e. /dev/kvm */
int vm_fd; /* For VM ioctls() */
-2
View File
@@ -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;
+8
View File
@@ -6,6 +6,14 @@
#include <string.h>
/*
* 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 <asm/mpspec_def.h>
/*