2018-04-03 09:26:26

by Matt Redfearn

[permalink] [raw]
Subject: [PATCH v5 1/3] Add notrace to lib/ucmpdi2.c

From: Palmer Dabbelt <[email protected]>

As part of the MIPS conversion to use the generic GCC library routines,
Matt Redfearn discovered that I'd missed a notrace on __ucmpdi2(). This
patch rectifies the problem.

CC: Matt Redfearn <[email protected]>
CC: Antony Pavlov <[email protected]>
Signed-off-by: Palmer Dabbelt <[email protected]>
Reviewed-by: Matt Redfearn <[email protected]>
Signed-off-by: Matt Redfearn <[email protected]>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
add notrace to lib/ucmpdi2.c

lib/ucmpdi2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ucmpdi2.c b/lib/ucmpdi2.c
index 25ca2d4c1e19..597998169a96 100644
--- a/lib/ucmpdi2.c
+++ b/lib/ucmpdi2.c
@@ -17,7 +17,7 @@
#include <linux/module.h>
#include <linux/libgcc.h>

-word_type __ucmpdi2(unsigned long long a, unsigned long long b)
+word_type notrace __ucmpdi2(unsigned long long a, unsigned long long b)
{
const DWunion au = {.ll = a};
const DWunion bu = {.ll = b};
--
2.7.4



2018-04-03 09:28:20

by Matt Redfearn

[permalink] [raw]
Subject: [PATCH v5 2/3] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

When these are included into arch Kconfig files, maintaining
alphabetical ordering of the selects means these get split up. To allow
for keeping things tidier and alphabetical, rename the selects to
GENERIC_LIB_*

Signed-off-by: Matt Redfearn <[email protected]>
Reviewed-by: Palmer Dabbelt <[email protected]>

---

Changes in v5: None
Changes in v4:
Rename Kconfig symbols GENERIC_* -> GENERIC_LIB_*

Changes in v3: None
Changes in v2: None

arch/riscv/Kconfig | 6 +++---
lib/Kconfig | 12 ++++++------
lib/Makefile | 12 ++++++------
3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 04807c7f64cc..20185aaaf933 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -104,9 +104,9 @@ config ARCH_RV32I
bool "RV32I"
select CPU_SUPPORTS_32BIT_KERNEL
select 32BIT
- select GENERIC_ASHLDI3
- select GENERIC_ASHRDI3
- select GENERIC_LSHRDI3
+ select GENERIC_LIB_ASHLDI3
+ select GENERIC_LIB_ASHRDI3
+ select GENERIC_LIB_LSHRDI3

config ARCH_RV64I
bool "RV64I"
diff --git a/lib/Kconfig b/lib/Kconfig
index e96089499371..e54ebe00937e 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -588,20 +588,20 @@ config STRING_SELFTEST

endmenu

-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
bool

-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
bool

-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
bool

-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
bool

-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
bool

-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
bool
diff --git a/lib/Makefile b/lib/Makefile
index a90d4fcd748f..7425e177f08c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -253,9 +253,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
obj-$(CONFIG_PARMAN) += parman.o

# GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
--
2.7.4


2018-04-03 09:28:57

by Matt Redfearn

[permalink] [raw]
Subject: [PATCH v5 3/3] MIPS: use generic GCC library routines from lib/

From: Antony Pavlov <[email protected]>

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 <[email protected]>
[Matt Redfearn] Use GENERIC_LIB_* named Kconfig entries
Signed-off-by: Matt Redfearn <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Matt Redfearn <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: [email protected]
Cc: [email protected]

---

Changes in v5:
Actually delete the MIPS lib routines

Changes in v4:
Rework to use the new GENERIC_LIB_ Kconfig entries

Changes in v3:
Maintain alphabetical order of MIPS Kconfig

Changes in v2: None

arch/mips/Kconfig | 5 +++++
arch/mips/lib/Makefile | 3 +--
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(+), 144 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 8128c3b68d6b..98955a76c656 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -22,6 +22,11 @@ config MIPS
select GENERIC_CPU_AUTOPROBE
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
+ select GENERIC_LIB_ASHLDI3
+ select GENERIC_LIB_ASHRDI3
+ select GENERIC_LIB_CMPDI2
+ select GENERIC_LIB_LSHRDI3
+ select GENERIC_LIB_UCMPDI2
select GENERIC_PCI_IOMAP
select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
select GENERIC_SMP_IDLE_THREAD
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index e84e12655fa8..6537e022ef62 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -16,5 +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 multi3.o \
- ucmpdi2.o
+obj-y += bswapsi.o bswapdi.o multi3.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 <linux/export.h>
-
-#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 <linux/export.h>
-
-#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 <linux/export.h>
-
-#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 <linux/export.h>
-
-#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 <linux/export.h>
-
-#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);
--
2.7.4


2018-04-03 16:09:13

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH v5 3/3] MIPS: use generic GCC library routines from lib/

