Skip to content

Commit

Permalink
eal: increase I/O privilege
Browse files Browse the repository at this point in the history
Set I/O privilege to the highest level (3).
It is needed for virtio.

Signed-off-by: Intel
  • Loading branch information
Intel authored and Thomas Monjalon committed Oct 9, 2013
1 parent 4c17330 commit 7bd128e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/librte_eal/common/include/rte_eal.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ 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
*/
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.
*
Expand Down
15 changes: 15 additions & 0 deletions lib/librte_eal/linuxapp/eal/eal.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <errno.h>
#include <sys/mman.h>
#include <sys/queue.h>
#include <sys/io.h>
#include <sys/user.h>
#include <linux/binfmts.h>

Expand Down Expand Up @@ -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) \
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 7bd128e

Please sign in to comment.