Commit ab527f9e authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Zheng Zengkai
Browse files

arm64/mpam: Clean up header files and rearrange declarations



hulk inclusion
category: feature
feature: ARM MPAM support
bugzilla: 48265
CVE: NA

--------------------------------

Rearrange helpers' declaration place for resctrlfs and clean up
header files included, this make code more clear.

Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent e0077ba5
Loading
Loading
Loading
Loading
+6 −38
Original line number Diff line number Diff line
@@ -115,9 +115,6 @@
DECLARE_STATIC_KEY_FALSE(resctrl_enable_key);
DECLARE_STATIC_KEY_FALSE(resctrl_mon_enable_key);

extern bool rdt_alloc_capable;
extern bool rdt_mon_capable;

extern int max_name_width, max_data_width;

enum resctrl_conf_type {
@@ -207,11 +204,6 @@ struct resctrl_schema {
	struct resctrl_resource     *res;
};


/* rdtgroup.flags */
#define	RDT_DELETED		BIT(0)
#define	RDT_CTRLMON		BIT(1)

/**
 * struct rdt_domain - group of cpus sharing an RDT resource
 * @list:	all instances of this resource
@@ -250,35 +242,13 @@ struct rdt_domain {

#define RESCTRL_SHOW_DOM_MAX_NUM 8

extern struct mutex resctrl_group_mutex;

extern struct resctrl_resource resctrl_resources_all[];

int __init resctrl_group_init(void);

void rdt_last_cmd_clear(void);
void rdt_last_cmd_puts(const char *s);
void rdt_last_cmd_printf(const char *fmt, ...);

int alloc_rmid(void);
void free_rmid(u32 rmid);
int resctrl_group_mondata_show(struct seq_file *m, void *arg);
void rmdir_mondata_subdir_allrdtgrp(struct resctrl_resource *r,
				    unsigned int dom_id);

int closid_init(void);
int closid_alloc(void);
void closid_free(int closid);

int cdp_enable(int level, int data_type, int code_type);
void resctrl_resource_reset(void);
void release_rdtgroupfs_options(void);
int parse_rdtgroupfs_options(char *data);

static inline int __resctrl_group_show_options(struct seq_file *seq)
{
	return 0;
}

void post_resctrl_mount(void);

@@ -354,6 +324,12 @@ union mon_data_bits {
	} u;
};

ssize_t resctrl_group_schemata_write(struct kernfs_open_file *of,
				char *buf, size_t nbytes, loff_t off);

int resctrl_group_schemata_show(struct kernfs_open_file *of,
				struct seq_file *s, void *v);

struct rdt_domain *mpam_find_domain(struct resctrl_resource *r, int id,
		struct list_head **pos);

@@ -365,14 +341,6 @@ int resctrl_group_ctrlmon_show(struct kernfs_open_file *of,

int resctrl_group_alloc_mon(struct rdtgroup *grp);

void mon_init(void);
int alloc_mon(void);
void free_mon(u32 mon);

int resctrl_mkdir_ctrlmon_mondata(struct kernfs_node *parent_kn,
				  struct rdtgroup *prgrp,
				  struct kernfs_node **dest_kn);

u16 mpam_resctrl_max_mon_num(void);

#endif /* _ASM_ARM64_MPAM_H */
+35 −5
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
#define _ASM_ARM64_RESCTRL_H

#include <asm/mpam_sched.h>
#include <asm/mpam.h>

#define resctrl_group rdtgroup
#define resctrl_alloc_capable rdt_alloc_capable
@@ -79,6 +78,9 @@ int schemata_list_init(void);

void schemata_list_destroy(void);

int alloc_rmid(void);
void free_rmid(u32 rmid);

static inline int alloc_mon_id(void)
{

@@ -90,7 +92,11 @@ static inline void free_mon_id(u32 id)
	free_rmid(id);
}

int closid_init(void);
int closid_alloc(void);
void closid_free(int closid);
void pmg_init(void);

static inline int resctrl_id_init(void)
{
	int ret;
@@ -120,11 +126,26 @@ void update_closid_rmid(const struct cpumask *cpu_mask, struct resctrl_group *r)
int __resctrl_group_move_task(struct task_struct *tsk,
				struct resctrl_group *rdtgrp);

ssize_t resctrl_group_schemata_write(struct kernfs_open_file *of,
				char *buf, size_t nbytes, loff_t off);
extern bool rdt_alloc_capable;
extern bool rdt_mon_capable;

/* rdtgroup.flags */
#define	RDT_DELETED		BIT(0)
#define	RDT_CTRLMON		BIT(1)

void rdt_last_cmd_clear(void);
void rdt_last_cmd_puts(const char *s);
void rdt_last_cmd_printf(const char *fmt, ...);

extern struct mutex resctrl_group_mutex;

void release_rdtgroupfs_options(void);
int parse_rdtgroupfs_options(char *data);

int resctrl_group_schemata_show(struct kernfs_open_file *of,
				struct seq_file *s, void *v);
int alloc_mon(void);
void free_mon(u32 mon);

void resctrl_resource_reset(void);

#define release_resctrl_group_fs_options release_rdtgroupfs_options
#define parse_resctrl_group_fs_options parse_rdtgroupfs_options
@@ -141,6 +162,15 @@ mongroup_create_dir(struct kernfs_node *parent_kn, struct resctrl_group *prgrp,

int resctrl_group_init_alloc(struct rdtgroup *rdtgrp);

static inline int __resctrl_group_show_options(struct seq_file *seq)
{
	return 0;
}

int resctrl_mkdir_ctrlmon_mondata(struct kernfs_node *parent_kn,
				  struct rdtgroup *prgrp,
				  struct kernfs_node **dest_kn);

struct resctrl_resource *
mpam_resctrl_get_resource(enum resctrl_resource_level level);

+0 −4
Original line number Diff line number Diff line
@@ -29,11 +29,8 @@
#include <linux/kernfs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/resctrlfs.h>

#include <asm/mpam.h>
#include <asm/mpam_resource.h>
#include <asm/resctrl.h>
#include "mpam_internal.h"

/* schemata content list */
@@ -701,7 +698,6 @@ int mkdir_mondata_all(struct kernfs_node *parent_kn,
		r = s->res;

		if (r->mon_enabled) {
			/* HHA does not support monitor by pmg */
			struct raw_resctrl_resource *rr;

			rr = r->res;
+1 −1
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@
#include <linux/cacheinfo.h>
#include <linux/arm_mpam.h>
#include <asm/mpam_resource.h>
#include <asm/mpam.h>

#include "mpam_device.h"
#include "mpam_internal.h"

/*
 * During discovery this lock protects writers to class, components and devices.
+0 −1
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@
#include <linux/cpumask.h>
#include <linux/types.h>
#include <linux/arm_mpam.h>
#include "mpam_internal.h"

struct mpam_config;

Loading