On 2011-05-10 10:02, BrillyWu wrote: > From: BrillyWu <brillywu@xxxxxxxxxxxxxx> > > When KVM is running on VIA CPU with host cpu's model, the > feautures of VIA CPU will be passed into kvm guest by calling > the CPUID instruction for Centaur. > > Signed-off-by: BrillyWu<brillywu@xxxxxxxxxxxxxx> > Signed-off-by: KaryJin<karyjin@xxxxxxxxxxxxxx> > --- > target-i386/cpu.h | 3 +++ > target-i386/cpuid.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- > target-i386/kvm.c | 15 +++++++++++++++ > 3 files changed, 63 insertions(+), 1 deletion(-) > > --- a/target-i386/cpu.h 2011-05-09 09:55:48.624885001 +0800 > +++ b/target-i386/cpu.h 2011-05-09 09:48:53.704885019 +0800 > @@ -721,6 +721,9 @@ typedef struct CPUX86State { > uint32_t cpuid_ext3_features; > uint32_t cpuid_apic_id; > int cpuid_vendor_override; > + /* Store the results of Centaur's CPUID instructions */ > + uint32_t cpuid_xlevel2; > + uint32_t cpuid_ext4_features; > > /* MTRRs */ > uint64_t mtrr_fixed[11]; > --- a/target-i386/cpuid.c 2011-05-09 09:31:11.754884991 +0800 > +++ b/target-i386/cpuid.c 2011-05-09 10:18:46.204885008 +0800 > @@ -230,6 +230,9 @@ typedef struct x86_def_t { > char model_id[48]; > int vendor_override; > uint32_t flags; > + /* Store the results of Centaur's CPUID instructions */ > + uint32_t ext4_features; > + uint32_t xlevel2; > } x86_def_t; > > #define I486_FEATURES (CPUID_FP87 | CPUID_VME | CPUID_PSE) > @@ -522,6 +525,18 @@ static int cpu_x86_fill_host(x86_def_t * > cpu_x86_fill_model_id(x86_cpu_def->model_id); > x86_cpu_def->vendor_override = 0; > > + /* Call Centaur's CPUID instruction. */ > + if (x86_cpu_def->vendor1 == CPUID_VENDOR_VIA_1 && > + x86_cpu_def->vendor2 == CPUID_VENDOR_VIA_2 && > + x86_cpu_def->vendor3 == CPUID_VENDOR_VIA_3) { CPUID_VENDOR_VIA_* definitions in target-i386/cpu.h are missing so that this patch breaks current uq/master build. Please fix. Thanks, Jan
Attachment:
signature.asc
Description: OpenPGP digital signature