[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/10] ide: enable preallocated sg lists
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 04/10] ide: enable preallocated sg lists |
Date: |
Wed, 17 Nov 2010 09:21:09 +0000 |
On Wed, Nov 17, 2010 at 1:05 AM, Alexander Graf <address@hidden> wrote:
> @@ -535,12 +543,25 @@ static int dma_buf_rw(BMDMAState *bm, int is_write)
> if (bm->cur_prd_len == 0) {
> /* end of table (with a fail safe of one page) */
> if (bm->cur_prd_last ||
> - (bm->cur_addr - bm->addr) >= IDE_PAGE_SIZE)
> - return 0;
> - cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&prd, 8);
> - bm->cur_addr += 8;
> - prd.addr = le32_to_cpu(prd.addr);
> - prd.size = le32_to_cpu(prd.size);
> + (bm->cur_addr - bm->addr) >= IDE_PAGE_SIZE) {
> + s->sg.sg -= s->sg.nsg; //XXX
I don't understand why s->sg.sg needs to be modified at all. Are we stashing
the pointer away accross dma_buf_rw() invocations?
> + return 0;
> + }
> + if (s->sg_third_party) {
> + /* We've already parsed the guest RAM PRDT.
> + * This is essential for AHCI, where the PRDT is in a
> different
> + * format than in IDE BMDMA.
> + */
> + memcpy((uint8_t *)&prd, s->sg.sg, sizeof(prd));
struct {
uint32_t addr;
uint32_t size;
} prd;
typedef struct {
target_phys_addr_t base;
target_phys_addr_t len;
} ScatterGatherEntry;
sizeof(target_phys_addr_t) != sizeof(uint32_t) for 64-bit targets
prd should use a proper struct instead of redefining it inline in dma_buf_rw()
and dma_buf_prepare(). That struct could either be a ScatterGatherEntry or
something else that we assign s->sg.sg fields to individually.
Stefan
- [Qemu-devel] [PATCH 00/10] AHCI emulation support, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 10/10] ahci: spawn controller on demand, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 07/10] pci: add ich7 pci id, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 05/10] ide: add ncq identify data for ahci sata drives, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 06/10] pci: add storage class for sata, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 01/10] ide: split ide command interpretation off, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 04/10] ide: enable preallocated sg lists, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 03/10] ide: add support for ide extenders, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 09/10] ahci: add -drive support, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 02/10] ide: fix whitespace gap in ide_exec_cmd, Alexander Graf, 2010/11/16
- [Qemu-devel] [PATCH 08/10] ahci: add ahci emulation, Alexander Graf, 2010/11/16