- Feb 21, 2017
-
-
Paolo Bonzini authored
Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Fam Zheng <famz@redhat.com> Reviewed-by:
Daniel P. Berrange <berrange@redhat.com> Message-id: 20170213135235.12274-15-pbonzini@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Jan 31, 2017
-
-
Daniel P. Berrangé authored
Introduce rules in the top level Makefile that are able to generate trace.[ch] files in every subdirectory which has a trace-events file. The top level directory is handled specially, so instead of creating trace.h, it creates trace-root.h. This allows sub-directories to include the top level trace-root.h file, without ambiguity wrt to the trace.g file in the current sub-dir. Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Daniel P. Berrange <berrange@redhat.com> Message-id: 20170125161417.31949-7-berrange@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Oct 27, 2016
-
-
Mark Cave-Ayland authored
The hard-coded default alignment is BDRV_SECTOR_SIZE, however this is not necessarily the case for all platforms. Use this as the default alignment for all current callers. Signed-off-by:
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by:
Eric Blake <eblake@redhat.com> Acked-by:
John Snow <jsnow@redhat.com> Message-id: 1476445266-27503-2-git-send-email-mark.cave-ayland@ilande.co.uk Signed-off-by:
John Snow <jsnow@redhat.com>
-
- Jun 28, 2016
-
-
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:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Fam Zheng <famz@redhat.com> Message-id: 1466451417-27988-1-git-send-email-stefanha@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- May 25, 2016
-
-
Paolo Bonzini authored
Callers of dma_blk_io have no way to pass extra data to the DMAIOFunc, because the original callback and opaque are gone by the time DMAIOFunc is called. On the other hand, the BlockBackend is usually derived from those extra data that you could pass to the DMAIOFunc (in the next patch, that would be the SCSIRequest). So change DMAIOFunc's prototype, decoupling it from blk_aio_readv and blk_aio_writev's. The new prototype loses the BlockBackend and gains an extra opaque value which, in the case of dma_blk_readv and dma_blk_writev, is of course used for the BlockBackend. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- May 12, 2016
-
-
Eric Blake authored
Sector-based blk_aio_readv() and blk_aio_writev() should die; switch to byte-based blk_aio_preadv() and blk_aio_pwritev() instead. The patch had to touch multiple files at once, because dma_blk_io() takes pointers to the functions, and ide_issue_trim() piggybacks on the same interface (while ignoring offset under the hood). Signed-off-by:
Eric Blake <eblake@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Feb 04, 2016
-
-
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:
Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
-
- Apr 30, 2015
-
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Apr 27, 2015
-
-
Fam Zheng authored
If DMA's owning thread cancels the IO while the bounce buffer's owning thread is notifying the "cpu client list", a use-after-free happens: continue_after_map_failure dma_aio_cancel ------------------------------------------------------------------ aio_bh_new qemu_bh_delete qemu_bh_schedule (use after free) Also, the old code doesn't run the bh in the right AioContext. Fix both problems by passing a QEMUBH to cpu_register_map_client. Signed-off-by:
Fam Zheng <famz@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1426496617-10702-6-git-send-email-famz@redhat.com> [Remove unnecessary forward declaration. - Paolo] Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Apr 26, 2015
-
-
Peter Maydell authored
Make address_space_rw take transaction attributes, rather than always using the 'unspecified' attributes. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org>
-
- Oct 20, 2014
-
-
Markus Armbruster authored
Device models should access their block backends only through the block-backend.h API. Convert them, and drop direct includes of inappropriate headers. Just four uses of BlockDriverState are left: * The Xen paravirtual block device backend (xen_disk.c) opens images itself when set up via xenbus, bypassing blockdev.c. I figure it should go through qmp_blockdev_add() instead. * Device model "usb-storage" prompts for keys. No other device model does, and this one probably shouldn't do it, either. * ide_issue_trim_cb() uses bdrv_aio_discard() instead of blk_aio_discard() because it fishes its backend out of a BlockAIOCB, which has only the BlockDriverState. * PC87312State has an unused BlockDriverState[] member. The next two commits take care of the latter two. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Max Reitz <mreitz@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Markus Armbruster authored
I'll use it with block backends shortly, and the name is going to fit badly there. It's a block layer thing anyway, not just a block driver thing. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Max Reitz <mreitz@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Markus Armbruster authored
I'll use BlockDriverAIOCB with block backends shortly, and the name is going to fit badly there. It's a block layer thing anyway, not just a block driver thing. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Max Reitz <mreitz@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Sep 22, 2014
-
-
Fam Zheng authored
Suggested-by:
Benoît Canet <benoit.canet@irqsave.net> Signed-off-by:
Fam Zheng <famz@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Fam Zheng authored
Just forward the request to bdrv_aio_cancel_async. Signed-off-by:
Fam Zheng <famz@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Sep 10, 2014
-
-
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:
Benoît Canet <benoit.canet@nodalink.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Jul 14, 2014
-
-
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:
Kevin Wolf <kwolf@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com>
-
- May 23, 2014
-
-
Jules Wang authored
Calling dma_bdrv_unmap() twice is not necessary and may cause potential problems if some code changes. Signed-off-by:
Jules Wang <junqing.wang@cs2c.com.cn> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Apr 04, 2014
-
-
Peter Maydell authored
Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get() does not return zero-initialized memory. Spotted by the clang sanitizer (which complained when the value loaded in dma_complete() was not valid for a bool type); this might have resulted in leaking the AIO block. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Aug 22, 2013
-
-
Alex Bligh authored
include/qemu/timer.h has no need to include main-loop.h and doing so causes an issue for the next patch. Unfortunately various files assume including timers.h will pull in main-loop.h. Untangle this mess. Signed-off-by:
Alex Bligh <alex@alex.org.uk> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Jul 04, 2013
-
-
Paolo Bonzini authored
Reviewed-by:
Anthony Liguori <aliguori@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jun 20, 2013
-
-
Paolo Bonzini authored
The DMAContext is a simple pointer to an AddressSpace that is now always already available. Make everyone hold the address space directly, and clean up the DMA API to use the AddressSpace directly. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The translate function in the DMAContext is now always NULL. Remove every reference to it. Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- May 29, 2013
-
-
Paolo Bonzini authored
The old-style IOMMU lets you check whether an access is valid in a given DMAContext. There is no equivalent for AddressSpace in the memory API, implement it with a lookup of the dispatch tree. Reviewed-by:
Richard Henderson <rth@twiddle.net> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 19, 2012
-
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Nov 14, 2012
-
-
Stefan Hajnoczi authored
Now that AIOPool no longer keeps a freelist, it isn't really a "pool" anymore. Rename it to AIOCBInfo and make it const since it no longer needs to be modified. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Oct 23, 2012
-
-
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:
Avi Kivity <avi@redhat.com> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Oct 22, 2012
-
-
Avi Kivity authored
Instead of accessing the cpu address space, use an address space configured by the caller. Eventually all dma functionality will be folded into AddressSpace, but we have to start from something. Reviewed-by:
Anthony Liguori <aliguori@us.ibm.com> Signed-off-by:
Avi Kivity <avi@redhat.com>
-
- Aug 16, 2012
-
-
Benjamin Herrenschmidt authored
Hi hard a brain fart when coding that function, it will fail to "set" the memory beyond the first 512 bytes. This is in turn causing guest crashes in ibmveth (spapr_llan.c on the qemu side) due to the receive queue not being properly initialized. Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Aug 10, 2012
-
-
Jason Baron authored
I noticed that in hw/ide/ahci:ahci_dma_rw_buf() we do not free the sglist. Thus, I've added a call to qemu_sglist_destroy() to fix this memory leak. In addition, I've adeed a call in qemu_sglist_destroy() to 0 all of the sglist fields, in case there is some other codepath that tries to free the sglist. Signed-off-by:
Jason Baron <jbaron@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Jun 27, 2012
-
-
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:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
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:
Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by:
David Gibson <david@gibson.dropbear.id.au> Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
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:
David Gibson <david@gibson.dropbear.id.au> Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
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:
David Gibson <david@gibson.dropbear.id.au> Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Apr 05, 2012
-
-
David Gibson authored
Currently dma_bdrv_io() takes a 'to_dev' boolean parameter to determine the direction of DMA it is emulating. We already have a DMADirection enum designed specifically to encode DMA directions. This patch uses it for dma_bdrv_io() as well. This involves removing the DMADirection definition from the #ifdef it was inside, but since that only existed to protect the definition of dma_addr_t from places where config.h is not included, there wasn't any reason for it to be there in the first place. Signed-off-by:
David Gibson <david@gibson.dropbear.id.au> Reviewed-by:
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by:
Andreas Färber <afaerber@suse.de> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Paolo Bonzini authored
And remove several block_int.h inclusions that should not be there. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Feb 22, 2012
-
-
Paolo Bonzini authored
The length of the transfer is already in the sglist, the wrapper simply fetches it. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
These helpers do a full transfer from an in-memory buffer to target memory, with support for scatter/gather lists. It will be used to store the reply of an emulated command into a QEMUSGList provided by the adapter. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-