aboutsummaryrefslogtreecommitdiff
path: root/kvm.h
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2012-10-04 17:49:05 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-30 23:39:49 -0200
commitbc74b7db86bc84d3e027ac7b536e8e39140d984f (patch)
tree6f06ae718d9d31dfc8ac3288281a83767fcd7684 /kvm.h
parentc9da8382c1432fbafb8705e7faecdf783c0b1821 (diff)
downloadqemu-bc74b7db86bc84d3e027ac7b536e8e39140d984f.zip
qemu-bc74b7db86bc84d3e027ac7b536e8e39140d984f.tar.gz
qemu-bc74b7db86bc84d3e027ac7b536e8e39140d984f.tar.bz2
i386: kvm: filter CPUID feature words earlier, on cpu.c
cpu.c contains the code that will check if all requested CPU features are available, so the filtering of KVM features must be there, so we can implement "check" and "enforce" properly. The only point where kvm_arch_init_vcpu() is called on i386 is: - cpu_x86_init() - x86_cpu_realize() (after cpu_x86_register() is called) - qemu_init_vcpu() - qemu_kvm_start_vcpu() - qemu_kvm_thread_fn() (on a new thread) - kvm_init_vcpu() - kvm_arch_init_vcpu() With this patch, the filtering will be done earlier, at: - cpu_x86_init() - cpu_x86_register() (before x86_cpu_realize() is called) Also, the KVM CPUID filtering will now be done at the same place where the TCG CPUID feature filtering is done. Later, the code can be changed to use the same filtering code for the "check" and "enforce" modes, as now the cpu.c code knows exactly which CPU features are going to be exposed to the guest (and much earlier). One thing I was worrying about when doing this is that kvm_arch_get_supported_cpuid() depends on kvm_irqchip_in_kernel(), and maybe the 'kvm_kernel_irqchip' global variable wasn't initialized yet at CPU creation time. But kvm_kernel_irqchip is initialized during kvm_init(), that is called very early (much earlier than the machine init function), and kvm_init() is already a requirement to run the GET_SUPPORTED_CPUID ioctl() (as kvm_init() initializes the kvm_state global variable). Side note: it would be nice to keep KVM-specific code inside kvm.c. The problem is that properly implementing -cpu check/enforce code (that's inside cpu.c) depends directly on the feature bit filtering done using kvm_arch_get_supported_cpuid(). Currently -cpu check/enforce is broken because it simply uses the host CPU feature bits instead of GET_SUPPORTED_CPUID, and we need to fix that. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'kvm.h')
-rw-r--r--kvm.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/kvm.h b/kvm.h
index 2b26dcb..1e7f244 100644
--- a/kvm.h
+++ b/kvm.h
@@ -20,6 +20,7 @@
#ifdef CONFIG_KVM
#include <linux/kvm.h>
+#include <linux/kvm_para.h>
#endif
extern int kvm_allowed;