Permalink
Switch branches/tags
Commits on Jan 30, 2013
  1. target-m68k: Rename CPU types

    In the initial conversion of CPU models to QOM types, model names were
    mapped 1:1 to type names. As a side effect this gained us a type "any",
    which is now a device.
    
    To avoid "-device any" silliness and to pave the way for compiling
    multiple targets into one executable, adopt a <name>-<arch>-cpu scheme.
    
    No functional changes for -cpu arguments or -cpu ? output.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    committed Jan 27, 2013
Commits on Jan 29, 2013
  1. Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

    * qemu-kvm/uq/master:
      target-i386: kvm: prevent buffer overflow if -cpu foo, [x]level is too big
      vmxcap: bit 9 of VMX_PROCBASED_CTLS2 is 'virtual interrupt delivery'
    
    Conflicts:
    	target-i386/kvm.c
    
    Trivial merge resolution due to lack of context.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Anthony Liguori committed Jan 29, 2013
  2. Merge remote-tracking branch 'mdroth/qga-pull-1-28-13' into staging

    # By Markus Armbruster
    # Via Michael Roth
    * mdroth/qga-pull-1-28-13:
      qemu-ga: Plug leaks on qmp_guest_network_get_interfaces() error paths
      qemu-ga: Plug memory leak in guest_fsfreeze_cleanup()
    Anthony Liguori committed Jan 29, 2013
  3. target-i386: kvm: prevent buffer overflow if -cpu foo, [x]level is to…

    …o big
    
    Stack corruption may occur if too big 'level' or 'xlevel' values passed
    on command line with KVM enabled, due to limited size of cpuid_data
    in kvm_arch_init_vcpu().
    
    reproduces with:
     qemu -enable-kvm -cpu qemu64,level=4294967295
    or
     qemu -enable-kvm -cpu qemu64,xlevel=4294967295
    
    Check if there is space in cpuid_data before passing it to cpu_x86_cpuid()
    or abort() if there is not space.
    
    Reviewed-by: Laszlo Ersek <lersek@redhat.com>
    Reviewed-by: Andreas Faerber <afaerber@suse.de>
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Gleb Natapov <gleb@redhat.com>
    Igor Mammedov committed with Gleb Natapov Jan 28, 2013
