Skip to contentSkip to conversation

linux-qoriq, powerpc: kernel patches for cmp assembly instructions that fail with binutils 2.28

PATCH New Bob Cochran 1 participant 1 message Apr 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-qoriq, powerpc: kernel patches for cmp assembly instructions that fail with binutils 2.28

linux-qoriq 4.1.35 64b kernel fails to build for vdso64/gettimeofday.S, vdso64/datapage.S, and head_64.S due to incorrectly coded cmp instructions. Apply two existing kernel patches from upstream, mainline kernel to correct the coding of these instructions.

Built and tested on an e5500 t1040rdb-64b machine

---
 ...pc-64e-Convert-cmpi-to-cmpwi-in-head_64.S.patch | 57 ++++++++++++++++++
 ...dso64-Use-double-word-compare-on-pointers.patch | 67 ++++++++++++++++++++++
 recipes-kernel/linux/linux-qoriq_4.1.bb            |  2 +
 3 files changed, 126 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-qoriq/powerpc-64e-Convert-cmpi-to-cmpwi-in-head_64.S.patch
 create mode 100644 recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch
recipes-kernel/linux/linux-qoriq/powerpc-64e-Convert-cmpi-to-cmpwi-in-head_64.S.patch new file +57 -0
new file mode 100644
index 0000000..710b212
@@ -0,0 +1,57 @@
+From f87f253bac3ce4a4eb2a60a1ae604d74e65f9042 Mon Sep 17 00:00:00 2001
+From: Nicholas Piggin <[email protected]>
+Date: Thu, 24 Nov 2016 00:02:07 +1100
+Subject: [PATCH] powerpc/64e: Convert cmpi to cmpwi in head_64.S
+
+From 80f23935cadb ("powerpc: Convert cmp to cmpd in idle enter sequence"):
+
+  PowerPC's "cmp" instruction has four operands. Normally people write
+  "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently
+  people forget, and write "cmp" with just three operands.
+
+  With older binutils this is silently accepted as if this was "cmpw",
+  while often "cmpd" is wanted. With newer binutils GAS will complain
+  about this for 64-bit code. For 32-bit code it still silently assumes
+  "cmpw" is what is meant.
+
+In this case, cmpwi is called for, so this is just a build fix for
+new toolchains.
+
+Cc: [email protected] # v3.0+
+Signed-off-by: Nicholas Piggin <[email protected]>
+Signed-off-by: Michael Ellerman <[email protected]>
+---
+ arch/powerpc/kernel/head_64.S | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
+index 451a8e1..bdb4612 100644
+--- a/arch/powerpc/kernel/head_64.S
++++ b/arch/powerpc/kernel/head_64.S
+@@ -221,9 +221,9 @@ booting_thread_hwid:
+  */
+ _GLOBAL(book3e_start_thread)
+ 	LOAD_REG_IMMEDIATE(r5, MSR_KERNEL)
+-	cmpi	0, r3, 0
++	cmpwi	r3, 0
+ 	beq	10f
+-	cmpi	0, r3, 1
++	cmpwi	r3, 1
+ 	beq	11f
+ 	/* If the thread id is invalid, just exit. */
+ 	b	13f
+@@ -248,9 +248,9 @@ _GLOBAL(book3e_start_thread)
+  * r3 = the thread physical id
+  */
+ _GLOBAL(book3e_stop_thread)
+-	cmpi	0, r3, 0
++	cmpwi	r3, 0
+ 	beq	10f
+-	cmpi	0, r3, 1
++	cmpwi	r3, 1
+ 	beq	10f
+ 	/* If the thread id is invalid, just exit. */
+ 	b	13f
+-- 
+2.7.4
+
recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch new file +67 -0

67 lines not on this page · raw message

recipes-kernel/linux/linux-qoriq_4.1.bb +2 -0
index 6c2b235..12d12f5 100644
@@ -15,6 +15,8 @@ SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git;nobranch=1 \
     file://powerpc-fsl-Fix-build-of-the-dtb-embedded-kernel-images.patch \
     file://CVE-2016-2053.patch \
     file://CVE-2016-0758.patch \
+    file://powerpc-64e-Convert-cmpi-to-cmpwi-in-head_64.S.patch \
+    file://powerpc-vdso64-Use-double-word-compare-on-pointers.patch \
 "
 SRCREV = "b14540ee315f79f6a5dfc621e7f4217c8fac7d1c"
 
Signature · 1 line
2.7.4