Commit 1b9eb83f authored by Vikram Narayanan's avatar Vikram Narayanan

Merge branch 'dev_ixgbe' into lcd_v4.8

parents 1bcaff4b 01cc13f2
......@@ -621,6 +621,11 @@ include arch/$(SRCARCH)/Makefile
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
# force no-pie for distro compilers that enable pie by default
KBUILD_CFLAGS += $(call cc-option, -fno-pie)
KBUILD_CFLAGS += $(call cc-option, -no-pie)
KBUILD_AFLAGS += $(call cc-option, -fno-pie)
KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
......
......@@ -48,7 +48,7 @@ config X86
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if SMP
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
select ARCH_WANT_FRAME_POINTERS
#select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_IPC_PARSE_VERSION if X86_32
select BUILDTIME_EXTABLE_SORT
select CLKEVT_I8253
......
......@@ -5632,7 +5632,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
unsigned int rss, fdir;
u32 fwsm;
int i;
#define NUM_HW_QUEUES 4
/* PCI config space info */
hw->vendor_id = pdev->vendor;
......@@ -5642,12 +5642,14 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
hw->subsystem_device_id = pdev->subsystem_device;
/* Set common capability flags and settings */
rss = min_t(int, ixgbe_max_rss_indices(adapter), num_online_cpus());
//rss = min_t(int, ixgbe_max_rss_indices(adapter), num_online_cpus());
rss = min_t(int, ixgbe_max_rss_indices(adapter), NUM_HW_QUEUES);
adapter->ring_feature[RING_F_RSS].limit = rss;
adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
adapter->max_q_vectors = MAX_Q_VECTORS_82599;
adapter->atr_sample_rate = 20;
fdir = min_t(int, IXGBE_MAX_FDIR_INDICES, num_online_cpus());
//fdir = min_t(int, IXGBE_MAX_FDIR_INDICES, num_online_cpus());
fdir = min_t(int, IXGBE_MAX_FDIR_INDICES, NUM_HW_QUEUES);
adapter->ring_feature[RING_F_FDIR].limit = fdir;
adapter->fdir_pballoc = IXGBE_FDIR_PBALLOC_64K;
#ifdef CONFIG_IXGBE_DCA
......
/* Author: Anton Burtsev
* Copyright: University of Utah */
#ifndef __LCD_CAP_H__
#define __LCD_CAP_H__
#include <linux/types.h>
#include <linux/spinlock.h>
#include "cap-cache.h"
#include <uapi/linux/lcd-cap.h>
#define LCD_MAX_CAPS 32
#define CAP_IDENTIFIER_BITS 2
#define TABLE_IDENTIFIER_BITS 1
// should always be 2^CAP_IDENTIFIER_BITS
#define MAX_CAP_SLOTS 4
// should always be 2^TABLE_IDENTIFIER_BITS
#define MAX_TABLE_ID_SLOTS 2
// should always be 2^CAP_IDENTIFIER_BITS + 2^TABLE_IDENTIFIER_BITS
#define MAX_SLOTS_PER_TABLE 6
struct cdt_root_node;
struct cnode;
struct cspace;
extern struct cdt_root_node * get_cdt_root(void);
extern void free_cdt_root(struct cdt_root_node *cdt_node);
enum lcd_cap_type
{
LCD_CAP_TYPE_INVALID,
LCD_CAP_TYPE_FREE,
LCD_CAP_TYPE_SYNC_EP,
LCD_CAP_TYPE_CNODE
};
enum allocation_state {
ALLOCATION_INVALID,
ALLOCATION_VALID,
ALLOCATION_MARKED_FOR_DELETE,
ALLOCATION_REMOVED
};
struct cdt_root_node {
spinlock_t lock;
struct cnode *cnode;
unsigned long node_count;
enum allocation_state state;
};
struct cnode {
enum lcd_cap_type type;
void *object;
spinlock_t lock;
struct cdt_root_node *cdt_root;
struct cnode *parent, *child, *prev, *next;
capability_t cap;
struct cspace *cspace;
};
struct cnode_table {
struct cnode cnode[MAX_SLOTS_PER_TABLE];
uint8_t table_level;
};
struct cspace {
spinlock_t lock;
enum allocation_state state;
struct cnode_table *cnode_table;
struct kmem_cache *cnode_table_cache;
struct cap_cache cap_cache;
};
bool _get_level_bits(int table_level, capability_t cap, capability_t *levelId);
bool _lcd_delete_node (struct cnode *cnode);
int _lcd_delete_table(struct cspace *cspace, struct cnode_table *table);
int lcd_cap_init_cspace(struct cspace *cspace);
struct cnode *lcd_cnode_lookup(struct cspace *cspace, capability_t cap, bool alloc);
int lcd_cap_insert(struct cspace *cspace, capability_t cap,
void *object, enum lcd_cap_type type);
void lcd_cap_delete(struct cspace *cspace, capability_t cap);
int lcd_cap_grant(struct cspace *cspacesrc, capability_t capsrc, struct cspace *cspacedst, capability_t capdst);
int lcd_cap_revoke(struct cspace *cspace, capability_t cap);
int lcd_cap_destroy_cspace(struct cspace *cspace);
#endif
#ifndef HOST_IPC_H
#define HOST_IPC_H
#include <uapi/linux/lcd-ipc.h>
#include <lcd/cap.h>
struct sync_ipc {
struct list_head senders;
struct list_head receivers;
spinlock_t lock;
};
/* Per thread kernel stack unified on a single page. */
union utcb_union {
struct utcb utcb;
char kstack[PAGE_SIZE];
};
struct sync_ipc * alloc_sync_ipc(void);
int lcd_ipc_init(void);
int lcd_ipc_exit(void);
#endif
/*
* Author: Charles Jacobsen <charlesj@cs.utah.edu>
* Copyright: University of Utah
*/
#ifndef LCD_LCD_H
#define LCD_LCD_H
#define LCD_NUM_REGS 8
#define LCD_NUM_OUT_CAP_REGS 8
#define LCD_NUM_IN_CAP_REGS LCD_NUM_OUT_CAP_REGS
#define LCD_NUM_BOOT_CPTRS 8
struct cspace;
typedef u64 cptr_t;
struct lcd {
/*
* Not accessible in lcd
*/
struct task_struct *parent;
u64 badge;
struct cspace *cspace;
struct list_head senders;
struct list_head receivers;
int making_call;
/*
* Accessible in lcd
*/
struct {
cptr_t boot_cptrs[LCD_NUM_BOOT_CPTRS];
u64 regs[LCD_NUM_REGS];
cptr_t out_cap_regs[LCD_NUM_OUT_CAP_REGS];
cptr_t in_cap_regs[LCD_NUM_IN_CAP_REGS];
u8 max_valid_reg_idx;
u8 max_valid_out_cap_reg_idx;
u8 max_valid_in_cap_reg_idx;
cptr_t call_endpoint_cap;
cptr_t reply_endpoint_cap;
} utcb;
};
#endif /* LCD_LCD_H */
......@@ -15,12 +15,6 @@
#include <linux/types.h>
#include <linux/bitops.h>
/*
* deal with unrepresentable constant logarithms
*/
extern __attribute__((const, noreturn))
int ____ilog2_NaN(void);
/*
* non-constant log of base 2 calculators
* - the arch may override these in asm/bitops.h if they can be implemented
......@@ -85,7 +79,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
#define ilog2(n) \
( \
__builtin_constant_p(n) ? ( \
(n) < 1 ? ____ilog2_NaN() : \
(n) < 2 ? 0 : \
(n) & (1ULL << 63) ? 63 : \
(n) & (1ULL << 62) ? 62 : \
(n) & (1ULL << 61) ? 61 : \
......@@ -148,9 +142,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
(n) & (1ULL << 4) ? 4 : \
(n) & (1ULL << 3) ? 3 : \
(n) & (1ULL << 2) ? 2 : \
(n) & (1ULL << 1) ? 1 : \
(n) & (1ULL << 0) ? 0 : \
____ilog2_NaN() \
1 \
) : \
(sizeof(n) <= 4) ? \
__ilog2_u32(n) : \
......
......@@ -74,7 +74,8 @@ enum {
NETIF_F_BUSY_POLL_BIT, /* Busy poll */
NETIF_F_HW_TC_BIT, /* Offload TC infrastructure */
NETIF_F_PRIV_DATA_POOL_BIT, /* private pool for skb->data */
NETIF_F_CHAIN_SKB_BIT,
/*
* Add your fresh new feature above and remember to update
* netdev_features_strings[] in net/core/ethtool.c and maybe
......@@ -136,6 +137,8 @@ enum {
#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
#define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL)
#define NETIF_F_HW_TC __NETIF_F(HW_TC)
#define NETIF_F_PRIV_DATA_POOL __NETIF_F(PRIV_DATA_POOL)
#define NETIF_F_CHAIN_SKB __NETIF_F(CHAIN_SKB)
#define for_each_netdev_feature(mask_addr, bit) \
for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
......
......@@ -2032,6 +2032,11 @@ static inline bool netdev_uses_dsa(struct net_device *dev)
return false;
}
struct _net_device_container {
struct net_device net_device;
u64 cptr1, cptr2;
} __packed;
/**
* netdev_priv - access network device private data
* @dev: network device
......@@ -2040,7 +2045,7 @@ static inline bool netdev_uses_dsa(struct net_device *dev)
*/
static inline void *netdev_priv(const struct net_device *dev)
{
return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
return (char *)dev + ALIGN(sizeof(struct _net_device_container), NETDEV_ALIGN);
}
/* Set the sysfs physical device reference for the network logical device
......@@ -3665,6 +3670,12 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
unsigned char name_assign_type,
void (*setup)(struct net_device *),
unsigned int txqs, unsigned int rxqs);
struct net_device *alloc_netdev_mqs_lcd(int sizeof_priv, const char *name,
unsigned char name_assign_type,
void (*setup)(struct net_device *),
unsigned int txqs, unsigned int rxqs, u64 their_ref_cptr);
#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
......
#ifndef PRIV_MEMPOOL_H
#define PRIV_MEMPOOL_H
#define MTU 1470
#define HEADERS 42
#define SKB_LCD_MEMBERS_SZ 48
#define SKB_SHARED_INFO (sizeof(struct skb_shared_info))
#define DATA_ALIGNED_SZ (SKB_DATA_ALIGN(MTU + HEADERS + SKB_LCD_MEMBERS_SZ))
#define SKB_DATA_SIZE (DATA_ALIGNED_SZ + SKB_DATA_ALIGN(SKB_SHARED_INFO))
#define SKB_CONTAINER_SIZE 128
typedef enum {
/* for skb->data */
SKB_DATA_POOL = 0,
/* for skb->page_frag */
SKB_FRAG_POOL,
/* for skb_container */
SKB_CONTAINER_POOL,
POOL_MAX,
} pool_type_t;
struct object {
struct object *next;
};
struct bundle {
struct object *list;
struct bundle *next;
};
struct atom {
struct bundle *head;
long version;
} __attribute__((aligned(16)));
typedef struct {
struct object __percpu **head;
struct object __percpu **marker;
#ifdef PBUF
char __percpu **buf;
char __percpu **bufend;
#endif
int __percpu *cached;
unsigned int obj_size;
unsigned int total_pages;
unsigned int num_objs_percpu;
unsigned int total_objs;
unsigned int num_cpus;
void *pool;
void *gpool;
struct atom stack;
unsigned int pool_order;
spinlock_t pool_spin_lock;
bool dump_once;
} priv_pool_t;
void *priv_alloc(pool_type_t type);
void priv_free(void *p, pool_type_t type);
//priv_pool_t *priv_pool_init(pool_type_t type, unsigned int num_objs, unsigned int obj_size);
priv_pool_t *priv_pool_init(pool_type_t type, void *pool_base,
size_t pool_size,
unsigned int obj_size);
void priv_pool_destroy(priv_pool_t *p);
#endif /* PRIV_MEMPOOL_H */
......@@ -222,6 +222,9 @@
/* Maximum value in skb->csum_level */
#define SKB_MAX_CSUM_LEVEL 3
/* for skb->data allocation */
#define SKB_DATA_PRIV_POOL (1 << 31)
#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
#define SKB_WITH_OVERHEAD(X) \
((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
......@@ -682,7 +685,8 @@ struct sk_buff {
fclone:2,
peeked:1,
head_frag:1,
xmit_more:1;
xmit_more:1,
private:1;
/* one bit hole */
kmemcheck_bitfield_end(flags1);
......@@ -730,6 +734,7 @@ struct sk_buff {
__u8 ipvs_property:1;
__u8 inner_protocol_type:1;
__u8 remcsum_offload:1;
__u8 chain_skb:1;
/* 3 or 5 bit hole */
#ifdef CONFIG_NET_SCHED
......
......@@ -898,7 +898,4 @@ asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
size_t len, unsigned int flags);
asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
asmlinkage long sys_init_lcd(void __user *umod, unsigned long len,
const char __user *uargs);
#endif
......@@ -246,7 +246,6 @@ header-y += hw_breakpoint.h
header-y += l2tp.h
header-y += libc-compat.h
header-y += lirc.h
header-y += lcd.h
header-y += limits.h
header-y += llc.h
header-y += loop.h
......@@ -472,4 +471,3 @@ header-y += zorro.h
header-y += zorro_ids.h
header-y += userfaultfd.h
header-y += hw_breakpoint.h
header-y += lcd-domains.h
#ifndef LCD_DOMAINS_H
#define LCD_DOMAINS_H
/*
* lcd-domains.h - public header for LCD support
*/
#include <linux/types.h>
/*
* IOCTL interface
*/
/* FIXME: this must be reserved in miscdevice.h */
#define LCD_MINOR 234
struct lcd_pv_kernel_config {
char *file_name;
unsigned int file_name_length;
__u64 length;
} __attribute__((packed));
struct lcd_blob_info {
unsigned char *blob;
unsigned int blob_order;
} __attribute__((packed));
#define LCD_LOAD_PV_KERNEL _IOR(LCD_MINOR, 0x01, struct lcd_pv_kernel_config)
#define LCD_RUN_BLOB _IOR(LCD_MINOR, 0x02, struct lcd_blob_info)
#endif /* LCD_DOMAINS_H */
......@@ -3805,165 +3805,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
return err;
}
#ifdef CONFIG_LCD
static int load_lcd(struct load_info *info, const char __user *uargs,
int flags)
{
struct lcd * lcd;
struct module *mod;
long err;
err = module_sig_check(info);
if (err)
goto free_copy;
err = elf_header_check(info);
if (err)
goto free_copy;
/* Figure out module layout, and allocate all the memory. */
mod = layout_and_allocate(info, flags, for_lcd);
if (IS_ERR(mod)) {
err = PTR_ERR(mod);
goto free_copy;
}
/* Reserve our place in the list. */
err = add_unformed_module(mod);
if (err)
goto free_module;
#ifdef CONFIG_MODULE_SIG
mod->sig_ok = info->sig_ok;
if (!mod->sig_ok) {
printk_once(KERN_NOTICE
"%s: module verification failed: signature and/or"
" required key missing - tainting kernel\n",
mod->name);
add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_STILL_OK);
}
#endif
/* To avoid stressing percpu allocator, do this once we're unique. */
err = alloc_module_percpu(mod, info);
if (err)
goto unlink_mod;
/* Now module is in final location, initialize linked lists, etc. */
err = module_unload_init(mod);
if (err)
goto unlink_mod;
/* Now we've got everything in the final locations, we can
* find optional sections. */
find_module_sections(mod, info);
err = check_module_license_and_versions(mod);
if (err)
goto free_unload;
/* Set up MODINFO_ATTR fields */
setup_modinfo(mod, info);
/* Fix up syms, so that st_value is a pointer to location. */
err = simplify_symbols(mod, info);
if (err < 0)
goto free_modinfo;
err = apply_relocations(mod, info);
if (err < 0)
goto free_modinfo;
err = post_relocation(mod, info, for_lcd);
if (err < 0)
goto free_modinfo;
flush_module_icache(mod);
/* Now copy in args */
mod->args = strndup_user(uargs, ~0UL >> 1);
if (IS_ERR(mod->args)) {
err = PTR_ERR(mod->args);
goto free_arch_cleanup;
}
dynamic_debug_setup(info->debug, info->num_debug);
/* Finally it's fully formed, ready to start executing. */
err = complete_formation(mod, info);
if (err)
goto ddebug_cleanup;
/* Module is ready to execute: parsing args may do that. */
err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
-32768, 32767, &ddebug_dyndbg_module_param_cb);
if (err < 0)
goto bug_cleanup;
/* Link in to syfs. */
err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp);
if (err < 0)
goto bug_cleanup;
/* Get rid of temporary copy. */
free_copy(info);
/* Done! */
trace_module_load(mod);
return do_init_module(mod, for_lcd);
bug_cleanup:
/* module_bug_cleanup needs module_mutex protection */
mutex_lock(&module_mutex);
module_bug_cleanup(mod);
mutex_unlock(&module_mutex);
ddebug_cleanup:
dynamic_debug_remove(info->debug);
synchronize_sched();
kfree(mod->args);
free_arch_cleanup:
module_arch_cleanup(mod);
free_modinfo:
free_modinfo(mod);
free_unload:
module_unload_free(mod);
unlink_mod:
mutex_lock(&module_mutex);
/* Unlink carefully: kallsyms could be walking list. */
list_del_rcu(&mod->list);
wake_up_all(&module_wq);
mutex_unlock(&module_mutex);
free_module:
module_deallocate(mod, info);
free_copy:
free_copy(info);
return err;
}
#endif
#ifdef CONFIG_LCD
SYSCALL_DEFINE3(init_lcd, void __user *, umod,
unsigned long, len, const char __user *, uargs)
{
int err;
struct load_info info = { };
err = may_init_module();
if (err)
return err;
pr_debug("init_module: umod=%p, len=%lu, uargs=%p\n",
umod, len, uargs);
err = copy_module_from_user(umod, len, &info);
if (err)
return err;
return load_lcd(&info, uargs, 0);
}
#endif
int do_sys_init_module(void __user *umod, unsigned long len,
const char __user *uargs, int for_lcd)
{
......
......@@ -78,7 +78,7 @@ int lcd_arch_ept_unmap_range(struct lcd_arch *lcd, gpa_t ga_start,
/**
* Simple routine combinding ept walk and get.
*/
int lcd_arch_ept_gpa_to_hpa(struct lcd_arch *lcd, gpa_t ga, hpa_t *ha_out);
int lcd_arch_ept_gpa_to_hpa(struct lcd_arch *lcd, gpa_t ga, hpa_t *ha_out, bool verbose);
/**
* Translate guest physical address to host virtual.
*/
......@@ -87,7 +87,7 @@ static inline int lcd_arch_ept_gpa_to_hva(struct lcd_arch *lcd, gpa_t gpa,
{
hpa_t hpa;
int ret;
ret = lcd_arch_ept_gpa_to_hpa(lcd, gpa, &hpa);
ret = lcd_arch_ept_gpa_to_hpa(lcd, gpa, &hpa, true);
if (ret)
return ret;
*hva_out = hpa2hva(hpa);
......
......@@ -206,6 +206,26 @@ static inline int lcd_syscall_sync_reply(void)
return lcd_syscall_no_args(LCD_SYSCALL_SYNC_REPLY);
}
static inline int lcd_syscall_assign_device(int domain, int bus, int devfn)
{
return lcd_syscall_three_args(LCD_SYSCALL_ASSIGN_DEVICE, domain, bus, devfn);
}
static inline int lcd_syscall_deassign_device(int domain, int bus, int devfn)
{
return lcd_syscall_three_args(LCD_SYSCALL_DEASSIGN_DEVICE, domain, bus, devfn);
}
static inline int lcd_syscall_iommu_map_page(gpa_t gpa, unsigned int order, bool force)
{
return lcd_syscall_three_args(LCD_SYSCALL_IOMMU_MAP_PAGE, gpa_val(gpa), order, force);
}
static inline int lcd_syscall_iommu_unmap_page(gpa_t gpa, unsigned int order)
{
return lcd_syscall_two_args(LCD_SYSCALL_IOMMU_UNMAP_PAGE, gpa_val(gpa), order);
}
static inline int lcd_syscall_create_sync_ep(cptr_t slot)
{
return lcd_syscall_one_arg(LCD_SYSCALL_CREATE_SYNC_EP, cptr_val(slot));
......
......@@ -349,7 +349,7 @@ int lcd_arch_ept_unmap_range(struct lcd_arch *lcd, gpa_t ga_start,
/**
* Simple routine combinding ept walk and get.
*/
int lcd_arch_ept_gpa_to_hpa(struct lcd_arch *lcd, gpa_t ga, hpa_t *ha_out);
int lcd_arch_ept_gpa_to_hpa(struct lcd_arch *lcd, gpa_t ga, hpa_t *ha_out, bool);
/**
* Translate guest physical address to host virtual.
*/
......@@ -358,7 +358,7 @@ static inline int lcd_arch_ept_gpa_to_hva(struct lcd_arch *lcd, gpa_t gpa,
{
hpa_t hpa;
int ret;
ret = lcd_arch_ept_gpa_to_hpa(lcd, gpa, &hpa);
ret = lcd_arch_ept_gpa_to_hpa(lcd, gpa, &hpa, true);
if (ret)
return ret;
*hva_out = hpa2hva(hpa);
......
......@@ -403,7 +403,7 @@ int lcd_arch_ept_unmap_range(struct lcd_arch *lcd, gpa_t ga_start,
return 0;
}
int lcd_arch_ept_gpa_to_hpa(struct lcd_arch *lcd, gpa_t ga, hpa_t *ha_out)
int lcd_arch_ept_gpa_to_hpa(struct lcd_arch *lcd, gpa_t ga, hpa_t *ha_out, bool verbose)
{