linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] sh: Implement __get_user_u64() required for 64-bit get_user()
@ 2020-06-11  7:58 John Paul Adrian Glaubitz
  2020-06-11  7:58 ` [PATCH] " John Paul Adrian Glaubitz
  2020-06-17  7:52 ` [PATCH v3] " John Paul Adrian Glaubitz
  0 siblings, 2 replies; 5+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-06-11  7:58 UTC (permalink / raw)
  To: linux-sh
  Cc: Rich Felker, Yoshinori Sato, Geert Uytterhoeven, Michael Karcher,
	NIIBE Yutaka, linux-kernel

Hi!

This is version 3 of my patch to implement __get_user_u64() for SH.

I have asked both Yutaka Niibe and Yoshinori Sato to look over my changes and they
both agreed that an entry in __ex_tables for the second access was missing, so I
add the missing ".long 1b+2, 3b\n\t".

The changes should be correct now and will hopefully get a positive review by
the SH maintainers.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] sh: Implement __get_user_u64() required for 64-bit get_user()
  2020-06-11  7:58 [PATCH v3] sh: Implement __get_user_u64() required for 64-bit get_user() John Paul Adrian Glaubitz
@ 2020-06-11  7:58 ` John Paul Adrian Glaubitz
  2020-06-27 15:26   ` Yoshinori Sato
  2020-06-17  7:52 ` [PATCH v3] " John Paul Adrian Glaubitz
  1 sibling, 1 reply; 5+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-06-11  7:58 UTC (permalink / raw)
  To: linux-sh
  Cc: Rich Felker, Yoshinori Sato, Geert Uytterhoeven, Michael Karcher,
	NIIBE Yutaka, linux-kernel, John Paul Adrian Glaubitz

Trying to build the kernel with CONFIG_INFINIBAND_USER_ACCESS enabled fails

     ERROR: "__get_user_unknown" [drivers/infiniband/core/ib_uverbs.ko] undefined!

with on SH since the kernel misses a 64-bit implementation of get_user().

Implement the missing 64-bit get_user() as __get_user_u64(), matching the
already existing __put_user_u64() which implements the 64-bit put_user().

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 arch/sh/include/asm/uaccess_32.h | 53 ++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h
index 624cf55acc27..5d7ddc092afd 100644
--- a/arch/sh/include/asm/uaccess_32.h
+++ b/arch/sh/include/asm/uaccess_32.h
@@ -26,6 +26,9 @@ do {								\
 	case 4:							\
 		__get_user_asm(x, ptr, retval, "l");		\
 		break;						\
+	case 8:							\
+		__get_user_u64(x, ptr, retval);			\
+		break;						\
 	default:						\
 		__get_user_unknown();				\
 		break;						\
@@ -66,6 +69,56 @@ do {							\
 
 extern void __get_user_unknown(void);
 
+#if defined(CONFIG_CPU_LITTLE_ENDIAN)
+#define __get_user_u64(x, addr, err) \
+({ \
+__asm__ __volatile__( \
+	"1:\n\t" \
+	"mov.l	%2,%R1\n\t" \
+	"mov.l	%T2,%S1\n\t" \
+	"2:\n" \
+	".section	.fixup,\"ax\"\n" \
+	"3:\n\t" \
+	"mov  #0,%R1\n\t"   \
+	"mov  #0,%S1\n\t"   \
+	"mov.l	4f, %0\n\t" \
+	"jmp	@%0\n\t" \
+	" mov	%3, %0\n\t" \
+	".balign	4\n" \
+	"4:	.long	2b\n\t" \
+	".previous\n" \
+	".section	__ex_table,\"a\"\n\t" \
+	".long	1b, 3b\n\t" \
+	".long	1b + 2, 3b\n\t" \
+	".previous" \
+	:"=&r" (err), "=&r" (x) \
+	:"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
+#else
+#define __get_user_u64(x, addr, err) \
+({ \
+__asm__ __volatile__( \
+	"1:\n\t" \
+	"mov.l	%2,%S1\n\t" \
+	"mov.l	%T2,%R1\n\t" \
+	"2:\n" \
+	".section	.fixup,\"ax\"\n" \
+	"3:\n\t" \
+	"mov  #0,%S1\n\t"   \
+	"mov  #0,%R1\n\t"   \
+	"mov.l	4f, %0\n\t" \
+	"jmp	@%0\n\t" \
+	" mov	%3, %0\n\t" \
+	".balign	4\n" \
+	"4:	.long	2b\n\t" \
+	".previous\n" \
+	".section	__ex_table,\"a\"\n\t" \
+	".long	1b, 3b\n\t" \
+	".long	1b + 2, 3b\n\t" \
+	".previous" \
+	:"=&r" (err), "=&r" (x) \
+	:"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
+#endif
+
 #define __put_user_size(x,ptr,size,retval)		\
 do {							\
 	retval = 0;					\
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] sh: Implement __get_user_u64() required for 64-bit get_user()
  2020-06-11  7:58 [PATCH v3] sh: Implement __get_user_u64() required for 64-bit get_user() John Paul Adrian Glaubitz
  2020-06-11  7:58 ` [PATCH] " John Paul Adrian Glaubitz
