1. 30 9月, 2016 1 次提交
    • J
      ide: fix DMA register transitions · 9da82227
      John Snow 提交于
      ATA8-APT defines the state transitions for both a host controller and
      for the hardware device during the lifecycle of a DMA transfer, in
      section 9.7 "DMA command protocol."
      
      One of the interesting tidbits here is that when a device transitions
      from DDMA0 ("Prepare state") to DDMA1 ("Data_Transfer State"), it can
      choose to set either BSY or DRQ to signal this transition, but not both.
      
      as ide_sector_dma_start is the last point in our preparation process
      before we begin the real data transfer process (for either AHCI or BMDMA),
      this is the correct transition point for DDMA0 to DDMA1.
      
      I have chosen !BSY && DRQ for QEMU to make the transition from DDMA0 the
      most obvious.
      Reported-by: NBenjamin David Lunt <fys@fysnet.net>
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Tested-by: NStefan Weil <sw@weilnetz.de>
      Message-id: 1470175541-19344-1-git-send-email-jsnow@redhat.com
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      9da82227
  2. 08 9月, 2016 1 次提交
  3. 06 9月, 2016 1 次提交
  4. 09 8月, 2016 1 次提交
  5. 08 8月, 2016 3 次提交
    • M
      macio: set res_count value to 0 after non-block ATAPI DMA transfers · 16275edb
      Mark Cave-Ayland 提交于
      res_count should be set to the number of outstanding bytes after a DBDMA
      request. Unfortunately this wasn't being set to zero by the non-block
      transfer codepath meaning drivers that checked the descriptor result for
      such requests (e.g reading the CDROM TOC) would assume from a non-zero result
      that the transfer had failed.
      Signed-off-by: NMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      16275edb
    • M
      ahci: fix sglist leak on retry · 5839df7b
      Marc-André Lureau 提交于
      ahci-test /x86_64/ahci/io/dma/lba28/retry triggers the following leak:
      
      Direct leak of 16 byte(s) in 1 object(s) allocated from:
          #0 0x7fc4b2a25e20 in malloc (/lib64/libasan.so.3+0xc6e20)
          #1 0x7fc4993bce58 in g_malloc (/lib64/libglib-2.0.so.0+0x4ee58)
          #2 0x556a187d4b34 in ahci_populate_sglist hw/ide/ahci.c:896
          #3 0x556a187d8237 in ahci_dma_prepare_buf hw/ide/ahci.c:1367
          #4 0x556a187b5a1a in ide_dma_cb hw/ide/core.c:844
          #5 0x556a187d7eec in ahci_start_dma hw/ide/ahci.c:1333
          #6 0x556a187b650b in ide_start_dma hw/ide/core.c:921
          #7 0x556a187b61e6 in ide_sector_start_dma hw/ide/core.c:911
          #8 0x556a187b9e26 in cmd_write_dma hw/ide/core.c:1486
          #9 0x556a187bd519 in ide_exec_cmd hw/ide/core.c:2027
          #10 0x556a187d71c5 in handle_reg_h2d_fis hw/ide/ahci.c:1204
          #11 0x556a187d7681 in handle_cmd hw/ide/ahci.c:1254
          #12 0x556a187d168a in check_cmd hw/ide/ahci.c:510
          #13 0x556a187d0afc in ahci_port_write hw/ide/ahci.c:314
          #14 0x556a187d105d in ahci_mem_write hw/ide/ahci.c:435
          #15 0x556a1831d959 in memory_region_write_accessor /home/elmarco/src/qemu/memory.c:525
          #16 0x556a1831dc35 in access_with_adjusted_size /home/elmarco/src/qemu/memory.c:591
          #17 0x556a18323ce3 in memory_region_dispatch_write /home/elmarco/src/qemu/memory.c:1262
          #18 0x556a1828cf67 in address_space_write_continue /home/elmarco/src/qemu/exec.c:2578
          #19 0x556a1828d20b in address_space_write /home/elmarco/src/qemu/exec.c:2635
          #20 0x556a1828d92b in address_space_rw /home/elmarco/src/qemu/exec.c:2737
          #21 0x556a1828daf7 in cpu_physical_memory_rw /home/elmarco/src/qemu/exec.c:2746
          #22 0x556a183068d3 in cpu_physical_memory_write /home/elmarco/src/qemu/include/exec/cpu-common.h:72
          #23 0x556a18308194 in qtest_process_command /home/elmarco/src/qemu/qtest.c:382
          #24 0x556a18309999 in qtest_process_inbuf /home/elmarco/src/qemu/qtest.c:573
          #25 0x556a18309a4a in qtest_read /home/elmarco/src/qemu/qtest.c:585
          #26 0x556a18598b85 in qemu_chr_be_write_impl /home/elmarco/src/qemu/qemu-char.c:387
          #27 0x556a18598c52 in qemu_chr_be_write /home/elmarco/src/qemu/qemu-char.c:399
          #28 0x556a185a2afa in tcp_chr_read /home/elmarco/src/qemu/qemu-char.c:2902
          #29 0x556a18cbaf52 in qio_channel_fd_source_dispatch io/channel-watch.c:84
      
      Follow John Snow recommendation:
        Everywhere else ncq_err is used, it is accompanied by a list cleanup
        except for ncq_cb, which is the case you are fixing here.
      
        Move the sglist destruction inside of ncq_err and then delete it from
        the other two locations to keep it tidy.
      
        Call dma_buf_commit in ide_dma_cb after the early return. Though, this
        is also a little wonky because this routine does more than clear the
        list, but it is at the moment the centralized "we're done with the
        sglist" function and none of the other side effects that occur in
        dma_buf_commit will interfere with the reset that occurs from
        ide_restart_bh, I think
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      5839df7b
    • M
      ahci: free irqs array · 9d324b0e
      Marc-André Lureau 提交于
      Each irq is referenced by the IDEBus in ide_init2(), thus we can free
      the no longer used array.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Acked-by: NJohn Snow <jsnow@redhat.com>
      9d324b0e
  6. 29 7月, 2016 1 次提交
  7. 20 7月, 2016 1 次提交
  8. 19 7月, 2016 2 次提交
    • E
      ide: set retry_unit for PIO and FLUSH requests · 35f78ab4
      Evgeny Yakovlev 提交于
      The following sequence of tests discovered a problem in IDE emulation:
      1. Send DMA write to IDE device 0
      2. Send CMD_FLUSH_CACHE to same IDE device which will be failed by block
      layer using blkdebug script in tests/ide-test:test_retry_flush
      
      When doing DMA request ide/core.c will set s->retry_unit to s->unit in
      ide_start_dma. When dma completes ide_set_inactive sets retry_unit to -1.
      After that ide_flush_cache runs and fails thanks to blkdebug.
      ide_flush_cb calls ide_handle_rw_error which asserts that s->retry_unit
      == s->unit. But s->retry_unit is still -1 after previous DMA completion
      and flush does not use anything related to retry.
      
      This patch restricts retry unit assertion only to ops that actually use
      retry logic.
      Signed-off-by: NEvgeny Yakovlev <eyakovlev@virtuozzo.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1468870792-7411-3-git-send-email-den@openvz.org
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Fam Zheng <famz@redhat.com>
      CC: John Snow <jsnow@redhat.com>
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      35f78ab4
    • E
      ide: refactor retry_unit set and clear into separate function · 0eeee07e
      Evgeny Yakovlev 提交于
      Code to set and clear state associated with retry in moved into
      ide_set_retry and ide_clear_retry to make adding retry setups easier.
      Signed-off-by: NEvgeny Yakovlev <eyakovlev@virtuozzo.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1468870792-7411-2-git-send-email-den@openvz.org
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Fam Zheng <famz@redhat.com>
      CC: John Snow <jsnow@redhat.com>
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      0eeee07e
  9. 13 7月, 2016 2 次提交
  10. 12 7月, 2016 1 次提交
  11. 05 7月, 2016 1 次提交
  12. 29 6月, 2016 1 次提交
  13. 28 6月, 2016 1 次提交
  14. 20 6月, 2016 1 次提交
  15. 14 6月, 2016 1 次提交
  16. 07 6月, 2016 1 次提交
  17. 26 5月, 2016 2 次提交
  18. 12 5月, 2016 3 次提交
  19. 13 4月, 2016 4 次提交
  20. 08 4月, 2016 1 次提交
  21. 23 3月, 2016 3 次提交
    • V
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa 提交于
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      include/qemu/bcd.h)
      Signed-off-by: NVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • R
      Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND · 73bcb24d
      Rutuja Shah 提交于
      This patch replaces get_ticks_per_sec() calls with the macro
      NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec()
      is then removed.  This replacement improves the readability and
      understandability of code.
      
      For example,
      
          timer_mod(fdctrl->result_timer,
      	      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50));
      
      NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns
      matches the unit of the expression on the right side of the plus.
      Signed-off-by: NRutuja Shah <rutu.shah.26@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      73bcb24d
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  22. 11 2月, 2016 7 次提交