Discussion:
[vbox-dev] DMA transaction
Ray Yang
2014-09-03 06:40:09 UTC
Permalink
Hi,

I am trying to implement a pci device to support data transfer between
host/guest via DMA but now am a bit lost on how to start a DMA
transaction.

Basically, I follow the sample of FDC in VBox source code tree to call
PDMDevHlpDMARegister(..., callback_host, ...) to register a callback on
the host. Then on the guest Windows side, I call
WdfDmaTransactionInitialize to initialize the DMA transaction and call
WdfDmaTransactionExecute to start the execution. However, the
callback_host routine is never called by VBox. I set the breakpoints on
FDC's dma routine but it is never triggered either.

So, is there anything else I need to do?

Thanks.

-Ray
Klaus Espenlaub
2014-09-03 08:43:42 UTC
Permalink
Ray,
Post by Ray Yang
Hi,
I am trying to implement a pci device to support data transfer between
host/guest via DMA but now am a bit lost on how to start a DMA
transaction.
Basically, I follow the sample of FDC in VBox source code tree to call
PDMDevHlpDMARegister(..., callback_host, ...) to register a callback on
the host.
A PCI device using the extremely legacy, super low speed ISA DMA
controller? Sounds extremely unlikely. PCI devices don't need the help
of any ISA rubbish, they simply trigger the "memory accesses"
themselves. Good examples are the AHCI controller implementation or the
various network cards. They get only some basic information about the
memory area to use, and from this memory area they get the transfer
descriptors etc etc.
Post by Ray Yang
Then on the guest Windows side, I call
WdfDmaTransactionInitialize to initialize the DMA transaction and call
WdfDmaTransactionExecute to start the execution. However, the
callback_host routine is never called by VBox. I set the breakpoints on
FDC's dma routine but it is never triggered either.
What you confirmed this way is that there are no floppy controller DMA
transfers happening, not that the callbacks are unused.
Post by Ray Yang
So, is there anything else I need to do?
You need to do something completely different :)

Klaus
Post by Ray Yang
Thanks.
-Ray
Ray Yang
2014-09-04 06:16:07 UTC
Permalink
I didn't think DMA is slow :)

I initially followed DevE1000.cpp to build my PCI device. But when it came
to the data transfer part, the complexity of E1K code really made me
headache then thought DMA could be an option for me.

Anyway, I re-read E1K code and found PDMDevHlpPhysRead is used for reading
the content from the guest memory. Hope this is the right clue I should
follow.

Also, I use the following code to register both IO port and MMIO but vbox
only shows one of the resources (anyone is registered later) in the guest
OS although PDMDevHlpPCIIORegionRegister always returns success. Since
other vbox built-in devices have both resources shown in the guest OS, I
would think this is something wrong with my own code. Is there any clue
about this?

rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 8, PCI_ADDRESS_SPACE_IO,
pciMyIOPortRegionMap);
rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, MY_MAP_IOSPACE_LENGTH,
PCI_ADDRESS_SPACE_MEM, pciMyIOPortRegionMap);


Thanks.

-Ray
Post by Klaus Espenlaub
Ray,
Post by Ray Yang
Hi,
I am trying to implement a pci device to support data transfer between
host/guest via DMA but now am a bit lost on how to start a DMA
transaction.
Basically, I follow the sample of FDC in VBox source code tree to call
PDMDevHlpDMARegister(..., callback_host, ...) to register a callback on
the host.
A PCI device using the extremely legacy, super low speed ISA DMA
controller? Sounds extremely unlikely. PCI devices don't need the help
of any ISA rubbish, they simply trigger the "memory accesses"
themselves. Good examples are the AHCI controller implementation or the
various network cards. They get only some basic information about the
memory area to use, and from this memory area they get the transfer
descriptors etc etc.
Post by Ray Yang
Then on the guest Windows side, I call
WdfDmaTransactionInitialize to initialize the DMA transaction and call
WdfDmaTransactionExecute to start the execution. However, the
callback_host routine is never called by VBox. I set the breakpoints on
FDC's dma routine but it is never triggered either.
What you confirmed this way is that there are no floppy controller DMA
transfers happening, not that the callbacks are unused.
Post by Ray Yang
So, is there anything else I need to do?
You need to do something completely different :)
Klaus
Post by Ray Yang
Thanks.
-Ray
_______________________________________________
vbox-dev mailing list
vbox-dev at virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev
Loading...