aboutsummaryrefslogtreecommitdiff
path: root/arch/s390/kernel/ipl.c
diff options
context:
space:
mode:
authorGravatar Nico Boehr <nrb@linux.ibm.com> 2023-03-10 12:52:37 +0100
committerGravatar Vasily Gorbik <gor@linux.ibm.com> 2023-04-13 17:36:26 +0200
commitbac30ea9ef80624dfe4bf20c0fc2073dcc771a87 (patch)
tree1dee99cf1f683adf10cf125cba78b970a66d4d2d /arch/s390/kernel/ipl.c
parents390/kaslr: randomize module base load address (diff)
downloadlinux-bac30ea9ef80624dfe4bf20c0fc2073dcc771a87.tar.gz
linux-bac30ea9ef80624dfe4bf20c0fc2073dcc771a87.tar.bz2
linux-bac30ea9ef80624dfe4bf20c0fc2073dcc771a87.zip
s390/ipl: fix physical-virtual confusion for diag308
Diag 308 subcodes expect a physical address as their parameter. This currently is not a bug, but in the future physical and virtual addresses might differ. Fix the confusion by doing a virtual-to-physical conversion in the exported diag308() and leave the assembly wrapper __diag308() alone. Note that several callers pass NULL as addr, so check for the case when NULL is passed and pass 0 to hardware since virt_to_phys(0) might be nonzero. Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Nico Boehr <nrb@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/ipl.c')
-rw-r--r--arch/s390/kernel/ipl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 0f91cd401eef..43de939b7af1 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -176,11 +176,11 @@ static bool reipl_fcp_clear;
static bool reipl_ccw_clear;
static bool reipl_eckd_clear;
-static inline int __diag308(unsigned long subcode, void *addr)
+static inline int __diag308(unsigned long subcode, unsigned long addr)
{
union register_pair r1;
- r1.even = (unsigned long) addr;
+ r1.even = addr;
r1.odd = 0;
asm volatile(
" diag %[r1],%[subcode],0x308\n"
@@ -195,7 +195,7 @@ static inline int __diag308(unsigned long subcode, void *addr)
int diag308(unsigned long subcode, void *addr)
{
diag_stat_inc(DIAG_STAT_X308);
- return __diag308(subcode, addr);
+ return __diag308(subcode, addr ? virt_to_phys(addr) : 0);
}
EXPORT_SYMBOL_GPL(diag308);