[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/14] Use dma_addr_t type for scatter/gather code
From: |
David Gibson |
Subject: |
[Qemu-devel] [PATCH 02/14] Use dma_addr_t type for scatter/gather code |
Date: |
Mon, 31 Oct 2011 17:06:46 +1100 |
This patch uses the newly created dma_addr_t type throughout the
scatter/gather handling code in dma-helpers.c whenever we need to
represent a dma bus address. This makes a better distinction as to
what is a bus address and what is a cpu physical address. Since we
don't support IOMMUs yet, they can't be very different for now, but
that will change in future, and this preliminary helps clarify what's
going on.
Signed-off-by: David Gibson <address@hidden>
---
dma-helpers.c | 5 ++---
dma.h | 9 ++++-----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dma-helpers.c b/dma-helpers.c
index 86d2d0a..bdcd38c 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -18,8 +18,7 @@ void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)
qsg->size = 0;
}
-void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
- target_phys_addr_t len)
+void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len)
{
if (qsg->nsg == qsg->nalloc) {
qsg->nalloc = 2 * qsg->nalloc + 1;
@@ -45,7 +44,7 @@ typedef struct {
bool to_dev;
bool in_cancel;
int sg_cur_index;
- target_phys_addr_t sg_cur_byte;
+ dma_addr_t sg_cur_byte;
QEMUIOVector iov;
QEMUBH *bh;
DMAIOFunc *io_func;
diff --git a/dma.h b/dma.h
index 56e163a..a13209d 100644
--- a/dma.h
+++ b/dma.h
@@ -28,20 +28,19 @@ typedef enum {
} DMADirection;
struct ScatterGatherEntry {
- target_phys_addr_t base;
- target_phys_addr_t len;
+ dma_addr_t base;
+ dma_addr_t len;
};
struct QEMUSGList {
ScatterGatherEntry *sg;
int nsg;
int nalloc;
- target_phys_addr_t size;
+ dma_addr_t size;
};
void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
-void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
- target_phys_addr_t len);
+void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);
void qemu_sglist_destroy(QEMUSGList *qsg);
#endif
--
1.7.7
- [Qemu-devel] [0/14] Preliminary work for IOMMU emulation support (v3), David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 02/14] Use dma_addr_t type for scatter/gather code,
David Gibson <=
- [Qemu-devel] [PATCH 07/14] es1370: Use PCI DMA stub functions, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 01/14] Define DMA address and direction types, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 03/14] Add stub functions for PCI device models to do PCI DMA, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 08/14] e1000: Use PCI DMA stub functions, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 14/14] usb-uhci: Use PCI DMA stub functions, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 10/14] pcnet-pci: Use PCI DMA stub functions, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 04/14] rtl8139: Use PCI DMA stub functions, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 05/14] eepro100: Use PCI DMA stub functions, David Gibson, 2011/10/31
- [Qemu-devel] [PATCH 06/14] ac97: Use PCI DMA stub functions, David Gibson, 2011/10/31