[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 10/31] i386: extended the cpuid_level when Intel P
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL v2 10/31] i386: extended the cpuid_level when Intel PT is enabled |
Date: |
Mon, 11 Mar 2019 17:55:14 +0100 |
From: Luwei Kang <address@hidden>
Intel Processor Trace required CPUID[0x14] but the cpuid_level
have no change when create a kvm guest with
e.g. "-cpu qemu64,+intel-pt".
Signed-off-by: Eduardo Habkost <address@hidden>
Signed-off-by: Luwei Kang <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/pc.c | 1 +
target/i386/cpu.c | 9 +++++++++
target/i386/cpu.h | 3 +++
3 files changed, 13 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 9c8f833..c6d047b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -136,6 +136,7 @@ GlobalProperty pc_compat_3_1[] = {
{ "Icelake-Client" "-" TYPE_X86_CPU, "mpx", "on" },
{ "Icelake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
{ "Cascadelake-Server" "-" TYPE_X86_CPU, "stepping", "5" },
+ { TYPE_X86_CPU, "x-intel-pt-auto-level", "off" },
};
const size_t pc_compat_3_1_len = G_N_ELEMENTS(pc_compat_3_1);
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index d3aa6a8..d90c01a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5031,6 +5031,13 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error
**errp)
x86_cpu_adjust_feat_level(cpu, FEAT_C000_0001_EDX);
x86_cpu_adjust_feat_level(cpu, FEAT_SVM);
x86_cpu_adjust_feat_level(cpu, FEAT_XSAVE);
+
+ /* Intel Processor Trace requires CPUID[0x14] */
+ if ((env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_INTEL_PT) &&
+ kvm_enabled() && cpu->intel_pt_auto_level) {
+ x86_cpu_adjust_level(cpu, &cpu->env.cpuid_min_level, 0x14);
+ }
+
/* SVM requires CPUID[0x8000000A] */
if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM) {
x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000000A);
@@ -5824,6 +5831,8 @@ static Property x86_cpu_properties[] = {
DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
DEFINE_PROP_BOOL("x-hv-synic-kvm-only", X86CPU, hyperv_synic_kvm_only,
false),
+ DEFINE_PROP_BOOL("x-intel-pt-auto-level", X86CPU, intel_pt_auto_level,
+ true),
DEFINE_PROP_END_OF_LIST()
};
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 95112b9..83fb522 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1454,6 +1454,9 @@ struct X86CPU {
/* Enable auto level-increase for all CPUID leaves */
bool full_cpuid_auto_level;
+ /* Enable auto level-increase for Intel Processor Trace leave */
+ bool intel_pt_auto_level;
+
/* if true fill the top bits of the MTRR_PHYSMASKn variable range */
bool fill_mtrr_mask;
--
1.8.3.1
- [Qemu-devel] [PULL v2 00/31] Misc patches for 2019-03-09, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 01/31] memory: Do not update coalesced IO range in the case of NOP, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 03/31] riscv/Kconfig: enable PCI_DEVICES, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 02/31] vfio-pci: enable by default, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 04/31] tests: test-qgraph: fix a memory leak, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 05/31] hw/i386/pc: run the multiboot loader before the PVH loader, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 06/31] block/iscsi: Restrict Linux-specific code, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 07/31] contrib/elf2dmp: add kernel start address checking, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 08/31] configure: Enable werror for git worktrees, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 10/31] i386: extended the cpuid_level when Intel PT is enabled,
Paolo Bonzini <=
- [Qemu-devel] [PULL v2 11/31] virtio-scsi: Fix build with gcc 9, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 15/31] build: get rid of target-obj-y, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 12/31] lsi: implement basic SBCL functionality, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 09/31] target-i386: add kvm stubs to user-mode emulators, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 13/31] lsi: check if SIGP bit is already set in Wait reselect, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 14/31] update copyright notice, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 16/31] build: remove unnecessary assignments from Makefile.target, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 17/31] build: clean trace/generated-helpers.c, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 19/31] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure, Paolo Bonzini, 2019/03/11
- [Qemu-devel] [PULL v2 18/31] accel: Allow to build QEMU without TCG or KVM support, Paolo Bonzini, 2019/03/11