qemu/target/i386
Jan Dakinevich 0b368a10c7 i386/cpu/kvm: look at PMU's CPUID before setting MSRs
Certain PMU-related MSRs are not supported for CPUs with PMU
architecture below version 2. KVM rejects any access to them (see
intel_is_valid_msr_idx routine in KVM), and QEMU fails on the following
assertion:

  kvm_put_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.

QEMU also could fail if KVM exposes less fixed counters then 3. It could
happen if host system run inside another hypervisor, which is tweaking
PMU-related CPUID. To prevent possible fail, number of fixed counters now is
obtained in the same way as number of GP counters.

Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Message-Id: <1514383466-7257-1-git-send-email-jan.dakinevich@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-01-12 13:22:02 +01:00
..
hvf i386: hvf: cleanup x86_gen.h 2017-12-22 15:02:07 +01:00
arch_dump.c exec,dump,i386,ppc,s390x: don't include exec/cpu-all.h explicitly 2017-09-19 18:21:33 +02:00
arch_memory_mapping.c exec,dump,i386,ppc,s390x: don't include exec/cpu-all.h explicitly 2017-09-19 18:21:33 +02:00
bpt_helper.c target-i386: Fix eflags.TF/#DB handling of syscall/sysret insns 2016-12-22 16:01:04 +01:00
cc_helper_template.h
cc_helper.c target-i386: Use ctpop helper 2017-01-10 08:49:59 -08:00
cpu-qom.h i386: refactor KVM cpuid code so that it applies to hvf as well 2017-12-22 15:01:48 +01:00
cpu.c i386: hvf: refactor event injection code for hvf 2017-12-22 15:01:48 +01:00
cpu.h i386: hvf: unify register enums between HVF and the rest 2017-12-22 15:02:07 +01:00
excp_helper.c target/i386: move TLB refill function out of helper.c 2017-07-05 09:12:44 +02:00
fpu_helper.c target/i386: split cpu_set_mxcsr() and make cpu_set_fpuc() inline 2017-07-05 09:12:44 +02:00
gdbstub.c x86: Fix x86_64 'g' packet response to gdb from 32-bit mode. 2016-12-22 16:00:25 +01:00
hax-all.c vcpu_dirty: share the same field in CPUState for all accelerators 2017-07-04 14:30:03 +02:00
hax-darwin.c i386/hax: remove duplicated includes 2017-12-18 17:07:02 +03:00
hax-darwin.h i386/hax: remove duplicated includes 2017-12-18 17:07:02 +03:00
hax-i386.h hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-interface.h target/i386: Add Intel HAX files 2017-01-19 22:07:46 +01:00
hax-mem.c General warn report fixups 2017-09-19 14:09:34 +02:00
hax-windows.c target/i386: Add Intel HAX files 2017-01-19 22:07:46 +01:00
hax-windows.h i386/hax: remove duplicated include 2017-12-18 17:07:02 +03:00
helper.c target/i386: add the tcg_enabled() in target/i386/ 2017-07-05 09:12:44 +02:00
helper.h target-i386: correctly propagate retaddr into SVM helpers 2017-02-16 18:37:01 +01:00
hyperv-proto.h hyperv: add header with protocol definitions 2017-09-19 16:20:49 +02:00
hyperv.c hyperv: add header with protocol definitions 2017-09-19 16:20:49 +02:00
hyperv.h
int_helper.c target-i386: Use clz and ctz opcodes 2017-01-10 08:06:11 -08:00
kvm_i386.h Move CONFIG_KVM related definitions to kvm_i386.h 2017-07-04 14:30:03 +02:00
kvm-stub.c
kvm.c i386/cpu/kvm: look at PMU's CPUID before setting MSRs 2018-01-12 13:22:02 +01:00
machine.c migration: pre_save return int 2017-09-27 11:35:59 +01:00
Makefile.objs i386: hvf: move all hvf files in the same directory 2017-12-22 15:02:05 +01:00
mem_helper.c
misc_helper.c target/i386/misc_helper: wrap BQL around another IRQ generator 2017-04-10 10:14:50 +01:00
monitor.c target/i386: fix "info mem" for LA57 mode 2017-09-19 16:20:49 +02:00
mpx_helper.c target/i386: move cpu_sync_bndcs_hflags() function 2017-07-05 09:12:44 +02:00
ops_sse_header.h target-i386: Use ctpop helper 2017-01-10 08:49:59 -08:00
ops_sse.h target/i386: fix phminposuw in-place operation 2017-09-19 14:09:11 +02:00
seg_helper.c target/i386: simplify handling of conforming code segments on interrupt 2017-07-04 14:30:03 +02:00
shift_helper_template.h
smm_helper.c target/i386: use multiple CPU AddressSpaces 2017-06-07 18:22:02 +02:00
svm_helper.c target/*helper: don't check retaddr before calling cpu_restore_state 2017-12-27 17:20:44 -08:00
svm.h
TODO
trace-events docs: fix broken paths to docs/devel/tracing.txt 2017-07-31 13:12:53 +03:00
translate.c tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
xsave_helper.c xsave_helper: pull xsave and xrstor out of kvm.c into helper function 2017-07-04 14:39:27 +02:00