On Tue, Apr 03, 2018 at 10:24:26AM +0100, Matt Redfearn wrote:
> From: Antony Pavlov <[email protected]>
>
> 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 <[email protected]>
> [Matt Redfearn] Use GENERIC_LIB_* named Kconfig entries
> Signed-off-by: Matt Redfearn <[email protected]>
> Cc: Palmer Dabbelt <[email protected]>
> Cc: Matt Redfearn <[email protected]>
> Cc: James Hogan <[email protected]>
> Cc: Ralf Baechle <[email protected]>
> Cc: [email protected]
> Cc: [email protected]

ci20_defconfig:
make[1]: *** No rule to make target 'arch/mips/lib/ashldi3.c', needed by 'arch/mips/boot/compressed/ashldi3.c'. Stop.
make[1]: *** Waiting for unfinished jobs....
make: *** [arch/mips/Makefile +395 : vmlinuz] Error 2

same for db1xxx_defconfig (and possibly others).

Thanks
James


Attachments:
(No filename) (1.11 kB)
signature.asc (849.00 B)
Digital signature
Download all attachments

2018-04-03 23:28:17

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v5 2/3] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

On Tue, 03 Apr 2018 02:24:25 PDT (-0700), [email protected] wrote:
> When these are included into arch Kconfig files, maintaining
> alphabetical ordering of the selects means these get split up. To allow
> for keeping things tidier and alphabetical, rename the selects to
> GENERIC_LIB_*
>
> Signed-off-by: Matt Redfearn <[email protected]>
> Reviewed-by: Palmer Dabbelt <[email protected]>
>
> ---
>
> Changes in v5: None
> Changes in v4:
> Rename Kconfig symbols GENERIC_* -> GENERIC_LIB_*
>
> Changes in v3: None
> Changes in v2: None
>
> arch/riscv/Kconfig | 6 +++---
> lib/Kconfig | 12 ++++++------
> lib/Makefile | 12 ++++++------
> 3 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 04807c7f64cc..20185aaaf933 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -104,9 +104,9 @@ config ARCH_RV32I
> bool "RV32I"
> select CPU_SUPPORTS_32BIT_KERNEL
> select 32BIT
> - select GENERIC_ASHLDI3
> - select GENERIC_ASHRDI3
> - select GENERIC_LSHRDI3
> + select GENERIC_LIB_ASHLDI3
> + select GENERIC_LIB_ASHRDI3
> + select GENERIC_LIB_LSHRDI3
>
> config ARCH_RV64I
> bool "RV64I"
> diff --git a/lib/Kconfig b/lib/Kconfig
> index e96089499371..e54ebe00937e 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -588,20 +588,20 @@ config STRING_SELFTEST
>
> endmenu
>
> -config GENERIC_ASHLDI3
> +config GENERIC_LIB_ASHLDI3
> bool
>
> -config GENERIC_ASHRDI3
> +config GENERIC_LIB_ASHRDI3
> bool
>
> -config GENERIC_LSHRDI3
> +config GENERIC_LIB_LSHRDI3
> bool
>
> -config GENERIC_MULDI3
> +config GENERIC_LIB_MULDI3
> bool
>
> -config GENERIC_CMPDI2
> +config GENERIC_LIB_CMPDI2
> bool
>
> -config GENERIC_UCMPDI2
> +config GENERIC_LIB_UCMPDI2
> bool
> diff --git a/lib/Makefile b/lib/Makefile
> index a90d4fcd748f..7425e177f08c 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -253,9 +253,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
> obj-$(CONFIG_PARMAN) += parman.o
>
> # GCC library routines
> -obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
> -obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
> -obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
> -obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
> -obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
> -obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
> +obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
> +obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
> +obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
> +obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
> +obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
> +obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o

Sorry, I'm not sure if this is the right patch -- someone suggested acking
this, but it's already Review-By me and if I understand correctly it's going
through your tree. I'm a bit new to this, but if it helps then here's a

