From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: 34278 CVE: NA
-------------------------------------------------
Rearrange helpers' declaration place for resctrlfs and clean up header files included, this make code more clear.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- arch/arm64/include/asm/mpam.h | 44 ++++---------------------- arch/arm64/include/asm/resctrl.h | 40 ++++++++++++++++++++--- arch/arm64/kernel/mpam/mpam_ctrlmon.c | 4 --- arch/arm64/kernel/mpam/mpam_device.c | 2 +- arch/arm64/kernel/mpam/mpam_device.h | 1 - arch/arm64/kernel/mpam/mpam_internal.h | 1 + arch/arm64/kernel/mpam/mpam_mon.c | 2 -- arch/arm64/kernel/mpam/mpam_resctrl.c | 2 -- arch/arm64/kernel/mpam/mpam_setup.c | 2 -- 9 files changed, 43 insertions(+), 55 deletions(-)
diff --git a/arch/arm64/include/asm/mpam.h b/arch/arm64/include/asm/mpam.h index 82b9887270a1..52a334cce91a 100644 --- a/arch/arm64/include/asm/mpam.h +++ b/arch/arm64/include/asm/mpam.h @@ -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 */ diff --git a/arch/arm64/include/asm/resctrl.h b/arch/arm64/include/asm/resctrl.h index 408b4a02d7c7..90b7683dd4dd 100644 --- a/arch/arm64/include/asm/resctrl.h +++ b/arch/arm64/include/asm/resctrl.h @@ -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);
diff --git a/arch/arm64/kernel/mpam/mpam_ctrlmon.c b/arch/arm64/kernel/mpam/mpam_ctrlmon.c index d1f7ffd25b69..a94a1f2c5847 100644 --- a/arch/arm64/kernel/mpam/mpam_ctrlmon.c +++ b/arch/arm64/kernel/mpam/mpam_ctrlmon.c @@ -33,11 +33,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 */ @@ -705,7 +702,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; diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index 62ca0952cadc..356362ecdc79 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -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. diff --git a/arch/arm64/kernel/mpam/mpam_device.h b/arch/arm64/kernel/mpam/mpam_device.h index 3165d6b1a270..9930ca70e0ce 100644 --- a/arch/arm64/kernel/mpam/mpam_device.h +++ b/arch/arm64/kernel/mpam/mpam_device.h @@ -6,7 +6,6 @@ #include <linux/cpumask.h> #include <linux/types.h> #include <linux/arm_mpam.h> -#include "mpam_internal.h"
struct mpam_config;
diff --git a/arch/arm64/kernel/mpam/mpam_internal.h b/arch/arm64/kernel/mpam/mpam_internal.h index 1a31d563bc41..57a08a78bb6e 100644 --- a/arch/arm64/kernel/mpam/mpam_internal.h +++ b/arch/arm64/kernel/mpam/mpam_internal.h @@ -3,6 +3,7 @@ #define _ASM_ARM64_MPAM_INTERNAL_H
#include <linux/resctrlfs.h> +#include <asm/mpam.h> #include <asm/resctrl.h>
typedef u32 mpam_features_t; diff --git a/arch/arm64/kernel/mpam/mpam_mon.c b/arch/arm64/kernel/mpam/mpam_mon.c index 297169b41ea3..bb681d1ab7ad 100644 --- a/arch/arm64/kernel/mpam/mpam_mon.c +++ b/arch/arm64/kernel/mpam/mpam_mon.c @@ -28,8 +28,6 @@
#include <linux/module.h> #include <linux/slab.h> -#include <linux/resctrlfs.h> -#include <asm/resctrl.h>
#include "mpam_internal.h"
diff --git a/arch/arm64/kernel/mpam/mpam_resctrl.c b/arch/arm64/kernel/mpam/mpam_resctrl.c index 76881ba127c9..aafe20473acf 100644 --- a/arch/arm64/kernel/mpam/mpam_resctrl.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -37,12 +37,10 @@ #include <linux/task_work.h> #include <linux/sched/signal.h> #include <linux/sched/task.h> -#include <linux/resctrlfs.h> #include <linux/arm_mpam.h>
#include <asm/mpam_sched.h> #include <asm/mpam_resource.h> -#include <asm/resctrl.h> #include <asm/io.h>
#include "mpam_device.h" diff --git a/arch/arm64/kernel/mpam/mpam_setup.c b/arch/arm64/kernel/mpam/mpam_setup.c index 4ad178c083ea..b01716392a65 100644 --- a/arch/arm64/kernel/mpam/mpam_setup.c +++ b/arch/arm64/kernel/mpam/mpam_setup.c @@ -28,8 +28,6 @@
#include <linux/slab.h> #include <linux/err.h> -#include <linux/resctrlfs.h> -#include <asm/resctrl.h>
#include "mpam_device.h" #include "mpam_internal.h"