Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: David Daney <ddaney.cavm@gmail.com>,
	Ralf Baechle <ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Subject: Re: [PATCH RFC 12/67] MIPS: asm: asmmacro: Replace add instructions with "addui"
Date: Tue, 13 Jan 2015 13:13:02 +0000	[thread overview]
Message-ID: <54B519DE.4010708@imgtec.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1501112322130.27458@eddie.linux-mips.org>

On 01/11/2015 11:34 PM, Maciej W. Rozycki wrote:
> On Fri, 19 Dec 2014, Markos Chandras wrote:
> 
>>>> The use of "add" instruction for immediate operations is wrong and
>>>> relies to gas being smart enough to notice that and replace it with
>>>> either addi or addui. However, MIPS R6 removed the addi instruction
>>>> so, fix this problem properly by using the correct instruction
>>>> directly.
> 
>  Not true, depending on the arguments the ADD assembly macro expands to 
> either of the ADD and the ADDI hardware instructions; where an immediate 
> outside the 16-bit signed range is used it also expands to a longer 
> sequence involving LUI and the actual operation is ADD.  It never expands 
> to ADDIU (which I gather you meant).
> 
>>> This is another case of the use of "add" being a real bug.  We should
>>> never have faulting instructions like this in the kernel.
>>>
>>> Can you send all patches in this set that fix this bug as a separate
>>> patch?  Since they are obviously correct, and really should be used by
>>> all non-R6 processors, we can get them in sooner that the entire R6 thing.
>>>
>>> Thanks,
>>> David Daney
>>
>> sure i will move these patches away from R6 and post them separately.
> 
>  I think using the ADDU macro is preferred here as it allows arbitrary 
> 32-bit values for `off', just like with memory references in MIPS assembly 
> instructions.
> 
>   Maciej
> 
Hi,

What ADDU macro?

-- 
markos

WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: David Daney <ddaney.cavm@gmail.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH RFC 12/67] MIPS: asm: asmmacro: Replace add instructions with "addui"
Date: Tue, 13 Jan 2015 13:13:02 +0000	[thread overview]
Message-ID: <54B519DE.4010708@imgtec.com> (raw)
Message-ID: <20150113131302.agqjIJzePUcSdMT561-JZEsuPVYLBe0CdUsXnVBRBC0@z> (raw)
In-Reply-To: <alpine.LFD.2.11.1501112322130.27458@eddie.linux-mips.org>

On 01/11/2015 11:34 PM, Maciej W. Rozycki wrote:
> On Fri, 19 Dec 2014, Markos Chandras wrote:
> 
>>>> The use of "add" instruction for immediate operations is wrong and
>>>> relies to gas being smart enough to notice that and replace it with
>>>> either addi or addui. However, MIPS R6 removed the addi instruction
>>>> so, fix this problem properly by using the correct instruction
>>>> directly.
> 
>  Not true, depending on the arguments the ADD assembly macro expands to 
> either of the ADD and the ADDI hardware instructions; where an immediate 
> outside the 16-bit signed range is used it also expands to a longer 
> sequence involving LUI and the actual operation is ADD.  It never expands 
> to ADDIU (which I gather you meant).
> 
>>> This is another case of the use of "add" being a real bug.  We should
>>> never have faulting instructions like this in the kernel.
>>>
>>> Can you send all patches in this set that fix this bug as a separate
>>> patch?  Since they are obviously correct, and really should be used by
>>> all non-R6 processors, we can get them in sooner that the entire R6 thing.
>>>
>>> Thanks,
>>> David Daney
>>
>> sure i will move these patches away from R6 and post them separately.
> 
>  I think using the ADDU macro is preferred here as it allows arbitrary 
> 32-bit values for `off', just like with memory references in MIPS assembly 
> instructions.
> 
>   Maciej
> 
Hi,

What ADDU macro?

-- 
markos

  reply	other threads:[~2015-01-13 13:13 UTC|newest]

