Received: by 10.223.176.5 with SMTP id f5csp2176813wra; Thu, 8 Feb 2018 09:36:24 -0800 (PST) X-Google-Smtp-Source: AH8x224tFz0FqAQVmj9owElXJUCcKSCYYyS9Nwys+8vh8dayFK9wO5IidnkpXwlE/HCdLuKVO43u X-Received: by 10.98.217.141 with SMTP id b13mr1362631pfl.239.1518111384232; Thu, 08 Feb 2018 09:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518111384; cv=none; d=google.com; s=arc-20160816; b=hsHhAco+9NmBJqU1TlUU6kFcWpI3ZX/jKw+tE4LD+sVwqPG/o+Pgf6eUZPsrvtsCNI cmQPnJR+BZbAxHPvAhXTPhQAf35/KLsm1i4SpX9GPb8YhrKiZmq/lUc3fZNA4YhAsLRz JeG47GlVSIolvFkU7csS7SGRsJDd78Vijqr9jNxNl7C0wYNUhO4Bl5W8/Ok/GKDzTXtM ytRTuYwEL+Nr1ZFQDO12PBN/L51vMjI9Zso6M9Ji5eK97P4PfBhR6L4EJ7knKezjRglZ r3wXvdnNomS1+LOCzyDnjyChp2QNKOIhZE6CNEP3jMTm/pkki7+u1hrzMv591AkJtk5W m7aQ== 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=ImPz4nFkAS9FraCSUS9bTNzPkXhgTN6QjxvVy55UUS8=; b=VRKTcpmluI7HeLor4z+v/SDRX073sbC5DotqiecU2qejFMNjsjr+Gg9BHqabadfpMR 98W6b2FGyYmBgqRP37ivnmqMTx9n+GSrfVg2x0JTE2CUxGau0BZAh/X89s33g3h5Em7J zHpRUIZTl9aQSNcPGFX67s1eGQ29lxCyMjJQMSP00LYz+0kfOH+gnf4d4bHCoWVQeYa0 WmRYuE1CKYAWHnUDDpkiv5afEGzmuOyBIW70FiGxkX45FOM1JIUXfNY0W+XsQ5HIpFFa Z7zUzYcCcuKrOltHTsZauy+cmTvtUFXIHx0FfMXeYOv6+zu5HpiRWvfnjTNFm5LdxATs a0DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bKSICy5u; 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 p14-v6si236327pli.114.2018.02.08.09.36.07; Thu, 08 Feb 2018 09:36:24 -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=bKSICy5u; 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 S1752240AbeBHRev (ORCPT + 99 others); Thu, 8 Feb 2018 12:34:51 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45988 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752132AbeBHRet (ORCPT ); Thu, 8 Feb 2018 12:34:49 -0500 Received: by mail-pl0-f68.google.com with SMTP id p5so156090plo.12 for ; Thu, 08 Feb 2018 09:34:49 -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=ImPz4nFkAS9FraCSUS9bTNzPkXhgTN6QjxvVy55UUS8=; b=bKSICy5u8oTY6rofa0YlPkuKUmypjWiRkcQqrSCd4JvhXE77dRSq6/KfYCHu3NjX+V 6smURJMpPNW87TnOHy8JH1aPbTzQc9RrbgkLr88Rrsp6Ey9c4u61cbqmisqGiUmBiOwr 5TWpjId1Jye/P+ptMmWnpa7XzOiqsi/Fj8N0AjK3T2oOz6ctGiOLEYsx78NAKs/5Ui0j +eaPr/UB+81p1DrBE68+Csrm04s75eiwAuu4m1VUf7AjbQVQ+cIM9pPhZ5fai+VGXdpN ct06uKFJ1gmA4LOIDwSicE1tgTd1DD76gSjOtdWYAIxe0qCMT/H8eYXp4tzaHjJbEGUX nNIQ== 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=ImPz4nFkAS9FraCSUS9bTNzPkXhgTN6QjxvVy55UUS8=; b=rRiBqwblRKqhJufOwUhysxgRT/9SD7Itm8hV5DNjW+3OhKXEzNf82L/zMbb+qKpLUC w144hWEqWGxa1wYrcVhe0A0fsbtGoUP0dIEHNL9IriLjKArWClhu73kDtXS5F3RmBsb2 EmFI6q+nQylC/q42ATFLff675BxMNUsW2zsLn6lO/nfflmB16/6591jcFEpkoMdV/nVY nTjaZ6GBmuRNXkOxppu9x2j3iT46tfTFhP7fLSb2k1nIrSDyXPyYFcbi884m4EFTPdvb x6e/GlOVjiFbgBFM6pB3qyywBAOfbzlbWS7+jr4hLr4lYklRFczHljRM9ucALRWakYbh FtgA== X-Gm-Message-State: APf1xPBR2K520sjahyurJGyYn/8V6b5Obo5x9/vzeHerKhYsfGKACiwi 3sHIIuDT0HgRRrC9llLY4XvDdA== X-Received: by 2002:a17:902:8d85:: with SMTP id v5-v6mr1320677plo.37.1518111288842; Thu, 08 Feb 2018 09:34:48 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id a23sm1167869pfa.149.2018.02.08.09.34.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 09:34:48 -0800 (PST) Date: Thu, 08 Feb 2018 09:34:48 -0800 (PST) X-Google-Original-Date: Thu, 08 Feb 2018 09:31:08 PST (-0800) Subject: Re: [PATCH v3 2/2] MIPS: use generic GCC library routines from lib/ In-Reply-To: CC: antonynpavlov@gmail.com, linux-mips@linux-mips.org, jhogan@kernel.org, ralf@linux-mips.org, linux-kernel@vger.kernel.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, 31 Jan 2018 08:07:51 PST (-0800), matt.redfearn@mips.com wrote: > Hi, > > On 31/01/18 15:33, 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: Matt Redfearn >> Cc: James Hogan >> 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(-) >> >> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig >> index 350a990fc719..b63a5422d485 100644 >> --- a/arch/mips/Kconfig >> +++ b/arch/mips/Kconfig >> @@ -18,16 +18,21 @@ config MIPS >> select BUILDTIME_EXTABLE_SORT >> select CLONE_BACKWARDS >> select CPU_PM if CPU_IDLE >> + select GENERIC_ASHLDI3 >> + select GENERIC_ASHRDI3 >> select GENERIC_ATOMIC64 if !64BIT >> select GENERIC_CLOCKEVENTS >> select GENERIC_CMOS_UPDATE >> + select GENERIC_CMPDI2 >> select GENERIC_CPU_AUTOPROBE >> select GENERIC_IRQ_PROBE >> select GENERIC_IRQ_SHOW >> + select GENERIC_LSHRDI3 >> select GENERIC_PCI_IOMAP >> select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC >> select GENERIC_SMP_IDLE_THREAD >> select GENERIC_TIME_VSYSCALL >> + select GENERIC_UCMPDI2 >> select HANDLE_DOMAIN_IRQ >> select HAVE_ARCH_JUMP_LABEL >> select HAVE_ARCH_KGDB > > OK, thanks for changing this. But to be honest, it does look pretty > messy like this. I feel like the CONFIG names should be something a > little more descriptive, such as CONFIG_GENERIC_LIB_*, putting them in a > namespace that would at least group them all together. Right now, AFAIK > there's only RISC-V using these so it shouldn't be too painful to change > them. What do you think Antony / Palmer? That looks good to me. It's a bit odd that they aren't all together. > > Thanks, > Matt > > >> 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) >> -{ >> - 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); >>