x86/resctrl: Simplify rftype flag definitions
authorBabu Moger <babu.moger@amd.com>
Tue, 3 Oct 2023 23:54:22 +0000 (18:54 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 17 Oct 2023 09:51:16 +0000 (11:51 +0200)
The rftype flags are bitmaps used for adding files under the resctrl
filesystem. Some of these bitmap defines have one extra level of
indirection which is not necessary.

Drop the RF_* defines and simplify the macros.

  [ bp: Massage commit message. ]

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-3-babu.moger@amd.com
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/rdtgroup.c

index c47ef2f13e8e55ef74f55ece3a9a11fe50d46701..0ad970c5c8679957a2f36383f2e61624122fb0bf 100644 (file)
@@ -243,12 +243,9 @@ struct rdtgroup {
  */
 #define RFTYPE_INFO                    BIT(0)
 #define RFTYPE_BASE                    BIT(1)
-#define RF_CTRLSHIFT                   4
-#define RF_MONSHIFT                    5
-#define RF_TOPSHIFT                    6
-#define RFTYPE_CTRL                    BIT(RF_CTRLSHIFT)
-#define RFTYPE_MON                     BIT(RF_MONSHIFT)
-#define RFTYPE_TOP                     BIT(RF_TOPSHIFT)
+#define RFTYPE_CTRL                    BIT(4)
+#define RFTYPE_MON                     BIT(5)
+#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)
index fe239691628ac6fd421d85087c5a9cd3e9f4aa8e..09141f1f0b9634a2284b7977c1299cb36165f7c5 100644 (file)
@@ -3260,7 +3260,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
                goto out_destroy;
        }
 
-       files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype);
+       if (rtype == RDTCTRL_GROUP)
+               files = RFTYPE_BASE | RFTYPE_CTRL;
+       else
+               files = RFTYPE_BASE | RFTYPE_MON;
+
        ret = rdtgroup_add_files(kn, files);
        if (ret) {
                rdt_last_cmd_puts("kernfs fill error\n");