Skip to contentSkip to conversation

vhost: fix physical address mapping

PATCH New [email protected] 1 participant 1 message Dec 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost: fix physical address mapping

From: Xuan Ding <[email protected]>

When choosing IOVA as PA mode, IOVA is likely to be discontinuous, which requires page by page mapping for DMA devices. To be consistent, this patch implements page by page mapping instead of mapping at the region granularity for both IOVA as VA and PA mode.

Fixes 7c61fa08b716 ("vhost: enable IOMMU for async vhost")
---
 lib/vhost/vhost.h      |   1 +
 lib/vhost/vhost_user.c | 116 ++++++++++++++++++++---------------------
 2 files changed, 57 insertions(+), 60 deletions(-)
lib/vhost/vhost.h +1 -0
index 7085e0885c..d246538ca5 100644
@@ -355,6 +355,7 @@ struct vring_packed_desc_event {
 struct guest_page {
 	uint64_t guest_phys_addr;
 	uint64_t host_phys_addr;
+	uint64_t host_user_addr;
 	uint64_t size;
 };
 
lib/vhost/vhost_user.c +56 -60

187 lines not on this page · raw message

Signature · 1 line
2.25.1