Permalink
Switch branches/tags
Commits on Jan 27, 2013
  1. target-unicore32: Don't use type_register_static()

    afaerber committed Jan 23, 2013
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  2. target-openrisc: Don't use type_register_static()

    afaerber committed Jan 23, 2013
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  3. target-unicore32: Catch attempt to instantiate abstract type in cpu_i…

    afaerber committed Jan 23, 2013
    …nit()
    
    Fixes -cpu unicore32-cpu asserting.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  4. target-openrisc: Catch attempt to instantiate abstract type in cpu_in…

    afaerber committed Jan 23, 2013
    …it()
    
    Fixes -cpu openrisc-cpu asserting.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  5. target-m68k: Catch attempt to instantiate abstract type in cpu_init()

    afaerber committed Jan 23, 2013
    This fixes -cpu m68k-cpu asserting.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  6. target-arm: Catch attempt to instantiate abstract type in cpu_init()

    afaerber committed Jan 23, 2013
    This fixes -cpu arm-cpu asserting.
    
    Cc: qemu-stable@nongnu.org
    Acked-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  7. target-alpha: Catch attempt to instantiate abstract type in cpu_init()

    afaerber committed Jan 23, 2013
    This fixes -cpu alpha-cpu asserting.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  8. qom: Introduce object_class_is_abstract()

    afaerber committed Jan 23, 2013
    This lets a caller check if an ObjectClass as returned by, e.g.,
    object_class_by_name() is instantiatable.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    Cc: Anthony Liguori <anthony@codemonkey.ws>
  9. target-unicore32: Detect attempt to instantiate non-CPU type in cpu_i…

    afaerber committed Jan 23, 2013
    …nit()
    
    Consolidate model checking into a new uc32_cpu_class_by_name().
    
    If the name matches an existing type, also check whether that type is
    actually (a sub-type of) TYPE_UNICORE32_CPU.
    
    This fixes, e.g., -cpu puv3_dma asserting.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  10. target-openrisc: Detect attempt to instantiate non-CPU type in cpu_in…

    afaerber committed Jan 23, 2013
    …it()
    
    Consolidate model checking into a new openrisc_cpu_class_by_name().
    
    If the name matches an existing type, also check whether that type is
    actually (a sub-type of) TYPE_OPENRISC_CPU.
    
    This fixes, e.g., -cpu open_eth asserting.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  11. target-m68k: Detect attempt to instantiate non-CPU type in cpu_init()

    afaerber committed Jan 21, 2013
    Consolidate model checking into a new m68k_cpu_class_by_name().
    
    If the name matches an existing type, also check whether that type is
    (a sub-type of) TYPE_M68K_CPU.
    
    This fixes, e.g., -cpu ide-hd asserting.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  12. target-alpha: Detect attempt to instantiate non-CPU type in cpu_init()

    afaerber committed Jan 21, 2013
    Check in alpha_cpu_class_by_name() whether the type found is actually
    (a sub-type of) TYPE_ALPHA_CPU.
    
    This fixes, e.g., -cpu typhoon-pcihost asserting.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  13. target-arm: Detect attempt to instantiate non-CPU type in cpu_init()

    afaerber committed Jan 21, 2013
    Consolidate model checking into a new arm_cpu_class_by_name().
    
    If the name matches an existing type, also check whether that type is
    actually (a sub-type of) TYPE_ARM_CPU.
    
    This fixes, e.g., -cpu tmp105 asserting.
    
    Cc: qemu-stable <qemu-stable@nongnu.org>
    Acked-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  14. cpu: Add model resolution support to CPUClass

    afaerber committed Jan 21, 2013
    Introduce CPUClass::class_by_name and add a default implementation.
    Hook up the alpha and ppc implementations.
    
    Introduce a wrapper function cpu_class_by_name().
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  15. target-i386: Remove setting tsc-frequency from x86_def_t

    Igor Mammedov authored and afaerber committed Jan 21, 2013
    Setting tsc-frequency from x86_def_t is NOP because default tsc_khz
    in x86_def_t is 0 and CPUX86State.tsc_khz is also initialized to 0
    by default. So there is no need to overwrite tsc_khz with default 0
    because field was already initialized to 0.
    
    Custom tsc-frequency setting is not affected due to it being set
    without using x86_def_t.
    
    Field tsc_khz in x86_def_t becomes unused with this patch, so drop it
    as well.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  16. target-i386: Set custom features/properties without intermediate x86_…

    Igor Mammedov authored and afaerber committed Jan 21, 2013
    …def_t
    
    Move custom features parsing after built-in cpu_model defaults are set
    and set custom features directly on CPU instance. That allows to make a
    clear distinction between built-in cpu model defaults that eventually
    should go into class_init() and extra property setting which is done
    after defaults are set on CPU instance.
    
    Impl. details:
     * use object_property_parse() property setter so it would be a mechanical
       change to switch to global properties later.
     * And after all current features/properties are converted into static
       properties, it will take a trivial patch to switch to global properties.
       Which will allow to:
       * get CPU instance initialized with all parameters passed on -cpu ...
         cmd. line from object_new() call.
       * call cpu_model/featurestr parsing only once before CPUs are created
       * open a road for removing CPUxxxState.cpu_model_str field, when other
         CPUs are similarly converted to subclasses and static properties.
     - re-factor error handling, to use Error instead of fprintf()s, since
       it is anyway passed in for property setter.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  17. target-i386: Remove vendor_override field from CPUX86State

    Igor Mammedov authored and afaerber committed Jan 21, 2013
    Commit 8935499 makes cpuid return to guest host's vendor value
    instead of built-in one by default if kvm_enabled() == true and allows
    to override this behavior if 'vendor' is specified on -cpu command line.
    
    But every time guest calls cpuid to get 'vendor' value, host's value is
    read again and again in default case.
    
    It complicates semantics of vendor property and makes it harder to use.
    
    Instead of reading 'vendor' value from host every time cpuid[vendor] is
    called, override 'vendor' value only once in cpu_x86_find_by_name(), when
    built-in CPU model is found and if(kvm_enabled() == true).
    
    It provides the same default semantics
     if (kvm_enabled() == true)  vendor = host's vendor
     else vendor = built-in vendor
    
    and then later:
     if (custom vendor) vendor = custom vendor
    
    'vendor' value is overridden when user provides it on -cpu command line,
    and there is no need for vendor_override field anymore, remove it.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  18. target-i386: Replace uint32_t vendor fields by vendor string in x86_d…

    Igor Mammedov authored and afaerber committed Jan 21, 2013
    …ef_t
    
    Vendor property setter takes string as vendor value but cpudefs
    use uint32_t vendor[123] fields to define vendor value. It makes it
    difficult to unify and use property setter for values from cpudefs.
    
    Simplify code by using vendor property setter, vendor[123] fields
    are converted into vendor[13] array to keep its value. And vendor
    property setter is used to access/set value on CPU.
    
     - Make for() cycle reusable for the next patch by adding
       x86_cpu_vendor_words2str()
    
    Intel's CPUID spec[1] says:
    "
    5.1.1 ...
    These registers contain the ASCII string: GenuineIntel
    ...
    "
    
    List[2] of known vendor values shows that they all are 12 ASCII
    characters long, padded where necessary with space.
    
    Current supported values are all ASCII characters packed in
    ebx, edx, ecx. So lets state that QEMU supports 12 printable ASCII
    characters packed in ebx, edx, ecx registers for cpuid(0) instruction.
    
    *1 - http://www.intel.com/Assets/PDF/appnote/241618.pdf
    *2 - http://en.wikipedia.org/wiki/CPUID#EAX.3D0:_Get_vendor_ID
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  19. target-i386: Print deprecation warning if xlevel < 0x80000000

    Igor Mammedov authored and afaerber committed Jan 21, 2013
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  20. target-i386: Drop redundant list of CPU definitions

    afaerber committed Jan 21, 2013
    It is no longer needed since dropping cpudef config file support.
    Cleaning this up removes knowledge about other models from x86_def_t,
    in preparation for reusing x86_def_t as intermediate step towards pure
    QOM X86CPU subclasses.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  21. target-i386: Simplify cpu_x86_find_by_name()

    afaerber committed Jan 21, 2013
    Catch NULL name argument early to avoid repeated checks.
    Similarly, check for -cpu host early and untangle from iterating through
    model definitions. This prepares for introducing X86CPU subclasses.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  22. pc: Generate APIC IDs according to CPU topology

    ehabkost authored and afaerber committed Jan 22, 2013
    This keeps compatibility on machine-types pc-1.2 and older, and prints a
    warning in case the requested configuration won't get the correct
    topology.
    
    I couldn't think of a better way to warn about broken topology when in
    compat mode other than using error_report(). The warning message will
    probably be buried in a log file somewhere, but it's better than
    nothing.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  23. target-i386: Topology & APIC ID utility functions

    ehabkost authored and afaerber committed Jan 23, 2013
    This introduces utility functions for the APIC ID calculation, based on:
      Intel® 64 Architecture Processor Topology Enumeration
      http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/
    
    The code should be compatible with AMD's "Extended Method" described at:
      AMD CPUID Specification (Publication #25481)
      Section 3: Multiple Core Calcuation
    as long as:
     - nr_threads is set to 1;
     - OFFSET_IDX is assumed to be 0;
     - CPUID Fn8000_0008_ECX[ApicIdCoreIdSize[3:0]] is set to
       apicid_core_width().
    
    Unit tests included.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  24. pc: Set fw_cfg data based on APIC ID calculation

    ehabkost authored and afaerber committed Jan 23, 2013
    This changes FW_CFG_MAX_CPUS and FW_CFG_NUMA to use apic_id_for_cpu(),
    so the NUMA table can be based on the APIC IDs, instead of CPU index
    (SeaBIOS knows nothing about CPU indexes, just APIC IDs).
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  25. cpus.h: Make constant smp_cores/smp_threads available on *-user

    ehabkost authored and afaerber committed Jan 22, 2013
    The code that calculates the APIC ID will use smp_cores/smp_threads, so
    just define them as 1 on *-user to avoid #ifdefs in the code.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  26. fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init()

    ehabkost authored and afaerber committed Jan 22, 2013
    PC will not use max_cpus for that field, so move it outside the common
    code so it can use a different value on PC.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  27. target-i386: Introduce x86_cpu_apic_id_from_index() function

    ehabkost authored and afaerber committed Jan 22, 2013
    This function will be used by both the CPU initialization code and the
    fw_cfg table initialization code.
    
    Later this function will be updated to generate APIC IDs according to
    the CPU topology.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  28. target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index

    ehabkost authored and afaerber committed Jan 22, 2013
    The CPU ID in KVM is supposed to be the APIC ID, so change the
    KVM_CREATE_VCPU call to match it. The current behavior didn't break
    anything yet because today the APIC ID is assumed to be equal to the CPU
    index, but this won't be true in the future.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
    Acked-by: Gleb Natapov <gleb@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  29. kvm: Create kvm_arch_vcpu_id() function

    ehabkost authored and afaerber committed Jan 22, 2013
    This will allow each architecture to define how the VCPU ID is set on
    the KVM_CREATE_VCPU ioctl call.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Acked-by: Gleb Natapov <gleb@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  30. pc: Reverse pc_init_pci() compatibility logic

    ehabkost authored and afaerber committed Jan 17, 2013
    Currently, the pc-1.4 machine init function enables PV EOI and then
    calls the pc-1.2 machine init function. The problem with this approach
    is that now we can't enable any additional compatibility code inside the
    pc-1.2 init function because it would end up enabling the compatibility
    behavior on pc-1.3 and pc-1.4 as well.
    
    This reverses the logic so that the pc-1.2 machine init function will
    disable PV EOI, and then call the pc-1.4 machine init function.
    
    This way we can change older machine-types to enable compatibility
    behavior, and the newer machine-types (pc-1.3, pc-q35-1.4 and
    pc-i440fx-1.4) would just use the default behavior.
    
    (This means that one nice side-effect of this change is that pc-q35-1.4
    will get PV EOI enabled by default, too)
    
    It would be interesting to eventually change pc_init_pci_no_kvmclock()
    and pc_init_isa() to reuse pc_init_pci_1_2() as well (so we don't need
    to duplicate compatibility code on those two functions). But this will
    be probably much easier to do after we create a PCInitArgs struct for
    the PC initialization arguments, and/or after we use global-properties
    to implement the compatibility modes present in pc_init_pci_1_2().
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  31. target-i386: Don't set any KVM flag by default if KVM is disabled

    ehabkost authored and afaerber committed Jan 17, 2013
    This is a cleanup that tries to solve two small issues:
    
     - We don't need a separate kvm_pv_eoi_features variable just to keep a
       constant calculated at compile-time, and this style would require
       adding a separate variable (that's declared twice because of the
       CONFIG_KVM ifdef) for each feature that's going to be
       enabled/disabled by machine-type compat code.
     - The pc-1.3 code is setting the kvm_pv_eoi flag on cpuid_kvm_features
       even when KVM is disabled at runtime. This small inconsistency in
       the cpuid_kvm_features field isn't a problem today because
       cpuid_kvm_features is ignored by the TCG code, but it may cause
       unexpected problems later when refactoring the CPUID handling code.
    
    This patch eliminates the kvm_pv_eoi_features variable and simply uses
    kvm_enabled() inside the enable_kvm_pv_eoi() compat function, so it
    enables kvm_pv_eoi only if KVM is enabled. I believe this makes the
    behavior of enable_kvm_pv_eoi() clearer and easier to understand.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Acked-by: Gleb Natapov <gleb@redhat.com>
    Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  32. kvm: Add fake KVM_FEATURE_CLOCKSOURCE_STABLE_BIT for builds without KVM

    ehabkost authored and afaerber committed Jan 17, 2013
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  33. target-openrisc: Clean up triple QOM casts

    afaerber committed Jan 17, 2013
    Instead of calling openrisc_env_get_cpu(), casting to CPU() via the
    ENV_GET_CPU() compatibility macro and casting back to OPENRISC_CPU(),
    just call openrisc_env_get_cpu() directly.
    
    ENV_GET_CPU() is meant as workaround for target-independent code only.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  34. target-openrisc: Drop OpenRISCCPUList

    afaerber committed Jan 5, 2013
    It was missed in 92a3136 (cpu:
    Introduce CPUListState struct) because its naming did not match the
    *CPUListState pattern. Use the generalized CPUListState instead.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
  35. xilinx_ethlite: Avoid build warnings in debug code

    edgarigl committed Jan 27, 2013
    Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>