Commits on Jan 28, 2013
  1. Merge remote-tracking branch 'afaerber/qom-cpu' into staging

    * afaerber/qom-cpu: (37 commits)
      kvm: Pass CPUState to kvm_on_sigbus_vcpu()
      cpu: Unconditionalize CPUState fields
      target-m68k: Use type_register() instead of type_register_static()
      target-unicore32: Use type_register() instead of type_register_static()
      target-openrisc: Use type_register() instead of type_register_static()
      target-unicore32: Catch attempt to instantiate abstract type in cpu_init()
      target-openrisc: Catch attempt to instantiate abstract type in cpu_init()
      target-m68k: Catch attempt to instantiate abstract type in cpu_init()
      target-arm: Catch attempt to instantiate abstract type in cpu_init()
      target-alpha: Catch attempt to instantiate abstract type in cpu_init()
      qom: Introduce object_class_is_abstract()
      target-unicore32: Detect attempt to instantiate non-CPU type in cpu_init()
      target-openrisc: Detect attempt to instantiate non-CPU type in cpu_init()
      target-m68k: Detect attempt to instantiate non-CPU type in cpu_init()
      target-alpha: Detect attempt to instantiate non-CPU type in cpu_init()
      target-arm: Detect attempt to instantiate non-CPU type in cpu_init()
      cpu: Add model resolution support to CPUClass
      target-i386: Remove setting tsc-frequency from x86_def_t
      target-i386: Set custom features/properties without intermediate x86_def_t
      target-i386: Remove vendor_override field from CPUX86State
      ...
    
    Conflicts:
    	tests/Makefile
    
    Resolved simple conflict caused by lack of context in Makefile
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Anthony Liguori committed Jan 28, 2013
  2. Merge remote-tracking branch 'kwolf/for-anthony' into staging

    # By Paolo Bonzini (14) and others
    # Via Kevin Wolf
    * kwolf/for-anthony: (24 commits)
      ide: Add fall through annotations
      block: Create proper size file for disk mirror
      ahci: Add migration support
      ahci: Change data types in preparation for migration
      ahci: Remove unused AHCIDevice fields
      hbitmap: add assertion on hbitmap_iter_init
      mirror: do nothing on zero-sized disk
      block/vdi: Check for bad signature
      block/vdi: Improved return values from vdi_open
      block/vdi: Improve debug output for signature
      block: Use error code EMEDIUMTYPE for wrong format in some block drivers
      block: Add special error code for wrong format
      mirror: support arbitrarily-sized iterations
      mirror: support more than one in-flight AIO operation
      mirror: add buf-size argument to drive-mirror
      mirror: switch mirror_iteration to AIO
      mirror: allow customizing the granularity
      block: allow customizing the granularity of the dirty bitmap
      block: return count of dirty sectors, not chunks
      mirror: perform COW if the cluster size is bigger than the granularity
      ...
    Anthony Liguori committed Jan 28, 2013
  3. Merge remote-tracking branch 'luiz/queue/qmp' into staging

    # By Lei Li (3) and others
    # Via Luiz Capitulino
    * luiz/queue/qmp:
      QAPI: Introduce memchar-read QMP command
      QAPI: Introduce memchar-write QMP command
      qemu-char: Add new char backend CirMemCharDriver
      docs: document virtio-balloon stats
      balloon: re-enable balloon stats
      balloon: drop old stats code & API
      block: Monitor command commit neglects to report some errors
    Anthony Liguori committed Jan 28, 2013
  4. qemu-ga: Plug leaks on qmp_guest_network_get_interfaces() error paths

    Spotted by Coverity.
    
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster committed with mdroth Jan 16, 2013
  5. qemu-ga: Plug memory leak in guest_fsfreeze_cleanup()

    Neglects to free errors allocated by qmp_guest_fsfreeze_thaw().
    Spotted by Coverity.
    
    While there, drop the test whether return value is negative (it's
    never true), and improve logging.
    
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
    Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
    Markus Armbruster committed with mdroth Jan 16, 2013
  6. kvm: Pass CPUState to kvm_on_sigbus_vcpu()

    Since commit 20d695a (kvm: Pass
    CPUState to kvm_arch_*) CPUArchState is no longer needed.
    
    Allows to change qemu_kvm_eat_signals() argument as well.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    Reviewed-by: Gleb Natapov <gleb@redhat.com>
    committed Jan 17, 2013
  7. cpu: Unconditionalize CPUState fields

    Commits fc8c5b8 (Makefile.user: Define
    CONFIG_USER_ONLY for libuser/) and
    dd83b06 (qom: Introduce CPU class)
    specifically prepared the qom/cpu.c file to be compiled differently for
    softmmu and *-user. This broke as part of build system refactorings
    while CPU patches were in flight, adding conditional fields
    kvm_fd (8737c51) and
    kvm_vcpu_dirty (20d695a) for softmmu.
    
    linux-user and bsd-user would therefore get a CPUState type with
    instance_size ~8 bytes longer than expected.
    Fix this by unconditionally having the fields in CPUState.
    
    In practice, target-specific CPU types' instance_size would compensate
    this, and upstream qom/cpu.c does not yet touch any affected field.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    committed Jan 25, 2013
  8. target-m68k: Use type_register() instead of type_register_static()

    According to its documentation, type_register_static()'s TypeInfo
    argument should exist for the life type of the type.
    Therefore use type_register() when registering the list of CPU subtypes.
    
    No functional change with the current implementation.
    
    Cf. 918fd08 for arm.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    committed Jan 27, 2013
  9. target-unicore32: Use type_register() instead of type_register_static()

    According to its documentation, type_register_static()'s TypeInfo
    argument should exist for the life type of the type.
    Therefore use type_register() when registering the list of CPU subtypes.
    
    No functional change with the current implementation.
    
    Cf. 918fd08 for arm.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    committed Jan 23, 2013
  10. target-openrisc: Use type_register() instead of type_register_static()

    According to its documentation, type_register_static()'s TypeInfo
    argument should exist for the life type of the type.
    Therefore use type_register() when registering the list of CPU subtypes.
    
    No functional change with the current implementation.
    
    Cf. 918fd08 for arm.
    
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    committed Jan 23, 2013
  11. target-unicore32: Catch attempt to instantiate abstract type in cpu_i…

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

    …it()
    
    There is no abstract OpenRISCCPU yet, but that seems a bug of its own.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andreas Färber <afaerber@suse.de>
    committed Jan 23, 2013
Commits on Jan 27, 2013
  1. target-m68k: Catch attempt to instantiate abstract type in cpu_init()

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

    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>
    committed Jan 23, 2013
  3. target-alpha: Catch attempt to instantiate abstract type in cpu_init()

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

    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>
    committed Jan 23, 2013
  5. target-unicore32: Detect attempt to instantiate non-CPU type in cpu_i…

    …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>
    committed Jan 23, 2013
  6. target-openrisc: Detect attempt to instantiate non-CPU type in cpu_in…

    …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>
    committed Jan 23, 2013
  7. target-m68k: Detect attempt to instantiate non-CPU type in cpu_init()

    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>
    committed Jan 21, 2013
  8. target-alpha: Detect attempt to instantiate non-CPU type in cpu_init()

    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>
    committed Jan 21, 2013
  9. target-arm: Detect attempt to instantiate non-CPU type in cpu_init()

    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>
    committed Jan 21, 2013
  10. cpu: Add model resolution support to CPUClass

    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>
    committed Jan 21, 2013
  11. target-i386: Remove setting tsc-frequency from x86_def_t

    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>
    Igor Mammedov committed with Jan 21, 2013
  12. target-i386: Set custom features/properties without intermediate x86_…

    …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>
    Igor Mammedov committed with Jan 21, 2013
  13. target-i386: Remove vendor_override field from CPUX86State

    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>
    Igor Mammedov committed with Jan 21, 2013
  14. target-i386: Replace uint32_t vendor fields by vendor string in x86_d…

    …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>
    Igor Mammedov committed with Jan 21, 2013
  15. target-i386: Print deprecation warning if xlevel < 0x80000000

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

    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>
    committed Jan 21, 2013
  17. target-i386: Simplify cpu_x86_find_by_name()

    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>
    committed Jan 21, 2013
  18. pc: Generate APIC IDs according to CPU topology

    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>
    ehabkost committed with Jan 22, 2013
  19. target-i386: Topology & APIC ID utility functions

    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>
    ehabkost committed with Jan 23, 2013