From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <shemming@brocade.com>
Subject: [dpdk-dev] [PATCH 3/5] xen: add phys-addr command line argument
Date: Sun, 15 Feb 2015 10:24:47 -0500 [thread overview]
Message-ID: <1424013889-2226-3-git-send-email-shemming@brocade.com> (raw)
In-Reply-To: <1424013889-2226-1-git-send-email-shemming@brocade.com>
Allow overriding default Xen DOM0 behavior to
use physical addresses insted of mfn
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v2 -- no changes
lib/librte_eal/common/eal_common_options.c | 5 +++++
lib/librte_eal/common/eal_internal_cfg.h | 1 +
lib/librte_eal/common/eal_options.h | 2 ++
lib/librte_eal/common/include/rte_memory.h | 3 +++
lib/librte_eal/linuxapp/eal/eal_memory.c | 5 +++++
lib/librte_mempool/rte_dom0_mempool.c | 10 ++++++++--
6 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 67e02dc..1742364 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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 */
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index e2ecb0d..41b4169 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -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
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index e476f8d..8aee959 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -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"
diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
index ab6c1ff..c3b8a98 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -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.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 4afda2a..a759ac9 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -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
/**
diff --git a/lib/librte_mempool/rte_dom0_mempool.c b/lib/librte_mempool/rte_dom0_mempool.c
index 9ec68fb..ab35826 100644
--- a/lib/librte_mempool/rte_dom0_mempool.c
+++ b/lib/librte_mempool/rte_dom0_mempool.c
@@ -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;
+ }
}
}
--
2.1.4
next prev parent reply other threads:[~2015-02-15 15:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-15 15:24 [dpdk-dev] [PATCH 1/5] xen: allow choosing dom0 support at runtime Stephen Hemminger
2015-02-15 15:24 ` [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0 Stephen Hemminger
2015-03-10 7:08 ` Liu, Jijiang
2015-02-15 15:24 ` Stephen Hemminger [this message]
2015-02-26 7:55 ` [dpdk-dev] [PATCH 3/5] xen: add phys-addr command line argument Liu, Jijiang
2015-02-26 16:09 ` Stephen Hemminger
2015-02-15 15:24 ` [dpdk-dev] [PATCH 4/5] xen: add uio driver Stephen Hemminger
2016-03-22 9:55 ` [dpdk-dev] [PATCH v3 0/3] xen: netfront poll mode driver Jan Blunck
2016-03-22 9:55 ` [dpdk-dev] [PATCH v3 1/3] xen: Add UIO kernel driver Jan Blunck
2016-03-22 10:42 ` Thomas Monjalon
2016-03-22 11:04 ` Jan Blunck
2016-03-22 11:27 ` Thomas Monjalon
2016-03-22 14:39 ` Jan Blunck
2016-03-22 9:55 ` [dpdk-dev] [PATCH v3 2/3] xen: Add netfront poll mode driver Jan Blunck
2016-03-22 10:07 ` David Marchand
2016-03-22 10:42 ` Jan Blunck
2016-03-22 9:55 ` [dpdk-dev] [PATCH v3 3/3] xen: Add documentation Jan Blunck
2016-04-20 14:18 ` [dpdk-dev] [PATCH v3 0/3] xen: netfront poll mode driver Bruce Richardson
2016-05-03 9:38 ` Xie, Huawei
2017-02-05 14:44 ` Thomas Monjalon
2017-02-06 14:27 ` Konrad Rzeszutek Wilk
2015-02-15 15:24 ` [dpdk-dev] [PATCH 5/5] xen: net-front " Stephen Hemminger
2015-07-09 0:10 ` [dpdk-dev] [PATCH 1/5] xen: allow choosing dom0 support at runtime Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424013889-2226-3-git-send-email-shemming@brocade.com \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=shemming@brocade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).