Acked-By: Palmer Dabbelt <[email protected]>



2018-04-04 09:20:27

by Matt Redfearn

[permalink] [raw]
Subject: [PATCH] MIPS: vmlinuz: Fix compiler intrinsics location and build directly

Since commit "MIPS: use generic GCC library routines from lib/", MIPS
now uses the generic lib/ashldi3.c, but bswapsi.c still comes from
arch/mips/lib. The rules for including these into vmlinuz need updating
to reflect these locations.
Both objects need to be built with different CFLAGS for inclusion to
vmlinuz rather than simply including the object built for the main
kernel image. But the copy of the source C file can be avoided by simply
calling cmd,cc_o_c to build the object from the source directly. This
also removes the need for the .gitignore file to ignore the copied
files, and the extra-y rule to clean them.

Signed-off-by: Matt Redfearn <[email protected]>
---

arch/mips/boot/compressed/.gitignore | 2 --
arch/mips/boot/compressed/Makefile | 8 ++++----
2 files changed, 4 insertions(+), 6 deletions(-)
delete mode 100644 arch/mips/boot/compressed/.gitignore

diff --git a/arch/mips/boot/compressed/.gitignore b/arch/mips/boot/compressed/.gitignore
deleted file mode 100644
index ebae133f1d00..000000000000
--- a/arch/mips/boot/compressed/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-ashldi3.c
-bswapsi.c
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index adce180f3ee4..8f04d659a915 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -46,10 +46,10 @@ $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c

vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o

-extra-y += ashldi3.c bswapsi.c
-$(obj)/ashldi3.o $(obj)/bswapsi.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
-$(obj)/ashldi3.c $(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c
- $(call cmd,shipped)
+$(obj)/ashldi3.o: $(srctree)/lib/ashldi3.c
+ $(call cmd,cc_o_c)
+$(obj)/bswapsi.o: $(srctree)/arch/mips/lib/bswapsi.c
+ $(call cmd,cc_o_c)

targets := $(notdir $(vmlinuzobjs-y))

--
2.7.4


2018-04-04 22:04:26

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH v5 2/3] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

On Tue, Apr 03, 2018 at 03:39:34PM -0700, Palmer Dabbelt wrote:
> Sorry, I'm not sure if this is the right patch -- someone suggested acking
> this, but it's already Review-By me and if I understand correctly it's going
> through your tree. I'm a bit new to this, but if it helps then here's a
>
> Acked-By: Palmer Dabbelt <[email protected]>

Thanks Palmer.

No worries. FYI Documentation/process/submitting-patches.rst appears to
now contain lots of gory detail about what Acked-by and Reviewed-by are
supposed to mean.

In this case an acked-by is needed to show your approval of the parts of
the patch which touch the subsystem you are responsible for (and/or code
which you have authored) so that the patch can go via another tree. It
usually indicates that you've reviewed those parts of the patch too, but
not necessarily the whole thing.

Cheers
James


Attachments:
(No filename) (885.00 B)
signature.asc (849.00 B)
Digital signature
Download all attachments

2018-04-05 00:16:06

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v5 2/3] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

On Wed, 04 Apr 2018 15:02:58 PDT (-0700), [email protected] wrote:
> On Tue, Apr 03, 2018 at 03:39:34PM -0700, Palmer Dabbelt wrote:
>> Sorry, I'm not sure if this is the right patch -- someone suggested acking
>> this, but it's already Review-By me and if I understand correctly it's going
>> through your tree. I'm a bit new to this, but if it helps then here's a
>>
>> Acked-By: Palmer Dabbelt <[email protected]>
>
> Thanks Palmer.
>
> No worries. FYI Documentation/process/submitting-patches.rst appears to
> now contain lots of gory detail about what Acked-by and Reviewed-by are
> supposed to mean.
>
> In this case an acked-by is needed to show your approval of the parts of
> the patch which touch the subsystem you are responsible for (and/or code
> which you have authored) so that the patch can go via another tree. It
> usually indicates that you've reviewed those parts of the patch too, but
> not necessarily the whole thing.

Thanks!

2018-04-05 10:15:03

by Matt Redfearn

[permalink] [raw]
Subject: Re: [PATCH] MIPS: vmlinuz: Fix compiler intrinsics location and build directly

Hi James,

