From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> To: joro@8bytes.org Cc: blauwirbel@gmail.com, paul@codesourcery.com, avi@redhat.com, anthony@codemonkey.ws, av1474@comtv.ru, yamahata@valinux.co.jp, kvm@vger.kernel.org, qemu-devel@nongnu.org, Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Subject: [PATCH 10/13] lsi53c895a: use the DMA memory access interface Date: Sat, 29 Jan 2011 19:40:31 +0200 [thread overview] Message-ID: <3db2d29c9087b87218e8818e3214a929f19a0fc2.1296321798.git.eduard.munteanu@linux360.ro> (raw) In-Reply-To: <cover.1296321798.git.eduard.munteanu@linux360.ro> In-Reply-To: <cover.1296321798.git.eduard.munteanu@linux360.ro> This allows the device to work properly with an emulated IOMMU. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> --- hw/lsi53c895a.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 0129ae3..76bd631 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -394,7 +394,7 @@ static inline uint32_t read_dword(LSIState *s, uint32_t addr) if ((addr & 0xffffe000) == s->script_ram_base) { return s->script_ram[(addr & 0x1fff) >> 2]; } - cpu_physical_memory_read(addr, (uint8_t *)&buf, 4); + dma_memory_read(&s->dev.dma, addr, (uint8_t *)&buf, 4); return cpu_to_le32(buf); } @@ -574,9 +574,9 @@ static void lsi_do_dma(LSIState *s, int out) /* ??? Set SFBR to first data byte. */ if (out) { - cpu_physical_memory_read(addr, s->current->dma_buf, count); + dma_memory_read(&s->dev.dma, addr, s->current->dma_buf, count); } else { - cpu_physical_memory_write(addr, s->current->dma_buf, count); + dma_memory_write(&s->dev.dma, addr, s->current->dma_buf, count); } s->current->dma_len -= count; if (s->current->dma_len == 0) { @@ -741,7 +741,7 @@ static void lsi_do_command(LSIState *s) DPRINTF("Send command len=%d\n", s->dbc); if (s->dbc > 16) s->dbc = 16; - cpu_physical_memory_read(s->dnad, buf, s->dbc); + dma_memory_read(&s->dev.dma, s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; @@ -790,7 +790,7 @@ static void lsi_do_status(LSIState *s) s->dbc = 1; sense = s->sense; s->sfbr = sense; - cpu_physical_memory_write(s->dnad, &sense, 1); + dma_memory_write(&s->dev.dma, s->dnad, &sense, 1); lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_add_msg_byte(s, 0); /* COMMAND COMPLETE */ @@ -804,7 +804,7 @@ static void lsi_do_msgin(LSIState *s) len = s->msg_len; if (len > s->dbc) len = s->dbc; - cpu_physical_memory_write(s->dnad, s->msg, len); + dma_memory_write(&s->dev.dma, s->dnad, s->msg, len); /* Linux drivers rely on the last byte being in the SIDL. */ s->sidl = s->msg[len - 1]; s->msg_len -= len; @@ -836,7 +836,7 @@ static void lsi_do_msgin(LSIState *s) static uint8_t lsi_get_msgbyte(LSIState *s) { uint8_t data; - cpu_physical_memory_read(s->dnad, &data, 1); + dma_memory_read(&s->dev.dma, s->dnad, &data, 1); s->dnad++; s->dbc--; return data; @@ -924,8 +924,8 @@ static void lsi_memcpy(LSIState *s, uint32_t dest, uint32_t src, int count) DPRINTF("memcpy dest 0x%08x src 0x%08x count %d\n", dest, src, count); while (count) { n = (count > LSI_BUF_SIZE) ? LSI_BUF_SIZE : count; - cpu_physical_memory_read(src, buf, n); - cpu_physical_memory_write(dest, buf, n); + dma_memory_read(&s->dev.dma, src, buf, n); + dma_memory_write(&s->dev.dma, dest, buf, n); src += n; dest += n; count -= n; @@ -993,7 +993,7 @@ again: /* 32-bit Table indirect */ offset = sxt24(addr); - cpu_physical_memory_read(s->dsa + offset, (uint8_t *)buf, 8); + dma_memory_read(&s->dev.dma, s->dsa + offset, (uint8_t *)buf, 8); /* byte count is stored in bits 0:23 only */ s->dbc = cpu_to_le32(buf[0]) & 0xffffff; s->rbc = s->dbc; @@ -1352,7 +1352,7 @@ again: n = (insn & 7); reg = (insn >> 16) & 0xff; if (insn & (1 << 24)) { - cpu_physical_memory_read(addr, data, n); + dma_memory_read(&s->dev.dma, addr, data, n); DPRINTF("Load reg 0x%x size %d addr 0x%08x = %08x\n", reg, n, addr, *(int *)data); for (i = 0; i < n; i++) { @@ -1363,7 +1363,7 @@ again: for (i = 0; i < n; i++) { data[i] = lsi_reg_readb(s, reg + i); } - cpu_physical_memory_write(addr, data, n); + dma_memory_write(&s->dev.dma, addr, data, n); } } } -- 1.7.3.4
WARNING: multiple messages have this Message-ID (diff)
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> To: joro@8bytes.org Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, blauwirbel@gmail.com, yamahata@valinux.co.jp, paul@codesourcery.com, Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>, avi@redhat.com Subject: [Qemu-devel] [PATCH 10/13] lsi53c895a: use the DMA memory access interface Date: Sat, 29 Jan 2011 19:40:31 +0200 [thread overview] Message-ID: <3db2d29c9087b87218e8818e3214a929f19a0fc2.1296321798.git.eduard.munteanu@linux360.ro> (raw) In-Reply-To: <cover.1296321798.git.eduard.munteanu@linux360.ro> In-Reply-To: <cover.1296321798.git.eduard.munteanu@linux360.ro> This allows the device to work properly with an emulated IOMMU. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> --- hw/lsi53c895a.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 0129ae3..76bd631 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -394,7 +394,7 @@ static inline uint32_t read_dword(LSIState *s, uint32_t addr) if ((addr & 0xffffe000) == s->script_ram_base) { return s->script_ram[(addr & 0x1fff) >> 2]; } - cpu_physical_memory_read(addr, (uint8_t *)&buf, 4); + dma_memory_read(&s->dev.dma, addr, (uint8_t *)&buf, 4); return cpu_to_le32(buf); } @@ -574,9 +574,9 @@ static void lsi_do_dma(LSIState *s, int out) /* ??? Set SFBR to first data byte. */ if (out) { - cpu_physical_memory_read(addr, s->current->dma_buf, count); + dma_memory_read(&s->dev.dma, addr, s->current->dma_buf, count); } else { - cpu_physical_memory_write(addr, s->current->dma_buf, count); + dma_memory_write(&s->dev.dma, addr, s->current->dma_buf, count); } s->current->dma_len -= count; if (s->current->dma_len == 0) { @@ -741,7 +741,7 @@ static void lsi_do_command(LSIState *s) DPRINTF("Send command len=%d\n", s->dbc); if (s->dbc > 16) s->dbc = 16; - cpu_physical_memory_read(s->dnad, buf, s->dbc); + dma_memory_read(&s->dev.dma, s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; @@ -790,7 +790,7 @@ static void lsi_do_status(LSIState *s) s->dbc = 1; sense = s->sense; s->sfbr = sense; - cpu_physical_memory_write(s->dnad, &sense, 1); + dma_memory_write(&s->dev.dma, s->dnad, &sense, 1); lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_add_msg_byte(s, 0); /* COMMAND COMPLETE */ @@ -804,7 +804,7 @@ static void lsi_do_msgin(LSIState *s) len = s->msg_len; if (len > s->dbc) len = s->dbc; - cpu_physical_memory_write(s->dnad, s->msg, len); + dma_memory_write(&s->dev.dma, s->dnad, s->msg, len); /* Linux drivers rely on the last byte being in the SIDL. */ s->sidl = s->msg[len - 1]; s->msg_len -= len; @@ -836,7 +836,7 @@ static void lsi_do_msgin(LSIState *s) static uint8_t lsi_get_msgbyte(LSIState *s) { uint8_t data; - cpu_physical_memory_read(s->dnad, &data, 1); + dma_memory_read(&s->dev.dma, s->dnad, &data, 1); s->dnad++; s->dbc--; return data; @@ -924,8 +924,8 @@ static void lsi_memcpy(LSIState *s, uint32_t dest, uint32_t src, int count) DPRINTF("memcpy dest 0x%08x src 0x%08x count %d\n", dest, src, count); while (count) { n = (count > LSI_BUF_SIZE) ? LSI_BUF_SIZE : count; - cpu_physical_memory_read(src, buf, n); - cpu_physical_memory_write(dest, buf, n); + dma_memory_read(&s->dev.dma, src, buf, n); + dma_memory_write(&s->dev.dma, dest, buf, n); src += n; dest += n; count -= n; @@ -993,7 +993,7 @@ again: /* 32-bit Table indirect */ offset = sxt24(addr); - cpu_physical_memory_read(s->dsa + offset, (uint8_t *)buf, 8); + dma_memory_read(&s->dev.dma, s->dsa + offset, (uint8_t *)buf, 8); /* byte count is stored in bits 0:23 only */ s->dbc = cpu_to_le32(buf[0]) & 0xffffff; s->rbc = s->dbc; @@ -1352,7 +1352,7 @@ again: n = (insn & 7); reg = (insn >> 16) & 0xff; if (insn & (1 << 24)) { - cpu_physical_memory_read(addr, data, n); + dma_memory_read(&s->dev.dma, addr, data, n); DPRINTF("Load reg 0x%x size %d addr 0x%08x = %08x\n", reg, n, addr, *(int *)data); for (i = 0; i < n; i++) { @@ -1363,7 +1363,7 @@ again: for (i = 0; i < n; i++) { data[i] = lsi_reg_readb(s, reg + i); } - cpu_physical_memory_write(addr, data, n); + dma_memory_write(&s->dev.dma, addr, data, n); } } } -- 1.7.3.4
next prev parent reply other threads:[~2011-01-29 17:41 UTC|newest] Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-29 17:40 [PATCH 00/13] AMD IOMMU emulation patchset Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 01/13] Generic DMA memory access interface Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-05 10:20 ` Blue Swirl 2011-02-05 10:20 ` [Qemu-devel] " Blue Swirl 2011-02-06 11:13 ` Michael S. Tsirkin 2011-02-06 11:13 ` [Qemu-devel] " Michael S. Tsirkin 2011-02-06 11:16 ` Michael S. Tsirkin 2011-02-06 11:16 ` [Qemu-devel] " Michael S. Tsirkin 2011-01-29 17:40 ` [PATCH 02/13] pci: add IOMMU support via the generic DMA layer Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 03/13] AMD IOMMU emulation Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-06 10:54 ` Michael S. Tsirkin 2011-02-06 10:54 ` [Qemu-devel] " Michael S. Tsirkin 2011-01-29 17:40 ` [PATCH 04/13] ide: use the DMA memory access interface for PCI IDE controllers Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-06 11:14 ` Michael S. Tsirkin 2011-02-06 11:14 ` [Qemu-devel] " Michael S. Tsirkin 2011-01-29 17:40 ` [PATCH 05/13] rtl8139: use the DMA memory access interface Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 06/13] eepro100: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 07/13] ac97: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 08/13] es1370: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 09/13] e1000: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` Eduard - Gabriel Munteanu [this message] 2011-01-29 17:40 ` [Qemu-devel] [PATCH 10/13] lsi53c895a: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 11/13] pcnet: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 12/13] usb-uhci: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [PATCH 13/13] usb-ohci: " Eduard - Gabriel Munteanu 2011-01-29 17:40 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-01-29 20:19 ` [PATCH 00/13] AMD IOMMU emulation patchset malc 2011-01-29 20:19 ` [Qemu-devel] " malc 2011-02-03 23:24 ` [PATCH 0/3] SeaBIOS AMD IOMMU initialization patches Eduard - Gabriel Munteanu 2011-02-03 23:24 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-03 23:24 ` [PATCH 1/3] pci: add pci_find_capability() helper Eduard - Gabriel Munteanu 2011-02-03 23:24 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-03 23:24 ` [PATCH 2/3] AMD IOMMU support Eduard - Gabriel Munteanu 2011-02-03 23:24 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-04 2:37 ` Isaku Yamahata 2011-02-04 2:37 ` [Qemu-devel] " Isaku Yamahata 2011-02-06 11:47 ` Michael S. Tsirkin 2011-02-06 11:47 ` [Qemu-devel] " Michael S. Tsirkin 2011-02-06 13:41 ` Eduard - Gabriel Munteanu 2011-02-06 13:41 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-06 15:22 ` Michael S. Tsirkin 2011-02-06 15:22 ` [Qemu-devel] " Michael S. Tsirkin 2011-02-03 23:24 ` [PATCH 3/3] Clarify address space layout Eduard - Gabriel Munteanu 2011-02-03 23:24 ` [Qemu-devel] " Eduard - Gabriel Munteanu 2011-02-05 13:07 ` [PATCH 00/13] AMD IOMMU emulation patchset (reworked cc/to) Blue Swirl 2011-02-05 13:07 ` [Qemu-devel] " Blue Swirl
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=3db2d29c9087b87218e8818e3214a929f19a0fc2.1296321798.git.eduard.munteanu@linux360.ro \ --to=eduard.munteanu@linux360.ro \ --cc=anthony@codemonkey.ws \ --cc=av1474@comtv.ru \ --cc=avi@redhat.com \ --cc=blauwirbel@gmail.com \ --cc=joro@8bytes.org \ --cc=kvm@vger.kernel.org \ --cc=paul@codesourcery.com \ --cc=qemu-devel@nongnu.org \ --cc=yamahata@valinux.co.jp \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.