linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: linux-sh@vger.kernel.org, Rich Felker <dalias@libc.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>,
	NIIBE Yutaka <gniibe@fsij.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sh: Implement __get_user_u64() required for 64-bit get_user()
Date: Sat, 27 Jun 2020 15:26:01 +0000	[thread overview]
Message-ID: <87bll4a5ti.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <20200611075811.2949870-2-glaubitz@physik.fu-berlin.de>

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

  reply	other threads:[~2020-06-27 15:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-06-17  7:52 ` [PATCH v3] " John Paul Adrian Glaubitz
2020-06-26  8:41   ` John Paul Adrian Glaubitz
  -- strict thread matches above, loose matches on Subject: below --
2020-05-29 17:45 [RESEND] " John Paul Adrian Glaubitz
2020-05-29 17:45 ` [PATCH] " John Paul Adrian Glaubitz
2020-05-31  9:52   ` Geert Uytterhoeven
2020-05-31  9:54     ` John Paul Adrian Glaubitz
2020-05-31  9:59       ` John Paul Adrian Glaubitz
2020-05-31 10:43         ` Geert Uytterhoeven
2020-05-31 10:52           ` John Paul Adrian Glaubitz
2020-06-01  3:03           ` Rich Felker
2020-06-01  9:02             ` Geert Uytterhoeven
2020-06-01  9:13               ` John Paul Adrian Glaubitz
2020-06-01 16:57                 ` Rich Felker
2020-06-01 20:26                   ` Michael Karcher
2020-06-01 20:50                     ` Rich Felker
2020-06-02 10:19                       ` Michael Karcher
2020-05-29 17:34 John Paul Adrian Glaubitz
2020-05-29 17:34 ` [PATCH] sh: Implement __get_user_u64() required for 64-bit get_user() John Paul Adrian Glaubitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bll4a5ti.wl-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=dalias@libc.org \
    --cc=geert@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=gniibe@fsij.org \
    --cc=kernel@mkarcher.dialup.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).