2021-05-07 22:12:06

by Arnd Bergmann

[permalink] [raw]
Subject: [RFC 04/12] m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS

From: Arnd Bergmann <[email protected]>

All supported CPUs other than the old dragonball use the
include/linux/unaligned/access_ok.h implementation for accessing unaligned
variables, so presumably this works everywhere.

However, m68k never selects CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS,
so none of the other conditionals in the kernel get the optimized
implementation.

Select this based on CPU_HAS_NO_UNALIGNED to make the two settings
always match, and then use the generic version of the header.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/m68k/Kconfig | 1 +
arch/m68k/include/asm/unaligned.h | 19 -------------------
2 files changed, 1 insertion(+), 19 deletions(-)
delete mode 100644 arch/m68k/include/asm/unaligned.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 5f1aafa7b2e2..9b586752807e 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -22,6 +22,7 @@ config M68K
select HAVE_AOUT if MMU
select HAVE_ASM_MODVERSIONS
select HAVE_DEBUG_BUGVERBOSE
+ select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_HAS_NO_UNALIGNED
select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
select HAVE_IDE
select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
diff --git a/arch/m68k/include/asm/unaligned.h b/arch/m68k/include/asm/unaligned.h
deleted file mode 100644
index 84e437337344..000000000000
--- a/arch/m68k/include/asm/unaligned.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_M68K_UNALIGNED_H
-#define _ASM_M68K_UNALIGNED_H
-
-#ifdef CONFIG_CPU_HAS_NO_UNALIGNED
-#include <asm-generic/unaligned.h>
-#else
-/*
- * The m68k can do unaligned accesses itself.
- */
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#define get_unaligned __get_unaligned_be
-#define put_unaligned __put_unaligned_be
-
-#endif
-
-#endif /* _ASM_M68K_UNALIGNED_H */
--
2.29.2


2021-05-10 10:21:12

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [RFC 04/12] m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS

Hi Arnd,

On Sat, May 8, 2021 at 12:10 AM Arnd Bergmann <[email protected]> wrote:
> From: Arnd Bergmann <[email protected]>
>
> All supported CPUs other than the old dragonball use the

Same comment about dragonball as for patch 01/12.

> include/linux/unaligned/access_ok.h implementation for accessing unaligned
> variables, so presumably this works everywhere.
>
> However, m68k never selects CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS,
> so none of the other conditionals in the kernel get the optimized
> implementation.
>
> Select this based on CPU_HAS_NO_UNALIGNED to make the two settings
> always match, and then use the generic version of the header.
>
> Signed-off-by: Arnd Bergmann <[email protected]>

> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -22,6 +22,7 @@ config M68K
> select HAVE_AOUT if MMU
> select HAVE_ASM_MODVERSIONS
> select HAVE_DEBUG_BUGVERBOSE
> + select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_HAS_NO_UNALIGNED

This was clearly forgotten in commit 58340a07c194e0ae ("introduce
HAVE_EFFICIENT_UNALIGNED_ACCESS Kconfig symbol"), which predates the
existence of CPU_HAS_NO_UNALIGNED.

Reviewed-by: Geert Uytterhoeven <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds