1. 17 1月, 2018 9 次提交
    • D
      spapr: Validate capabilities on migration · be85537d
      David Gibson 提交于
      Now that the "pseries" machine type implements optional capabilities (well,
      one so far) there's the possibility of having different capabilities
      available at either end of a migration.  Although arguably a user error,
      it would be nice to catch this situation and fail as gracefully as we can.
      
      This adds code to migrate the capabilities flags.  These aren't pulled
      directly into the destination's configuration since what the user has
      specified on the destination command line should take precedence.  However,
      they are checked against the destination capabilities.
      
      If the source was using a capability which is absent on the destination,
      we fail the migration, since that could easily cause a guest crash or other
      bad behaviour.  If the source lacked a capability which is present on the
      destination we warn, but allow the migration to proceed.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      be85537d
    • D
      spapr: Treat Hardware Transactional Memory (HTM) as an optional capability · ee76a09f
      David Gibson 提交于
      This adds an spapr capability bit for Hardware Transactional Memory.  It is
      enabled by default for pseries-2.11 and earlier machine types. with POWER8
      or later CPUs (as it must be, since earlier qemu versions would implicitly
      allow it).  However it is disabled by default for the latest pseries-2.12
      machine type.
      
      This means that with the latest machine type, HTM will not be available,
      regardless of CPU, unless it is explicitly enabled on the command line.
      That change is made on the basis that:
      
       * This way running with -M pseries,accel=tcg will start with whatever cpu
         and will provide the same guest visible model as with accel=kvm.
           - More specifically, this means existing make check tests don't have
             to be modified to use cap-htm=off in order to run with TCG
      
       * We hope to add a new "HTM without suspend" feature in the not too
         distant future which could work on both POWER8 and POWER9 cpus, and
         could be enabled by default.
      
       * Best guesses suggest that future POWER cpus may well only support the
         HTM-without-suspend model, not the (frankly, horribly overcomplicated)
         POWER8 style HTM with suspend.
      
       * Anecdotal evidence suggests problems with HTM being enabled when it
         wasn't wanted are more common than being missing when it was.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      ee76a09f
    • D
      spapr: Capabilities infrastructure · 33face6b
      David Gibson 提交于
      Because PAPR is a paravirtual environment access to certain CPU (or other)
      facilities can be blocked by the hypervisor.  PAPR provides ways to
      advertise in the device tree whether or not those features are available to
      the guest.
      
      In some places we automatically determine whether to make a feature
      available based on whether our host can support it, in most cases this is
      based on limitations in the available KVM implementation.
      
      Although we correctly advertise this to the guest, it means that host
      factors might make changes to the guest visible environment which is bad:
      as well as generaly reducing reproducibility, it means that a migration
      between different host environments can easily go bad.
      
      We've mostly gotten away with it because the environments considered mature
      enough to be well supported (basically, KVM on POWER8) have had consistent
      feature availability.  But, it's still not right and some limitations on
      POWER9 is going to make it more of an issue in future.
      
      This introduces an infrastructure for defining "sPAPR capabilities".  These
      are set by default based on the machine version, masked by the capabilities
      of the chosen cpu, but can be overriden with machine properties.
      
      The intention is at reset time we verify that the requested capabilities
      can be supported on the host (considering TCG, KVM and/or host cpu
      limitations).  If not we simply fail, rather than silently modifying the
      advertised featureset to the guest.
      
      This does mean that certain configurations that "worked" may now fail, but
      such configurations were already more subtly broken.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      33face6b
    • A
      target/ppc: Yet another fix for KVM-HV HPTE accessors · a36593e1
      Alexey Kardashevskiy 提交于
      As stated in the 1ad9f0a4 commit log, the returned entries are not
      a whole PTEG. It was not a problem before 1ad9f0a4 as it would read
      a single record assuming it contains a whole PTEG but now the code tries
      reading the entire PTEG and "if ((n - i) < invalid)" produces negative
      values which then are converted to size_t for memset() and that throws
      seg fault.
      
      This fixes the math.
      
      While here, fix the last @i increment as well.
      
      Fixes: 1ad9f0a4 "target/ppc: Fix KVM-HV HPTE accessors"
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a36593e1
    • P
      Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180116' into staging · 8e5dc9ba
      Peter Maydell 提交于
      Queued TCG patches
      
      # gpg: Signature made Tue 16 Jan 2018 16:24:50 GMT
      # gpg:                using RSA key 0x64DF38E8AF7E215F
      # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
      # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F
      
      * remotes/rth/tags/pull-tcg-20180116:
        tcg/ppc: Allow a 32-bit offset to the constant pool
        tcg/ppc: Support tlb offsets larger than 64k
        tcg/arm: Support tlb offsets larger than 64k
        tcg/arm: Fix double-word comparisons
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      8e5dc9ba
    • R
      tcg/ppc: Allow a 32-bit offset to the constant pool · 030ffe39
      Richard Henderson 提交于
      We recently relaxed the limit of the number of opcodes that can
      appear in a TranslationBlock.  In certain cases this has resulted
      in relocation overflow.
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      030ffe39
    • R
      tcg/ppc: Support tlb offsets larger than 64k · 4a64e0fd
      Richard Henderson 提交于
      AArch64 with SVE has an offset of 80k to the 8th TLB.
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      4a64e0fd
    • R
      tcg/arm: Support tlb offsets larger than 64k · 71f9cee9
      Richard Henderson 提交于
      AArch64 with SVE has an offset of 80k to the 8th TLB.
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      71f9cee9
    • R
      tcg/arm: Fix double-word comparisons · 7170ac33
      Richard Henderson 提交于
      The code sequence we were generating was only good for unsigned
      comparisons.  For signed comparisions, use the sequence from gcc.
      
      Fixes booting of ppc64 firmware, with a patch changing the code
      sequence for ppc comparisons.
      Tested-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      7170ac33
  2. 16 1月, 2018 31 次提交
    • P
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · c1d5b9ad
      Peter Maydell 提交于
      * QemuMutex tracing improvements (Alex)
      * ram_addr_t optimization (David)
      * SCSI fixes (Fam, Stefan, me)
      * do {} while (0) fixes (Eric)
      * KVM fix for PMU (Jan)
      * memory leak fixes from ASAN (Marc-André)
      * migration fix for HPET, icount, loadvm (Maria, Pavel)
      * hflags fixes (me, Tao)
      * block/iscsi uninitialized variable (Peter L.)
      * full support for GMainContexts in character devices (Peter Xu)
      * more boot-serial-test (Thomas)
      * Memory leak fix (Zhecheng)
      
      # gpg: Signature made Tue 16 Jan 2018 14:15:45 GMT
      # gpg:                using RSA key 0xBFFBD25F78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
      # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
      #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
      
      * remotes/bonzini/tags/for-upstream: (51 commits)
        scripts/analyse-locks-simpletrace.py: script to analyse lock times
        util/qemu-thread-*: add qemu_lock, locked and unlock trace events
        cpu: flush TB cache when loading VMState
        block/iscsi: fix initialization of iTask in iscsi_co_get_block_status
        find_ram_offset: Align ram_addr_t allocation on long boundaries
        find_ram_offset: Add comments and tracing
        cpu_physical_memory_sync_dirty_bitmap: Another alignment fix
        checkpatch: Enforce proper do/while (0) style
        maint: Fix macros with broken 'do/while(0); ' usage
        tests: Avoid 'do/while(false); ' in vhost-user-bridge
        chardev: Clean up previous patch indentation
        chardev: Use goto/label instead of do/break/while(0)
        mips: Tweak location of ';' in macros
        net: Drop unusual use of do { } while (0);
        irq: fix memory leak
        cpus: unify qemu_*_wait_io_event
        icount: fixed saving/restoring of icount warp timers
        scripts/qemu-gdb/timers.py: new helper to dump timer state
        scripts/qemu-gdb: add simple tcg lock status helper
        target-i386: update hflags on Hypervisor.framework
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c1d5b9ad
    • P
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180116' into staging · aae39d24
      Peter Maydell 提交于
      target-arm queue:
       * SDHCI: cleanups and minor bug fixes
       * target/arm: minor refactor preparatory to fp16 support
       * omap_ssd, ssi-sd, pl181, milkymist-memcard: reset the SD
         card on controller reset (fixes migration failures)
       * target/arm: Handle page table walk load failures correctly
       * hw/arm/virt: Add virt-2.12 machine type
       * get_phys_addr_pmsav7: Support AP=0b111 for v7M
       * hw/intc/armv7m: Support byte and halfword accesses to CFSR
      
      # gpg: Signature made Tue 16 Jan 2018 13:33:31 GMT
      # gpg:                using RSA key 0x3C2525ED14360CDE
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20180116: (24 commits)
        sdhci: add a 'dma' property to the sysbus devices
        sdhci: fix the PCI device, using the PCI address space for DMA
        sdhci: Implement write method of ACMD12ERRSTS register
        sdhci: fix CAPAB/MAXCURR registers, both are 64bit and read-only
        sdhci: rename the SDHC_CAPAB register
        sdhci: move MASK_TRNMOD with other SDHC_TRN* defines in "sd-internal.h"
        sdhci: convert the DPRINT() calls into trace events
        sdhci: use qemu_log_mask(UNIMP) instead of fprintf()
        sdhci: refactor common sysbus/pci unrealize() into sdhci_common_unrealize()
        sdhci: refactor common sysbus/pci realize() into sdhci_common_realize()
        sdhci: refactor common sysbus/pci class_init() into sdhci_common_class_init()
        sdhci: use DEFINE_SDHCI_COMMON_PROPERTIES() for common sysbus/pci properties
        sdhci: remove dead code
        sdhci: clean up includes
        target/arm: Add fp16 support to vfp_expand_imm
        target/arm: Split out vfp_expand_imm
        hw/sd/omap_mmc: Reset SD card on controller reset
        hw/sd/ssi-sd: Reset SD card on controller reset
        hw/sd/milkymist-memcard: Reset SD card on controller reset
        hw/sd/pl181: Reset SD card on controller reset
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      aae39d24
    • A
      scripts/analyse-locks-simpletrace.py: script to analyse lock times · b5976c2e
      Alex Bennée 提交于
      This script allows analysis of mutex acquisition and hold times based
      on a trace file. Given a trace control file of:
      
        qemu_mutex_lock
        qemu_mutex_locked
        qemu_mutex_unlock
      
      And running with:
      
        $QEMU $QEMU_ARGS -trace events=./lock-trace
      
      You can analyse the results with:
      
        ./scripts/analyse-locks-simpletrace.py trace-events-all ./trace-21812
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b5976c2e
    • A
    • P
      cpu: flush TB cache when loading VMState · 15a356c4
      Pavel Dovgalyuk 提交于
      Flushing TB cache is required because TBs key in the cache may match
      different code which existed in the previous state.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Signed-off-by: NMaria Klimushenkova <maria.klimushenkova@ispras.ru>
      Message-Id: <20180110134846.12940.99993.stgit@pasha-VirtualBox>
      [Add comment suggested by Peter Maydell. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
      15a356c4
    • P
      block/iscsi: fix initialization of iTask in iscsi_co_get_block_status · 79f9c75e
      Peter Lieven 提交于
      in case of unaligned requests or on a target that does not support
      block provisioning we leave iTask uninitialized and check iTask.task
      for NULL later.
      
      Fixes: e38bc234Signed-off-by: NPeter Lieven <pl@kamp.de>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1515425247-21730-1-git-send-email-pl@kamp.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      79f9c75e
    • D
      find_ram_offset: Align ram_addr_t allocation on long boundaries · 801110ab
      Dr. David Alan Gilbert 提交于
      The dirty bitmaps are built from 'long's and there is fast-path code
      for synchronising the case where the RAMBlock is aligned to the start
      of a long boundary.  Align the allocation to this boundary
      to cause the fast path to be used.
      
      Offsets before change:
      11398@1515169675.018566:find_ram_offset size: 0x1e0000 @ 0x8000000
      11398@1515169675.020064:find_ram_offset size: 0x20000 @ 0x81e0000
      11398@1515169675.020244:find_ram_offset size: 0x20000 @ 0x8200000
      11398@1515169675.024343:find_ram_offset size: 0x1000000 @ 0x8220000
      11398@1515169675.025154:find_ram_offset size: 0x10000 @ 0x9220000
      11398@1515169675.027682:find_ram_offset size: 0x40000 @ 0x9230000
      11398@1515169675.032921:find_ram_offset size: 0x200000 @ 0x9270000
      11398@1515169675.033307:find_ram_offset size: 0x1000 @ 0x9470000
      11398@1515169675.033601:find_ram_offset size: 0x1000 @ 0x9471000
      
      after change:
      10923@1515169108.818245:find_ram_offset size: 0x1e0000 @ 0x8000000
      10923@1515169108.819410:find_ram_offset size: 0x20000 @ 0x8200000
      10923@1515169108.819587:find_ram_offset size: 0x20000 @ 0x8240000
      10923@1515169108.823708:find_ram_offset size: 0x1000000 @ 0x8280000
      10923@1515169108.824503:find_ram_offset size: 0x10000 @ 0x9280000
      10923@1515169108.827093:find_ram_offset size: 0x40000 @ 0x92c0000
      10923@1515169108.833045:find_ram_offset size: 0x200000 @ 0x9300000
      10923@1515169108.833504:find_ram_offset size: 0x1000 @ 0x9500000
      10923@1515169108.833787:find_ram_offset size: 0x1000 @ 0x9540000
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20180105170138.23357-3-dgilbert@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      801110ab
    • D
      find_ram_offset: Add comments and tracing · 154cc9ea
      Dr. David Alan Gilbert 提交于
      Add some comments so I can understand the various nested loops.
      Add some tracing so I can see what they're doing.
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20180105170138.23357-2-dgilbert@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      154cc9ea
    • D
      cpu_physical_memory_sync_dirty_bitmap: Another alignment fix · aa777e29
      Dr. David Alan Gilbert 提交于
      This code has an optimised, word aligned version, and a boring
      unaligned version. My commit f70d3451 fixed one alignment issue, but
      there's another.
      
      The optimised version operates on 'longs' dealing with (typically) 64
      pages at a time, replacing the whole long by a 0 and counting the bits.
      If the Ramblock is less than 64bits in length that long can contain bits
      representing two different RAMBlocks, but the code will update the
      bmap belinging to the 1st RAMBlock only while having updated the total
      dirty page count for both.
      
      This probably didn't matter prior to 6b6712ef which split the dirty
      bitmap by RAMBlock, but now they're separate RAMBlocks we end up
      with a count that doesn't match the state in the bitmaps.
      
      Symptom:
        Migration showing a few dirty pages left to be sent constantly
        Seen on aarch64 and x86 with x86+ovmf
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Reported-by: NWei Huang <wei@redhat.com>
      Fixes: 6b6712efSigned-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      aa777e29
    • E
      checkpatch: Enforce proper do/while (0) style · f4bdc13e
      Eric Blake 提交于
      Use of a loop construct for code that is not intended to repeat
      does not make much idiomatic sense, except in one place: it is a
      common usage in macros in order to wrap arbitrary code with
      single-statement semantics.  But when used in a macro, it is more
      typical for the caller to supply the trailing ';' when calling
      the macro.
      
      Although qemu coding style frowns on bare:
        if (cond)
          statement1;
        else
          statement2;
      where extra semicolons actually cause syntax errors, we still
      want our macro styles to be easily copied to other projects.
      Thus, declare it an error if we encounter any form of 'while (0)'
      with a semicolon in the same line.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-8-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f4bdc13e
    • E
      maint: Fix macros with broken 'do/while(0); ' usage · 2562755e
      Eric Blake 提交于
      The point of writing a macro embedded in a 'do { ... } while (0)'
      loop (particularly if the macro has multiple statements or would
      otherwise end with an 'if' statement) is so that the macro can be
      used as a drop-in statement with the caller supplying the
      trailing ';'.  Although our coding style frowns on brace-less 'if':
        if (cond)
          statement;
        else
          something else;
      that is the classic case where failure to use do/while(0) wrapping
      would cause the 'else' to pair with any embedded 'if' in the macro
      rather than the intended outer 'if'.  But conversely, if the macro
      includes an embedded ';', then the same brace-less coding style
      would now have two statements, making the 'else' a syntax error
      rather than pairing with the outer 'if'.  Thus, even though our
      coding style with required braces is not impacted, ending a macro
      with ';' makes our code harder to port to projects that use
      brace-less styles.
      
      The change should have no semantic impact.  I was not able to
      fully compile-test all of the changes (as some of them are
      examples of the ugly bit-rotting debug print statements that are
      completely elided by default, and I didn't want to recompile
      with the necessary -D witnesses - cleaning those up is left as a
      bite-sized task for another day); I did, however, audit that for
      all files touched, all callers of the changed macros DID supply
      a trailing ';' at the callsite, and did not appear to be used
      as part of a brace-less conditional.
      
      Found mechanically via: $ git grep -B1 'while (0);' | grep -A1 \\\\
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20171201232433.25193-7-eblake@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2562755e
    • E
      tests: Avoid 'do/while(false); ' in vhost-user-bridge · 241187c1
      Eric Blake 提交于
      Use of a do/while(0) loop as a way to allow break statements in
      the middle of execute-once code is unusual.  More typical is
      the use of goto for early exits, with a label at the end of
      the execute-once code, rather than nesting code in a scope;
      however, the comment at the end of the existing code makes this
      alternative a bit unpractical.
      
      So, to avoid false positives from a future syntax check about
      'while (false);', and to keep the loop form (in case someone
      ever does add DONTWAIT support, where they can just as easily
      manipulate the initial loop condition or add an if around the
      final 'break'), I opted to use the form of a while(1) loop (the
      break as an early exit is more idiomatic there), coupled with
      a final break preserving the original comment.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-6-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      241187c1
    • E
      chardev: Clean up previous patch indentation · 539022dd
      Eric Blake 提交于
      The previous patch left in an extra scope layer for ease of
      review; time to remove it.  No semantic change.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-5-eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      539022dd
    • E
      chardev: Use goto/label instead of do/break/while(0) · 19a4d43e
      Eric Blake 提交于
      Use of a do/while(0) control flow in order to permit an early break
      is an unusual paradigm, and triggers a false positive with a planned
      future syntax check against 'while (0);'.  Rewrite the code to use a
      goto instead.  This patch temporarily keeps an extra level of
      indentation to highlight the change; the next patch cleans it up.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-4-eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      19a4d43e
    • E
      mips: Tweak location of ';' in macros · 94f5c480
      Eric Blake 提交于
      It is more typical to provide the ';' by the caller of a macro
      than to embed it in the macro itself; this is because syntax
      highlight engines can get confused if a macro is called without
      a semicolon before the closing '}'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <20171201232433.25193-3-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      94f5c480
    • E
      net: Drop unusual use of do { } while (0); · 1b4c0a04
      Eric Blake 提交于
      For a couple of macros in pcnet.c, we have to provide a new scope
      to avoid compiler warnings about declarations in the middle of a
      switch statement that aren't in a sub-scope.  But use of
      'do { ... } while (0);' merely to provide that new scope is arcane
      overkill, compared to just using '{ ... }'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <20171201232433.25193-2-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1b4c0a04
    • L
      irq: fix memory leak · 01960e6d
      linzhecheng 提交于
      entry is moved from list but is not freed.
      Signed-off-by: Nlinzhecheng <linzhecheng@huawei.com>
      
      Message-Id: <20171225024704.19540-1-linzhecheng@huawei.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      01960e6d
    • P
      cpus: unify qemu_*_wait_io_event · db08b687
      Paolo Bonzini 提交于
      Except for round-robin TCG, every other accelerator is using more or
      less the same code around qemu_wait_io_event_common.  The exception
      is HAX, which also has to eat the dummy APC that is queued by
      qemu_cpu_kick_thread.
      
      We can add the SleepEx call to qemu_wait_io_event under "if
      (!tcg_enabled())", since that is the condition that is used in
      qemu_cpu_kick_thread, and unify the function for KVM, HAX, HVF and
      multi-threaded TCG.  Single-threaded TCG code can also be simplified
      since it is only used in the round-robin, sleep-if-all-CPUs-idle case.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      db08b687
    • P
      icount: fixed saving/restoring of icount warp timers · b39e3f34
      Pavel Dovgalyuk 提交于
      This patch adds saving and restoring of the icount warp
      timers in the vmstate.
      It is needed because there timers affect the virtual clock value.
      Therefore determinism of the execution in icount record/replay mode
      depends on determinism of the timers.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
      b39e3f34
    • A
      scripts/qemu-gdb/timers.py: new helper to dump timer state · c24999fa
      Alex Bennée 提交于
      This introduces the qemu-gdb command "qemu timers" which will dump the
      state of the main timers in the system.
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c24999fa
    • A
      scripts/qemu-gdb: add simple tcg lock status helper · f1cd52d8
      Alex Bennée 提交于
      Add a simple helper to dump lock state.
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f1cd52d8
    • P
      target-i386: update hflags on Hypervisor.framework · 809092f3
      Paolo Bonzini 提交于
      This ensures that x86_cpu_dump_state shows registers with the correct
      size.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      809092f3
    • T
      target/i386: hax: Move x86_update_hflags. · df16af87
      Tao Wu 提交于
      x86_update_hflags reference env->efer which is updated in hax_get_msrs,
      so it has to be called after hax_get_msrs. This fix the bug that sometimes
      dump_state show 32 bits regs even in 64 bits mode.
      Signed-off-by: NTao Wu <lepton@google.com>
      Message-Id: <20180110195056.85403-3-lepton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      df16af87
    • T
      target/i386: hax: change to use x86_update_hflags · e527f86e
      Tao Wu 提交于
      Change to use x86_update_hflags instead of keeping another copy
      at hax side. This also fix bug like HF_CPL_MASK should be SS.DPL,
      not CS.DPL.
      Signed-off-by: NTao Wu <lepton@google.com>
      Message-Id: <20180110195056.85403-2-lepton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e527f86e
    • T
      target/i386: move hflags update code to a function · 35b1b927
      Tao Wu 提交于
      We will share the same code for hax/kvm.
      Signed-off-by: NTao Wu <lepton@google.com>
      Message-Id: <20180110195056.85403-1-lepton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      35b1b927
    • T
      tests/boot-serial-test: Add support for the raspi2 machine · 52cb6817
      Thomas Huth 提交于
      The raspi2 machine supports loading firmware images, so we can easily
      load a small test sequence as raw binary blob here to test the UART.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1512031988-32490-8-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      52cb6817
    • T
      tests/boot-serial-test: Add a test for the moxiesim machine · 7244edf2
      Thomas Huth 提交于
      Now that moxiesim supports the -bios parameter, we can check this machine
      in the boot-serial tester, too, by supplying a mini bios that only writes
      'T' characters to the UART.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1512031988-32490-7-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7244edf2
    • T
      tests/boot-serial-test: Add tests for microblaze boards · acf53766
      Thomas Huth 提交于
      This adds two simple TCG + UART tests for the microblaze boards,
      one in big endian mode, and one in little endian mode.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1512031988-32490-5-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      acf53766
    • S
      scsi-disk: release AioContext in unaligned WRITE SAME case · 24355b79
      Stefan Hajnoczi 提交于
      scsi_write_same_complete() can retry the write if the request was
      unaligned.  Make sure to release the AioContext when that code path is
      taken!
      
      This patch fixes a hang when QEMU terminates after an unaligned WRITE
      SAME request has been processed with dataplane.  The hang occurs because
      iothread_stop_all() cannot acquire the AioContext lock that was leaked
      by the IOThread in scsi_write_same_complete().
      
      Fixes: b9e413dd ("block: explicitly acquire aiocontext in aio callbacks that need it").
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: qemu-stable@nongnu.org
      Reported-by: NCong Li <coli@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20180104142502.15175-1-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      24355b79
    • M
      disas/s390: fix global-buffer-overflow · 02a2ad21
      Marc-André Lureau 提交于
      Spotted thanks to ASAN:
      
      ==25226==ERROR: AddressSanitizer: global-buffer-overflow on address 0x556715a1f120 at pc 0x556714b6f6b1 bp 0x7ffcdfac1360 sp 0x7ffcdfac1350
      READ of size 1 at 0x556715a1f120 thread T0
          #0 0x556714b6f6b0 in init_disasm /home/elmarco/src/qemu/disas/s390.c:219
          #1 0x556714b6fa6a in print_insn_s390 /home/elmarco/src/qemu/disas/s390.c:294
          #2 0x55671484d031 in monitor_disas /home/elmarco/src/qemu/disas.c:635
          #3 0x556714862ec0 in memory_dump /home/elmarco/src/qemu/monitor.c:1324
          #4 0x55671486342a in hmp_memory_dump /home/elmarco/src/qemu/monitor.c:1418
          #5 0x5567148670be in handle_hmp_command /home/elmarco/src/qemu/monitor.c:3109
          #6 0x5567148674ed in qmp_human_monitor_command /home/elmarco/src/qemu/monitor.c:613
          #7 0x556714b00918 in qmp_marshal_human_monitor_command /home/elmarco/src/qemu/build/qmp-marshal.c:1704
          #8 0x556715138a3e in do_qmp_dispatch /home/elmarco/src/qemu/qapi/qmp-dispatch.c:104
          #9 0x556715138f83 in qmp_dispatch /home/elmarco/src/qemu/qapi/qmp-dispatch.c:131
          #10 0x55671485cf88 in handle_qmp_command /home/elmarco/src/qemu/monitor.c:3839
          #11 0x55671514e80b in json_message_process_token /home/elmarco/src/qemu/qobject/json-streamer.c:105
          #12 0x5567151bf2dc in json_lexer_feed_char /home/elmarco/src/qemu/qobject/json-lexer.c:323
          #13 0x5567151bf827 in json_lexer_feed /home/elmarco/src/qemu/qobject/json-lexer.c:373
          #14 0x55671514ee62 in json_message_parser_feed /home/elmarco/src/qemu/qobject/json-streamer.c:124
          #15 0x556714854b1f in monitor_qmp_read /home/elmarco/src/qemu/monitor.c:3881
          #16 0x556715045440 in qemu_chr_be_write_impl /home/elmarco/src/qemu/chardev/char.c:172
          #17 0x556715047184 in qemu_chr_be_write /home/elmarco/src/qemu/chardev/char.c:184
          #18 0x55671505a8e6 in tcp_chr_read /home/elmarco/src/qemu/chardev/char-socket.c:440
          #19 0x5567150943c3 in qio_channel_fd_source_dispatch /home/elmarco/src/qemu/io/channel-watch.c:84
          #20 0x7fb90292b90b in g_main_dispatch ../glib/gmain.c:3182
          #21 0x7fb90292c7ac in g_main_context_dispatch ../glib/gmain.c:3847
          #22 0x556715162eca in glib_pollfds_poll /home/elmarco/src/qemu/util/main-loop.c:214
          #23 0x556715163001 in os_host_main_loop_wait /home/elmarco/src/qemu/util/main-loop.c:261
          #24 0x5567151631fa in main_loop_wait /home/elmarco/src/qemu/util/main-loop.c:515
          #25 0x556714ad6d3b in main_loop /home/elmarco/src/qemu/vl.c:1950
          #26 0x556714ade329 in main /home/elmarco/src/qemu/vl.c:4865
          #27 0x7fb8fe5c9009 in __libc_start_main (/lib64/libc.so.6+0x21009)
          #28 0x5567147af4d9 in _start (/home/elmarco/src/qemu/build/s390x-softmmu/qemu-system-s390x+0xf674d9)
      
      0x556715a1f120 is located 32 bytes to the left of global variable 'char_hci_type_info' defined in '/home/elmarco/src/qemu/hw/bt/hci-csr.c:493:23' (0x556715a1f140) of size 104
      0x556715a1f120 is located 8 bytes to the right of global variable 's390_opcodes' defined in '/home/elmarco/src/qemu/disas/s390.c:860:33' (0x556715a15280) of size 40600
      
      This fix is based on Andreas Arnez <arnez@linux.vnet.ibm.com> upstream
      commit:
      https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=9ace48f3d7d80ce09c5df60cccb433470410b11b
      
      2014-08-19  Andreas Arnez  <arnez@linux.vnet.ibm.com>
      
             * s390-dis.c (init_disasm): Simplify initialization of
             opc_index[].  This also fixes an access after the last element
             of s390_opcodes[].
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180104160523.22995-19-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      02a2ad21
    • M
      mips: fix potential fopen(NULL,...) · b7438458
      Marc-André Lureau 提交于
      Spotted thanks to ASAN.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180104160523.22995-18-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b7438458