]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/page: Add memory clobber to page_set_storage_key()
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 16 Jun 2025 15:00:28 +0000 (17:00 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Sun, 29 Jun 2025 11:12:01 +0000 (13:12 +0200)
Add memory clobbers to the page_set_storage_key() inline assemblies. This
allows for data dependencies from other code, which is important to prevent
the compiler from reordering instructions if required.

Note that this doesn't fix a bug in existing code; this is just a
prerequisite for upcoming code changes.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/include/asm/page.h

index 79db884b8e3e5e2c50779cb39b94cb7f52efe403..843c5cba882fe02b53c6f26d6c4814ac2bde0980 100644 (file)
@@ -134,12 +134,14 @@ static inline void page_set_storage_key(unsigned long addr,
                asm volatile(
                        "       .insn   rrf,0xb22b0000,%[skey],%[addr],8,0"
                        :
-                       : [skey] "d" (skey), [addr] "a" (addr));
+                       : [skey] "d" (skey), [addr] "a" (addr)
+                       : "memory");
        } else {
                asm volatile(
                        "       sske     %[skey],%[addr]"
                        :
-                       : [skey] "d" (skey), [addr] "a" (addr));
+                       : [skey] "d" (skey), [addr] "a" (addr)
+                       : "memory");
        }
 }