1. 20 Sep, 2013 2 commits
  2. 03 Sep, 2013 1 commit
    • Eduardo Habkost's avatar
      target-i386: Use #defines instead of magic numbers for CPUID cache info · 5e891bf8
      Eduardo Habkost authored
      
      
      This is an attempt to make the CPUID cache topology code clearer, by
      replacing the magic numbers in the code with #defines, and moving all
      the cache information to the same place in the file.
      
      I took care of comparing the assembly output of compiling
      target-i386/cpu.c before and after applying this change, to make sure
      not a single bit was changed on cpu_x86_cpuid() before and after
      applying this patch (unfortunately I had to manually check existing
      differences, because of __LINE__ expansions on
      object_class_dynamic_cast_assert() calls).
      
      This even keeps the code bug-compatible with the previous version: today
      the cache information returned on AMD cache information leaves (CPUID
      0x80000005 & 0x80000006) do not match the information returned on CPUID
      leaves 2 and 4. The L2 cache information on CPUID leaf 2 also doesn't
      match the information on CPUID leaf 2. The new constants should make it
      easier to eventually fix those inconsistencies. All inconsistencies I
      have found are documented in code comments.
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarliguang <lig.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      5e891bf8
  3. 20 Aug, 2013 1 commit
  4. 16 Aug, 2013 1 commit
  5. 06 Aug, 2013 1 commit
    • Andreas Färber's avatar
      target-i386: Fix X86CPU error handling · cd7b87ff
      Andreas Färber authored
      
      
      Error **errp argument is not for emitting warnings, it means an error
      has occurred and the caller should not make any assumptions about the
      state of other return values (unless otherwise documented).
      
      Therefore cpu_x86_create() must unref the new X86CPU itself, and
      pc_new_cpu() must check for an Error rather than NULL return value.
      
      While at it, clean up a superfluous NULL check.
      Reported-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Cc: qemu-stable@nongnu.org
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      cd7b87ff
  6. 29 Jul, 2013 3 commits
    • Eduardo Habkost's avatar
      target-i386: Disable PMU CPUID leaf by default · 9337e3b6
      Eduardo Habkost authored
      
      
      Bug description: QEMU currently gets all bits from GET_SUPPORTED_CPUID
      for CPUID leaf 0xA and passes them directly to the guest. This makes
      the guest ABI depend on host kernel and host CPU capabilities, and
      breaks live migration if we migrate between hosts with different
      capabilities (e.g., different number of PMU counters).
      
      Add a "pmu" property to X86CPU, and set it to true only on "-cpu host",
      or on pc-*-1.5 and older machine-types.
      
      For now, setting pmu=on will enable the current passthrough mode that
      doesn't have any ABI stability guarantees, but in the future we may
      implement a mode where the PMU CPUID bits are stable and configurable.
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      9337e3b6
    • Eduardo Habkost's avatar
      target-i386: Pass X86CPU object to cpu_x86_find_by_name() · c1399112
      Eduardo Habkost authored
      
      
      This will help us change the initialization code to not require carrying
      some intermediate values in a x86_def_t struct (and eventually kill the
      x86_def_t struct entirely).
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      c1399112
    • Andreas Färber's avatar
      cpu: Partially revert "cpu: Change qemu_init_vcpu() argument to CPUState" · 14a10fc3
      Andreas Färber authored
      Commit c643bed9
      
       moved qemu_init_vcpu() calls to common CPUState code.
      This causes x86 cpu-add to fail with "KVM: setting VAPIC address failed".
      
      The reason for the failure is that CPUClass::kvm_fd is not yet
      initialized in the following call graph:
      ->x86_cpu_realizefn
       ->x86_cpu_apic_realize
        ->qdev_init
         ->device_set_realized
          ->device_reset (hotplugged == 1)
           ->apic_reset_common
            ->vapic_base_update
             ->kvm_apic_vapic_base_update
      This causes attempted KVM vCPU ioctls to fail.
      
      By contrast, in the non-hotplug case the APIC is reset much later, when
      the vCPU is already initialized.
      
      As a quick and safe solution, move the qemu_init_vcpu() call back into
      the targets' realize functions.
      Reported-by: default avatarChen Fan <chen.fan.fnst@cn.fujitsu.com>
      Acked-by: Igor Mammedov <imammedo@redhat.com> (for i386)
      Tested-by: Jia Liu <proljc@gmail.com> (for openrisc)
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      14a10fc3
  7. 26 Jul, 2013 2 commits
  8. 23 Jul, 2013 3 commits
  9. 09 Jul, 2013 2 commits
  10. 28 Jun, 2013 2 commits
  11. 11 Jun, 2013 2 commits
  12. 10 Jun, 2013 3 commits
  13. 06 May, 2013 9 commits
    • Borislav Petkov's avatar
      target-i386: n270 can MOVBE · 4458c236
      Borislav Petkov authored
      
      
      The Atom core (cpu name "n270" in QEMU speak) supports MOVBE. This is
      needed when booting 3.8 and later linux kernels built with the MATOM
      target because we require MOVBE in order to boot properly now.
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      [ehabkost: added compat code to disable MOVBE on pc-*-1.4 and older]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      4458c236
    • Eduardo Habkost's avatar
      target-i386: Introduce generic CPUID feature compat function · 0668af54
      Eduardo Habkost authored
      
      
      Introduce x86_cpu_compat_set_features(), that can be used to set/unset
      feature bits on specific CPU models for machine-type compatibility.
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      0668af54
    • Andreas Färber's avatar
      target-i386: Change CPUID model of 486 to 8 · b2a856d9
      Andreas Färber authored
      
      
      This changes the model number of 486 to 8 (DX4) which matches the
      feature set presented, and actually has the CPUID instruction.
      
      This adds a compatibility property, to keep model=0 on pc-*-1.4 and older.
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      [AF: Add compat_props entry]
      Tested-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      b2a856d9
    • Andreas Färber's avatar
      target-i386: Emulate X86CPU subclasses for global properties · ba2bc7a4
      Andreas Färber authored
      
      
      After initializing the object from its x86_def_t and before setting any
      additional -cpu arguments, set any global properties for the designated
      subclass <name>-{i386,x86_64}-cpu.
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      ba2bc7a4
    • Eduardo Habkost's avatar
      target-i386: Add "filtered-features" property to X86CPU · 7e5292b5
      Eduardo Habkost authored
      
      
      This property will contain all the features that were removed from the
      CPU because they are not supported by the host.
      
      This way, libvirt or other management tools can emulate the
      check/enforce behavior by checking if filtered-properties is all zeroes,
      before starting the guest.
      
      Example output where some features were missing:
      
        $ qemu-system-x86_64 -enable-kvm -cpu Haswell,check -S \
          -qmp unix:/tmp/m,server,nowait
        warning: host doesn't support requested feature: CPUID.01H:ECX.fma [bit 12]
        warning: host doesn't support requested feature: CPUID.01H:ECX.movbe [bit 22]
        warning: host doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
        warning: host doesn't support requested feature: CPUID.01H:ECX.xsave [bit 26]
        warning: host doesn't support requested feature: CPUID.01H:ECX.avx [bit 28]
        warning: host doesn't support requested feature: CPUID.07H:EBX.fsgsbase [bit 0]
        warning: host doesn't support requested feature: CPUID.07H:EBX.bmi1 [bit 3]
        warning: host doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
        warning: host doesn't support requested feature: CPUID.07H:EBX.avx2 [bit 5]
        warning: host doesn't support requested feature: CPUID.07H:EBX.smep [bit 7]
        warning: host doesn't support requested feature: CPUID.07H:EBX.bmi2 [bit 8]
        warning: host doesn't support requested feature: CPUID.07H:EBX.erms [bit 9]
        warning: host doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
        warning: host doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
        [...]
        $ ./QMP/qmp --path=/tmp/m \
          qom-get --path=/machine/icc-bridge/icc/child[0] \
                  --property=filtered-features
        item[0].cpuid-register: EDX
        item[0].cpuid-input-eax: 2147483658
        item[0].features: 0
        item[1].cpuid-register: EAX
        item[1].cpuid-input-eax: 1073741825
        item[1].features: 0
        item[2].cpuid-register: EDX
        item[2].cpuid-input-eax: 3221225473
        item[2].features: 0
        item[3].cpuid-register: ECX
        item[3].cpuid-input-eax: 2147483649
        item[3].features: 0
        item[4].cpuid-register: EDX
        item[4].cpuid-input-eax: 2147483649
        item[4].features: 0
        item[5].cpuid-register: EBX
        item[5].cpuid-input-eax: 7
        item[5].features: 4025
        item[5].cpuid-input-ecx: 0
        item[6].cpuid-register: ECX
        item[6].cpuid-input-eax: 1
        item[6].features: 356519936
        item[7].cpuid-register: EDX
        item[7].cpuid-input-eax: 1
        item[7].features: 0
      
      Example output when no feature is missing:
      
        $ qemu-system-x86_64 -enable-kvm -cpu Nehalem,enforce -S \
          -qmp unix:/tmp/m,server,nowait
        [...]
        $ ./QMP/qmp --path=/tmp/m \
          qom-get --path=/machine/icc-bridge/icc/child[0] \
                  --property=filtered-features
        item[0].cpuid-register: EDX
        item[0].cpuid-input-eax: 2147483658
        item[0].features: 0
        item[1].cpuid-register: EAX
        item[1].cpuid-input-eax: 1073741825
        item[1].features: 0
        item[2].cpuid-register: EDX
        item[2].cpuid-input-eax: 3221225473
        item[2].features: 0
        item[3].cpuid-register: ECX
        item[3].cpuid-input-eax: 2147483649
        item[3].features: 0
        item[4].cpuid-register: EDX
        item[4].cpuid-input-eax: 2147483649
        item[4].features: 0
        item[5].cpuid-register: EBX
        item[5].cpuid-input-eax: 7
        item[5].features: 0
        item[5].cpuid-input-ecx: 0
        item[6].cpuid-register: ECX
        item[6].cpuid-input-eax: 1
        item[6].features: 0
        item[7].cpuid-register: EDX
        item[7].cpuid-input-eax: 1
        item[7].features: 0
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      7e5292b5
    • Eduardo Habkost's avatar
      target-i386: Introduce X86CPU::filtered_features field · 034acf4a
      Eduardo Habkost authored
      
      
      This field will contain the feature bits that were filtered out because
      of missing host support.
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      034acf4a
    • Eduardo Habkost's avatar
      target-i386: Add "feature-words" property to X86CPU · 8e8aba50
      Eduardo Habkost authored
      
      
      This property will be useful for libvirt, as libvirt already has logic
      based on low-level feature bits (not feature names), so it will be
      really easy to convert the current libvirt logic to something using the
      "feature-words" property.
      
      The property will have two main use cases:
       - Checking host capabilities, by checking the features of the "host"
         CPU model
       - Checking which features are enabled on each CPU model
      
      Example output:
      
        $ ./QMP/qmp --path=/tmp/m \
          qom-get --path=/machine/icc-bridge/icc/child[0] \
                  --property=feature-words
        item[0].cpuid-register: EDX
        item[0].cpuid-input-eax: 2147483658
        item[0].features: 0
        item[1].cpuid-register: EAX
        item[1].cpuid-input-eax: 1073741825
        item[1].features: 0
        item[2].cpuid-register: EDX
        item[2].cpuid-input-eax: 3221225473
        item[2].features: 0
        item[3].cpuid-register: ECX
        item[3].cpuid-input-eax: 2147483649
        item[3].features: 101
        item[4].cpuid-register: EDX
        item[4].cpuid-input-eax: 2147483649
        item[4].features: 563346425
        item[5].cpuid-register: EBX
        item[5].cpuid-input-eax: 7
        item[5].features: 0
        item[5].cpuid-input-ecx: 0
        item[6].cpuid-register: ECX
        item[6].cpuid-input-eax: 1
        item[6].features: 2155880449
        item[7].cpuid-register: EDX
        item[7].cpuid-input-eax: 1
        item[7].features: 126614521
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      8e8aba50
    • Eduardo Habkost's avatar
      target-i386: Use FeatureWord loop on filter_features_for_kvm() · bd87d2a2
      Eduardo Habkost authored
      
      
      Instead of open-coding the filtering code for each feature word, change
      the existing code to use the feature_word_info array, that has exactly
      the same CPUID eax/ecx/register values for each feature word.
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      bd87d2a2
    • Eduardo Habkost's avatar
      target-i386: Add ECX information to FeatureWordInfo · 04d104b6
      Eduardo Habkost authored
      
      
      FEAT_7_0_EBX uses ECX as input, so we have to take that into account
      when reporting feature word values.
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
      04d104b6
  14. 01 May, 2013 8 commits