From 187fa97e521be9da3e434d0936c11abd88c170ac Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Wed, 25 Sep 2019 13:53:06 +0800 Subject: [PATCH] hv:fixed compilation error in Ubuntu it uses builtin function(__builtin_popcountl)in bitmap_weight(), it will use the 'popcnt' instruction, this patch enable 'popcnt' instruction support in Makefile Tracked-On: #3663 Signed-off-by: Mingqiang Chi --- hypervisor/Makefile | 2 +- hypervisor/arch/x86/cpu_caps.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hypervisor/Makefile b/hypervisor/Makefile index 329480485..98988a8a1 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -78,7 +78,7 @@ CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -fshort-wchar -ffreestanding CFLAGS += -fsigned-char CFLAGS += -m64 -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387 -CFLAGS += -mno-red-zone +CFLAGS += -mno-red-zone -mpopcnt CFLAGS += -nostdinc -nostdlib -fno-common CFLAGS += -Werror CFLAGS += -O2 diff --git a/hypervisor/arch/x86/cpu_caps.c b/hypervisor/arch/x86/cpu_caps.c index fc3bc4d80..8627a774b 100644 --- a/hypervisor/arch/x86/cpu_caps.c +++ b/hypervisor/arch/x86/cpu_caps.c @@ -423,6 +423,9 @@ int32_t detect_hardware_support(void) } else if (!pcpu_has_cap(X86_FEATURE_X2APIC)) { printf("%s, x2APIC not supported\n", __func__); ret = -ENODEV; + } else if (!pcpu_has_cap(X86_FEATURE_POPCNT)) { + printf("%s, popcnt instruction not supported\n", __func__); + ret = -ENODEV; } else { ret = check_vmx_mmu_cap(); }