From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 28F62231C for ; Thu, 14 Aug 2014 08:09:58 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 13 Aug 2014 23:13:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="372215340" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 13 Aug 2014 23:09:36 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s7E6CvBK004078; Thu, 14 Aug 2014 14:12:57 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s7E6CsLE007164; Thu, 14 Aug 2014 14:12:56 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7E6CsjI007160; Thu, 14 Aug 2014 14:12:54 +0800 From: Helin Zhang To: dev@dpdk.org Date: Thu, 14 Aug 2014 14:12:53 +0800 Message-Id: <1407996773-7055-1-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] i40e: support xen domain0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 06:09:58 -0000 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 --- 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, id++; snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id); +#ifdef RTE_LIBRTE_XEN_DOM0 + mz = rte_memzone_reserve_bounded(z_name, size, 0, 0, alignment, + RTE_PGSIZE_2M); +#else mz = rte_memzone_reserve_aligned(z_name, size, 0, 0, alignment); +#endif if (!mz) return I40E_ERR_NO_MEMORY; mem->id = id; mem->size = size; mem->va = mz->addr; +#ifdef RTE_LIBRTE_XEN_DOM0 + mem->pa = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr); +#else mem->pa = mz->phys_addr; +#endif return I40E_SUCCESS; } -- 1.8.1.4