s390/diag: handle diag 204 subcode 4 address correctly
authorHeiko Carstens <hca@linux.ibm.com>
Sun, 2 Jul 2023 19:20:09 +0000 (21:20 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 24 Jul 2023 10:12:21 +0000 (12:12 +0200)
Diagnose 204 subcode 4 requires a real (physical) address, but a
virtual address is passed to the inline assembly.

Convert the address to a physical address for only this specific case.

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/diag.h
arch/s390/kernel/diag.c

index fb5a886ff47ff51309b32f8b02fae37983b96a51..bed804137537becd6a5d0ecdc2c74c7c764ba04b 100644 (file)
@@ -109,6 +109,8 @@ enum diag204_sc {
        DIAG204_SUBC_STIB7 = 7
 };
 
+#define DIAG204_SUBCODE_MASK 0xffff
+
 /* The two available diag 204 data formats */
 enum diag204_format {
        DIAG204_INFO_SIMPLE = 0,
index cca56b649ca3ba85c906b631fb3fe9d57074829c..f3a0f39cbd6cc9a6a387c77d0adcf8f2270b0d37 100644 (file)
@@ -171,6 +171,8 @@ static inline int __diag204(unsigned long *subcode, unsigned long size, void *ad
 int diag204(unsigned long subcode, unsigned long size, void *addr)
 {
        diag_stat_inc(DIAG_STAT_X204);
+       if ((subcode & DIAG204_SUBCODE_MASK) == DIAG204_SUBC_STIB4)
+               addr = (void *)__pa(addr);
        size = __diag204(&subcode, size, addr);
        if (subcode)
                return -1;