Skip to contentSkip to conversation

sh: Use -m2a-nofpu only

PATCH New Tom Rini 3 participants 12 messages Feb 17, 2018 – Feb 19, 2018

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/5 sh: Use -m2a-nofpu only

Based on reading over the GCC manual, passing both -m2a and -m2a-nofpu are redundant, as -m2a-nofpu will provide functional code for both. As -m2a-nofpu functions with more toolchains and does what is expected, switch.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/sh/cpu/sh2/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/cpu/sh2/config.mk +1 -1
index 12e202d539a0..a063e8361c98 100644
@@ -8,7 +8,7 @@
 ENDIANNESS += -EB
 
 ifdef CONFIG_CPU_SH2A
-PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb
+PLATFORM_CPPFLAGS += -m2a-nofpu -mb
 else # SH2
 PLATFORM_CPPFLAGS += -m3e -mb
 endif
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/5 travis-ci: Enable more SH to be tested

With the switch to newer toolchains from kernel.org we can now fetch an sh2 toolchain that will build for sh2/3/4, so switch to that.

---
 .travis.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
.travis.yml +4 -4
index 7b53b3dddc1b..a67d3c3dbab6 100644
@@ -38,7 +38,7 @@ install:
  - echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
  - echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman
  - echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
- - echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
+ - echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman
  - cat ~/.buildman
  - virtualenv /tmp/venv
  - . /tmp/venv/bin/activate
@@ -63,7 +63,7 @@ before_script:
   - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
   - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
   - if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi
-  - if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi
+  - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
   - if [[ "${TOOLCHAIN}" == *x86_64* ]]; then
       ./tools/buildman/buildman --fetch-arch x86_64;
       echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman;
@@ -268,8 +268,8 @@ matrix:
     - env:
         - BUILDMAN="rockchip"
     - env:
-        - BUILDMAN="sh4"
-          TOOLCHAIN="sh4"
+        - BUILDMAN="sh"
+          TOOLCHAIN="sh"
     - env:
         - JOB="Xilinx (ARM)"
           BUILDMAN="xilinx -x microblaze"
Signature · 1 line
2.7.4
Applied
#2 lore raw

PATCH 2/5 travis-ci: Enable more SH to be tested

Quoted 32 lines · Tom Rini

With the switch to newer toolchains from kernel.org we can now fetch an sh2 toolchain that will build for sh2/3/4, so switch to that.

---
 .travis.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
.travis.yml +2 -2
index 7b53b3dddc1b..a67d3c3dbab6 100644
@@ -38,7 +38,7 @@ install:
  - echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
  - echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman
  - echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
- - echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
+ - echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman
  - cat ~/.buildman
  - virtualenv /tmp/venv
  - . /tmp/venv/bin/activate
@@ -63,7 +63,7 @@ before_script:
   - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
   - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
   - if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi
-  - if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi
+  - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
   - if [[ "${TOOLCHAIN}" == *x86_64* ]]; then
       ./tools/buildman/buildman --fetch-arch x86_64;
       echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman;

.travis.yml matrix: · line 275

Quoted 10 lines
.travis.yml +2 -2
@@ -268,8 +268,8 @@ matrix:
     - env:
         - BUILDMAN="rockchip"
     - env:
-        - BUILDMAN="sh4"
-          TOOLCHAIN="sh4"
+        - BUILDMAN="sh"
+          TOOLCHAIN="sh"
     - env:
         - JOB="Xilinx (ARM)"
           BUILDMAN="xilinx -x microblaze"

Applied, thanks

Signature · 2 lines
Best regards,
Marek Vasut
author
#3 lore raw

PATCH 2/5 travis-ci: Enable more SH to be tested

Quoted 36 lines · Marek Vasut
Quoted 35 lines · Tom Rini

With the switch to newer toolchains from kernel.org we can now fetch an sh2 toolchain that will build for sh2/3/4, so switch to that.

---
 .travis.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
