> > My point is that > > qemu-version-A [-cpu whatever] > > should provide the same VM as > > qemu-version-B -machine pc-A [-cpu whatever] > > specifically if you leave out the cpu specification. > > So the compat machine could establish a feature mask (e.g. append some > "-tsc_deadline" in this case). But, indeed, we need a new channel for > this. > Yes, if such requirement need to be satisfied, I agree we need a new channel to solve this kind of common issue. As for tsc deadline timer feature exposing, I write an updated patch as attached. 1). It exposes tsc deadline timer feature to guest if in-kernel irqchip is used and kvm has emulated tsc deadline timer; 2). It also authorizes user to control the feature exposing via a cpu feature flag; Thanks, Jinsong ==================== >From 5b7d5f459b621686e78e437010ce34748bcb9e8e Mon Sep 17 00:00:00 2001 From: Liu, Jinsong <jinsong.liu@xxxxxxxxx> Date: Wed, 29 Feb 2012 01:53:15 +0800 Subject: [PATCH] Expose tsc deadline timer feature to guest It exposes tsc deadline timer feature to guest if in-kernel irqchip is used and kvm has emulated tsc deadline timer. It also authorizes user to control the feature exposing via a cpu feature flag. Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx> --- target-i386/cpu.h | 1 + target-i386/cpuid.c | 2 +- target-i386/kvm.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index d92be5d..3409afe 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -399,6 +399,7 @@ #define CPUID_EXT_X2APIC (1 << 21) #define CPUID_EXT_MOVBE (1 << 22) #define CPUID_EXT_POPCNT (1 << 23) +#define CPUID_EXT_TSC_DEADLINE_TIMER (1 << 24) #define CPUID_EXT_XSAVE (1 << 26) #define CPUID_EXT_OSXSAVE (1 << 27) #define CPUID_EXT_HYPERVISOR (1 << 31) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index b9bfeaf..ac4b79c 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -50,7 +50,7 @@ static const char *ext_feature_name[] = { "fma", "cx16", "xtpr", "pdcm", NULL, NULL, "dca", "sse4.1|sse4_1", "sse4.2|sse4_2", "x2apic", "movbe", "popcnt", - NULL, "aes", "xsave", "osxsave", + "tsc_deadline", "aes", "xsave", "osxsave", "avx", NULL, NULL, "hypervisor", }; static const char *ext2_feature_name[] = { diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7079e87..2639699 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -370,6 +370,10 @@ int kvm_arch_init_vcpu(CPUState *env) i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR; env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX); env->cpuid_ext_features |= i; + if (!kvm_irqchip_in_kernel() || + !kvm_check_extension(s, KVM_CAP_TSC_DEADLINE_TIMER)) { + env->cpuid_ext_features &= ~CPUID_EXT_TSC_DEADLINE_TIMER; + } env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX); -- 1.7.1
Attachment:
0001-Expose-tsc-deadline-timer-feature-to-guest.patch
Description: 0001-Expose-tsc-deadline-timer-feature-to-guest.patch