]>
Commit | Line | Data |
---|---|---|
45d80ddf SL |
1 | From 9ebac65e5fbd657e77979e2416b19cb21ddcf804 Mon Sep 17 00:00:00 2001 |
2 | From: Michael Ellerman <mpe@ellerman.id.au> | |
3 | Date: Thu, 11 Apr 2019 21:46:16 +1000 | |
4 | Subject: powerpc/pseries: Query hypervisor for count cache flush settings | |
5 | ||
6 | commit ba72dc171954b782a79d25e0f4b3ed91090c3b1e upstream. | |
7 | ||
8 | Use the existing hypercall to determine the appropriate settings for | |
9 | the count cache flush, and then call the generic powerpc code to set | |
10 | it up based on the security feature flags. | |
11 | ||
12 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
13 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
14 | --- | |
15 | arch/powerpc/include/asm/hvcall.h | 2 ++ | |
16 | arch/powerpc/platforms/pseries/setup.c | 7 +++++++ | |
17 | 2 files changed, 9 insertions(+) | |
18 | ||
19 | diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h | |
20 | index 9d978102bf0d..9587d301db55 100644 | |
21 | --- a/arch/powerpc/include/asm/hvcall.h | |
22 | +++ b/arch/powerpc/include/asm/hvcall.h | |
23 | @@ -316,10 +316,12 @@ | |
24 | #define H_CPU_CHAR_BRANCH_HINTS_HONORED (1ull << 58) // IBM bit 5 | |
25 | #define H_CPU_CHAR_THREAD_RECONFIG_CTRL (1ull << 57) // IBM bit 6 | |
26 | #define H_CPU_CHAR_COUNT_CACHE_DISABLED (1ull << 56) // IBM bit 7 | |
27 | +#define H_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) // IBM bit 9 | |
28 | ||
29 | #define H_CPU_BEHAV_FAVOUR_SECURITY (1ull << 63) // IBM bit 0 | |
30 | #define H_CPU_BEHAV_L1D_FLUSH_PR (1ull << 62) // IBM bit 1 | |
31 | #define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ull << 61) // IBM bit 2 | |
32 | +#define H_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) // IBM bit 5 | |
33 | ||
34 | #ifndef __ASSEMBLY__ | |
35 | #include <linux/types.h> | |
36 | diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c | |
37 | index 91ade7755823..adb09ab87f7c 100644 | |
38 | --- a/arch/powerpc/platforms/pseries/setup.c | |
39 | +++ b/arch/powerpc/platforms/pseries/setup.c | |
40 | @@ -475,6 +475,12 @@ static void init_cpu_char_feature_flags(struct h_cpu_char_result *result) | |
41 | if (result->character & H_CPU_CHAR_COUNT_CACHE_DISABLED) | |
42 | security_ftr_set(SEC_FTR_COUNT_CACHE_DISABLED); | |
43 | ||
44 | + if (result->character & H_CPU_CHAR_BCCTR_FLUSH_ASSIST) | |
45 | + security_ftr_set(SEC_FTR_BCCTR_FLUSH_ASSIST); | |
46 | + | |
47 | + if (result->behaviour & H_CPU_BEHAV_FLUSH_COUNT_CACHE) | |
48 | + security_ftr_set(SEC_FTR_FLUSH_COUNT_CACHE); | |
49 | + | |
50 | /* | |
51 | * The features below are enabled by default, so we instead look to see | |
52 | * if firmware has *disabled* them, and clear them if so. | |
53 | @@ -525,6 +531,7 @@ void pseries_setup_rfi_flush(void) | |
54 | security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR); | |
55 | ||
56 | setup_rfi_flush(types, enable); | |
57 | + setup_count_cache_flush(); | |
58 | } | |
59 | ||
60 | static void __init pSeries_setup_arch(void) | |
61 | -- | |
62 | 2.19.1 | |
63 |