@ 2020-06-17  7:52 ` John Paul Adrian Glaubitz
  2020-06-26  8:41   ` John Paul Adrian Glaubitz
  1 sibling, 1 reply; 5+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-06-17  7:52 UTC (permalink / raw)
  To: linux-sh
  Cc: Rich Felker, Yoshinori Sato, Geert Uytterhoeven, Michael Karcher,
	NIIBE Yutaka, linux-kernel

On 6/11/20 9:58 AM, John Paul Adrian Glaubitz wrote:
> This is version 3 of my patch to implement __get_user_u64() for SH.
> 
> I have asked both Yutaka Niibe and Yoshinori Sato to look over my changes and they
> both agreed that an entry in __ex_tables for the second access was missing, so I
> add the missing ".long 1b+2, 3b\n\t".
> 
> The changes should be correct now and will hopefully get a positive review by
> the SH maintainers.

Ping.

@Rich, @Yoshinori, @Yutaka, @Michael could I get a review if you have some time?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] sh: Implement __get_user_u64() required for 64-bit get_user()
  2020-06-17  7:52 ` [PATCH v3] " John Paul Adrian Glaubitz
@ 2020-06-26  8:41   ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 5+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-06-26  8:41 UTC (permalink / raw)
  To: linux-sh
  Cc: Rich Felker, Yoshinori Sato, Geert Uytterhoeven, Michael Karcher,
	NIIBE Yutaka, linux-kernel

Hello!

On 6/17/20 9:52 AM, John Paul Adrian Glaubitz wrote:
>> The changes should be correct now and will hopefully get a positive review by
>> the SH maintainers.
> 
> Ping.
> 
> @Rich, @Yoshinori, @Yutaka, @Michael could I get a review if you have some time?

Can we please move forward with this? I don't want to see another discussion arise
whether SH is maintained or not :-(.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sh: Implement __get_user_u64() required for 64-bit get_user()
  2020-06-11  7:58 ` [PATCH] " John Paul Adrian Glaubitz