.travis.yml +2 -3
index 7b53b3dddc1b..a67d3c3dbab6 100644
@@ -38,7 +38,7 @@ install:
  - echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
  - echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman
  - echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
- - echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
+ - echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman
  - cat ~/.buildman
  - virtualenv /tmp/venv
  - . /tmp/venv/bin/activate
@@ -63,7 +63,7 @@ before_script:
   - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
   - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
   - if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi
-  - if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi
+  - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
   - if [[ "${TOOLCHAIN}" == *x86_64* ]]; then
       ./tools/buildman/buildman --fetch-arch x86_64;
       echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman;
@@ -268,8 +268,8 @@ matrix:
     - env:
         - BUILDMAN="rockchip"
     - env:
-        - BUILDMAN="sh4"
Quoted 8 lines

.travis.yml matrix: · line 275

Quoted 7 lines
.travis.yml +2 -1
-          TOOLCHAIN="sh4"
+        - BUILDMAN="sh"
+          TOOLCHAIN="sh"
     - env:
         - JOB="Xilinx (ARM)"
           BUILDMAN="xilinx -x microblaze"

Applied, thanks

Sorry, I should have put some comments below the commit on this one. It depends on Daniel's patches that fix some other issues so that we can use the newer toolchains first.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180219/d80d4d7b/attachment.sig>
author
#4 lore raw

PATCH 3/5 net: sh_eth: Fix unused variable warnings

In reply to Tom Rini

With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.

Cc Joe Hershberger <[email protected]>
---
 drivers/net/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sh_eth.c +2 -2
index 850fe1587f59..6f48e93ab53d 100644
@@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth)
 #ifndef CONFIG_DM_ETH
 static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth)
 {
-	int port = eth->port, ret = 0;
+	int ret = 0;
 	struct sh_eth_info *port_info = &eth->port_info[eth->port];
 	struct eth_device *dev = port_info->dev;
 	struct phy_device *phydev;
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
 
 static int sh_eth_recv_common(struct sh_eth_dev *eth)
 {
-	int port = eth->port, len = 0;
+	int len = 0;
 	struct sh_eth_info *port_info = &eth->port_info[eth->port];
 	uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/5 net: sh_eth: Fix unused variable warnings

Quoted 25 lines · Tom Rini

With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.

Cc Joe Hershberger <[email protected]>
---
 drivers/net/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sh_eth.c +1 -1
index 850fe1587f59..6f48e93ab53d 100644
@@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth)
 #ifndef CONFIG_DM_ETH
 static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth)
 {
-	int port = eth->port, ret = 0;
+	int ret = 0;
 	struct sh_eth_info *port_info = &eth->port_info[eth->port];
 	struct eth_device *dev = port_info->dev;
 	struct phy_device *phydev;

drivers/net/sh_eth.c static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len) · line 546

Quoted 8 lines
drivers/net/sh_eth.c +1 -1
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
 
 static int sh_eth_recv_common(struct sh_eth_dev *eth)
 {
-	int port = eth->port, len = 0;
+	int len = 0;
 	struct sh_eth_info *port_info = &eth->port_info[eth->port];
 	uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
 

This should be fixed in the PR I sent too.

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 3/5 net: sh_eth: Fix unused variable warnings

Quoted 26 lines · Marek Vasut
Quoted 25 lines · Tom Rini

With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.

Cc Joe Hershberger <[email protected]>
---
 drivers/net/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sh_eth.c +1 -1
index 850fe1587f59..6f48e93ab53d 100644
@@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth)
 #ifndef CONFIG_DM_ETH
 static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth)
 {
-     int port = eth->port, ret = 0;
+     int ret = 0;
      struct sh_eth_info *port_info = &eth->port_info[eth->port];
      struct eth_device *dev = port_info->dev;
      struct phy_device *phydev;
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
 
Quoted 9 lines

drivers/net/sh_eth.c static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len) · line 546

