From: Intel Date: Wed, 18 Sep 2013 10:00:00 +0000 (+0200) Subject: eal: increase I/O privilege X-Git-Tag: spdx-start~11135 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7bd128eae21fd0583a6c3302ea80070fbe503d60;p=dpdk.git eal: increase I/O privilege Set I/O privilege to the highest level (3). It is needed for virtio. Signed-off-by: Intel --- diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 421a91bfc1..cdd88a525c 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -83,6 +83,9 @@ struct rte_config { /** Primary or secondary configuration */ enum rte_proc_type_t process_type; + /** A set of general status flags */ + unsigned flags; + /** * Pointer to memory configuration, which may be shared across multiple * Intel DPDK instances @@ -90,6 +93,9 @@ struct rte_config { struct rte_mem_config *mem_config; } __attribute__((__packed__)); +/* Flag definitions for rte_config flags */ +#define EAL_FLG_HIGH_IOPL 1 /**< indicates high IO privilage in a linux env */ + /** * Get the global configuration structure. * diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index f1d3a55cf4..cf522a66c5 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -97,6 +98,8 @@ #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10) +#define HIGHEST_RPL 3 + #define BITS_PER_HEX 4 #define GET_BLACKLIST_FIELD(in, fd, lim, dlm) \ @@ -833,6 +836,15 @@ rte_eal_mcfg_complete(void) rte_config.mem_config->magic = RTE_MAGIC; } +/* + * Request iopl priviledge for all RPL, returns 0 on success + */ +static int +rte_eal_iopl_init(void) +{ + return iopl(HIGHEST_RPL); +} + /* Launch threads, called at application init(). */ int rte_eal_init(int argc, char **argv) @@ -879,6 +891,9 @@ rte_eal_init(int argc, char **argv) rte_srand(rte_rdtsc()); rte_config_init(); + + if (rte_eal_iopl_init() == 0) + rte_config.flags |= EAL_FLG_HIGH_IOPL; if (rte_eal_cpu_init() < 0) rte_panic("Cannot detect lcores\n");