1. 21 Feb, 2017 1 commit
  2. 31 Jan, 2017 1 commit
  3. 27 Oct, 2016 1 commit
  4. 28 Jun, 2016 1 commit
    • Stefan Hajnoczi's avatar
      dma-helpers: dma_blk_io() cancel support · 5fa78b2a
      Stefan Hajnoczi authored
      Attempting to cancel a dma_blk_io() request causes an abort(3):
      
        void bdrv_aio_cancel(BlockAIOCB *acb)
        {
            ...
            while (acb->refcnt > 1) {
                if (acb->aiocb_info->get_aio_context) {
                    aio_poll(acb->aiocb_info->get_aio_context(acb), true);
                } else if (acb->bs) {
                    aio_poll(bdrv_get_aio_context(acb->bs), true);
                } else {
                    abort();
                }
            }
            ...
        }
      
      This happens because DMAAIOCB->bs is NULL and
      dma_aiocb_info.get_aio_context() is also NULL.
      
      This patch trivially implements dma_aiocb_info.get_aio_context() by
      fetching the DMAAIOCB->ctx field.
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: 's avatarFam Zheng <famz@redhat.com>
      Message-id: 1466451417-27988-1-git-send-email-stefanha@redhat.com
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
      5fa78b2a
  5. 25 May, 2016 2 commits
  6. 12 May, 2016 1 commit
  7. 04 Feb, 2016 1 commit
    • Peter Maydell's avatar
      all: Clean up includes · d38ea87a
      Peter Maydell authored
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: 's avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
      d38ea87a
  8. 30 Apr, 2015 1 commit
  9. 27 Apr, 2015 1 commit
  10. 26 Apr, 2015 1 commit
  11. 20 Oct, 2014 3 commits
  12. 22 Sep, 2014 2 commits
  13. 10 Sep, 2014 1 commit
    • Benoît Canet's avatar
      block: Make the block accounting functions operate on BlockAcctStats · 5366d0c8
      Benoît Canet authored
      This is the next step for decoupling block accounting functions from
      BlockDriverState.
      In a future commit the BlockAcctStats structure will be moved from
      BlockDriverState to the device models structures.
      
      Note that bdrv_get_stats was introduced so device models can retrieve the
      BlockAcctStats structure of a BlockDriverState without being aware of it's
      layout.
      This function should go away when BlockAcctStats will be embedded in the device
      models structures.
      
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Keith Busch <keith.busch@intel.com>
      CC: Anthony Liguori <aliguori@amazon.com>
      CC: "Michael S. Tsirkin" <mst@redhat.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Eric Blake <eblake@redhat.com>
      CC: Peter Maydell <peter.maydell@linaro.org>
      CC: Michael Tokarev <mjt@tls.msk.ru>
      CC: John Snow <jsnow@redhat.com>
      CC: Markus Armbruster <armbru@redhat.com>
      CC: Alexander Graf <agraf@suse.de>
      CC: Max Reitz <mreitz@redhat.com>
      Signed-off-by: 's avatarBenoît Canet <benoit.canet@nodalink.com>
      Signed-off-by: 's avatarKevin Wolf <kwolf@redhat.com>
      5366d0c8
  14. 14 Jul, 2014 1 commit
    • Kevin Wolf's avatar
      dma-helpers: Fix too long qiov · 58f423fb
      Kevin Wolf authored
      If the size of the scatter/gather list isn't a multiple of 512, the
      number of sectors for the block layer request is rounded down, resulting
      in a qiov that doesn't match the request length. Truncate the qiov to the
      new length of the request.
      
      This fixes the IDE qtest case /x86_64/ide/bmdma/short_prdt.
      Signed-off-by: 's avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: 's avatarEric Blake <eblake@redhat.com>
      58f423fb
  15. 23 May, 2014 1 commit
  16. 04 Apr, 2014 1 commit
  17. 22 Aug, 2013 1 commit
  18. 04 Jul, 2013 1 commit
  19. 20 Jun, 2013 2 commits
  20. 29 May, 2013 1 commit
  21. 19 Dec, 2012 2 commits
  22. 14 Nov, 2012 1 commit
  23. 23 Oct, 2012 1 commit
    • Avi Kivity's avatar
      Rename target_phys_addr_t to hwaddr · a8170e5e
      Avi Kivity authored
      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: 's avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: 's avatarAnthony Liguori <aliguori@us.ibm.com>
      a8170e5e
  24. 22 Oct, 2012 1 commit
  25. 16 Aug, 2012 1 commit
  26. 10 Aug, 2012 1 commit
  27. 27 Jun, 2012 4 commits
    • Benjamin Herrenschmidt's avatar
      Add a memory barrier to DMA functions · 7a0bac4d
      Benjamin Herrenschmidt authored
      The emulated devices can run simultaneously with the guest, so
      we need to be careful with ordering of load and stores done by
      them to the guest system memory, which need to be observed in
      the right order by the guest operating system.
      
      This adds a barrier call to the basic DMA read/write ops which
      is currently implemented as a smp_mb(), but could be later
      improved for more fine grained control of barriers.
      
      Additionally, a _relaxed() variant of the accessors is provided
      to easily convert devices who would be performance sensitive
      and negatively impacted by the change.
      Signed-off-by: 's avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: 's avatarAnthony Liguori <aliguori@us.ibm.com>
      7a0bac4d
    • David Gibson's avatar
      iommu: Introduce IOMMU emulation infrastructure · e5332e63
      David Gibson authored
      This patch adds the basic infrastructure necessary to emulate an IOMMU
      visible to the guest.  The DMAContext structure is extended with
      information and a callback describing the translation, and the various
      DMA functions used by devices will now perform IOMMU translation using
      this callback.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Signed-off-by: 's avatarEduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Signed-off-by: 's avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: 's avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: 's avatarAnthony Liguori <aliguori@us.ibm.com>
      e5332e63
    • David Gibson's avatar
      iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers · c65bcef3
      David Gibson authored
      dma-helpers.c contains a number of helper functions for doing
      scatter/gather DMA, and various block device related DMA.  Currently,
      these directly access guest memory using cpu_physical_memory_*(),
      assuming no IOMMU translation.
      
      This patch updates this code to use the new universal DMA helper
      functions.  qemu_sglist_init() now takes a DMAContext * to describe
      the DMA address space in which the scatter/gather will take place.
      
      We minimally update the callers qemu_sglist_init() to pass NULL
      (i.e. no translation, same as current behaviour).  Some of those
      callers should pass something else in some cases to allow proper IOMMU
      translation in future, but that will be fixed in later patches.
      
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: 's avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: 's avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: 's avatarAnthony Liguori <aliguori@us.ibm.com>
      c65bcef3
    • David Gibson's avatar
      iommu: Add universal DMA helper functions · d86a77f8
      David Gibson authored
      Not that long ago, every device implementation using DMA directly
      accessed guest memory using cpu_physical_memory_*().  This meant that
      adding support for a guest visible IOMMU would require changing every
      one of these devices to go through IOMMU translation.
      
      Shortly before qemu 1.0, I made a start on fixing this by providing
      helper functions for PCI DMA.  These are currently just stubs which
      call the direct access functions, but mean that an IOMMU can be
      implemented in one place, rather than for every PCI device.
      
      Clearly, this doesn't help for non PCI devices, which could also be
      IOMMU translated on some platforms.  It is also problematic for the
      devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we
      cannot use the the pci_dma_*() functions, because they assume the
      presence of a PCIDevice, but we don't want to have to check between
      pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the
      device code.
      
      This patch makes the first step on addressing both these problems, by
      introducing new (stub) dma helper functions which can be used for any
      DMA capable device.
      
      These dma functions take a DMAContext *, a new (currently empty)
      variable describing the DMA address space in which the operation is to
      take place.  NULL indicates untranslated DMA directly into guest
      physical address space.  The intention is that in future non-NULL
      values will given information about any necessary IOMMU translation.
      
      DMA using devices must obtain a DMAContext (or, potentially, contexts)
      from their bus or platform.  For now this patch just converts the PCI
      wrappers to be implemented in terms of the universal wrappers,
      converting other drivers can take place over time.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Cc: Richard Henderson <rth@twiddle.net>
      Signed-off-by: 's avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: 's avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: 's avatarAnthony Liguori <aliguori@us.ibm.com>
      d86a77f8
  28. 05 Apr, 2012 2 commits
  29. 22 Feb, 2012 2 commits