#include <linux/highmem.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/mlx5/driver.h>
#include <linux/xarray.h>
#include "mlx5_core.h"
#include "lib/eq.h"
#include "lib/tout.h"
enum { … };
struct mlx5_pages_req { … };
struct fw_page { … };
enum { … };
static u32 get_function(u16 func_id, bool ec_function)
{ … }
static u16 func_id_to_type(struct mlx5_core_dev *dev, u16 func_id, bool ec_function)
{ … }
static u32 mlx5_get_ec_function(u32 function)
{ … }
static u32 mlx5_get_func_id(u32 function)
{ … }
static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
{ … }
static int insert_page(struct mlx5_core_dev *dev, u64 addr, struct page *page, u32 function)
{ … }
static struct fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr,
u32 function)
{ … }
static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id,
s32 *npages, int boot)
{ … }
static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function)
{ … }
#define MLX5_U64_4K_PAGE_MASK …
static void free_fwp(struct mlx5_core_dev *dev, struct fw_page *fwp,
bool in_free_list)
{ … }
static void free_4k(struct mlx5_core_dev *dev, u64 addr, u32 function)
{ … }
static int alloc_system_page(struct mlx5_core_dev *dev, u32 function)
{ … }
static void page_notify_fail(struct mlx5_core_dev *dev, u16 func_id,
bool ec_function)
{ … }
static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
int event, bool ec_function)
{ … }
static void release_all_pages(struct mlx5_core_dev *dev, u16 func_id,
bool ec_function)
{ … }
static u32 fwp_fill_manage_pages_out(struct fw_page *fwp, u32 *out, u32 index,
u32 npages)
{ … }
static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
u32 *in, int in_size, u32 *out, int out_size)
{ … }
static int reclaim_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
int *nclaimed, bool event, bool ec_function)
{ … }
static void pages_work_handler(struct work_struct *work)
{ … }
enum { … };
static int req_pages_handler(struct notifier_block *nb,
unsigned long type, void *data)
{ … }
int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot)
{ … }
enum { … };
static int optimal_reclaimed_pages(void)
{ … }
static int mlx5_reclaim_root_pages(struct mlx5_core_dev *dev,
struct rb_root *root, u32 function)
{ … }
int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev)
{ … }
int mlx5_pagealloc_init(struct mlx5_core_dev *dev)
{ … }
void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev)
{ … }
void mlx5_pagealloc_start(struct mlx5_core_dev *dev)
{ … }
void mlx5_pagealloc_stop(struct mlx5_core_dev *dev)
{ … }
int mlx5_wait_for_pages(struct mlx5_core_dev *dev, int *pages)
{ … }