@@ -83,6 +83,7 @@ eal_long_options[] = {
{OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM},
{OPT_BASE_VIRTADDR, 1, 0, OPT_BASE_VIRTADDR_NUM},
{OPT_XEN_DOM0, 0, 0, OPT_XEN_DOM0_NUM},
+ {OPT_XEN_PHYS_ADDR, 0, 0, OPT_XEN_PHYS_ADDR_NUM},
{OPT_CREATE_UIO_DEV, 1, NULL, OPT_CREATE_UIO_DEV_NUM},
{OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM},
{0, 0, 0, 0}
@@ -491,6 +492,10 @@ eal_parse_common_option(int opt, const char *optarg,
}
conf->log_level = log;
break;
+
+ case OPT_XEN_PHYS_ADDR_NUM:
+ conf->xen_phys_addr_support = 1;
+ break;
}
/* don't know what to do, leave this to caller */
@@ -65,6 +65,7 @@ struct internal_config {
volatile unsigned force_nrank; /**< force number of ranks */
volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */
volatile unsigned xen_dom0_support; /**< support app running on Xen Dom0*/
+ volatile unsigned xen_phys_addr_support; /**< support phys addr */
volatile unsigned no_pci; /**< true to disable PCI */
volatile unsigned no_hpet; /**< true to disable HPET */
volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping
@@ -73,6 +73,8 @@ enum {
OPT_BASE_VIRTADDR_NUM,
#define OPT_XEN_DOM0 "xen-dom0"
OPT_XEN_DOM0_NUM,
+#define OPT_XEN_PHYS_ADDR "xen-phys-addr"
+ OPT_XEN_PHYS_ADDR_NUM,
#define OPT_CREATE_UIO_DEV "create-uio-dev"
OPT_CREATE_UIO_DEV_NUM,
#define OPT_VFIO_INTR "vfio-intr"
@@ -180,6 +180,9 @@ unsigned rte_memory_get_nrank(void);
/**< Internal use only - should DOM0 memory mapping be used */
extern int is_xen_dom0_supported(void);
+/**< Internal use only - should DOM0 use physical addresses insted of mfn */
+extern int is_xen_phys_addr_supported(void);
+
/**
* Return the physical address of elt, which is an element of the pool mp.
*
@@ -103,6 +103,11 @@ int is_xen_dom0_supported(void)
{
return internal_config.xen_dom0_support;
}
+
+int is_xen_phys_addr_supported(void)
+{
+ return internal_config.xen_phys_addr_support;
+}
#endif
/**
@@ -74,8 +74,14 @@ get_phys_map(void *va, phys_addr_t pa[], uint32_t pg_num,
virt_addr =(uintptr_t) mcfg->memseg[memseg_id].addr;
for (i = 0; i != pg_num; i++) {
- mfn_id = ((uintptr_t)va + i * pg_sz - virt_addr) / RTE_PGSIZE_2M;
- pa[i] = mcfg->memseg[memseg_id].mfn[mfn_id] * page_size;
+ if (!is_xen_phys_addr_supported()) {
+ mfn_id = ((uintptr_t)va + i * pg_sz -
+ virt_addr) / RTE_PGSIZE_2M;
+ pa[i] = mcfg->memseg[memseg_id].mfn[mfn_id] * page_size;
+ } else {
+ pa[i] = mcfg->memseg[memseg_id].phys_addr + i * pg_sz +
+ (uintptr_t)va - virt_addr;
+ }
}
}