Fix KVM includes in helper.c
PATCH 1/1 Fix KVM includes in helper.c
By default target-i386/helper.c does not include config.h, so no code in there knows if we're enabling KVM or not. This breaks the nested activation, as that's depending on the config options.
Of course, with this patch applied the CPUID KVM checks are applied twice, as now kvm_enabled() does not default to true for the cpuid helper functions. Maybe it's a good idea to remove the qemu-kvm-x86.c cpuid code?
This patch fixes compilation broken thanks to my nested SVM patches.
--- qemu/qemu-kvm.h | 1 + qemu/target-i386/helper.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
qemu/qemu-kvm.h +1 -0
@@ -161,6 +161,7 @@ int qemu_kvm_has_sync_mmu(void);void kvm_init_vcpu (CPUState *env);#else #define kvm_enabled () (0) +#define kvm_nested 0#define qemu_kvm_irqchip_in_kernel () (0)#define qemu_kvm_pit_in_kernel () (0)#define kvm_has_sync_mmu () (0)
qemu/target-i386/helper.c +1 -0
@@ -30,6 +30,7 @@#include "qemu-common.h" #include "kvm.h" +#include "config.h" #include "qemu-kvm.h" //#define DEBUG_MMU
Signature · 1 line
1.5.6
Quoted 14 lines · Alexander Graf
By default
target-i386/helper.cdoes not includeconfig.h, so no code in there knows if we're enabling KVM or not. This breaks the nested activation, as that's depending on the config options.Of course, with this patch applied the CPUID KVM checks are applied twice, as now
kvm_enabled()does not default to true for the cpuid helper functions. Maybe it's a good idea to remove theqemu-kvm-x86.ccpuid code?This patch fixes compilation broken thanks to my nested SVM patches.
qemu/target-i386/helper.c line 35
Quoted 6 lines
qemu/target-i386/helper.c +1
-0@@ -30,6 +30,7 @@#include "qemu-common.h" #include "kvm.h" +#include "config.h" #include "qemu-kvm.h"
Isn't this a problem with upstream qemu as well?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 14 lines · Avi Kivity
Quoted 13 lines · Alexander Graf
By default
target-i386/helper.cdoes not includeconfig.h, so no code in there knows if we're enabling KVM or not. This breaks the nested activation, as that's depending on the config options.Of course, with this patch applied the CPUID KVM checks are applied twice, as now
kvm_enabled()does not default to true for the cpuid helper functions. Maybe it's a good idea to remove theqemu-kvm-x86.ccpuid code?This patch fixes compilation broken thanks to my nested SVM patches.
Quoted 8 lines
qemu/target-i386/helper.c line 34
Quoted 6 lines
qemu/target-i386/helper.c +1
-0@@ -30,6 +30,7 @@#include "qemu-common.h" #include "kvm.h" +#include "config.h" #include "qemu-kvm.h" Isn't this a problem with upstream qemu as well?
kvm.h includes config.h - I'm puzzled.
I'm pretty sure when I did that patch USE_KVM was not set in helper.c.
Alex
Quoted 2 lines · Alexander Graf
kvm.hincludesconfig.h- I'm puzzled.
Oh, it doesn't in kvm-userspace. I'll fix it.
Qemu should probably move to -include "config.h" instead of relying on all users to include it, since it will fail silently instead of complaining.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 14 lines · Avi Kivity
Quoted 13 lines · Alexander Graf
By default
target-i386/helper.cdoes not includeconfig.h, so no code in there knows if we're enabling KVM or not. This breaks the nested activation, as that's depending on the config options.Of course, with this patch applied the CPUID KVM checks are applied twice, as now
kvm_enabled()does not default to true for the cpuid helper functions. Maybe it's a good idea to remove theqemu-kvm-x86.ccpuid code?This patch fixes compilation broken thanks to my nested SVM patches.
Quoted 8 lines
qemu/target-i386/helper.c line 34
Quoted 6 lines
qemu/target-i386/helper.c +1
-0@@ -30,6 +30,7 @@#include "qemu-common.h" #include "kvm.h" +#include "config.h" #include "qemu-kvm.h" Isn't this a problem with upstream qemu as well?
Nevertheless, if you only apply the second chunk with the #else #define kvm_nested 0 we should be fine off. The only place where kvm_enabled() is called in helper.c is the cpuid check and that's a logic AND, meaning the SVM bit wouldn't get stripped if kvm_enabled() isn't set. We'd do that check in the second KVM CPUID parsing again later on anyways.
Alex
Quoted 2 lines · Alexander Graf
Nevertheless, if you only apply the second chunk with the #else #define
kvm_nested0 we should be fine off. The only place wherekvm_enabled()is called inhelper.cis the cpuid check and that's a logic AND, meaning the SVM bit wouldn't get stripped ifkvm_enabled()isn't set.
Did just that.
Signature · 1 line
error compiling committee.c: too many arguments to function