1. 10 1月, 2016 1 次提交
  2. 09 11月, 2015 1 次提交
    • P
      hw/timer/hpet.c: Avoid signed integer overflow which results in bugs on OSX · d17008bc
      Peter Maydell 提交于
      Signed integer overflow in C is undefined behaviour, and the compiler
      is at liberty to assume it can never happen and optimize accordingly.
      In particular, the subtractions in hpet_time_after() and hpet_time_after64()
      were causing OSX clang to optimize the code such that it was prone to
      hangs and complaints about the main loop stalling (presumably because
      we were spending all our time trying to service very high frequency
      HPET timer callbacks). The clang sanitizer confirms the UB:
      
      hw/timer/hpet.c:119:26: runtime error: signed integer overflow: -2146967296 - 2147003978 cannot be represented in type 'int'
      
      Fix this by doing the subtraction as an unsigned operation and then
      converting to signed for the comparison.
      Reported-by: NAaron Elkins <threcius@yahoo.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1447080991-24995-1-git-send-email-peter.maydell@linaro.org
      d17008bc
  3. 25 9月, 2015 1 次提交
  4. 23 6月, 2015 1 次提交
  5. 12 6月, 2015 1 次提交
    • J
      migration: Use normal VMStateDescriptions for Subsections · 5cd8cada
      Juan Quintela 提交于
      We create optional sections with this patch.  But we already have
      optional subsections.  Instead of having two mechanism that do the
      same, we can just generalize it.
      
      For subsections we just change:
      
      - Add a needed function to VMStateDescription
      - Remove VMStateSubsection (after removal of the needed function
        it is just a VMStateDescription)
      - Adjust the whole tree, moving the needed function to the corresponding
        VMStateDescription
      Signed-off-by: NJuan Quintela <quintela@redhat.com>
      5cd8cada
  6. 26 4月, 2015 1 次提交
    • P
      Switch non-CPU callers from ld/st*_phys to address_space_ld/st* · 42874d3a
      Peter Maydell 提交于
      Switch all the uses of ld/st*_phys to address_space_ld/st*,
      except for those cases where the address space is the CPU's
      (ie cs->as). This was done with the following script which
      generates a Coccinelle patch.
      
      A few over-80-columns lines in the result were rewrapped by
      hand where Coccinelle failed to do the wrapping automatically,
      as well as one location where it didn't put a line-continuation
      '\' when wrapping lines on a change made to a match inside
      a macro definition.
      
      ===begin===
      #!/bin/sh -e
      # Usage:
      # ./ldst-phys.spatch.sh > ldst-phys.spatch
      # spatch -sp_file ldst-phys.spatch -dir . | sed -e '/^+/s/\t/        /g' > out.patch
      # patch -p1 < out.patch
      
      for FN in ub uw_le uw_be l_le l_be q_le q_be uw l q; do
      cat <<EOF
      @ cpu_matches_ld_${FN} @
      expression E1,E2;
      identifier as;
      @@
      
      ld${FN}_phys(E1->as,E2)
      
      @ other_matches_ld_${FN} depends on !cpu_matches_ld_${FN} @
      expression E1,E2;
      @@
      
      -ld${FN}_phys(E1,E2)
      +address_space_ld${FN}(E1,E2, MEMTXATTRS_UNSPECIFIED, NULL)
      
      EOF
      
      done
      
      for FN in b w_le w_be l_le l_be q_le q_be w l q; do
      cat <<EOF
      @ cpu_matches_st_${FN} @
      expression E1,E2,E3;
      identifier as;
      @@
      
      st${FN}_phys(E1->as,E2,E3)
      
      @ other_matches_st_${FN} depends on !cpu_matches_st_${FN} @
      expression E1,E2,E3;
      @@
      
      -st${FN}_phys(E1,E2,E3)
      +address_space_st${FN}(E1,E2,E3, MEMTXATTRS_UNSPECIFIED, NULL)
      
      EOF
      
      done
      ===endit===
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEdgar E. Iglesias <edgar.iglesias@xilinx.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      42874d3a
  7. 26 1月, 2015 1 次提交
  8. 12 12月, 2014 1 次提交
  9. 16 6月, 2014 1 次提交
  10. 06 5月, 2014 1 次提交
  11. 27 3月, 2014 1 次提交
    • M
      Don't enable a HPET timer if HPET is disabled · c36ad13f
      Matt Lupfer 提交于
      A HPET timer can be started when HPET is not yet
      enabled. This will not generate an interrupt
      to the guest, but causes problems when HPET is later
      enabled.
      
      A timer that is created and expires at least once before
      HPET is enabled will have an initialized comparator based
      on a hpet_offset of 0 (uninitialized). When HPET is
      enabled, hpet_set_timer() is called a second time, which
      modifies the timer expiry to a time based on the
      difference between current ticks (measured with the
      newly initialized hpet_offset) and the timer's
      comparator (which was generated before hpet_offset was
      initialized). This results in a long period of no HPET
      timer ticks.
      
      When this occurs with a CentOS 5.x guest, the guest
      may not receive timer interrupts during its narrow
      timer check window and panic on boot.
      Signed-off-by: NMatt Lupfer <mlupfer@ddn.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      c36ad13f
  12. 11 2月, 2014 1 次提交
  13. 23 12月, 2013 2 次提交
    • M
      sysbus: Set cannot_instantiate_with_device_add_yet · 837d3716
      Markus Armbruster 提交于
      device_add plugs devices into suitable bus.  For "real" buses, that
      actually connects the device.  For sysbus, the connections need to be
      made separately, and device_add can't do that.  The device would be
      left unconnected, and could not possibly work.
      
      Quite a few, but not all sysbus devices already set
      cannot_instantiate_with_device_add_yet in their class init function.
      
      Set it in their abstract base's class init function
      sysbus_device_class_init(), and remove the now redundant assignments
      from device class init functions.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.a@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      837d3716
    • M
      qdev: Replace no_user by cannot_instantiate_with_device_add_yet · efec3dd6
      Markus Armbruster 提交于
      In an ideal world, machines can be built by wiring devices together
      with configuration, not code.  Unfortunately, that's not the world we
      live in right now.  We still have quite a few devices that need to be
      wired up by code.  If you try to device_add such a device, it'll fail
      in sometimes mysterious ways.  If you're lucky, you get an
      unmysterious immediate crash.
      
      To protect users from such badness, DeviceClass member no_user used to
      make device models unavailable with -device / device_add, but that
      regressed in commit 18b6dade.  The device model is still omitted from
      help, but is available anyway.
      
      Attempts to fix the regression have been rejected with the argument
      that the purpose of no_user isn't clear, and it's prone to misuse.
      
      This commit clarifies no_user's purpose.  Anthony suggested to rename
      it cannot_instantiate_with_device_add_yet_due_to_internal_bugs, which
      I shorten somewhat to keep checkpatch happy.  While there, make it
      bool.
      
      Every use of cannot_instantiate_with_device_add_yet gets a FIXME
      comment asking for rationale.  The next few commits will clean them
      all up, either by providing a rationale, or by getting rid of the use.
      
      With that done, the regression fix is hopefully acceptable.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.a@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      efec3dd6
  14. 12 12月, 2013 3 次提交
  15. 14 10月, 2013 1 次提交
  16. 23 8月, 2013 1 次提交
  17. 23 7月, 2013 2 次提交
  18. 04 7月, 2013 2 次提交
  19. 09 4月, 2013 2 次提交
  20. 01 3月, 2013 1 次提交
    • P
      hw: include hw header files with full paths · 83c9f4ca
      Paolo Bonzini 提交于
      Done with this script:
      
      cd hw
      for i in `find . -name '*.h' | sed 's/^..//'`; do
        echo '\,^#.*include.*["<]'$i'[">], s,'$i',hw/&,'
      done | sed -i -f - `find . -type f`
      
      This is so that paths remain valid as files are moved.
      
      Instead, files in hw/dataplane are referenced with the relative path.
      We know they are not going to move to include/, and they are the only
      include files that are in subdirectories _and_ move.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      83c9f4ca
  21. 22 1月, 2013 1 次提交
  22. 11 1月, 2013 1 次提交
    • A
      Make all static TypeInfos const · 8c43a6f0
      Andreas Färber 提交于
      Since 39bffca2 (qdev: register all
      types natively through QEMU Object Model), TypeInfo as used in
      the common, non-iterative pattern is no longer amended with information
      and should therefore be const.
      
      Fix the documented QOM examples:
      
       sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h
      
      Since frequently the wrong examples are being copied by contributors of
      new devices, fix all types in the tree:
      
       sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c
       sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c
      
      This also avoids to piggy-back these changes onto real functional
      changes or other refactorings.
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      8c43a6f0
  23. 19 12月, 2012 2 次提交
  24. 23 10月, 2012 1 次提交
    • A
      Rename target_phys_addr_t to hwaddr · a8170e5e
      Avi Kivity 提交于
      target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
      reserved) and its purpose doesn't match the name (most target_phys_addr_t
      addresses are not target specific).  Replace it with a finger-friendly,
      standards conformant hwaddr.
      
      Outstanding patchsets can be fixed up with the command
      
        git rebase -i --exec 'find -name "*.[ch]"
                              | xargs s/target_phys_addr_t/hwaddr/g' origin
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      a8170e5e
  25. 17 2月, 2012 3 次提交
    • J
      i8254: Rework & fix interaction with HPET in legacy mode · ce967e2f
      Jan Kiszka 提交于
      When the HPET enters legacy mode, the IRQ output of the PIT is
      suppressed and replaced by the HPET timer 0. But the current code to
      emulate this was broken in many ways. It reset the PIT state after
      re-enabling, it worked against a stale static PIT structure, and it did
      not properly saved/restored the IRQ output mask in the PIT vmstate.
      
      This patch solves the PIT IRQ control in a different way. On x86, it
      both redirects the PIT IRQ to the HPET, just like the RTC. But it also
      keeps the control line from the HPET to the PIT. This allows to disable
      the PIT QEMU timer when it is not needed. The PIT's view on the control
      line state is now saved in the same format that qemu-kvm is already
      using.
      
      Note that, in contrast to the suppressed RTC IRQ line, we do not need to
      save/restore the PIT line state in the HPET. As we trigger a PIT IRQ
      update via the control line, the line state is reconstructed on mode
      switch.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      ce967e2f
    • J
      i8254: Factor out interface header · b1277b03
      Jan Kiszka 提交于
      Move the public interface of the PIT into its own header file and update
      all users.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      b1277b03
    • J
      hpet: Save/restore cached RTC IRQ level · 5904ae4e
      Jan Kiszka 提交于
      In legacy mode, the HPET suppresses the RTC interrupt delivery via IRQ
      8 but keeps track of the RTC output level and applies it when legacy
      mode is turned off again. This value has to be preserved across save/
      restore as it cannot be reconstructed otherwise.
      
      To document that a raised rtc_irq_level won't survive a vmload without
      a hpet/rtc_irq_level subsection, add an explicit clearing to the reset
      handler.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      5904ae4e
  26. 15 2月, 2012 1 次提交
  27. 04 2月, 2012 1 次提交
    • A
      qdev: register all types natively through QEMU Object Model · 39bffca2
      Anthony Liguori 提交于
      This was done in a mostly automated fashion.  I did it in three steps and then
      rebased it into a single step which avoids repeatedly touching every file in
      the tree.
      
      The first step was a sed-based addition of the parent type to the subclass
      registration functions.
      
      The second step was another sed-based removal of subclass registration functions
      while also adding virtual functions from the base class into a class_init
      function as appropriate.
      
      Finally, a python script was used to convert the DeviceInfo structures and
      qdev_register_subclass functions to TypeInfo structures, class_init functions,
      and type_register_static calls.
      
      We are almost fully converted to QOM after this commit.
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      39bffca2
  28. 28 1月, 2012 1 次提交
  29. 28 11月, 2011 1 次提交
  30. 25 11月, 2011 1 次提交
  31. 10 11月, 2011 1 次提交
    • M
      hpet: fix infinite loop in qemu_run_timers with -icount enabled · 4f61927a
      Max Filippov 提交于
      hpet_timer timer callback rearms itself based on difference between
      current HPET tick counter and comparator value. Difference calculated by
      the hpet_calculate_diff function is limited to non-negative values.
      
      cur_tick is calculated via hpet_get_ticks that uses qemu_get_clock_ns(vm_clock).
      
      With -icount enabled vm_clock doesn't advance during qemu_run_timers
      loop thus once difference is zero, qemu_run_timers loops forever
      handling hpet_timer.
      
      Limit hpet_calculate_diff results to positive only values to avoid that
      infinite loop.
      
      This fixes the following qemu-system-x86_64 hang when it reaches
      timer_irq_works() in the linux bootup:
      
      [    0.000000] Fast TSC calibration using PIT
      [    0.000000] Detected 1000.054 MHz processor.
      [    0.000031] Calibrating delay loop (skipped), value calculated using timer frequency.. 2000.10 BogoMIPS (lpj=10000540)
      [    0.000404] pid_max: default: 32768 minimum: 301
      [    0.001138] Mount-cache hash table entries: 256
      [    0.003883] Initializing cgroup subsys ns
      [    0.004035] Initializing cgroup subsys cpuacct
      [    0.004280] Initializing cgroup subsys freezer
      [    0.004790] Performance Events: AMD PMU driver.
      [    0.004985] ... version:                0
      [    0.005134] ... bit width:              48
      [    0.005285] ... generic registers:      4
      [    0.005437] ... value mask:             0000ffffffffffff
      [    0.005625] ... max period:             00007fffffffffff
      [    0.005807] ... fixed-purpose events:   0
      [    0.005957] ... event mask:             000000000000000f
      [    0.006275] SMP alternatives: switching to UP code
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      4f61927a