[dpdk-dev] [PATCH] i40e: support xen domain0

Helin Zhang helin.zhang at intel.com
Thu Aug 14 08:12:53 CEST 2014

i40e was failing to run in XEN domain0, as the physical
memory for adminq DMA should be allocated and translated
in a different way for XEN domain0. So
rte_memzone_reserve_bounded() should be used for DMA
memory allocation, and rte_mem_phy2mch() should be used
for DMA memory address translation to support running
i40e PMD in XEN domain0.

Signed-off-by: Helin Zhang <helin.zhang at intel.com>
 lib/librte_pmd_i40e/i40e_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 9ed31b5..7a823a0 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1515,14 +1515,23 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
 	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
+	mz = rte_memzone_reserve_bounded(z_name, size, 0, 0, alignment,
+							RTE_PGSIZE_2M);
 	mz = rte_memzone_reserve_aligned(z_name, size, 0, 0, alignment);
 	if (!mz)
 		return I40E_ERR_NO_MEMORY;
 	mem->id = id;
 	mem->size = size;
 	mem->va = mz->addr;
+	mem->pa = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr);
 	mem->pa = mz->phys_addr;
 	return I40E_SUCCESS;

More information about the dev mailing list