Received: by 10.223.148.5 with SMTP id 5csp7698531wrq; Thu, 18 Jan 2018 08:29:43 -0800 (PST) X-Google-Smtp-Source: ACJfBotStFnwgeCvXUwBPN6mkui4i1dqxmozYmxJn+OcH71O7PK/4m5596ftyZSOUeKdeAB8+ndS X-Received: by 10.99.154.10 with SMTP id o10mr36931427pge.156.1516292983225; Thu, 18 Jan 2018 08:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516292983; cv=none; d=google.com; s=arc-20160816; b=RLqT1hnCwSi9kD3DUamAEAXbUx8b73qbzAtK+lTt3hVyCtXlqeM+uLOo6lRIkkoC8+ nZ4a4AJbuRxjFIYwoHsiPwnmIv05+kFBw17CMBOZjTCmiZtmJk04cdzXNXfDlOL/HIdD IMzKY94kA97mr9YiMCr4i+jqIwRbsjvYS9H7N/GxP2JMN15V0DgW/nnugjiWuulfOt5f OXrupQvIPRM9eV3nkYkrUAZxMQUmUjEhemW2f49JY0gJ/A/lEgqTfAL+HRYxHrJ5AJwb UxLzdPofjx0iKf0PX6ZLpewxX02TcqvXskX9bPqICuaKvnM/X/TV2UkVFYtPSAw/hGhS XjHA== 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:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=v2TKKQZbIePiJCi/hVZ5vkWBTBrpv0HSgByaEoB/Km0=; b=UR+8Rpa0Tdo8G1KrDYVu36JGaFo4CVps8huvQa92xzcswK0FQAcLAWsVQnSb5arVkD Wdz2w7wdWobN/Rbgxb9a4I2WvW5QTsU9qmMMmRxKhazB71mR3qU6V/9Lio04zXd6+0k1 6n8Jpu39U//QNNNu71hwdi9svLZsCv35R9uzrQvnG3MT8PPA6/6zc3fvqpWUaOYnnRAp jwODJ8HyymsiON/jrjnNogp7tfh3KW0UG5SriCdlpJXrgbkZUOVWy518BYXKg8+lRHjB ZNbrJ01xm8gVgWzjyEjRHT+WZ4EteU7KfMelIXfMIr9qJNFyK7dL8fJX6nTuYQc0cCLQ AMSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=ljgI7gm1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j128si7201891pfc.209.2018.01.18.08.29.29; Thu, 18 Jan 2018 08:29:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=ljgI7gm1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933158AbeARQF4 (ORCPT + 99 others); Thu, 18 Jan 2018 11:05:56 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36626 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933070AbeARQFy (ORCPT ); Thu, 18 Jan 2018 11:05:54 -0500 Received: by mail-pg0-f66.google.com with SMTP id k68so6971052pga.3 for ; Thu, 18 Jan 2018 08:05:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=v2TKKQZbIePiJCi/hVZ5vkWBTBrpv0HSgByaEoB/Km0=; b=ljgI7gm1uosVg5yOzxKrOnoLhUgeMAWrNsvahf8SG3cX4uFo9MDim2Y3/UCy+09NGe AQM0ehCZhdh5EgCc/4OyXntALm0NbnHqzS2l5NKejI5nyYnBHAfZjXxbzdY8BLRpQZVp pqFVgeAlxvSw0gP3srxJXRKViqPVf7zxsdE4tTOz9H975SR7nVqULwIwBn6C6ddIo/ka /BKVbjihePmYbK05LyiXQIHuxTl3lPEoBGMT/ZCVLRfPU0nWMgg9HkVz/BtmFfqJcWVA 0kg4grqxiuH0lSuWXvVSJRPYqneym61RGEFoaVomARPeunErhhewmpmre/c5teWI53aT DTow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=v2TKKQZbIePiJCi/hVZ5vkWBTBrpv0HSgByaEoB/Km0=; b=oA3RcC3oZs91mfU1EXLtfDULFUwYjq9b2jCpYPsqWTT+EI+Oo+QEOUn8cP0Mjf1Whd 38vlGYjheHrGZv9isFXVyXiZCiPavDJyISS4/MFmzD2KEObF67WYZ8aHkonGjs80xY2j 4C4h51YdKo9bmKlqtAaPbUnajfnYnt9TzDopYEB8Ae6J1l0eWWFk0VVvUz4eTUkZLE// tkzPXHKSEqNmiQx16eHRQkX84SzNdgWGMQFbwledcNySabuexraCiaS8gr/yEnpRi9g9 wGn2oFoxESDe8wH7sgTVnQxZRXjTkraB6Bik7PI/mmrXNJ/uMbxWhu2O7qZpapMK6hQE 6sfQ== X-Gm-Message-State: AKwxyteVCtNhcbimRn8mK6x9tp7tDBrEtYRhxdCbbJUZLr8J1R8trnt5 RsYwekOH8Horb8a0lapMlLciIA== X-Received: by 10.98.161.16 with SMTP id b16mr17505876pff.34.1516291553210; Thu, 18 Jan 2018 08:05:53 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id f1sm11232587pgo.46.2018.01.18.08.05.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 08:05:52 -0800 (PST) Date: Thu, 18 Jan 2018 08:05:52 -0800 (PST) X-Google-Original-Date: Thu, 18 Jan 2018 08:01:55 PST (-0800) Subject: Re: [PATCH] MIPS: use generic GCC library routines from lib/ In-Reply-To: <20180117090348.GA20406@mredfearn-linux> CC: antonynpavlov@gmail.com, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, ralf@linux-mips.org From: Palmer Dabbelt To: matt.redfearn@mips.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Jan 2018 01:03:48 PST (-0800), matt.redfearn@mips.com wrote: > Hi, > > On Wed, Jan 17, 2018 at 09:51:21AM +0300, Antony Pavlov wrote: >> The commit b35cd9884fa5 ("lib: Add shared copies of >> some GCC library routines") makes it possible >> to share generic GCC library routines by several >> architectures. >> >> This commit removes several generic GCC library >> routines from arch/mips/lib/ in favour of similar >> routines from lib/. >> >> Signed-off-by: Antony Pavlov >> Cc: Palmer Dabbelt >> Cc: Ralf Baechle >> Cc: linux-mips@linux-mips.org >> Cc: linux-kernel@vger.kernel.org >> --- >> arch/mips/Kconfig | 5 +++++ >> arch/mips/lib/Makefile | 2 +- >> arch/mips/lib/ashldi3.c | 30 ------------------------------ >> arch/mips/lib/ashrdi3.c | 32 -------------------------------- >> arch/mips/lib/cmpdi2.c | 28 ---------------------------- >> arch/mips/lib/lshrdi3.c | 30 ------------------------------ >> arch/mips/lib/ucmpdi2.c | 22 ---------------------- >> 7 files changed, 6 insertions(+), 143 deletions(-) >> delete mode 100644 arch/mips/lib/ashldi3.c >> delete mode 100644 arch/mips/lib/ashrdi3.c >> delete mode 100644 arch/mips/lib/cmpdi2.c >> delete mode 100644 arch/mips/lib/lshrdi3.c >> delete mode 100644 arch/mips/lib/ucmpdi2.c >> >> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig >> index 350a990fc719..9cd49ee848c6 100644 >> --- a/arch/mips/Kconfig >> +++ b/arch/mips/Kconfig >> @@ -73,6 +73,11 @@ config MIPS >> select RTC_LIB if !MACH_LOONGSON64 >> select SYSCTL_EXCEPTION_TRACE >> select VIRT_TO_BUS >> + select GENERIC_ASHLDI3 >> + select GENERIC_ASHRDI3 >> + select GENERIC_LSHRDI3 >> + select GENERIC_CMPDI2 >> + select GENERIC_UCMPDI2 > > Please preserve alphabetical order > >> >> menu "Machine selection" >> >> diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile >> index 78c2affeabf8..195ab4cb0840 100644 >> --- a/arch/mips/lib/Makefile >> +++ b/arch/mips/lib/Makefile >> @@ -16,4 +16,4 @@ obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o >> obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o >> >> # libgcc-style stuff needed in the kernel >> -obj-y += ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o ucmpdi2.o >> +obj-y += bswapsi.o bswapdi.o >> diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c >> deleted file mode 100644 >> index 24cd6903e797..000000000000 >> --- a/arch/mips/lib/ashldi3.c >> +++ /dev/null >> @@ -1,30 +0,0 @@ >> -// SPDX-License-Identifier: GPL-2.0 >> -#include >> - >> -#include "libgcc.h" >> - >> -long long notrace __ashldi3(long long u, word_type b) >> -{ >> - DWunion uu, w; >> - word_type bm; >> - >> - if (b == 0) >> - return u; >> - >> - uu.ll = u; >> - bm = 32 - b; >> - >> - if (bm <= 0) { >> - w.s.low = 0; >> - w.s.high = (unsigned int) uu.s.low << -bm; >> - } else { >> - const unsigned int carries = (unsigned int) uu.s.low >> bm; >> - >> - w.s.low = (unsigned int) uu.s.low << b; >> - w.s.high = ((unsigned int) uu.s.high << b) | carries; >> - } >> - >> - return w.ll; >> -} >> - >> -EXPORT_SYMBOL(__ashldi3); >> diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c >> deleted file mode 100644 >> index 23f5295af51e..000000000000 >> --- a/arch/mips/lib/ashrdi3.c >> +++ /dev/null >> @@ -1,32 +0,0 @@ >> -// SPDX-License-Identifier: GPL-2.0 >> -#include >> - >> -#include "libgcc.h" >> - >> -long long notrace __ashrdi3(long long u, word_type b) >> -{ >> - DWunion uu, w; >> - word_type bm; >> - >> - if (b == 0) >> - return u; >> - >> - uu.ll = u; >> - bm = 32 - b; >> - >> - if (bm <= 0) { >> - /* w.s.high = 1..1 or 0..0 */ >> - w.s.high = >> - uu.s.high >> 31; >> - w.s.low = uu.s.high >> -bm; >> - } else { >> - const unsigned int carries = (unsigned int) uu.s.high << bm; >> - >> - w.s.high = uu.s.high >> b; >> - w.s.low = ((unsigned int) uu.s.low >> b) | carries; >> - } >> - >> - return w.ll; >> -} >> - >> -EXPORT_SYMBOL(__ashrdi3); >> diff --git a/arch/mips/lib/cmpdi2.c b/arch/mips/lib/cmpdi2.c >> deleted file mode 100644 >> index 93cfc785927d..000000000000 >> --- a/arch/mips/lib/cmpdi2.c >> +++ /dev/null >> @@ -1,28 +0,0 @@ >> -// SPDX-License-Identifier: GPL-2.0 >> -#include >> - >> -#include "libgcc.h" >> - >> -word_type notrace __cmpdi2(long long a, long long b) >> -{ >> - const DWunion au = { >> - .ll = a >> - }; >> - const DWunion bu = { >> - .ll = b >> - }; >> - >> - if (au.s.high < bu.s.high) >> - return 0; >> - else if (au.s.high > bu.s.high) >> - return 2; >> - >> - if ((unsigned int) au.s.low < (unsigned int) bu.s.low) >> - return 0; >> - else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) >> - return 2; >> - >> - return 1; >> -} >> - >> -EXPORT_SYMBOL(__cmpdi2); >> diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c >> deleted file mode 100644 >> index 914b971aca3b..000000000000 >> --- a/arch/mips/lib/lshrdi3.c >> +++ /dev/null >> @@ -1,30 +0,0 @@ >> -// SPDX-License-Identifier: GPL-2.0 >> -#include >> - >> -#include "libgcc.h" >> - >> -long long notrace __lshrdi3(long long u, word_type b) >> -{ >> - DWunion uu, w; >> - word_type bm; >> - >> - if (b == 0) >> - return u; >> - >> - uu.ll = u; >> - bm = 32 - b; >> - >> - if (bm <= 0) { >> - w.s.high = 0; >> - w.s.low = (unsigned int) uu.s.high >> -bm; >> - } else { >> - const unsigned int carries = (unsigned int) uu.s.high << bm; >> - >> - w.s.high = (unsigned int) uu.s.high >> b; >> - w.s.low = ((unsigned int) uu.s.low >> b) | carries; >> - } >> - >> - return w.ll; >> -} >> - >> -EXPORT_SYMBOL(__lshrdi3); >> diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c >> deleted file mode 100644 >> index c31c78ca4175..000000000000 >> --- a/arch/mips/lib/ucmpdi2.c >> +++ /dev/null >> @@ -1,22 +0,0 @@ >> -// SPDX-License-Identifier: GPL-2.0 >> -#include >> - >> -#include "libgcc.h" >> - >> -word_type notrace __ucmpdi2(unsigned long long a, unsigned long long b) > > The version of __ucmpdi2 in /lib/ is not marked notrace. We have seen > issues before with compiler intrinsics not being marked notrace - see > aedcfbe06558 ("MIPS: lib: Mark intrinsics notrace") > > Please ensure that the /lib/ version is equivalent before switching to > that version. IIRC we marked the others as notrace for a similar reason, I must have just missed this one somehow. I can submit a patch. Thanks! > > Thanks, > Matt > >> -{ >> - const DWunion au = {.ll = a}; >> - const DWunion bu = {.ll = b}; >> - >> - if ((unsigned int) au.s.high < (unsigned int) bu.s.high) >> - return 0; >> - else if ((unsigned int) au.s.high > (unsigned int) bu.s.high) >> - return 2; >> - if ((unsigned int) au.s.low < (unsigned int) bu.s.low) >> - return 0; >> - else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) >> - return 2; >> - return 1; >> -} >> - >> -EXPORT_SYMBOL(__ucmpdi2); >> -- >> 2.15.1 >> >>