Thread overview: 187+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 15:09 [PATCH RFC 00/67] Add MIPS R6 support Markos Chandras
2014-12-18 15:09 ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 01/67] MIPS: Add generic QEMU R6 PRid and cpu type identifiers Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 19:10   ` David Daney
2014-12-19  8:49     ` Markos Chandras
2014-12-19  8:49       ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 02/67] MIPS: Add cases for CPU_QEMUR6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 03/67] MIPS: Add MIPS QEMUR6 probe support Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 04/67] MIPS: Add build support for the MIPS R6 ISA Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 05/67] MIPS: mm: uasm: Add signed 9-bit immediate related macros Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 06/67] MIPS: mm: Add MIPS R6 instruction encodings Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 07/67] MIPS: asm: asm: Add new macros to set ISA and arch asm annotations Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 08/67] MIPS: asm: module: define MODULE_PROC_FAMILY for MIPS R6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 09/67] MIPS: asm: stackframe: Do not preserve the HI/LO registers on " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 10/67] MIPS: asm: asmmacro: Drop unused 'reg' argument on MIPSR2 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 11/67] MIPS: asm: asmmacro: Add MIPS R6 support to the simple EI/DI variants Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 12/67] MIPS: asm: asmmacro: Replace add instructions with "addui" Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 18:56   ` David Daney
2014-12-19  9:01     ` Markos Chandras
2014-12-19  9:01       ` Markos Chandras
2015-01-11 23:34       ` Maciej W. Rozycki
2015-01-13 13:13         ` Markos Chandras [this message]
2015-01-13 13:13           ` Markos Chandras
2015-01-13 14:58           ` Maciej W. Rozycki
2015-01-13 15:04             ` Markos Chandras
2015-01-13 15:04               ` Markos Chandras
2015-01-13 15:24               ` Maciej W. Rozycki
2014-12-18 15:09 ` [PATCH RFC 13/67] MIPS: Use generic checksum functions for MIPS R6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 14/67] MIPS: asm: cpu: Add MIPSR6 ISA definitions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 15/67] MIPS: asm: hazards: Add MIPSR6 definitions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 16/67] MIPS: asm: irqflags: Add MIPS R6 related definitions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 17/67] MIPS: asm: r4kcache: Add MIPS R6 cache unroll functions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 18/67] MIPS: asm: spram: Add MIPS R6 related definitions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 19/67] MIPS: asm: atomic: Update asm and ISA constrains for MIPS R6 support Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 18:50   ` David Daney
2014-12-18 18:59     ` Måns Rullgård
2014-12-18 19:01     ` Ralf Baechle
2014-12-18 21:04       ` Matthew Fortune
2014-12-18 21:04         ` Matthew Fortune
2014-12-18 22:18         ` Måns Rullgård
2014-12-18 22:18           ` Måns Rullgård
2014-12-18 22:19         ` David Daney
2014-12-18 22:58           ` Matthew Fortune
2014-12-18 23:43             ` Måns Rullgård
2014-12-18 23:43               ` Måns Rullgård
2014-12-19 10:20             ` Markos Chandras
2014-12-19 12:39               ` Markos Chandras
2014-12-19 13:53                 ` Matthew Fortune
2014-12-19 13:55                   ` Markos Chandras
2015-01-11 23:51               ` Maciej W. Rozycki
2014-12-19 12:29             ` Ralf Baechle
2014-12-19 10:01     ` Markos Chandras
2014-12-19 10:01       ` Markos Chandras
2014-12-19 16:38       ` David Daney
2014-12-18 15:09 ` [PATCH RFC 20/67] MIPS: asm: cmpxchg: " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 21/67] MIPS: asm: bitops: " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 22/67] MIPS: asm: futex: " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 23/67] MIPS: asm: spinlock: Update asm " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 24/67] MIPS: asm: spinlock: Replace sub instruction with addiu Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 18:53   ` David Daney
2014-12-18 19:06     ` Ralf Baechle
2014-12-19  8:51     ` Markos Chandras
2014-12-19  8:51       ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 25/67] MIPS: kernel: cpu-bugs64: Do not check R6 cores for existing 64-bit bugs Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 26/67] MIPS: kernel: cevt-r4k: Add MIPS R6 to the c0_compare_interrupt handler Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 27/67] MIPS: kernel: cpu-probe.c: Add support for MIPS R6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 28/67] MIPS: kernel: entry.S: Add MIPS R6 related definitions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 29/67] MIPS: kernel: proc: Add MIPS R6 support to /proc/cpuinfo Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-19 11:32   ` Sergei Shtylyov
2014-12-18 15:09 ` [PATCH RFC 30/67] MIPS: kernel: traps: Add MIPS R6 related definitions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 31/67] MIPS: kernel: r4k_switch: Add support for MIPS R6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 32/67] MIPS: kernel: r4k_fpu: " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 33/67] MIPS: kernel: genex: Set correct ISA level Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 34/67] MIPS: kernel: cps-vec: Replace addi with addiu Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 35/67] MIPS: uapi: inst: Add new opcodes for COP2 instructions Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 36/67] MIPS: kernel: unaligned: Add support for the MIPS R6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 37/67] MIPS: lib: memcpy: Add MIPS R6 support Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 38/67] MIPS: lib: memset: " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 39/67] MIPS: mm: page: " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 40/67] MIPS: mm: tlbex: Add MIPS R6 case for the EHB instruction Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 19:05   ` David Daney
2014-12-18 15:09 ` [PATCH RFC 41/67] MIPS: mm: c-r4k: Set the correct ISA level Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 42/67] MIPS: kernel: branch: Prepare the JR instruction for emulation on MIPS R6 Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 43/67] MIPS: kernel: branch: Prevent BLTZL emulation for " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 44/67] MIPS: kernel: branch: Prevent BGEZL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 45/67] MIPS: kernel: branch: Prevent BLTZAL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 46/67] MIPS: kernel: branch: Prevent BGEZAL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 47/67] MIPS: kernel: branch: Prevent BEQL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 23:56   ` Joshua Kinard
2014-12-19  8:54     ` Markos Chandras
2014-12-19  8:54       ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 48/67] MIPS: kernel: branch: Prevent BNEL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 49/67] MIPS: kernel: branch: Prevent BLEZL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:09 ` [PATCH RFC 50/67] MIPS: kernel: branch: Prevent BGTZL " Markos Chandras
2014-12-18 15:09   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 51/67] MIPS: uapi: inst: Add new BC1EQZ and BC1NEZ MIPS R6 opcodes Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 52/67] MIPS: kernel: branch: Add support for the BC1{EQ,NE}Z FPU branches Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 53/67] MIPS: kernel: branch: Add new MIPS R6 B{L,G}ΕZ{AL,}C emulation Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-19 11:59   ` Sergei Shtylyov
2014-12-18 15:10 ` [PATCH RFC 54/67] MIPS: kernel: branch: Add new MIPS R6 B{L,G}TZ{AL,}C emulation Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-19 12:02   ` Sergei Shtylyov
2014-12-18 15:10 ` [PATCH RFC 55/67] MIPS: kernel: branch: Emulate the branch compact (BC) on MIPS R6 Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 56/67] MIPS: kernel: branch: Emulate the BOVC, BEQC and BEQZALC R6 instructions Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 19:07   ` David Daney
2014-12-19  8:52     ` Markos Chandras
2014-12-19  8:52       ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 57/67] MIPS: kernel: branch: Emulate the BNVC, BNEC and BNEZLAC " Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 19:08   ` David Daney
2014-12-18 15:10 ` [PATCH RFC 58/67] MIPS: kernel: branch: Emulate the BALC R6 instruction Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-19 12:06   ` Sergei Shtylyov
2014-12-18 15:10 ` [PATCH RFC 59/67] MIPS: kernel: branch: Emulate the BEQZC and JIC instructions Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-19 12:08   ` Sergei Shtylyov
2014-12-18 15:10 ` [PATCH RFC 60/67] MIPS: math-emu: cp1emu: Move the fpucondbit struct to a header Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-19 12:10   ` Sergei Shtylyov
2014-12-18 15:10 ` [PATCH RFC 61/67] MIPS: Add LLB bit and related feature for the Config 5 CP0 register Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 62/67] MIPS: asm: mipsregs: Add support for the LLADDR register Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 63/67] MIPS: kernel: mips-r2-to-r6-emul: Add R2 emulator for MIPS R6 Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 64/67] MIPS: Make use of the ERETNC instruction on " Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 65/67] MIPS: Malta: malta-int: Set correct asm ISA level Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 66/67] MIPS: Malta: Add support for building MIPS R6 kernel Markos Chandras
2014-12-18 15:10   ` Markos Chandras
2014-12-18 15:10 ` [PATCH RFC 67/67] MIPS: Add Malta QEMU 32R6 defconfig Markos Chandras
2014-12-18 15:10   ` Markos Chandras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B519DE.4010708@imgtec.com \
    --to=markos.chandras@imgtec.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox