Re: [PATCH V3 13/13] HV/Storvsc: Add Isolation VM support for storvsc driver

From
Tianyu Lan <hidden>
Date
2021-08-20 15:38:20
Also in
linux-arch, linux-iommu, linux-scsi, lkml, netdev, xen-devel
Reply to
Tianyu Lan, 2021-08-20
On 8/20/2021 11:20 PM, Tianyu Lan wrote:
quoted
The whole approach here is to do dma remapping on each individual page
of the I/O buffer.  But wouldn't it be possible to use dma_map_sg() to map
each scatterlist entry as a unit?  Each scatterlist entry describes a range of
physically contiguous memory.  After dma_map_sg(), the resulting dma
address must also refer to a physically contiguous range in the swiotlb
bounce buffer memory.   So at the top of the "for" loop over the scatterlist
entries, do dma_map_sg() if we're in an isolated VM.  Then compute the
hvpfn value based on the dma address instead of sg_page().  But everything
else is the same, and the inner loop for populating the pfn_arry is unmodified.
Furthermore, the dma_range array that you've added is not needed, since
scatterlist entries already have a dma_address field for saving the mapped
address, and dma_unmap_sg() uses that field.
I don't use dma_map_sg() here in order to avoid introducing one more loop(e,g dma_map_sg()). We already have a loop to populate cmd_request->dma_range[] and so do the dma map in the same loop.
Sorry for a typo. s/cmd_request->dma_range[]/payload->range.pfn_array[]/
Thread (64 messages) 64 messages, 6 authors, last reply 2021-08-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help