Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1950596ybm; Sun, 31 May 2020 03:51:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI0+FWAWy5e540RI+3GmKcButmqRd4t5a59HOezgQDX2BHk72I5Zrl1v//t5X5ZvsKtRH/ X-Received: by 2002:a50:ed14:: with SMTP id j20mr5874492eds.79.1590922292960; Sun, 31 May 2020 03:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590922292; cv=none; d=google.com; s=arc-20160816; b=e7sua8GyM5pRYSPmIepVlSLHWFvSSMfLdJb00k4ReZGnKct8X0s5rC4Vo1MJ1EZeT/ 9dh7yBCc8fkxe3OBazBgn3itt/CP2gSJfhfOeat3cl2o9yPolzLX/DfWPLd788cA2ww2 +Nxunbgr/M+wghXbzudtMSg/PblgOegfpSWFFnt1MwQOt/tH7cY9JjgCZqm4232yaTxG vUN5qRgurXGeFzPXW2aLs8CbvVg6Y5ncbee+Rq2gGqN+tiq0A3N8jOD27FM6UOZ9bSOK Z57vGUzVxwMYri4vxe1wUWFPEVKiUWzl6bvMAgj2NwH2L1sVzjMEBMSMxrGmvMqnGqBf 6BFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=X8OVgPUFclx2gW213oXK9WW6zClY4aYncS/0qYq5ito=; b=hHCtZDwGnQIUfJpSEgBvkw90hmrsgdnbfO3QTffRZC9tY7Z5QITKtuJ/X741kSaTpy CcpzwM8EFAbJl8ZZRbLcqZp9Q/R7KzWs3qmFzGx5PV9SLB/kyhDpS/2WTliIanfhRFvh DrBhenfN48XEEQRP/ejHpVdjPp3aWUh6T1zC6otyHmuJgd8kH65KKGMFESiPpyaMSPO0 0Uw7/xviBzfX6keg8VDUOEm5PascrxycO6Zxe/wZ99Vu6+m2xqL73hwlWTRj4JSUtZnS w0KDVea4SXus0ikikQ92GSflE2PJ0sYN7LpKr+OuiclyZr5ptzQPzuc9CsV27JePfavP +4BQ== 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 o18si6911077ejb.193.2020.05.31.03.51.09; Sun, 31 May 2020 03:51:32 -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 S1728288AbgEaKtJ (ORCPT + 99 others); Sun, 31 May 2020 06:49:09 -0400 Received: from outpost17.zedat.fu-berlin.de ([130.133.4.110]:47409 "EHLO outpost17.zedat.fu-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725813AbgEaKtJ (ORCPT ); Sun, 31 May 2020 06:49:09 -0400 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost.zedat.fu-berlin.de (Exim 4.93) with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1jfLWZ-00304k-Jg; Sun, 31 May 2020 12:49:03 +0200 Received: from z6.physik.fu-berlin.de ([160.45.32.137] helo=z6) by relay1.zedat.fu-berlin.de (Exim 4.93) with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1jfLWZ-001ryz-H6; Sun, 31 May 2020 12:49:03 +0200 Received: from glaubitz by z6 with local (Exim 4.93) (envelope-from ) id 1jfLWR-00AXem-Pj; Sun, 31 May 2020 12:48:55 +0200 From: John Paul Adrian Glaubitz To: linux-sh@vger.kernel.org Cc: Rich Felker , Yoshinori Sato , Geert Uytterhoeven , Michael Karcher , linux-kernel@vger.kernel.org, John Paul Adrian Glaubitz Subject: [PATCH v2] sh: Implement __get_user_u64() required for 64-bit get_user() Date: Sun, 31 May 2020 12:47:16 +0200 Message-Id: <20200531104715.2512247-1-glaubitz@physik.fu-berlin.de> X-Mailer: git-send-email 2.27.0.rc2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Originating-IP: 160.45.32.137 X-ZEDAT-Hint: RV Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) Changes since v1: - Replace single mov instruction for exception handling in case of invalid load diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h index 624cf55acc27..35f6c1e40ec3 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,54 @@ 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" \ + ".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" \ + ".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.rc2