s390/mem_detect: fix diag260() program check new psw handling
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 14 Jun 2021 19:40:43 +0000 (21:40 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Fri, 18 Jun 2021 14:41:24 +0000 (16:41 +0200)
commit86807f348f418a84970eebb8f9912a7eea16b497
tree7d90be771c14b23742ecd8dd4523a85767b147cd
parentd99aea73b4de2357095e1059637ef5427e9473e8
s390/mem_detect: fix diag260() program check new psw handling

The __diag260() inline asm temporarily changes the program check new
psw to redirect a potential program check on the diag instruction.
Restoring of the program check new psw is done in C code behind the
inline asm.

This can be problematic, especially if the function is inlined, since
the compiler can reorder instructions in such a way that a different
instruction, which may result in a program check, might be executed
before the program check new psw has been restored.

To avoid such a scenario move restoring into the inline asm. For
consistency reasons move also saving of the original program check new
psw into the inline asm.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/boot/mem_detect.c