From 70e28aa0bbb68ed458be0b922d8b58a2b4ae191d Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 21 Feb 2017 10:51:55 +0100 Subject: s390/nmi: fix order of register validation When validating register contents first validate control registers since these control the availability of features later being validated. For example the control register 0 should be validated first, before the additional floating point (AFP) registers are validated, since control register 0 contains the AFP-register control bit. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- arch/s390/kernel/nmi.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'arch/s390/kernel/nmi.c') diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index 56e14d073167..b76b5fef251e 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c @@ -116,6 +116,18 @@ static int notrace s390_validate_registers(union mci mci, int umode) s390_handle_damage(); kill_task = 1; } + /* Validate control registers */ + if (!mci.cr) { + /* + * Control registers have unknown contents. + * Can't recover and therefore stopping machine. + */ + s390_handle_damage(); + } else { + asm volatile( + " lctlg 0,15,0(%0)" + : : "a" (&S390_lowcore.cregs_save_area) : "memory"); + } if (!mci.fp) { /* * Floating point registers can't be restored. If the @@ -208,18 +220,6 @@ static int notrace s390_validate_registers(union mci mci, int umode) */ kill_task = 1; } - /* Validate control registers */ - if (!mci.cr) { - /* - * Control registers have unknown contents. - * Can't recover and therefore stopping machine. - */ - s390_handle_damage(); - } else { - asm volatile( - " lctlg 0,15,0(%0)" - : : "a" (&S390_lowcore.cregs_save_area) : "memory"); - } /* * We don't even try to validate the TOD register, since we simply * can't write something sensible into that register. -- cgit v1.2.3-59-g8ed1b From 5791d90d0046c6d74f19ab58fa774f50e463b0d9 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 21 Feb 2017 11:07:39 +0100 Subject: s390/nmi: purge tlbs after control register validation Play safe and purge all tlbs after the control registers that contain the primary, secondary and home space asces have been validated. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- arch/s390/kernel/nmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/s390/kernel/nmi.c') diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index b76b5fef251e..80c093e0c6f1 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c @@ -125,7 +125,8 @@ static int notrace s390_validate_registers(union mci mci, int umode) s390_handle_damage(); } else { asm volatile( - " lctlg 0,15,0(%0)" + " lctlg 0,15,0(%0)\n" + " ptlb\n" : : "a" (&S390_lowcore.cregs_save_area) : "memory"); } if (!mci.fp) { -- cgit v1.2.3-59-g8ed1b