@ 2020-06-27 15:26   ` Yoshinori Sato
  0 siblings, 0 replies; 5+ messages in thread
From: Yoshinori Sato @ 2020-06-27 15:26 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: linux-sh, Rich Felker, Geert Uytterhoeven, Michael Karcher,
	NIIBE Yutaka, linux-kernel

On Thu, 11 Jun 2020 16:58:11 +0900,
John Paul Adrian Glaubitz wrote:
> 
> Trying to build the kernel with CONFIG_INFINIBAND_USER_ACCESS enabled fails
> 
>      ERROR: "__get_user_unknown" [drivers/infiniband/core/ib_uverbs.ko] undefined!
> 
> with on SH since the kernel misses a 64-bit implementation of get_user().
> 
> Implement the missing 64-bit get_user() as __get_user_u64(), matching the
> already existing __put_user_u64() which implements the 64-bit put_user().
> 
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> ---
>  arch/sh/include/asm/uaccess_32.h | 53 ++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h
> index 624cf55acc27..5d7ddc092afd 100644
> --- a/arch/sh/include/asm/uaccess_32.h
> +++ b/arch/sh/include/asm/uaccess_32.h
> @@ -26,6 +26,9 @@ do {								\
>  	case 4:							\
>  		__get_user_asm(x, ptr, retval, "l");		\
>  		break;						\
> +	case 8:							\
> +		__get_user_u64(x, ptr, retval);			\
> +		break;						\
>  	default:						\
>  		__get_user_unknown();				\
>  		break;						\
> @@ -66,6 +69,56 @@ do {							\
>  
>  extern void __get_user_unknown(void);
>  
> +#if defined(CONFIG_CPU_LITTLE_ENDIAN)
> +#define __get_user_u64(x, addr, err) \
> +({ \
> +__asm__ __volatile__( \
> +	"1:\n\t" \
> +	"mov.l	%2,%R1\n\t" \
> +	"mov.l	%T2,%S1\n\t" \
> +	"2:\n" \
> +	".section	.fixup,\"ax\"\n" \
> +	"3:\n\t" \
> +	"mov  #0,%R1\n\t"   \
> +	"mov  #0,%S1\n\t"   \
> +	"mov.l	4f, %0\n\t" \
> +	"jmp	@%0\n\t" \
> +	" mov	%3, %0\n\t" \
> +	".balign	4\n" \
> +	"4:	.long	2b\n\t" \
> +	".previous\n" \
> +	".section	__ex_table,\"a\"\n\t" \
> +	".long	1b, 3b\n\t" \
> +	".long	1b + 2, 3b\n\t" \
> +	".previous" \
> +	:"=&r" (err), "=&r" (x) \
> +	:"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
> +#else
> +#define __get_user_u64(x, addr, err) \
> +({ \
> +__asm__ __volatile__( \
> +	"1:\n\t" \
> +	"mov.l	%2,%S1\n\t" \
> +	"mov.l	%T2,%R1\n\t" \
> +	"2:\n" \
> +	".section	.fixup,\"ax\"\n" \
> +	"3:\n\t" \
> +	"mov  #0,%S1\n\t"   \
> +	"mov  #0,%R1\n\t"   \
> +	"mov.l	4f, %0\n\t" \
> +	"jmp	@%0\n\t" \
> +	" mov	%3, %0\n\t" \
> +	".balign	4\n" \
> +	"4:	.long	2b\n\t" \
> +	".previous\n" \
> +	".section	__ex_table,\"a\"\n\t" \
> +	".long	1b, 3b\n\t" \
> +	".long	1b + 2, 3b\n\t" \
> +	".previous" \
> +	:"=&r" (err), "=&r" (x) \
> +	:"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
> +#endif
> +
>  #define __put_user_size(x,ptr,size,retval)		\
>  do {							\
>  	retval = 0;					\
> -- 
> 2.27.0
> 

Acked-by: Yoshinori Sato <ysato@users.sourceforge.jp>

-- 
Yosinori Sato

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-27 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11  7:58 [PATCH v3] sh: Implement __get_user_u64() required for 64-bit get_user() John Paul Adrian Glaubitz
2020-06-11  7:58 ` [PATCH] " John Paul Adrian Glaubitz
2020-06-27 15:26   ` Yoshinori Sato
2020-06-17  7:52 ` [PATCH v3] " John Paul Adrian Glaubitz
2020-06-26  8:41   ` John Paul Adrian Glaubitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).