Skip to content

Commit eb44b13

Browse files
danglin44gregkh
authored andcommitted
parisc: Fix lpa and lpa_user defines
commit db19c6f upstream. While working on the rewrite to the light-weight syscall and futex code, I experimented with using a hash index based on the user physical address of atomic variable. This exposed two problems with the lpa and lpa_user defines. Because of the copy instruction, the pa argument needs to be an early clobber argument. This prevents gcc from allocating the va and pa arguments to the same register. Secondly, the lpa instruction can cause a page fault so we need to catch exceptions. Signed-off-by: John David Anglin <dave.anglin@bell.net> Fixes: 116d753 ("parisc: Use lpa instruction to load physical addresses in driver code") Signed-off-by: Helge Deller <deller@gmx.de> Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9b78ee2 commit eb44b13

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

‎arch/parisc/include/asm/special_insns.h‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,32 @@
22
#ifndef __PARISC_SPECIAL_INSNS_H
33
#define __PARISC_SPECIAL_INSNS_H
44

5-
#define lpa(va) ({ \
6-
unsigned long pa; \
7-
__asm__ __volatile__( \
8-
"copy %%r0,%0\n\t" \
9-
"lpa %%r0(%1),%0" \
10-
: "=r" (pa) \
11-
: "r" (va) \
12-
: "memory" \
13-
); \
14-
pa; \
5+
#define lpa(va) ({ \
6+
unsigned long pa; \
7+
__asm__ __volatile__( \
8+
"copy %%r0,%0\n" \
9+
"8:\tlpa %%r0(%1),%0\n" \
10+
"9:\n" \
11+
ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \
12+
: "=&r" (pa) \
13+
: "r" (va) \
14+
: "memory" \
15+
); \
16+
pa; \
1517
})
1618

17-
#define lpa_user(va) ({ \
18-
unsigned long pa; \
19-
__asm__ __volatile__( \
20-
"copy %%r0,%0\n\t" \
21-
"lpa %%r0(%%sr3,%1),%0" \
22-
: "=r" (pa) \
23-
: "r" (va) \
24-
: "memory" \
25-
); \
26-
pa; \
19+
#define lpa_user(va) ({ \
20+
unsigned long pa; \
21+
__asm__ __volatile__( \
22+
"copy %%r0,%0\n" \
23+
"8:\tlpa %%r0(%%sr3,%1),%0\n" \
24+
"9:\n" \
25+
ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \
26+
: "=&r" (pa) \
27+
: "r" (va) \
28+
: "memory" \
29+
); \
30+
pa; \
2731
})
2832

2933
#define mfctl(reg) ({ \

0 commit comments

Comments
 (0)