Skip to content

Commit 97fa21f

Browse files
committed
x86/resctrl: Move MSR defines into msr-index.h
msr-index.h should contain all MSRs for easier grepping for MSR numbers when dealing with unchecked MSR access warnings, for example. Move the resctrl ones. Prefix IA32_PQR_ASSOC with "MSR_" while at it. No functional changes. Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2d4daa5 commit 97fa21f

File tree

5 files changed

+21
-24
lines changed

5 files changed

+21
-24
lines changed

arch/x86/include/asm/msr-index.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44

55
#include <linux/bits.h>
66

7-
/*
8-
* CPU model specific register (MSR) numbers.
9-
*
10-
* Do not add new entries to this file unless the definitions are shared
11-
* between multiple compilation units.
12-
*/
7+
/* CPU model specific register (MSR) numbers. */
138

149
/* x86-64 specific MSRs */
1510
#define MSR_EFER 0xc0000080 /* extended feature register */
@@ -1050,6 +1045,20 @@
10501045
#define VMX_BASIC_MEM_TYPE_WB 6LLU
10511046
#define VMX_BASIC_INOUT 0x0040000000000000LLU
10521047

1048+
/* Resctrl MSRs: */
1049+
/* - Intel: */
1050+
#define MSR_IA32_L3_QOS_CFG 0xc81
1051+
#define MSR_IA32_L2_QOS_CFG 0xc82
1052+
#define MSR_IA32_QM_EVTSEL 0xc8d
1053+
#define MSR_IA32_QM_CTR 0xc8e
1054+
#define MSR_IA32_PQR_ASSOC 0xc8f
1055+
#define MSR_IA32_L3_CBM_BASE 0xc90
1056+
#define MSR_IA32_L2_CBM_BASE 0xd10
1057+
#define MSR_IA32_MBA_THRTL_BASE 0xd50
1058+
1059+
/* - AMD: */
1060+
#define MSR_IA32_MBA_BW_BASE 0xc0000200
1061+
10531062
/* MSR_IA32_VMX_MISC bits */
10541063
#define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14)
10551064
#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)

arch/x86/include/asm/resctrl.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
#include <linux/sched.h>
88
#include <linux/jump_label.h>
99

10-
#define IA32_PQR_ASSOC 0x0c8f
11-
1210
/**
1311
* struct resctrl_pqr_state - State cache for the PQR MSR
1412
* @cur_rmid: The cached Resource Monitoring ID
1513
* @cur_closid: The cached Class Of Service ID
1614
* @default_rmid: The user assigned Resource Monitoring ID
1715
* @default_closid: The user assigned cached Class Of Service ID
1816
*
19-
* The upper 32 bits of IA32_PQR_ASSOC contain closid and the
20-
* lower 10 bits rmid. The update to IA32_PQR_ASSOC always
17+
* The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the
18+
* lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always
2119
* contains both parts, so we need to cache them. This also
2220
* stores the user configured per cpu CLOSID and RMID.
2321
*
@@ -77,7 +75,7 @@ static void __resctrl_sched_in(void)
7775
if (closid != state->cur_closid || rmid != state->cur_rmid) {
7876
state->cur_closid = closid;
7977
state->cur_rmid = rmid;
80-
wrmsr(IA32_PQR_ASSOC, rmid, closid);
78+
wrmsr(MSR_IA32_PQR_ASSOC, rmid, closid);
8179
}
8280
}
8381

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static void clear_closid_rmid(int cpu)
575575
state->default_rmid = 0;
576576
state->cur_closid = 0;
577577
state->cur_rmid = 0;
578-
wrmsr(IA32_PQR_ASSOC, 0, 0);
578+
wrmsr(MSR_IA32_PQR_ASSOC, 0, 0);
579579
}
580580

581581
static int resctrl_online_cpu(unsigned int cpu)

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
#include <linux/fs_context.h>
99
#include <linux/jump_label.h>
1010

11-
#define MSR_IA32_L3_QOS_CFG 0xc81
12-
#define MSR_IA32_L2_QOS_CFG 0xc82
13-
#define MSR_IA32_L3_CBM_BASE 0xc90
14-
#define MSR_IA32_L2_CBM_BASE 0xd10
15-
#define MSR_IA32_MBA_THRTL_BASE 0xd50
16-
#define MSR_IA32_MBA_BW_BASE 0xc0000200
17-
18-
#define MSR_IA32_QM_CTR 0x0c8e
19-
#define MSR_IA32_QM_EVTSEL 0x0c8d
20-
2111
#define L3_QOS_CDP_ENABLE 0x01ULL
2212

2313
#define L2_QOS_CDP_ENABLE 0x01ULL

arch/x86/kernel/cpu/resctrl/pseudo_lock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
477477
* pseudo-locked followed by reading of kernel memory to load it
478478
* into the cache.
479479
*/
480-
__wrmsr(IA32_PQR_ASSOC, rmid_p, rdtgrp->closid);
480+
__wrmsr(MSR_IA32_PQR_ASSOC, rmid_p, rdtgrp->closid);
481481
/*
482482
* Cache was flushed earlier. Now access kernel memory to read it
483483
* into cache region associated with just activated plr->closid.
@@ -513,7 +513,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
513513
* Critical section end: restore closid with capacity bitmask that
514514
* does not overlap with pseudo-locked region.
515515
*/
516-
__wrmsr(IA32_PQR_ASSOC, rmid_p, closid_p);
516+
__wrmsr(MSR_IA32_PQR_ASSOC, rmid_p, closid_p);
517517

518518
/* Re-enable the hardware prefetcher(s) */
519519
wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr);

0 commit comments

Comments
 (0)