x86/resctrl: Rename rftype flags for consistency
authorBabu Moger <babu.moger@amd.com>
Tue, 17 Oct 2023 00:23:02 +0000 (19:23 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 17 Oct 2023 09:59:14 +0000 (11:59 +0200)
resctrl associates rftype flags with its files so that files can be chosen
based on the resource, whether it is info or base, and if it is control
or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes.

Change the prefix to RFTYPE_ for all these flags to be consistent.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Peter Newman <peternewman@google.com>
Reviewed-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
Link: https://lore.kernel.org/r/20231017002308.134480-4-babu.moger@amd.com
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/rdtgroup.c

index 0ad970c5c8679957a2f36383f2e61624122fb0bf..ba4611111212f4a20d94f77959d6f7d02e183aee 100644 (file)
@@ -248,10 +248,10 @@ struct rdtgroup {
 #define RFTYPE_TOP                     BIT(6)
 #define RFTYPE_RES_CACHE               BIT(8)
 #define RFTYPE_RES_MB                  BIT(9)
-#define RF_CTRL_INFO                   (RFTYPE_INFO | RFTYPE_CTRL)
-#define RF_MON_INFO                    (RFTYPE_INFO | RFTYPE_MON)
-#define RF_TOP_INFO                    (RFTYPE_INFO | RFTYPE_TOP)
-#define RF_CTRL_BASE                   (RFTYPE_BASE | RFTYPE_CTRL)
+#define RFTYPE_CTRL_INFO               (RFTYPE_INFO | RFTYPE_CTRL)
+#define RFTYPE_MON_INFO                        (RFTYPE_INFO | RFTYPE_MON)
+#define RFTYPE_TOP_INFO                        (RFTYPE_INFO | RFTYPE_TOP)
+#define RFTYPE_CTRL_BASE               (RFTYPE_BASE | RFTYPE_CTRL)
 
 /* List of all resource groups */
 extern struct list_head rdt_all_groups;
@@ -267,7 +267,7 @@ void __exit rdtgroup_exit(void);
  * @mode:      Access mode
  * @kf_ops:    File operations
  * @flags:     File specific RFTYPE_FLAGS_* flags
- * @fflags:    File specific RF_* or RFTYPE_* flags
+ * @fflags:    File specific RFTYPE_* flags
  * @seq_show:  Show content of the file
  * @write:     Write to the file
  */
index 09141f1f0b9634a2284b7977c1299cb36165f7c5..125d12d8f4b9cef239724f68e32bee91a9df828b 100644 (file)
@@ -1716,77 +1716,77 @@ static struct rftype res_common_files[] = {
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_last_cmd_status_show,
-               .fflags         = RF_TOP_INFO,
+               .fflags         = RFTYPE_TOP_INFO,
        },
        {
                .name           = "num_closids",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_num_closids_show,
-               .fflags         = RF_CTRL_INFO,
+               .fflags         = RFTYPE_CTRL_INFO,
        },
        {
                .name           = "mon_features",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_mon_features_show,
-               .fflags         = RF_MON_INFO,
+               .fflags         = RFTYPE_MON_INFO,
        },
        {
                .name           = "num_rmids",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_num_rmids_show,
-               .fflags         = RF_MON_INFO,
+               .fflags         = RFTYPE_MON_INFO,
        },
        {
                .name           = "cbm_mask",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_default_ctrl_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_CACHE,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
        },
        {
                .name           = "min_cbm_bits",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_min_cbm_bits_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_CACHE,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
        },
        {
                .name           = "shareable_bits",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_shareable_bits_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_CACHE,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
        },
        {
                .name           = "bit_usage",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_bit_usage_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_CACHE,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
        },
        {
                .name           = "min_bandwidth",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_min_bw_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_MB,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
        },
        {
                .name           = "bandwidth_gran",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_bw_gran_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_MB,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
        },
        {
                .name           = "delay_linear",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_delay_linear_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_MB,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
        },
        /*
         * Platform specific which (if any) capabilities are provided by
@@ -1805,7 +1805,7 @@ static struct rftype res_common_files[] = {
                .kf_ops         = &rdtgroup_kf_single_ops,
                .write          = max_threshold_occ_write,
                .seq_show       = max_threshold_occ_show,
-               .fflags         = RF_MON_INFO | RFTYPE_RES_CACHE,
+               .fflags         = RFTYPE_MON_INFO | RFTYPE_RES_CACHE,
        },
        {
                .name           = "mbm_total_bytes_config",
@@ -1852,7 +1852,7 @@ static struct rftype res_common_files[] = {
                .kf_ops         = &rdtgroup_kf_single_ops,
                .write          = rdtgroup_schemata_write,
                .seq_show       = rdtgroup_schemata_show,
-               .fflags         = RF_CTRL_BASE,
+               .fflags         = RFTYPE_CTRL_BASE,
        },
        {
                .name           = "mode",
@@ -1860,21 +1860,21 @@ static struct rftype res_common_files[] = {
                .kf_ops         = &rdtgroup_kf_single_ops,
                .write          = rdtgroup_mode_write,
                .seq_show       = rdtgroup_mode_show,
-               .fflags         = RF_CTRL_BASE,
+               .fflags         = RFTYPE_CTRL_BASE,
        },
        {
                .name           = "size",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdtgroup_size_show,
-               .fflags         = RF_CTRL_BASE,
+               .fflags         = RFTYPE_CTRL_BASE,
        },
        {
                .name           = "sparse_masks",
                .mode           = 0444,
                .kf_ops         = &rdtgroup_kf_single_ops,
                .seq_show       = rdt_has_sparse_bitmasks_show,
-               .fflags         = RF_CTRL_INFO | RFTYPE_RES_CACHE,
+               .fflags         = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
        },
 
 };
@@ -1931,7 +1931,7 @@ void __init thread_throttle_mode_init(void)
        if (!rft)
                return;
 
-       rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB;
+       rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB;
 }
 
 void __init mbm_config_rftype_init(const char *config)
@@ -1940,7 +1940,7 @@ void __init mbm_config_rftype_init(const char *config)
 
        rft = rdtgroup_get_rftype_by_name(config);
        if (rft)
-               rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE;
+               rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE;
 }
 
 /**
@@ -2075,21 +2075,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
        if (IS_ERR(kn_info))
                return PTR_ERR(kn_info);
 
-       ret = rdtgroup_add_files(kn_info, RF_TOP_INFO);
+       ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO);
        if (ret)
                goto out_destroy;
 
        /* loop over enabled controls, these are all alloc_capable */
        list_for_each_entry(s, &resctrl_schema_all, list) {
                r = s->res;
-               fflags =  r->fflags | RF_CTRL_INFO;
+               fflags = r->fflags | RFTYPE_CTRL_INFO;
                ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags);
                if (ret)
                        goto out_destroy;
        }
 
        for_each_mon_capable_rdt_resource(r) {
-               fflags =  r->fflags | RF_MON_INFO;
+               fflags = r->fflags | RFTYPE_MON_INFO;
                sprintf(name, "%s_MON", r->name);
                ret = rdtgroup_mkdir_info_resdir(r, name, fflags);
                if (ret)
@@ -3727,7 +3727,7 @@ static int __init rdtgroup_setup_root(void)
 
        list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups);
 
-       ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE);
+       ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE);
        if (ret) {
                kernfs_destroy_root(rdt_root);
                goto out;