Actually, this patch would be better inserted as patch 3 in the series
since it can pull in the generic ashldi3 before the MIPS one is removed
in the final patch. Here's an updated commit message:

MIPS: vmlinuz: Use generic ashldi3 and build directly



In preparation for removing some of the MIPS compiler intrinsics from

arch/mips/lib, first update the build of vmlinuz to use the generic

ashldi3 from lib.



Both ashldi3 and bswapsi objects need to be built with different CFLAGS

for inclusion to vmlinuz rather than simply including the object built

for the main kernel image. But the current copy of the source C file to

arch/mips/boot/compressed can be avoided by simply calling cmd,cc_o_c to

build the object from the source directly. This also removes the need

for the .gitignore file to ignore the copied files, and the extra-y rule

to clean them.

Signed-off-by: Matt Redfearn <[email protected]>

Thanks,
Matt



On 04/04/18 10:18, Matt Redfearn wrote:
> Since commit "MIPS: use generic GCC library routines from lib/", MIPS
> now uses the generic lib/ashldi3.c, but bswapsi.c still comes from
> arch/mips/lib. The rules for including these into vmlinuz need updating
> to reflect these locations.
> Both objects need to be built with different CFLAGS for inclusion to
> vmlinuz rather than simply including the object built for the main
> kernel image. But the copy of the source C file can be avoided by simply
> calling cmd,cc_o_c to build the object from the source directly. This
> also removes the need for the .gitignore file to ignore the copied
> files, and the extra-y rule to clean them.
>
> Signed-off-by: Matt Redfearn <[email protected]>
> ---
>
> arch/mips/boot/compressed/.gitignore | 2 --
> arch/mips/boot/compressed/Makefile | 8 ++++----
> 2 files changed, 4 insertions(+), 6 deletions(-)
> delete mode 100644 arch/mips/boot/compressed/.gitignore
>
> diff --git a/arch/mips/boot/compressed/.gitignore b/arch/mips/boot/compressed/.gitignore
> deleted file mode 100644
> index ebae133f1d00..000000000000
> --- a/arch/mips/boot/compressed/.gitignore
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -ashldi3.c
> -bswapsi.c
> diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
> index adce180f3ee4..8f04d659a915 100644
> --- a/arch/mips/boot/compressed/Makefile
> +++ b/arch/mips/boot/compressed/Makefile
> @@ -46,10 +46,10 @@ $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
>
> vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o
>
> -extra-y += ashldi3.c bswapsi.c
> -$(obj)/ashldi3.o $(obj)/bswapsi.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
> -$(obj)/ashldi3.c $(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c
> - $(call cmd,shipped)
> +$(obj)/ashldi3.o: $(srctree)/lib/ashldi3.c
> + $(call cmd,cc_o_c)
> +$(obj)/bswapsi.o: $(srctree)/arch/mips/lib/bswapsi.c
> + $(call cmd,cc_o_c)
>
> targets := $(notdir $(vmlinuzobjs-y))
>
>

2018-04-05 21:46:40

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] MIPS: vmlinuz: Fix compiler intrinsics location and build directly

On Thu, Apr 05, 2018 at 11:13:14AM +0100, Matt Redfearn wrote:
> Actually, this patch would be better inserted as patch 3 in the series
> since it can pull in the generic ashldi3 before the MIPS one is removed
> in the final patch. Here's an updated commit message:

Thanks Matt, applied.

Cheers
James


Attachments:
(No filename) (314.00 B)
signature.asc (849.00 B)
Digital signature
Download all attachments

2018-04-06 23:13:23

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] MIPS: vmlinuz: Fix compiler intrinsics location and build directly

On Thu, Apr 05, 2018 at 10:42:19PM +0100, James Hogan wrote:
> On Thu, Apr 05, 2018 at 11:13:14AM +0100, Matt Redfearn wrote:
> > Actually, this patch would be better inserted as patch 3 in the series
> > since it can pull in the generic ashldi3 before the MIPS one is removed
> > in the final patch. Here's an updated commit message:
>
> Thanks Matt, applied.

Loongson1b/c defconfigs are still broken unfortunately. The .o files
aren't getting generated, apparently due to a different cmd_cc_o_c
definition when CONFIG_MODVERSIONS=y.

I'm gonna drop this patchset from 4.17. Hopefully an updated version can
be applied for 4.18 after the merge window.

Thanks
James


Attachments:
(No filename) (688.00 B)
signature.asc (849.00 B)
Digital signature
Download all attachments