Quoted 8 lines
drivers/net/sh_eth.c +1 -1
 static int sh_eth_recv_common(struct sh_eth_dev *eth)
 {
-     int port = eth->port, len = 0;
+     int len = 0;
      struct sh_eth_info *port_info = &eth->port_info[eth->port];
      uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
 

This should be fixed in the PR I sent too.

PR or the series?

If you meant the series, then we should probably go with that instead of Tom's patch so that the series doesn't need to respin.

-Joe

#7 lore raw

PATCH 3/5 net: sh_eth: Fix unused variable warnings

Quoted 37 lines · Joe Hershberger
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Tom Rini

With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.

Cc Joe Hershberger <[email protected]>
---
 drivers/net/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sh_eth.c +1 -1
index 850fe1587f59..6f48e93ab53d 100644
@@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth)
 #ifndef CONFIG_DM_ETH
 static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth)
 {
-     int port = eth->port, ret = 0;
+     int ret = 0;
      struct sh_eth_info *port_info = &eth->port_info[eth->port];
      struct eth_device *dev = port_info->dev;
      struct phy_device *phydev;
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
 
Quoted 9 lines

drivers/net/sh_eth.c static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len) · line 546

Quoted 8 lines
drivers/net/sh_eth.c +1 -1
 static int sh_eth_recv_common(struct sh_eth_dev *eth)
 {
-     int port = eth->port, len = 0;
+     int len = 0;
      struct sh_eth_info *port_info = &eth->port_info[eth->port];
      uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
 

This should be fixed in the PR I sent too.

Quoted 1 line

PR or the series?

PR, I wrapped this patch into mine.

Signature · 2 lines
Best regards,
Marek Vasut
author
#8 lore raw

PATCH 4/5 sh: Do not provide strncmp

In reply to Tom Rini

With modern GCC, we get warnings such as:
cmd/jffs2.c: In function 'mtdparts_init':
arch/sh/include/asm/string.h:110:38:
warning: array subscript is above array bounds [-Warray-bounds]
: "0" (__cs), "1" (__ct), "r" (__cs+__n)

                                  ~~~~^~~~

This results in a small size reduction as well.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/sh/include/asm/string.h | 33 ++-------------------------------
 1 file changed, 2 insertions(+), 31 deletions(-)
arch/sh/include/asm/string.h +2 -31
index 27d981b79af8..999febcb6b7d 100644
@@ -81,37 +81,8 @@ static inline int strcmp(const char *__cs, const char *__ct)
 	return __res;
 }
 
-#define __HAVE_ARCH_STRNCMP
-static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
-{
-	register int __res;
-	unsigned long __dummy;
-
-	if (__n == 0)
-		return 0;
-
-	__asm__ __volatile__(
-		"mov.b	@%1+, %3\n"
-		"1:\n\t"
-		"mov.b	@%0+, %2\n\t"
-		"cmp/eq %6, %0\n\t"
-		"bt/s	2f\n\t"
-		" cmp/eq #0, %3\n\t"
-		"bt/s	3f\n\t"
-		" cmp/eq %3, %2\n\t"
-		"bt/s	1b\n\t"
-		" mov.b	@%1+, %3\n\t"
-		"add	#-2, %1\n\t"
-		"mov.b	@%1, %3\n"
-		"2:\n\t"
-		"sub	%3, %2\n"
-		"3:"
-		:"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
-		: "0" (__cs), "1" (__ct), "r" (__cs+__n)
-		: "t");
-
-	return __res;
-}
+#undef __HAVE_ARCH_STRNCMP
+extern int strncmp(const char *__cs, const char *__ct, size_t __n);
 
 #undef __HAVE_ARCH_MEMSET
 extern void *memset(void *__s, int __c, size_t __count);
Signature · 1 line
2.7.4
Applied
#9 lore raw

PATCH 4/5 sh: Do not provide strncmp

Quoted 50 lines · Tom Rini

With modern GCC, we get warnings such as:
cmd/jffs2.c: In function 'mtdparts_init':
arch/sh/include/asm/string.h:110:38:
warning: array subscript is above array bounds [-Warray-bounds]
: "0" (__cs), "1" (__ct), "r" (__cs+__n)

                                  ~~~~^~~~

This results in a small size reduction as well.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/sh/include/asm/string.h | 33 ++-------------------------------
 1 file changed, 2 insertions(+), 31 deletions(-)
arch/sh/include/asm/string.h +0 -26
index 27d981b79af8..999febcb6b7d 100644
@@ -81,37 +81,8 @@ static inline int strcmp(const char *__cs, const char *__ct)
 	return __res;
 }
 
-#define __HAVE_ARCH_STRNCMP
-static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
-{
-	register int __res;
-	unsigned long __dummy;
-
-	if (__n == 0)
-		return 0;
-
-	__asm__ __volatile__(
-		"mov.b	@%1+, %3\n"
-		"1:\n\t"
-		"mov.b	@%0+, %2\n\t"
-		"cmp/eq %6, %0\n\t"
-		"bt/s	2f\n\t"
-		" cmp/eq #0, %3\n\t"
-		"bt/s	3f\n\t"
-		" cmp/eq %3, %2\n\t"
-		"bt/s	1b\n\t"
-		" mov.b	@%1+, %3\n\t"
-		"add	#-2, %1\n\t"
-		"mov.b	@%1, %3\n"
-		"2:\n\t"
-		"sub	%3, %2\n"
-		"3:"
-		:"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)

arch/sh/include/asm/string.h static inline int strcmp(const char *__cs, const char *__ct) · line 88

Quoted 10 lines
arch/sh/include/asm/string.h +2 -5
-		: "0" (__cs), "1" (__ct), "r" (__cs+__n)
-		: "t");
-
-	return __res;
-}
+#undef __HAVE_ARCH_STRNCMP
+extern int strncmp(const char *__cs, const char *__ct, size_t __n);
 
 #undef __HAVE_ARCH_MEMSET
 extern void *memset(void *__s, int __c, size_t __count);

Applied, thanks

Signature · 2 lines
Best regards,
Marek Vasut
author
#10 lore raw

PATCH 5/5 sh7763rdp: Add correct MTDIDS/MTDPARTS

In reply to Tom Rini

Based on v4.15, add MTDIDS / MTDPARTS that match the in-kernel defaults.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 configs/sh7763rdp_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/sh7763rdp_defconfig +2 -0
index 9683c7a6cabf..ff8011793016 100644
@@ -24,6 +24,8 @@ CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 # CONFIG_CMD_MISC is not set
 CONFIG_CMD_JFFS2=y
+CONFIG_MTDIDS_DEFAULT="nor0=physmap-flash.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.0:256k(U-Boot),2560k(Linux-Kernel),-(Root Filesystem)"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_NETDEVICES=y
Signature · 1 line
2.7.4
Applied
#11 lore raw

PATCH 1/5 sh: Use -m2a-nofpu only

In reply to Tom Rini
Quoted 17 lines · Tom Rini

Based on reading over the GCC manual, passing both -m2a and -m2a-nofpu are redundant, as -m2a-nofpu will provide functional code for both. As -m2a-nofpu functions with more toolchains and does what is expected, switch.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/sh/cpu/sh2/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/cpu/sh2/config.mk +0 -0
index 12e202d539a0..a063e8361c98 100644

arch/sh/cpu/sh2/config.mk line 14

Quoted 8 lines
arch/sh/cpu/sh2/config.mk +1 -1
@@ -8,7 +8,7 @@
 ENDIANNESS += -EB
 
 ifdef CONFIG_CPU_SH2A
-PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb
+PLATFORM_CPPFLAGS += -m2a-nofpu -mb
 else # SH2
 PLATFORM_CPPFLAGS += -m3e -mb
 endif

Applied, thanks.

Signature · 2 lines
Best regards,
Marek Vasut