x86 queue, 2020-10-15
The following changes since commit 57c98ea9acdcef5021f5671efa6475a5794a51c4:
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201014-pull-request' into staging (2020-10-14 13:56:06 +0100)
are available in the Git repository at:
git://github.com/ehabkost/qemu.git tags/x86-next-pull-request
for you to fetch changes up to 3e6a015cbd0f61c19cdc02d5ce74a3e60235cb9a:
i386: Mark Icelake-Client CPU models deprecated (2020-10-14 15:28:55 -0400)
----------------------------------------------------------------
x86 queue, 2020-10-15
Cleanups:
* Drop x86_cpu_get_supported_feature_word() forward declaration (Vitaly Kuznetsov)
* Delete kvm_allows_irq0_override() (Eduardo Habkost)
* Correct documentation of kvm_irqchip_*() (Eduardo Habkost)
* Fix FEATURE_HYPERV_EDX value in hyperv_passthrough case (Zhenyu Wang)
Deprecation:
* CPU model deprecation API (Robert Hoo)
* Mark Icelake-Client CPU models deprecated (Robert Hoo)
Bug fixes:
* Remove core_id assert check in CPUID 0x8000001E (Babu Moger)
----------------------------------------------------------------
Babu Moger (1):
target/i386: Remove core_id assert check in CPUID 0x8000001E
Eduardo Habkost (4):
i386/kvm: Require KVM_CAP_IRQ_ROUTING
i386/kvm: Remove IRQ routing support checks
i386/kvm: Delete kvm_allows_irq0_override()
kvm: Correct documentation of kvm_irqchip_*()
Robert Hoo (2):
cpu: Introduce CPU model deprecation API
i386: Mark Icelake-Client CPU models deprecated
Vitaly Kuznetsov (1):
i386: drop x86_cpu_get_supported_feature_word() forward declaration
Zhenyu Wang (1):
i386/kvm: fix FEATURE_HYPERV_EDX value in hyperv_passthrough case
docs/system/deprecated.rst | 6 ++++++ qapi/machine-target.json | 7 ++++++- include/hw/core/cpu.h | 3 +++ include/sysemu/kvm.h | 19 +++++++++---------- target/i386/kvm_i386.h | 1 - hw/core/machine.c | 12 ++++++++++-- hw/i386/fw_cfg.c | 2 +- hw/i386/kvm/apic.c | 5 ++--- hw/i386/kvm/ioapic.c | 33 ++++++++++++++++----------------- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 2 +- target/i386/cpu.c | 32 +++++++++++++++++++++++--------- target/i386/kvm-stub.c | 5 ----- target/i386/kvm.c | 19 ++++++------------- 14 files changed, 84 insertions(+), 64 deletions(-)
Signature · 1 line
2.28.0
[PULL 1/9] i386: drop x86_cpu_get_supported_feature_word() forward declaration
From: Vitaly Kuznetsov <[email protected]>
We only use x86_cpu_get_supported_feature_word() after its implementation, no forward declaration needed.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 3 --- 1 file changed, 3 deletions(-)
target/i386/cpu.c +0 -3
@@ -4180,9 +4180,6 @@ void x86_cpu_change_kvm_default(const char *prop, const char *value)assert (pv->prop); } -static uint64_t x86_cpu_get_supported_feature_word (FeatureWord w, -bool migratable_only); -static bool lmce_supported (void ) {uint64_t mce_cap =0 ;
Signature · 1 line
2.28.0
[PULL 3/9] target/i386: Remove core_id assert check in CPUID 0x8000001E
In reply to Eduardo HabkostFrom: Babu Moger <[email protected]>
With x2apic enabled, configurations can have more that 255 cores. Noticed the device add test is hitting an assert when during cpu hotplug with core_id > 255. This is due to assert check in the CPUID 0x8000001E.
Remove the assert check and fix the problem.
Fixes the bug:
Message-Id: <[email protected]>
--- target/i386/cpu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
target/i386/cpu.c +8 -3
@@ -5910,9 +5910,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, }break ;case 0x8000001E : -assert (cpu->core_id <=255 ); -encode_topo_cpuid8000001e (cpu, &topo_info, - eax, ebx, ecx, edx); +if (cpu->core_id <=255 ) { +encode_topo_cpuid8000001e (cpu, &topo_info, eax, ebx, ecx, edx); + }else { + *eax =0 ; + *ebx =0 ; + *ecx =0 ; + *edx =0 ; + }break ;case 0xC0000000 : *eax = env->cpuid_xlevel2;
Signature · 1 line
2.28.0
[PULL 2/9] i386/kvm: fix FEATURE_HYPERV_EDX value in hyperv_passthrough case
In reply to Eduardo HabkostFrom: Zhenyu Wang <[email protected]>
Fix typo to use correct edx value for FEATURE_HYPERV_EDX when hyperv_passthrough is enabled.
Message-Id: <[email protected]>
--- target/i386/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/kvm.c +1 -1
@@ -1214,7 +1214,7 @@ static int hyperv_handle_properties(CPUState *cs,if (c) { env->features[FEAT_HYPERV_EAX ] = c->eax; env->features[FEAT_HYPERV_EBX ] = c->ebx; - env->features[FEAT_HYPERV_EDX ] = c->eax; + env->features[FEAT_HYPERV_EDX ] = c->edx; } c =cpuid_find_entry (cpuid,HV_CPUID_ENLIGHTMENT_INFO ,0 );if (c) {
Signature · 1 line
2.28.0
[PULL 7/9] kvm: Correct documentation of kvm_irqchip_*()
In reply to Eduardo HabkostWhen split irqchip support was introduced, the meaning of kvm_irqchip_in_kernel() changed: now it only means the LAPIC is in kernel. The PIC, IOAPIC, and PIT might be in userspace if irqchip=split was set. Update the doc comment to reflect that.
While at it, remove the "the user asked us" part in kvm_irqchip_is_split() doc comment. That macro has nothing to do with existence of explicit user-provided options.
Message-Id: <[email protected]>
--- include/sysemu/kvm.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
include/sysemu/kvm.h +9 -10
@@ -51,23 +51,22 @@ extern bool kvm_msi_use_devid;/** * kvm_irqchip_in_kernel: * -* Returns: true if the user asked us to create an in-kernel -* irqchip via the "kernel_irqchip=on" machine option. +* Returns: true if an in-kernel irqchip was created. * What this actually means is architecture and machine model -* specific: on PC, for instance, it means that the LAPIC, -* IOAPIC and PIT are all in kernel. This function should never -* be used from generic target-independent code: use one of the -* following functions or some other specific check instead. +* specific: on PC, for instance, it means that the LAPIC +* is in kernel. This function should never be used from generic +* target-independent code: use one of the following functions or +* some other specific check instead. */ #define kvm_irqchip_in_kernel () (kvm_kernel_irqchip)/** * kvm_irqchip_is_split: * -* Returns: true if the user asked us to split the irqchip -* implementation between user and kernel space. The details are -* architecture and machine specific. On PC, it means that the PIC, -* IOAPIC, and PIT are in user space while the LAPIC is in the kernel. +* Returns: true if the irqchip implementation is split between +* user and kernel space. The details are architecture and +* machine specific. On PC, it means that the PIC, IOAPIC, and +* PIT are in user space while the LAPIC is in the kernel. */ #define kvm_irqchip_is_split () (kvm_split_irqchip)
Signature · 1 line
2.28.0
[PULL 8/9] cpu: Introduce CPU model deprecation API
In reply to Eduardo HabkostFrom: Robert Hoo <[email protected]>
Implement the ability of marking some versions deprecated. When that CPU model is chosen, print a warning. The warning message can be customized, e.g. suggesting an alternative CPU model to be used instead.
The deprecation message will be printed by x86_cpu_list_entry(), e.g. '-cpu help'.
QMP command 'query-cpu-definitions' will return a bool value indicating the deprecation status.
Message-Id: <[email protected]>
--- qapi/machine-target.json | 7 ++++++- include/hw/core/cpu.h | 3 +++ hw/core/machine.c | 12 ++++++++++-- target/i386/cpu.c | 8 ++++++++ 4 files changed, 27 insertions(+), 3 deletions(-)
qapi/machine-target.json +6 -1
@@ -286,6 +286,10 @@ # in the VM configuration, because aliases may stop being # migration-safe in the future (since 4.1) # +# @deprecated: If true, this CPU model is deprecated and may be removed in +# in some future version of QEMU according to the QEMU deprecation +# policy. (since 5.2) +# # @unavailable-features is a list of QOM property names that # represent CPU model attributes that prevent the CPU from running. # If the QOM property is read-only, that means there's no known
@@ -310,7 +314,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' }, 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } ##
include/hw/core/cpu.h +3 -0
@@ -155,6 +155,8 @@ struct TranslationBlock;* @disas_set_info: Setup architecture specific components of disassembly info * @adjust_watchpoint_address: Perform a target-specific adjustment to an * address before attempting to match it against watchpoints. +* @deprecation_note: If this CPUClass is deprecated, this field provides +* related information. * * Represents a CPU family or model. */
@@ -221,6 +223,7 @@ struct CPUClass {vaddr (*adjust_watchpoint_address)(CPUState *cpu,vaddr addr,int len);void (*tcg_initialize)(void ); +const char *deprecation_note;/* Keep non-pointer data at the end to minimize holes. */ int gdb_num_core_regs;bool gdb_stop_before_watchpoint;
hw/core/machine.c +10 -2
@@ -1087,6 +1087,8 @@ MemoryRegion *machine_consume_memdev(MachineState *machine,void machine_run_board_init (MachineState *machine) {MachineClass *machine_class =MACHINE_GET_CLASS (machine); +ObjectClass *oc =object_class_by_name (machine->cpu_type); +CPUClass *cc;if (machine->ram_memdev_id) {Object *o;
@@ -1106,11 +1108,10 @@ void machine_run_board_init(MachineState *machine)* specified a CPU with -cpu check here that the user CPU is supported. */ if (machine_class->valid_cpu_types && machine->cpu_type) { -ObjectClass *class =object_class_by_name (machine->cpu_type);int i;for (i =0 ; machine_class->valid_cpu_types[i]; i++) { -if (object_class_dynamic_cast (class, +if (object_class_dynamic_cast (oc, machine_class->valid_cpu_types[i])) {/* The user specificed CPU is in the valid field, we are * good to go.
@@ -1133,6 +1134,13 @@ void machine_run_board_init(MachineState *machine) } } +/* Check if CPU type is deprecated and warn if so */ + cc =CPU_CLASS (oc); +if (cc && cc->deprecation_note) { +warn_report ("CPU model %s is deprecated -- %s" , machine->cpu_type, + cc->deprecation_note); + } + machine_class->init (machine); }
target/i386/cpu.c +8 -0
@@ -1633,6 +1633,7 @@ typedef struct X86CPUDefinition {* If NULL, version 1 will be registered automatically. */ const X86CPUVersionDefinition *versions; +const char *deprecation_note; } X86CPUDefinition;/* Reference to a specific CPU model version */
@@ -4990,6 +4991,11 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data) info->migration_safe = cc->migration_safe; info->has_migration_safe = true; info->q_static = cc->static_model; +if (cc->model && cc->model->cpudef->deprecation_note) { + info->deprecated = true; + }else { + info->deprecated = false; + }/* * Old machine types won't report aliases, so that alias translation * doesn't break compatibility with previous QEMU versions.
@@ -5380,9 +5386,11 @@ static void x86_cpu_cpudef_class_init(ObjectClass *oc, void *data) {X86CPUModel *model = data;X86CPUClass *xcc =X86_CPU_CLASS (oc); +CPUClass *cc =CPU_CLASS (oc); xcc->model = model; xcc->migration_safe = true; + cc->deprecation_note = model->cpudef->deprecation_note; }static void x86_register_cpu_model_type (const char *name,X86CPUModel *model)
Signature · 1 line
2.28.0
[PULL 4/9] i386/kvm: Require KVM_CAP_IRQ_ROUTING
In reply to Eduardo HabkostKVM_CAP_IRQ_ROUTING is available since 2009 (Linux v2.6.30), so it's safe to just make it a requirement on x86.
Message-Id: <[email protected]>
--- target/i386/kvm.c | 5 +++++ 1 file changed, 5 insertions(+)
target/i386/kvm.c +5 -0
@@ -2114,6 +2114,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)int ret;struct utsname utsname; +if (!kvm_check_extension (s,KVM_CAP_IRQ_ROUTING )) { +error_report ("kvm: KVM_CAP_IRQ_ROUTING not supported by KVM" ); +return -ENOTSUP ; + } + has_xsave =kvm_check_extension (s,KVM_CAP_XSAVE ); has_xcrs =kvm_check_extension (s,KVM_CAP_XCRS ); has_pit_state2 =kvm_check_extension (s,KVM_CAP_PIT_STATE2 );
Signature · 1 line
2.28.0
[PULL 9/9] i386: Mark Icelake-Client CPU models deprecated
In reply to Eduardo HabkostFrom: Robert Hoo <[email protected]>
Icelake-Client CPU models will be removed in the future.
Message-Id: <[email protected]>
--- docs/system/deprecated.rst | 6 ++++++ target/i386/cpu.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
docs/system/deprecated.rst +6 -0
@@ -314,6 +314,12 @@ a future version of QEMU. Support for this CPU was removed from the upstream Linux kernel, and there is no available upstream toolchain to build binaries for it. +``Icelake-Client`` CPU Model (since 5.2.0) +'''''''''''''''''''''''''''''''''''''''''' + +``Icelake-Client`` CPU Models are deprecated. Use ``Icelake-Server`` CPU +Models instead. + System emulator devices -----------------------
target/i386/cpu.c +7 -3
@@ -3358,10 +3358,13 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x80000008, .model_id = "Intel Core Processor (Icelake)", .versions = (X86CPUVersionDefinition []) { - { .version =1 }, + { + .version =1 , + .note ="deprecated" + }, { .version =2 , - .note ="no TSX" , + .note ="no TSX, deprecated" , .alias ="Icelake-Client-noTSX" , .props = (PropValue []) { {"hle" ,"off" },
@@ -3370,7 +3373,8 @@ static X86CPUDefinition builtin_x86_defs[] = { }, }, {/* end of list */ } - } + }, + .deprecation_note = "use Icelake-Server instead" }, { .name = "Icelake-Server",
Signature · 1 line
2.28.0
[PULL 5/9] i386/kvm: Remove IRQ routing support checks
In reply to Eduardo HabkostKVM_CAP_IRQ_ROUTING is always available on x86, so replace checks for kvm_has_gsi_routing() and KVM_CAP_IRQ_ROUTING with asserts.
Message-Id: <[email protected]>
--- hw/i386/kvm/apic.c | 5 ++--- hw/i386/kvm/ioapic.c | 33 ++++++++++++++++----------------- target/i386/kvm.c | 7 ------- 3 files changed, 18 insertions(+), 27 deletions(-)
hw/i386/kvm/apic.c +2 -3
@@ -225,9 +225,8 @@ static void kvm_apic_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->io_memory,OBJECT (s), &kvm_apic_io_ops, s,"kvm-apic-msi" ,APIC_SPACE_SIZE ); -if (kvm_has_gsi_routing ()) { - msi_nonbroken = true; - } +assert (kvm_has_gsi_routing ()); + msi_nonbroken = true; }static void kvm_apic_unrealize (DeviceState *dev)
hw/i386/kvm/ioapic.c +16 -17
@@ -25,27 +25,26 @@ void kvm_pc_setup_irq_routing(bool pci_enabled)KVMState *s = kvm_state;int i; -if (kvm_check_extension (s,KVM_CAP_IRQ_ROUTING )) { -for (i =0 ; i <8 ; ++i) { -if (i ==2 ) { -continue ; - } -kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_PIC_MASTER , i); - } -for (i =8 ; i <16 ; ++i) { -kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_PIC_SLAVE , i -8 ); +assert (kvm_has_gsi_routing ()); +for (i =0 ; i <8 ; ++i) { +if (i ==2 ) { +continue ; } -if (pci_enabled) { -for (i =0 ; i <24 ; ++i) { -if (i ==0 ) { -kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_IOAPIC ,2 ); - }else if (i !=2 ) { -kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_IOAPIC , i); - } +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_PIC_MASTER , i); + } +for (i =8 ; i <16 ; ++i) { +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_PIC_SLAVE , i -8 ); + } +if (pci_enabled) { +for (i =0 ; i <24 ; ++i) { +if (i ==0 ) { +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_IOAPIC ,2 ); + }else if (i !=2 ) { +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_IOAPIC , i); } } -kvm_irqchip_commit_routes (s); } +kvm_irqchip_commit_routes (s); }typedef struct KVMIOAPICState KVMIOAPICState ;
target/i386/kvm.c +0 -7
@@ -4552,13 +4552,6 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs)void kvm_arch_init_irq_routing (KVMState *s) { -if (!kvm_check_extension (s,KVM_CAP_IRQ_ROUTING )) { -/* If kernel can't do irq routing, interrupt source -* override 0->2 cannot be set up as required by HPET. -* So we have to disable it. -*/ - no_hpet =1 ; - }/* We know at this point that we're using the in-kernel * irqchip, so we can use irqfds, and on x86 we know * we can use msi via irqfd and GSI routing.
Signature · 1 line
2.28.0
[PULL 6/9] i386/kvm: Delete kvm_allows_irq0_override()
In reply to Eduardo HabkostAs IRQ routing is always available on x86, kvm_allows_irq0_override() will always return true, so we don't need the function anymore.
Message-Id: <[email protected]>
--- target/i386/kvm_i386.h | 1 - hw/i386/fw_cfg.c | 2 +- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 2 +- target/i386/kvm-stub.c | 5 ----- target/i386/kvm.c | 5 ----- 6 files changed, 3 insertions(+), 14 deletions(-)
target/i386/kvm_i386.h +0 -1
@@ -32,7 +32,6 @@#endif /* CONFIG_KVM */ -bool kvm_allows_irq0_override (void );bool kvm_has_smm (void );bool kvm_has_adjust_clock (void );bool kvm_has_adjust_clock_stable (void );
hw/i386/fw_cfg.c +1 -1
@@ -123,7 +123,7 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,fw_cfg_add_bytes (fw_cfg,FW_CFG_ACPI_TABLES , acpi_tables, acpi_tables_len);#endif -fw_cfg_add_i32 (fw_cfg,FW_CFG_IRQ0_OVERRIDE ,kvm_allows_irq0_override ()); +fw_cfg_add_i32 (fw_cfg,FW_CFG_IRQ0_OVERRIDE ,1 );fw_cfg_add_bytes (fw_cfg,FW_CFG_E820_TABLE , &e820_reserve,sizeof (e820_reserve));
hw/i386/microvm.c +1 -1
@@ -290,7 +290,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)fw_cfg_add_i16 (fw_cfg,FW_CFG_NB_CPUS , machine->smp.cpus);fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , machine->smp.max_cpus);fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , (uint64_t )machine->ram_size); -fw_cfg_add_i32 (fw_cfg,FW_CFG_IRQ0_OVERRIDE ,kvm_allows_irq0_override ()); +fw_cfg_add_i32 (fw_cfg,FW_CFG_IRQ0_OVERRIDE ,1 );fw_cfg_add_bytes (fw_cfg,FW_CFG_E820_TABLE , &e820_reserve,sizeof (e820_reserve)); fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
hw/i386/pc.c +1 -1
@@ -827,7 +827,7 @@ void pc_guest_info_init(PCMachineState *pcms)MachineState *ms =MACHINE (pcms);X86MachineState *x86ms =X86_MACHINE (pcms); - x86ms->apic_xrupt_override =kvm_allows_irq0_override (); + x86ms->apic_xrupt_override = true; pcms->numa_nodes = ms->numa_state->num_nodes; pcms->node_mem =g_malloc0 (pcms->numa_nodes *sizeof *pcms->node_mem);
target/i386/kvm-stub.c +0 -5
@@ -13,11 +13,6 @@#include "cpu.h" #include "kvm_i386.h" -bool kvm_allows_irq0_override (void ) -{ -return 1 ; -} -#ifndef __OPTIMIZE__bool kvm_has_smm (void ) {
target/i386/kvm.c +0 -5
@@ -154,11 +154,6 @@ bool kvm_has_exception_payload(void)return has_exception_payload; } -bool kvm_allows_irq0_override (void ) -{ -return !kvm_irqchip_in_kernel () ||kvm_has_gsi_routing (); -} -static bool kvm_x2apic_api_set_flags (uint64_t flags) {KVMState *s =KVM_STATE (current_accel ());
Signature · 1 line
2.28.0
Peter Maydell
AppliedQuoted 23 lines · Eduardo Habkost
The following changes since commit
57c98ea9acdcef5021f5671efa6475a5794a51c4:Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201014-pull-request' into staging (2020-10-14 13:56:06 +0100)
are available in the Git repository at:
git://github.com/ehabkost/qemu.gittags/x86-next-pull-requestfor you to fetch changes up to
3e6a015cbd0f61c19cdc02d5ce74a3e60235cb9a:i386: Mark Icelake-Client CPU models deprecated (2020-10-14 15:28:55 -0400)
----------------------------------------------------------------
x86 queue, 2020-10-15Cleanups:
* Dropx86_cpu_get_supported_feature_word()forward declaration (Vitaly Kuznetsov)
* Deletekvm_allows_irq0_override()(Eduardo Habkost)
* Correct documentation of kvm_irqchip_*() (Eduardo Habkost)
* FixFEATURE_HYPERV_EDXvalue inhyperv_passthroughcase (Zhenyu Wang)
Quoted 7 lines
Deprecation:
* CPU model deprecation API (Robert Hoo)
* Mark Icelake-Client CPU models deprecated (Robert Hoo)Bug fixes:
* Removecore_idassert check in CPUID0x8000001E(Babu Moger)
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.
-- PMM