Commit db19c6f1 authored by John David Anglin's avatar John David Anglin Committed by Helge Deller
Browse files

parisc: Fix lpa and lpa_user defines



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: default avatarJohn David Anglin <dave.anglin@bell.net>
Fixes: 116d7533 ("parisc: Use lpa instruction to load physical addresses in driver code")
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v5.2+
parent 45458aa4
Loading
Loading
Loading
Loading
+24 −20
Original line number Diff line number Diff line
@@ -5,9 +5,11 @@
#define lpa(va)	({					\
	unsigned long pa;				\
	__asm__ __volatile__(				\
		"copy %%r0,%0\n\t"	\
		"lpa %%r0(%1),%0"	\
		: "=r" (pa)		\
		"copy %%r0,%0\n"			\
		"8:\tlpa %%r0(%1),%0\n"			\
		"9:\n"					\
		ASM_EXCEPTIONTABLE_ENTRY(8b, 9b)	\
		: "=&r" (pa)				\
		: "r" (va)				\
		: "memory"				\
	);						\
@@ -17,9 +19,11 @@
#define lpa_user(va)	({				\
	unsigned long pa;				\
	__asm__ __volatile__(				\
		"copy %%r0,%0\n\t"	\
		"lpa %%r0(%%sr3,%1),%0"	\
		: "=r" (pa)		\
		"copy %%r0,%0\n"			\
		"8:\tlpa %%r0(%%sr3,%1),%0\n"		\
		"9:\n"					\
		ASM_EXCEPTIONTABLE_ENTRY(8b, 9b)	\
		: "=&r" (pa)				\
		: "r" (va)				\
		: "memory"				\
	);						\