Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp486073rdb; Tue, 23 Jan 2024 05:58:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDiYIBrUwPmi7BpSaE5ZrF3uVTyeUep5igOhSHYtic7dR8eMjuRcsoI2RRBJ6VGwMSuIUl X-Received: by 2002:a05:6a21:78aa:b0:19c:53aa:53dd with SMTP id bf42-20020a056a2178aa00b0019c53aa53ddmr1699992pzc.42.1706018326900; Tue, 23 Jan 2024 05:58:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706018326; cv=pass; d=google.com; s=arc-20160816; b=vjkw8HJUsIDeVBMkSUMbefTIsSZoTYbsjfwQCajDLrMI9tWILgHPa3R0EuQJxOmGB7 QQxvsze5yIn5BfzU+BL74eQzE080kA/6mC+2eLtJCAzqJSuKBIxICepC2zbX+oaPxIH6 Izj87gJmcyD9pM3ooydYc9qEU0W0Ax39rlsx5YqB9AhCmZL7kaUgAhb5qL5UTsEczF5L YFzG7cJ2lCXWVgnCwsAyjC3ND+edOnzNIQ6IBcLACFnj1YXloRGZA8BZdZzFvLhhq5YS tyl88lEr4ocHHvt+5tFdW3TtiVpgBzG695MxyxLQObhNLL1M1qsXWit05UQ8fBP18N80 w0fA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=zuDBuArVy5/CW7YFPKgts5ZJ1lP4HsyqjF3AU+tXFdQ=; fh=SBoOpoWvXPtflU4fHSmq9Vhz6jB+wkrt+RY2vksG08Q=; b=HoCFQFUE+nT8dH30NO4b4Kd50rexaVry3YwVCm33pKc+4Lyl8N6Mp0prU4KMMH1MhV LZSn9vI7cTXCX0nJWZkGloGrf8Kst+00q9C7EU1BGGuVwvbmM4yu5DALbZwvrGQ5CAcM 8TTacVcEx4GRAhibch3VBa99JECrIo2lIcDHkvYoK0b84OHsCA1NC8M8CqImzU9hA4xl WoGq2mn1nqG3daGi7AbdEXq2PQVHKNkmX0azv1fRij53ff+I6SNN9JsLquTQPOa1bUfy RrR6/n1ZaZjoxrNCqbOJTcsWNFrcWYXKf4phtaa0BCpejWBm7QP8ecz95KpzwvK2kyzx BE5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HDsdxTCP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-35382-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35382-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id kq20-20020a056a004b1400b006d9abe94a76si12529821pfb.67.2024.01.23.05.58.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 05:58:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35382-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HDsdxTCP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-35382-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35382-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B596B274E4 for ; Tue, 23 Jan 2024 13:28:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E340E605C1; Tue, 23 Jan 2024 13:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HDsdxTCP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15406605B8; Tue, 23 Jan 2024 13:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706016221; cv=none; b=EJXbW5NpQy4lm1CqGpjXH2u8MvtfoBH66D31QaHYh1us6LkBDuoG0OQeF/Rro6vPUDytkfFcxGl0B5yJfytNj6HliIikT93FCqWaMy8y9iPfvFnnA14sg9zrUjryEbT9u9rqZ4GnQY7cOe30DJi8uBX5TpKY9OAC9fm+21YX5Sw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706016221; c=relaxed/simple; bh=0RGNHFInxFQRBM29nCBUXg7rUT8MFbgsXfxi0b/Mf3o=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=a62pOEOsdkpSjQ5RGZYmNrCOxz2lsrHJl9P4ykb4XCJB1YmmBev15wy5pmfix+gjeLjGxXwVaDjy62OREPADanI23ZBoHoTEbtlz0TrLyPKNjJGIaRe6V3SG/t6t2Xm9BqJW8jEeFPq8FY9vB7a8DZ8fMitUPh1N6P9C1HR7FFM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HDsdxTCP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C0F6C433F1; Tue, 23 Jan 2024 13:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706016220; bh=0RGNHFInxFQRBM29nCBUXg7rUT8MFbgsXfxi0b/Mf3o=; h=From:To:Cc:Subject:Date:From; b=HDsdxTCPF2P8K6rIbqpCVoXFAaJMHGYEHl/5rvQT08ljmM5S+A1N+8n6SEbg37UrZ haKP5Mxsx78xdiZzUoW6l8J0KNzhBUuO3BoyKjQBZ73dosoIMGDg2m52H7psIuxJQH 5Jcugn+deUs8HeTfr5/b9S07L942RzQmS0UesSgWhrRaJTAVCLW7PS9CXmLeK0XcnB E5yj4eC33L7JH5ENXkgFu65QRES6Lml1d4qXR/YtnVIYSvW145uoed3RHgHz4i5XKm lnn5/r67EHpwzNIUz3i34+oy1CxWQQujKy5WS7FaZnDSZsrqN6BGUccYHDLGnGUnN1 p/ssMhEAlE7sA== From: Arnd Bergmann To: Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz Cc: Arnd Bergmann , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH] sh: use generic uaccess Date: Tue, 23 Jan 2024 14:23:20 +0100 Message-Id: <20240123132335.2034611-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann As reported by many people, the nommu SH code runs into a compiler error with a newly added syscall: + {standard input}: Error: displacement to undefined symbol .L105 overflows 8-bit field : => 590, 593 + {standard input}: Error: displacement to undefined symbol .L135 overflows 8-bit field : => 603 + {standard input}: Error: displacement to undefined symbol .L140 overflows 8-bit field : => 606 + {standard input}: Error: displacement to undefined symbol .L76 overflows 12-bit field: => 591, 594 + {standard input}: Error: displacement to undefined symbol .L77 overflows 8-bit field : 607 => 607, 582, 585 + {standard input}: Error: displacement to undefined symbol .L97 overflows 12-bit field: => 607 + {standard input}: Error: pcrel too far: 604, 590, 577, 593, 572, 569, 598, 599, 596, 610 => 610, 574, 599, 569, 598, 596, 601, 590, 604, 595, 572, 577, 593 Avoid the code that triggers this entirely by using the same generic uaccess code that m68k and riscv have on nommu. Link: https://lore.kernel.org/all/07d8877b-d933-46f4-8ca4-c10ed602f37e@app.fastmail.com/ Signed-off-by: Arnd Bergmann --- arch/sh/include/asm/uaccess.h | 5 +++++ arch/sh/include/asm/uaccess_32.h | 23 ----------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index a79609eb14be..b42764d55901 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h @@ -2,6 +2,7 @@ #ifndef __ASM_SH_UACCESS_H #define __ASM_SH_UACCESS_H +#ifdef CONFIG_MMU #include #include @@ -130,4 +131,8 @@ struct mem_access { int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, struct mem_access *ma, int, unsigned long address); +#else +#include +#endif + #endif /* __ASM_SH_UACCESS_H */ diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h index 5d7ddc092afd..e053f2fd245c 100644 --- a/arch/sh/include/asm/uaccess_32.h +++ b/arch/sh/include/asm/uaccess_32.h @@ -35,7 +35,6 @@ do { \ } \ } while (0) -#ifdef CONFIG_MMU #define __get_user_asm(x, addr, err, insn) \ ({ \ __asm__ __volatile__( \ @@ -56,16 +55,6 @@ __asm__ __volatile__( \ ".previous" \ :"=&r" (err), "=&r" (x) \ :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); }) -#else -#define __get_user_asm(x, addr, err, insn) \ -do { \ - __asm__ __volatile__ ( \ - "mov." insn " %1, %0\n\t" \ - : "=&r" (x) \ - : "m" (__m(addr)) \ - ); \ -} while (0) -#endif /* CONFIG_MMU */ extern void __get_user_unknown(void); @@ -140,7 +129,6 @@ do { \ } \ } while (0) -#ifdef CONFIG_MMU #define __put_user_asm(x, addr, err, insn) \ do { \ __asm__ __volatile__ ( \ @@ -164,17 +152,6 @@ do { \ : "memory" \ ); \ } while (0) -#else -#define __put_user_asm(x, addr, err, insn) \ -do { \ - __asm__ __volatile__ ( \ - "mov." insn " %0, %1\n\t" \ - : /* no outputs */ \ - : "r" (x), "m" (__m(addr)) \ - : "memory" \ - ); \ -} while (0) -#endif /* CONFIG_MMU */ #if defined(CONFIG_CPU_LITTLE_ENDIAN) #define __put_user_u64(val,addr,retval) \ -- 2.39.2