Skip to content

Commit c6dbd3e

Browse files
author
Peter Zijlstra
committed
x86/mmx_32: Remove X86_USE_3DNOW
This code puts an exception table entry on the PREFETCH instruction to overwrite it with a JMP.d8 when it triggers an exception. Except of course, our code is no longer writable, also SMP. Instead of fixing this broken mess, simply take it out. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent bff8c38 commit c6dbd3e

File tree

11 files changed

+1
-469
lines changed

11 files changed

+1
-469
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,7 @@ config EFI
19571957

19581958
config EFI_STUB
19591959
bool "EFI stub support"
1960-
depends on EFI && !X86_USE_3DNOW
1960+
depends on EFI
19611961
depends on $(cc-option,-mabi=ms) || X86_32
19621962
select RELOCATABLE
19631963
help

arch/x86/Kconfig.cpu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,6 @@ config X86_USE_PPRO_CHECKSUM
342342
def_bool y
343343
depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM
344344

345-
config X86_USE_3DNOW
346-
def_bool y
347-
depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML
348-
349345
#
350346
# P6_NOPs are a relatively minor optimization that require a family >=
351347
# 6 processor, except that it is broken on certain VIA chips.

arch/x86/include/asm/mmx.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +0,0 @@
1-
/* SPDX-License-Identifier: GPL-2.0 */
2-
#ifndef _ASM_X86_MMX_H
3-
#define _ASM_X86_MMX_H
4-
5-
/*
6-
* MMX 3Dnow! helper operations
7-
*/
8-
9-
#include <linux/types.h>
10-
11-
extern void *_mmx_memcpy(void *to, const void *from, size_t size);
12-
extern void mmx_clear_page(void *page);
13-
extern void mmx_copy_page(void *to, void *from);
14-
15-
#endif /* _ASM_X86_MMX_H */

arch/x86/include/asm/page_32.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ extern unsigned long __phys_addr(unsigned long);
1919
#define pfn_valid(pfn) ((pfn) < max_mapnr)
2020
#endif /* CONFIG_FLATMEM */
2121

22-
#ifdef CONFIG_X86_USE_3DNOW
23-
#include <asm/mmx.h>
24-
25-
static inline void clear_page(void *page)
26-
{
27-
mmx_clear_page(page);
28-
}
29-
30-
static inline void copy_page(void *to, void *from)
31-
{
32-
mmx_copy_page(to, from);
33-
}
34-
#else /* !CONFIG_X86_USE_3DNOW */
3522
#include <linux/string.h>
3623

3724
static inline void clear_page(void *page)
@@ -43,7 +30,6 @@ static inline void copy_page(void *to, void *from)
4330
{
4431
memcpy(to, from, PAGE_SIZE);
4532
}
46-
#endif /* CONFIG_X86_USE_3DNOW */
4733
#endif /* !__ASSEMBLY__ */
4834

4935
#endif /* _ASM_X86_PAGE_32_H */

arch/x86/include/asm/required-features.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
# define NEED_CMOV 0
3636
#endif
3737

38-
#ifdef CONFIG_X86_USE_3DNOW
39-
# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31))
40-
#else
4138
# define NEED_3DNOW 0
42-
#endif
4339

4440
#if defined(CONFIG_X86_P6_NOP) || defined(CONFIG_X86_64)
4541
# define NEED_NOPL (1<<(X86_FEATURE_NOPL & 31))

arch/x86/include/asm/string_32.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -146,42 +146,9 @@ static __always_inline void *__constant_memcpy(void *to, const void *from,
146146
extern void *memcpy(void *, const void *, size_t);
147147

148148
#ifndef CONFIG_FORTIFY_SOURCE
149-
#ifdef CONFIG_X86_USE_3DNOW
150-
151-
#include <asm/mmx.h>
152-
153-
/*
154-
* This CPU favours 3DNow strongly (eg AMD Athlon)
155-
*/
156-
157-
static inline void *__constant_memcpy3d(void *to, const void *from, size_t len)
158-
{
159-
if (len < 512)
160-
return __constant_memcpy(to, from, len);
161-
return _mmx_memcpy(to, from, len);
162-
}
163-
164-
static inline void *__memcpy3d(void *to, const void *from, size_t len)
165-
{
166-
if (len < 512)
167-
return __memcpy(to, from, len);
168-
return _mmx_memcpy(to, from, len);
169-
}
170-
171-
#define memcpy(t, f, n) \
172-
(__builtin_constant_p((n)) \
173-
? __constant_memcpy3d((t), (f), (n)) \
174-
: __memcpy3d((t), (f), (n)))
175-
176-
#else
177-
178-
/*
179-
* No 3D Now!
180-
*/
181149

182150
#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
183151

184-
#endif
185152
#endif /* !CONFIG_FORTIFY_SOURCE */
186153

187154
#define __HAVE_ARCH_MEMMOVE

arch/x86/lib/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ ifeq ($(CONFIG_X86_32),y)
6363
ifneq ($(CONFIG_X86_CMPXCHG64),y)
6464
lib-y += cmpxchg8b_emu.o atomic64_386_32.o
6565
endif
66-
lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
6766
else
6867
obj-y += iomap_copy_64.o
6968
lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o

arch/x86/lib/memcpy_32.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77

88
__visible void *memcpy(void *to, const void *from, size_t n)
99
{
10-
#if defined(CONFIG_X86_USE_3DNOW) && !defined(CONFIG_FORTIFY_SOURCE)
11-
return __memcpy3d(to, from, n);
12-
#else
1310
return __memcpy(to, from, n);
14-
#endif
1511
}
1612
EXPORT_SYMBOL(memcpy);
1713

0 commit comments

Comments
 (0)