Commit 0f497526 authored by Juerg Haefliger's avatar Juerg Haefliger Committed by Stefan Bader

Revert "UBUNTU: SAUCE: rfi-flush: Support more than one flush type at once"

This reverts commit 313e806c.

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1756121

The functionality of this commit is provided by the following upstream
patch series:
  * powerpc/64s: Allow control of RFI flush via debugfs
  * powerpc/64s: Wire up cpu_show_meltdown()
  * powerpc/powernv: Check device-tree for RFI flush settings
  * powerpc/pseries: Query hypervisor for RFI flush settings
  * powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti
  * powerpc/64s: Add support for RFI flush of L1-D cache
  * powerpc/64s: Convert slb_miss_common to use RFI_TO_USER/KERNEL
  * powerpc/64: Convert the syscall exit path to use RFI_TO_USER/KERNEL
  * powerpc/64: Convert fast_exception_return to use RFI_TO_USER/KERNEL
  * powerpc/64s: Simple RFI macro conversions
  * powerpc/64: Add macros for annotating the destination of rfid/hrfid
  * powerpc/pseries: Add H_GET_CPU_CHARACTERISTICS flags & wrapper
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 7a9767dc
...@@ -833,7 +833,7 @@ static int __init disable_hardlockup_detector(void) ...@@ -833,7 +833,7 @@ static int __init disable_hardlockup_detector(void)
early_initcall(disable_hardlockup_detector); early_initcall(disable_hardlockup_detector);
#endif #endif
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
static enum l1d_flush_type enabled_flush_types; static enum l1d_flush_type l1d_flush_type;
static void *l1d_flush_fallback_area; static void *l1d_flush_fallback_area;
bool rfi_flush; bool rfi_flush;
...@@ -851,7 +851,7 @@ void rfi_flush_enable(bool enable) ...@@ -851,7 +851,7 @@ void rfi_flush_enable(bool enable)
return; return;
if (enable) { if (enable) {
do_rfi_flush_fixups(enabled_flush_types); do_rfi_flush_fixups(l1d_flush_type);
on_each_cpu(do_nothing, NULL, 1); on_each_cpu(do_nothing, NULL, 1);
} else } else
do_rfi_flush_fixups(L1D_FLUSH_NONE); do_rfi_flush_fixups(L1D_FLUSH_NONE);
...@@ -859,9 +859,9 @@ void rfi_flush_enable(bool enable) ...@@ -859,9 +859,9 @@ void rfi_flush_enable(bool enable)
rfi_flush = enable; rfi_flush = enable;
} }
void __init setup_rfi_flush(enum l1d_flush_type types, bool enable) void __init setup_rfi_flush(enum l1d_flush_type type, bool enable)
{ {
if (types & L1D_FLUSH_FALLBACK) { if (type == L1D_FLUSH_FALLBACK) {
int cpu; int cpu;
u64 l1d_size = ppc64_caches.dsize; u64 l1d_size = ppc64_caches.dsize;
u64 limit = min(safe_stack_limit(), ppc64_rma_size); u64 limit = min(safe_stack_limit(), ppc64_rma_size);
...@@ -893,15 +893,12 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable) ...@@ -893,15 +893,12 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
paca[cpu].l1d_flush_congruence = c; paca[cpu].l1d_flush_congruence = c;
paca[cpu].l1d_flush_sets = c / 128; paca[cpu].l1d_flush_sets = c / 128;
} }
} } else if (type == L1D_FLUSH_ORI)
if (types & L1D_FLUSH_ORI)
pr_info("rfi-fixups: Using ori type flush\n"); pr_info("rfi-fixups: Using ori type flush\n");
else if (type == L1D_FLUSH_MTTRIG)
if (types & L1D_FLUSH_MTTRIG)
pr_info("rfi-fixups: Using mttrig type flush\n"); pr_info("rfi-fixups: Using mttrig type flush\n");
enabled_flush_types = types; l1d_flush_type = type;
rfi_flush_enable(enable); rfi_flush_enable(enable);
} }
#endif /* CONFIG_PPC_BOOK3S_64 */ #endif /* CONFIG_PPC_BOOK3S_64 */
...@@ -116,34 +116,34 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end) ...@@ -116,34 +116,34 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
void do_rfi_flush_fixups(enum l1d_flush_type types) void do_rfi_flush_fixups(enum l1d_flush_type types)
{ {
unsigned int instrs[2], *dest;
long *start, *end; long *start, *end;
unsigned int instr, *dest;
int i; int i;
switch (type) {
case L1D_FLUSH_FALLBACK:
instr = 0x48000008; /* b .+8 to fallback flush */
break;
case L1D_FLUSH_ORI:
instr = 0x63de0000; /* ori 30,30,0 */
break;
case L1D_FLUSH_MTTRIG:
instr = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */
break;
default:
instr = 0x60000000; /* nop */
break;
}
start = PTRRELOC(&__start___rfi_flush_fixup), start = PTRRELOC(&__start___rfi_flush_fixup),
end = PTRRELOC(&__stop___rfi_flush_fixup); end = PTRRELOC(&__stop___rfi_flush_fixup);
instrs[0] = 0x60000000; /* nop */
instrs[1] = 0x60000000; /* nop */
if (types & L1D_FLUSH_FALLBACK)
/* b .+8 to fallback flush */
instrs[1] = 0x48000008;
i = 0;
if (types & L1D_FLUSH_ORI)
instrs[i++] = 0x63de0000; /* ori 30,30,0 */
if (types & L1D_FLUSH_MTTRIG)
instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */
for (i = 0; start < end; start++, i++) { for (i = 0; start < end; start++, i++) {
dest = (void *)start + *start; dest = (void *)start + *start;
pr_devel("patching dest %lx\n", (unsigned long)dest); pr_devel("patching dest %lx\n", (unsigned long)dest);
patch_instruction(dest, 0x60000000);
patch_instruction(dest, instrs[0]); patch_instruction(dest + 1, instr);
patch_instruction(dest + 1, instrs[1]);
} }
printk(KERN_DEBUG "rfi-fixups: patched %d locations\n", i); printk(KERN_DEBUG "rfi-fixups: patched %d locations\n", i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment