From 0dacec874fa3b3fd34b0d0670fa257efdcbbebd0 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 7 Feb 2018 11:40:25 +0100 Subject: cpu: add CPU_RESOLVING_TYPE macro it will be used for providing to cpu name resolving class for parsing cpu model for system and user emulation code. Along with change add target to null-machine tests, so that when switch to CPU_RESOLVING_TYPE happens, it would ensure that null-machine usecase still works. Signed-off-by: Igor Mammedov Reviewed-by: Laurent Vivier (m68k) Acked-by: David Gibson (ppc) Acked-by: Bastian Koppelmann (tricore) Message-Id: <1518000027-274608-4-git-send-email-imammedo@redhat.com> Reviewed-by: Eduardo Habkost [ehabkost: Added macro to riscv too] Signed-off-by: Eduardo Habkost --- target/i386/cpu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'target/i386') diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 2e2bab5ff3..63aea9abcd 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1593,6 +1593,7 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU #define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) +#define CPU_RESOLVING_TYPE TYPE_X86_CPU #ifdef TARGET_X86_64 #define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu64") -- cgit v1.2.1 From 3f71e724e283233753f1b5b3d6a30948d3084636 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 7 Feb 2018 11:40:27 +0100 Subject: cpu: get rid of unused cpu_init() defines cpu_init(cpu_model) were replaced by cpu_create(cpu_type) so no users are left, remove it. Signed-off-by: Igor Mammedov Acked-by: David Gibson (ppc) Reviewed-by: Eduardo Habkost Message-Id: <1518000027-274608-6-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- target/i386/cpu.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'target/i386') diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 63aea9abcd..78db1b833a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1589,8 +1589,6 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define PHYS_ADDR_MASK MAKE_64BIT_MASK(0, TCG_PHYS_ADDR_BITS) -#define cpu_init(cpu_model) cpu_generic_init(TYPE_X86_CPU, cpu_model) - #define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU #define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) #define CPU_RESOLVING_TYPE TYPE_X86_CPU -- cgit v1.2.1 From 99193d8f2ef594648ad67cc3d007b0e4fb2f8cf8 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 7 Feb 2018 15:30:57 +0100 Subject: cpu: drop unnecessary NULL check and cpu_common_class_by_name() both do nothing as for the first all callers parse_cpu_model() and qmp_query_cpu_model_() should provide non NULL value, so just abort if it's not so. While at it drop cpu_common_class_by_name() which is not need any more as every target has CPUClass::class_by_name callback by now, though abort in case a new arch will forget to define one. Signed-off-by: Igor Mammedov Message-Id: <1518013857-4372-1-git-send-email-imammedo@redhat.com> Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'target/i386') diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6bb4ce8719..30b4af897b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -781,13 +781,7 @@ static char *x86_cpu_type_name(const char *model_name) static ObjectClass *x86_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; - char *typename; - - if (cpu_model == NULL) { - return NULL; - } - - typename = x86_cpu_type_name(cpu_model); + char *typename = x86_cpu_type_name(cpu_model); oc = object_class_by_name(typename); g_free(typename); return oc; -- cgit v1.2.1 From c078ca968c6c7cb62781c1843d840cb0f5c72781 Mon Sep 17 00:00:00 2001 From: Luwei Kang Date: Wed, 14 Mar 2018 03:26:31 +0800 Subject: i386: Disable Intel PT if packets IP payloads have LIP values Intel processor trace should be disabled when CPUID.(EAX=14H,ECX=0H).ECX.[bit31] is set. Generated packets which contain IP payloads will have LIP values when this bit is set, or IP payloads will have RIP values. Currently, The information of CPUID 14H is constant to make live migration safty and this bit is always 0 in guest even if host support LIP values. Guest sees the bit is 0 will expect IP payloads with RIP values, but the host CPU will generate IP payloads with LIP values if this bit is set in HW. To make sure the value of IP payloads correctly, Intel PT should be disabled when bit[31] is set. Signed-off-by: Luwei Kang Message-Id: <1520969191-18162-1-git-send-email-luwei.kang@intel.com> Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'target/i386') diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 30b4af897b..4f62fe776d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -195,6 +195,8 @@ * bit[02]: Support Single-Range Output scheme; */ #define INTEL_PT_MINIMAL_ECX 0x7 +/* generated packets which contain IP payloads have LIP values */ +#define INTEL_PT_IP_LIP (1 << 31) #define INTEL_PT_ADDR_RANGES_NUM 0x2 /* Number of configurable address ranges */ #define INTEL_PT_ADDR_RANGES_NUM_MASK 0x3 #define INTEL_PT_MTC_BITMAP (0x0249 << 16) /* Support ART(0,3,6,9) */ @@ -4167,7 +4169,8 @@ static int x86_cpu_filter_features(X86CPU *cpu) ((eax_1 & INTEL_PT_ADDR_RANGES_NUM_MASK) < INTEL_PT_ADDR_RANGES_NUM) || ((ebx_1 & (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP)) != - (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP))) { + (INTEL_PT_PSB_BITMAP | INTEL_PT_CYCLE_BITMAP)) || + (ecx_0 & INTEL_PT_IP_LIP)) { /* * Processor Trace capabilities aren't configurable, so if the * host can't emulate the capabilities we report on -- cgit v1.2.1