All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: [PATCH] parisc: Fix boot with kernel v5.14
Date: Tue, 31 Aug 2021 22:46:18 +0200	[thread overview]
Message-ID: <YS6VGsZ7fZtZeu/i@ls3530> (raw)

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 on parisc which needs byte-wise
accesses to unaligned memory.

Below is a *** temporary *** patch/hack which fixes those boot problems.

Signed-off-by: Helge Deller <deller@gmx.de>
---

diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 1c4242416c9f..3ef9a5dd35b5 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -9,10 +9,21 @@
 #include <linux/unaligned/packed_struct.h>
 #include <asm/byteorder.h>

+#if 0
 #define __get_unaligned_t(type, ptr) ({						\
 	const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);	\
 	__pptr->x;								\
 })
+#else
+#define __get_unaligned_t(type, ptr) ({						\
+	unsigned char *a = (unsigned char *)(unsigned long)(ptr);		\
+	sizeof(type) == 1 ? a[0] :						\
+	sizeof(type) == 2 ? a[0] << 8  | a[1] : 				\
+	sizeof(type) == 3 ? a[0] << 16 | a[1] << 8  | a[2] : 			\
+	sizeof(type) == 4 ? a[0] << 24 | a[1] << 16 | a[2] << 8 | a[3] :	\
+	 0 ; \
+})
+#endif

 #define __put_unaligned_t(type, val, ptr) do {					\
 	struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);		\

             reply	other threads:[~2021-08-31 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 20:46 Helge Deller [this message]
2021-09-02 14:06 ` [PATCH v2] parisc: Fix boot with kernel v5.14 Helge Deller
2021-09-02 18:35   ` Arnd Bergmann
2021-09-02 19:48     ` Helge Deller
2021-09-02 20:19       ` Helge Deller
2021-09-02 20:41       ` Arnd Bergmann
2021-09-05 21:40         ` Helge Deller
2021-09-06 10:54           ` Arnd Bergmann
2021-09-06 20:15             ` Helge Deller
2021-09-06 21:49               ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YS6VGsZ7fZtZeu/i@ls3530 \
    --to=deller@gmx.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.