From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E1968B108 for ; Tue, 3 Jun 2014 14:59:37 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 03 Jun 2014 05:54:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,965,1392192000"; d="scan'208";a="550838584" Received: from shilc102.sh.intel.com ([10.239.39.44]) by orsmga002.jf.intel.com with ESMTP; 03 Jun 2014 05:59:46 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shilc102.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s53Cxfdw020239; Tue, 3 Jun 2014 20:59:43 +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 s53CxcKN006592; Tue, 3 Jun 2014 20:59:40 +0800 Received: (from jijiangl@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s53CxZhU006588; Tue, 3 Jun 2014 20:59:35 +0800 From: Jijiang Liu To: dev@dpdk.org Date: Tue, 3 Jun 2014 20:59:33 +0800 Message-Id: <1401800373-6483-1-git-send-email-jijiang.liu@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH]xen:support Dom0 driver for Linux kernel 3.13.0 and later 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: Tue, 03 Jun 2014 12:59:38 -0000 Since Linux kernel version 3.13.0, the xen_create/destroy_contiguous_region() API has been changed, and the first parameter is physical address in the API. Signed-off-by: Jijiang Liu Acked-by: Huawei Xie Tested-by: Heng Ding --- lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c | 24 ++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c index c254300..a91c7ec 100644 --- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c +++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -262,6 +263,7 @@ dom0_memory_free(uint32_t rsv_size) for (i = 0; i < dom0_dev.num_bigblock * 2; i += 2) { vstart = rsv_mm_info[i].vir_addr; if (vstart) { + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) if (rsv_mm_info[i].exchange_flag) xen_destroy_contiguous_region(vstart, DOM0_CONTIG_NUM_ORDER); @@ -269,6 +271,17 @@ dom0_memory_free(uint32_t rsv_size) xen_destroy_contiguous_region(vstart + DOM0_MEMBLOCK_SIZE, DOM0_CONTIG_NUM_ORDER); + #else + if (rsv_mm_info[i].exchange_flag) + xen_destroy_contiguous_region(rsv_mm_info[i].pfn + * PAGE_SIZE, + DOM0_CONTIG_NUM_ORDER); + if (rsv_mm_info[i + 1].exchange_flag) + xen_destroy_contiguous_region(rsv_mm_info[i].pfn + * PAGE_SIZE + DOM0_MEMBLOCK_SIZE, + DOM0_CONTIG_NUM_ORDER); + #endif + size = DOM0_MEMBLOCK_SIZE * 2; vaddr = vstart; while (size > 0) { @@ -381,6 +394,10 @@ dom0_memory_reserve(uint32_t rsv_size) uint64_t pfn, vstart, vaddr; uint32_t i, num_block, size, allocated_size = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) + dma_addr_t dma_handle; +#endif + /* 2M as memory block */ num_block = rsv_size / SIZE_PER_BLOCK; @@ -452,8 +469,13 @@ dom0_memory_reserve(uint32_t rsv_size) * This API is used to exchage MFN for getting a block of * contiguous physical addresses, its maximum size is 2M. */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) if (xen_create_contiguous_region(rsv_mm_info[i].vir_addr, - DOM0_CONTIG_NUM_ORDER, 0) == 0) { + DOM0_CONTIG_NUM_ORDER, 0) == 0) { + #else + if (xen_create_contiguous_region(rsv_mm_info[i].pfn * PAGE_SIZE, + DOM0_CONTIG_NUM_ORDER, 0, &dma_handle) == 0) { + #endif rsv_mm_info[i].exchange_flag = 1; rsv_mm_info[i].mfn = pfn_to_mfn(rsv_mm_info[i].pfn); -- 1.7.7.6