question upon RtlCopyMemory inside the BalloonFill #970
-
Hello, I am trying to learn the basics by reading the code. I am newbie to windows driver programming and would like to have one question get answered.. I believe that function Thank you very much in advance for the help. Best, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @jshen28 MDL has guest physical addresses, but we must pass DMA addresses (or logical address in Windows DMA API terminology) to hypervisor. The difference between these kinds of addresses will appear if you have an IOMMU device enabled in QEMU, for example
For further information I suggest to read: |
Beta Was this translation helpful? Give feedback.
-
Hi @viktor-prutyanov , thank you very much for the detailed explanation. If I do not pass virtio-iommu or other iommu device to the qemu, then can I suggest guest physical address is equal to the DMA address? Best, |
Beta Was this translation helpful? Give feedback.
-
To pass data from guest to host virtio uses some sort of DMA SGList abstraction. When it comes to building a SG element |
Beta Was this translation helpful? Give feedback.
Hi @jshen28
MDL has guest physical addresses, but we must pass DMA addresses (or logical address in Windows DMA API terminology) to hypervisor.
The difference between these kinds of addresses will appear if you have an IOMMU device enabled in QEMU, for example
intel-iommu
, and DMA remapping enabled in Windows. IOMMU translates DMA addresses (by which devices do memory access) to physical addresses about the same as MMU translates virtual addresses to physical ones.VirtIOWdfDeviceGetPhysicalAddress
finds DMA address for a buffer obtained with DMA API inAllocateCommonBuffer
. In DMA API, forWDFCOMMONBUFFER
we can callWdfCommonBufferGetAlignedVirtualAddress
to obtain the buffer's virtual …