Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1444575ybt; Sat, 27 Jun 2020 08:26:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfM8sAxQhOeol1w2FvouoK62wDDxU0ADomv0+pBmx9l9ob7A0j452g7r3Il99UQa18CSRf X-Received: by 2002:a17:906:6d49:: with SMTP id a9mr6757687ejt.435.1593271600961; Sat, 27 Jun 2020 08:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593271600; cv=none; d=google.com; s=arc-20160816; b=0JCtJ4V0iwvt/OpaJXyn/umP/kH0JxMyXAnRmP0NbQsmEeu1+y+WRdUpL4OlrzTtCZ ITY0+JY13/7+UAsL3TOCL4ZVuFHwRiFpiXeBmJG1J+IhTIcIFpXrvV4JTXM+ZWyKmCTY zudVVhF+t9LPQN0BzmBebyb+d2GcGuLjsUQo050X7/Fka6I/3TfFexVTXNOa6PCo0IM4 TFf68YciOPBmOteReuuViUKaw7f1Q4blYeG+A0dHihZBljcqvPwIj5wnqr9PbGd0DlJa 17Pls06Wo5z244MjjFd1l9/uBs87L3qKu4/p3fYnL9kcVrsFHicHJdEjBLfh9Lr9ceVr kTQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=H1qP22+O6u8pqHBEDuUCug9DJpVnfJH5F/Y90BIdX1g=; b=O86AenLQy03nJ/4IUbbk0Q7kCU7TAbL18r95QetM85E9FnPJZ8NKzxzosq79iRzRjz dyZt1ft/kB+06EbrvKixEecWEhCz2tj5k5H522wdak9uH5zXESp3fXxaNVE8cFMvImf3 rCNT49aLiKLc+R5at+iLfiTk4ZPNJ1eDLnFSUtYI/30is8MAer79nz68vFInlqyBVmDm J9+pT6qjEk8SMpQ5lQl7aWguhqutmYSO60z48NeGYMJ9pAquRs2eemhtiEpmKsGUlfAY WlFmN1KvqMps58zZsF33t4olKr+zsr8p3PgPUMs0kJ5YSDgcXYni9pNlKg+BgUQ8S1oL Z11g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si10992944ejs.370.2020.06.27.08.26.17; Sat, 27 Jun 2020 08:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726128AbgF0P0J (ORCPT + 99 others); Sat, 27 Jun 2020 11:26:09 -0400 Received: from mail01.asahi-net.or.jp ([202.224.55.13]:59975 "EHLO mail01.asahi-net.or.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725864AbgF0P0J (ORCPT ); Sat, 27 Jun 2020 11:26:09 -0400 Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) (Authenticated sender: PQ4Y-STU) by mail01.asahi-net.or.jp (Postfix) with ESMTPA id 40DE710BA3A; Sun, 28 Jun 2020 00:26:05 +0900 (JST) Received: from yo-satoh-debian.ysato.ml (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by sakura.ysato.name (Postfix) with ESMTPSA id 391051C079E; Sun, 28 Jun 2020 00:26:05 +0900 (JST) Date: Sun, 28 Jun 2020 00:26:01 +0900 Message-ID: <87bll4a5ti.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: John Paul Adrian Glaubitz Cc: linux-sh@vger.kernel.org, Rich Felker , Geert Uytterhoeven , Michael Karcher , NIIBE Yutaka , linux-kernel@vger.kernel.org Subject: Re: [PATCH] sh: Implement __get_user_u64() required for 64-bit get_user() In-Reply-To: <20200611075811.2949870-2-glaubitz@physik.fu-berlin.de> References: <20200611075811.2949870-1-glaubitz@physik.fu-berlin.de> <20200611075811.2949870-2-glaubitz@physik.fu-berlin.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 -- Yosinori Sato