[dpdk-stable] patch 'vfio: fix sPAPR IOMMU mapping' has been queued to stable release 18.08.1
Kevin Traynor
ktraynor at redhat.com
Fri Nov 23 11:26:09 CET 2018
Hi,
FYI, your patch has been queued to stable release 18.08.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/29/18. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.
Thanks.
Kevin Traynor
---
>From e9634e33b6908bce9add992f5406863a64d834bb Mon Sep 17 00:00:00 2001
From: Takeshi Yoshimura <tyos at jp.ibm.com>
Date: Tue, 7 Aug 2018 11:35:06 +0900
Subject: [PATCH] vfio: fix sPAPR IOMMU mapping
[ upstream commit 998c89f148ee31564ccde958056e54418c18f10c ]
Commit 73a639085938 ("vfio: allow to map other memory regions")
introduced a bug in sPAPR IOMMU mapping. The commit removed necessary
ioctl with VFIO_IOMMU_SPAPR_REGISTER_MEMORY. Also, vfio_spapr_map_walk
should call vfio_spapr_dma_do_map instead of vfio_spapr_dma_mem_map.
Fixes: 73a639085938 ("vfio: allow to map other memory regions")
Signed-off-by: Takeshi Yoshimura <tyos at jp.ibm.com>
---
lib/librte_eal/linuxapp/eal/eal_vfio.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index c68dc38e0..68e862946 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -1146,6 +1146,20 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
struct vfio_iommu_type1_dma_unmap dma_unmap;
int ret;
+ struct vfio_iommu_spapr_register_memory reg = {
+ .argsz = sizeof(reg),
+ .flags = 0
+ };
+ reg.vaddr = (uintptr_t) vaddr;
+ reg.size = len;
if (do_map != 0) {
+ ret = ioctl(vfio_container_fd,
+ VFIO_IOMMU_SPAPR_REGISTER_MEMORY, ®);
+ if (ret) {
+ RTE_LOG(ERR, EAL, " cannot register vaddr for IOMMU, "
+ "error %i (%s)\n", errno, strerror(errno));
+ return -1;
+ }
+
memset(&dma_map, 0, sizeof(dma_map));
dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map);
@@ -1164,11 +1178,4 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
} else {
- struct vfio_iommu_spapr_register_memory reg = {
- .argsz = sizeof(reg),
- .flags = 0
- };
- reg.vaddr = (uintptr_t) vaddr;
- reg.size = len;
-
ret = ioctl(vfio_container_fd,
VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY, ®);
@@ -1202,5 +1209,5 @@ vfio_spapr_map_walk(const struct rte_memseg_list *msl __rte_unused,
int *vfio_container_fd = arg;
- return vfio_spapr_dma_mem_map(*vfio_container_fd, ms->addr_64, ms->iova,
+ return vfio_spapr_dma_do_map(*vfio_container_fd, ms->addr_64, ms->iova,
ms->len, 1);
}
--
2.19.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2018-11-23 10:22:54.381170026 +0000
+++ 0005-vfio-fix-sPAPR-IOMMU-mapping.patch 2018-11-23 10:22:54.000000000 +0000
@@ -1,15 +1,16 @@
-From 998c89f148ee31564ccde958056e54418c18f10c Mon Sep 17 00:00:00 2001
+From e9634e33b6908bce9add992f5406863a64d834bb Mon Sep 17 00:00:00 2001
From: Takeshi Yoshimura <tyos at jp.ibm.com>
Date: Tue, 7 Aug 2018 11:35:06 +0900
Subject: [PATCH] vfio: fix sPAPR IOMMU mapping
+[ upstream commit 998c89f148ee31564ccde958056e54418c18f10c ]
+
Commit 73a639085938 ("vfio: allow to map other memory regions")
introduced a bug in sPAPR IOMMU mapping. The commit removed necessary
ioctl with VFIO_IOMMU_SPAPR_REGISTER_MEMORY. Also, vfio_spapr_map_walk
should call vfio_spapr_dma_do_map instead of vfio_spapr_dma_mem_map.
Fixes: 73a639085938 ("vfio: allow to map other memory regions")
-Cc: stable at dpdk.org
Signed-off-by: Takeshi Yoshimura <tyos at jp.ibm.com>
---
@@ -17,10 +18,10 @@
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
-index d7268e4ce..ebecde12c 100644
+index c68dc38e0..68e862946 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
-@@ -1155,6 +1155,20 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
+@@ -1146,6 +1146,20 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
struct vfio_iommu_type1_dma_unmap dma_unmap;
int ret;
+ struct vfio_iommu_spapr_register_memory reg = {
@@ -41,7 +42,7 @@
+
memset(&dma_map, 0, sizeof(dma_map));
dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map);
-@@ -1173,11 +1187,4 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
+@@ -1164,11 +1178,4 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
} else {
- struct vfio_iommu_spapr_register_memory reg = {
@@ -53,8 +54,8 @@
-
ret = ioctl(vfio_container_fd,
VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY, ®);
-@@ -1214,5 +1221,5 @@ vfio_spapr_map_walk(const struct rte_memseg_list *msl,
- return 0;
+@@ -1202,5 +1209,5 @@ vfio_spapr_map_walk(const struct rte_memseg_list *msl __rte_unused,
+ int *vfio_container_fd = arg;
- return vfio_spapr_dma_mem_map(*vfio_container_fd, ms->addr_64, ms->iova,
+ return vfio_spapr_dma_do_map(*vfio_container_fd, ms->addr_64, ms->iova,
More information about the stable
mailing list