Joel Stanley | 876a7fb | 2017-06-27 18:18:08 +0930 | [diff] [blame] | 1 | From 63c3b788eebfa28f0b4032c209e90cc2df7b2c98 Mon Sep 17 00:00:00 2001 |
| 2 | From: Joel Stanley <joel.stanley@au1.ibm.com> |
| 3 | Date: Tue, 27 Jun 2017 18:00:09 +0930 |
| 4 | Subject: [PATCH] kernel: Update assembly for modern binutils |
| 5 | |
| 6 | From Linux 80f23935cadb ("powerpc: Convert cmp to cmpd in idle enter sequence"): |
| 7 | |
| 8 | PowerPC's "cmp" instruction has four operands. Normally people write |
| 9 | "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently |
| 10 | people forget, and write "cmp" with just three operands. |
| 11 | |
| 12 | With older binutils this is silently accepted as if this was "cmpw", |
| 13 | while often "cmpd" is wanted. With newer binutils GAS will complain |
| 14 | about this for 64-bit code. For 32-bit code it still silently assumes |
| 15 | "cmpw" is what is meant. |
| 16 | |
| 17 | The first two instances are dealing with SPRs, which are 32-bit, so cmpw is correct. |
| 18 | |
| 19 | It is not clear what to do in the third use of cmp, but given old toolchains |
| 20 | have generated cmpw lets assume that we should maintain the behaviour. |
| 21 | |
| 22 | Change-Id: Iee5dd5903dcd7ac4028bab0176e08ce3db23b2d5 |
| 23 | Signed-off-by: Joel Stanley <joel.stanley@au1.ibm.com> |
| 24 | --- |
| 25 | src/kernel/shutdown.S | 10 ++++++---- |
| 26 | 1 file changed, 6 insertions(+), 4 deletions(-) |
| 27 | |
| 28 | diff --git a/src/kernel/shutdown.S b/src/kernel/shutdown.S |
| 29 | index 629645b26c81..cad5c66b8137 100644 |
| 30 | --- a/src/kernel/shutdown.S |
| 31 | +++ b/src/kernel/shutdown.S |
| 32 | @@ -5,7 +5,9 @@ |
| 33 | # |
| 34 | # OpenPOWER HostBoot Project |
| 35 | # |
| 36 | -# COPYRIGHT International Business Machines Corp. 2012,2014 |
| 37 | +# Contributors Listed Below - COPYRIGHT 2012,2017 |
| 38 | +# [+] International Business Machines Corp. |
| 39 | +# |
| 40 | # |
| 41 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 42 | # you may not use this file except in compliance with the License. |
| 43 | @@ -92,7 +94,7 @@ kernel_shutdown_ea0_1_mode: |
| 44 | ;// as it was the one that updated the cpu_count & lowest_pir |
| 45 | ;// barrier - 1 wait for all nodes to report |
| 46 | mfspr r10, PIR |
| 47 | - cmp cr0, r10, r7 |
| 48 | + cmpw cr0, r10, r7 |
| 49 | bne+ 2f ;// inside KERNEL_BARRIER below |
| 50 | |
| 51 | ;// Perform barrier - 1 |
| 52 | @@ -131,7 +133,7 @@ kernel_shutdown_ea0_1_mode: |
| 53 | addi r8, r8, 8 |
| 54 | ;// Check for PIR == r7. |
| 55 | mfspr r10, PIR |
| 56 | - cmp cr0, r10, r7 |
| 57 | + cmpw cr0, r10, r7 |
| 58 | beq 3f |
| 59 | ;// Increment thread count. |
| 60 | 1: |
| 61 | @@ -164,7 +166,7 @@ kernel_shutdown_ea0_1_mode: |
| 62 | 1: |
| 63 | or 1,1,1 |
| 64 | ld r11, 0(r8) |
| 65 | - cmp cr0, r3, r11 |
| 66 | + cmpw cr0, r3, r11 |
| 67 | bne+ 1b |
| 68 | isync |
| 69 | ;// All other threads have left, so wait a little bit... |
| 70 | -- |
| 71 | 2.13.1 |
| 72 | |