]>
Commit | Line | Data |
---|---|---|
1f91e7a4 GKH |
1 | From foo@baz Tue 14 May 2019 08:29:35 PM CEST |
2 | From: Thomas Gleixner <tglx@linutronix.de> | |
3 | Date: Thu, 21 Feb 2019 12:36:50 +0100 | |
4 | Subject: x86/msr-index: Cleanup bit defines | |
5 | ||
6 | From: Thomas Gleixner <tglx@linutronix.de> | |
7 | ||
8 | commit d8eabc37310a92df40d07c5a8afc53cebf996716 upstream. | |
9 | ||
10 | Greg pointed out that speculation related bit defines are using (1 << N) | |
11 | format instead of BIT(N). Aside of that (1 << N) is wrong as it should use | |
12 | 1UL at least. | |
13 | ||
14 | Clean it up. | |
15 | ||
16 | [ Josh Poimboeuf: Fix tools build ] | |
17 | ||
18 | Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
19 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
20 | Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | Reviewed-by: Borislav Petkov <bp@suse.de> | |
22 | Reviewed-by: Frederic Weisbecker <frederic@kernel.org> | |
23 | Reviewed-by: Jon Masters <jcm@redhat.com> | |
24 | Tested-by: Jon Masters <jcm@redhat.com> | |
25 | [bwh: Backported to 4.4: | |
26 | - Drop change to x86_energy_perf_policy, which doesn't use msr-index.h here | |
27 | - Drop changes to flush MSRs which we haven't defined] | |
28 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | |
29 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
30 | --- | |
31 | arch/x86/include/asm/msr-index.h | 24 +++++++++++++----------- | |
32 | tools/power/x86/turbostat/Makefile | 2 +- | |
33 | 2 files changed, 14 insertions(+), 12 deletions(-) | |
34 | ||
35 | --- a/arch/x86/include/asm/msr-index.h | |
36 | +++ b/arch/x86/include/asm/msr-index.h | |
37 | @@ -1,6 +1,8 @@ | |
38 | #ifndef _ASM_X86_MSR_INDEX_H | |
39 | #define _ASM_X86_MSR_INDEX_H | |
40 | ||
41 | +#include <linux/bits.h> | |
42 | + | |
43 | /* CPU model specific register (MSR) numbers */ | |
44 | ||
45 | /* x86-64 specific MSRs */ | |
46 | @@ -33,14 +35,14 @@ | |
47 | ||
48 | /* Intel MSRs. Some also available on other CPUs */ | |
49 | #define MSR_IA32_SPEC_CTRL 0x00000048 /* Speculation Control */ | |
50 | -#define SPEC_CTRL_IBRS (1 << 0) /* Indirect Branch Restricted Speculation */ | |
51 | +#define SPEC_CTRL_IBRS BIT(0) /* Indirect Branch Restricted Speculation */ | |
52 | #define SPEC_CTRL_STIBP_SHIFT 1 /* Single Thread Indirect Branch Predictor (STIBP) bit */ | |
53 | -#define SPEC_CTRL_STIBP (1 << SPEC_CTRL_STIBP_SHIFT) /* STIBP mask */ | |
54 | +#define SPEC_CTRL_STIBP BIT(SPEC_CTRL_STIBP_SHIFT) /* STIBP mask */ | |
55 | #define SPEC_CTRL_SSBD_SHIFT 2 /* Speculative Store Bypass Disable bit */ | |
56 | -#define SPEC_CTRL_SSBD (1 << SPEC_CTRL_SSBD_SHIFT) /* Speculative Store Bypass Disable */ | |
57 | +#define SPEC_CTRL_SSBD BIT(SPEC_CTRL_SSBD_SHIFT) /* Speculative Store Bypass Disable */ | |
58 | ||
59 | #define MSR_IA32_PRED_CMD 0x00000049 /* Prediction Command */ | |
60 | -#define PRED_CMD_IBPB (1 << 0) /* Indirect Branch Prediction Barrier */ | |
61 | +#define PRED_CMD_IBPB BIT(0) /* Indirect Branch Prediction Barrier */ | |
62 | ||
63 | #define MSR_IA32_PERFCTR0 0x000000c1 | |
64 | #define MSR_IA32_PERFCTR1 0x000000c2 | |
65 | @@ -57,13 +59,13 @@ | |
66 | #define MSR_MTRRcap 0x000000fe | |
67 | ||
68 | #define MSR_IA32_ARCH_CAPABILITIES 0x0000010a | |
69 | -#define ARCH_CAP_RDCL_NO (1 << 0) /* Not susceptible to Meltdown */ | |
70 | -#define ARCH_CAP_IBRS_ALL (1 << 1) /* Enhanced IBRS support */ | |
71 | -#define ARCH_CAP_SSB_NO (1 << 4) /* | |
72 | - * Not susceptible to Speculative Store Bypass | |
73 | - * attack, so no Speculative Store Bypass | |
74 | - * control required. | |
75 | - */ | |
76 | +#define ARCH_CAP_RDCL_NO BIT(0) /* Not susceptible to Meltdown */ | |
77 | +#define ARCH_CAP_IBRS_ALL BIT(1) /* Enhanced IBRS support */ | |
78 | +#define ARCH_CAP_SSB_NO BIT(4) /* | |
79 | + * Not susceptible to Speculative Store Bypass | |
80 | + * attack, so no Speculative Store Bypass | |
81 | + * control required. | |
82 | + */ | |
83 | ||
84 | #define MSR_IA32_BBL_CR_CTL 0x00000119 | |
85 | #define MSR_IA32_BBL_CR_CTL3 0x0000011e | |
86 | --- a/tools/power/x86/turbostat/Makefile | |
87 | +++ b/tools/power/x86/turbostat/Makefile | |
88 | @@ -8,7 +8,7 @@ ifeq ("$(origin O)", "command line") | |
89 | endif | |
90 | ||
91 | turbostat : turbostat.c | |
92 | -CFLAGS += -Wall | |
93 | +CFLAGS += -Wall -I../../../include | |
94 | CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' | |
95 | ||
96 | %: %.c |