Re: [PATCH v2] parisc: Fix boot with kernel v5.14

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kernel v5.14 has various changes to optimize unaligned memory accesses,
e.g. commit 0652035a5794 ("asm-generic: unaligned: remove byteshift helpers").

Those changes break the bootloader and other places in kernel for parisc
which needs byte-wise accesses to unaligned memory.

Here is an updated patch/hack which fixes those boot problems by adding
a compiler optimization barrier. More info and background can be found in BZ:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162

Signed-off-by: Helge Deller <deller@xxxxxx>

diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 1c4242416c9f..fdb6864514b1 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -11,11 +11,13 @@

 #define __get_unaligned_t(type, ptr) ({						\
 	const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);	\
+	__asm__ ("" : "+r" (__pptr));						\
 	__pptr->x;								\
 })

 #define __put_unaligned_t(type, val, ptr) do {					\
 	struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);		\
+	__asm__ ("" : "+r" (__pptr));						\
 	__pptr->x = (val);							\
 } while (0)





[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux