Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: <linux-mips@linux-mips.org>,
	Matthew Fortune <Matthew.Fortune@imgtec.com>
Subject: Re: [PATCH RFC 19/67] MIPS: asm: atomic: Update asm and ISA constrains for MIPS R6 support
Date: Fri, 19 Dec 2014 10:01:56 +0000	[thread overview]
Message-ID: <5493F794.9040200@imgtec.com> (raw)
In-Reply-To: <549321F3.1090704@gmail.com>

On 12/18/2014 06:50 PM, David Daney wrote:
> On 12/18/2014 07:09 AM, Markos Chandras wrote:
>> MIPS R6 changed the opcodes for LL/SC instructions and reduced the
>> offset field to 9-bits. This has some undesired effects with the "m"
>> constrain since it implies a 16-bit immediate. As a result of which,
>> add a register ("r") constrain as well to make sure the entire address
>> is loaded to a register before the LL/SC operations. Also use macro
>> to set the appropriate ISA for the asm blocks
>>
> 
> Has support for MIPS R6 been added to GCC?
> 
> If so, that should include a proper constraint to be used with the new
> offset restrictions.  We should probably use that, instead of forcing to
> a "r" constraint.
> 
> 
>> Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>> ---
>>   arch/mips/include/asm/atomic.h | 50
>> +++++++++++++++++++++---------------------
>>   1 file changed, 25 insertions(+), 25 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/atomic.h
>> b/arch/mips/include/asm/atomic.h
>> index 6dd6bfc607e9..8669e0ec97e3 100644
>> --- a/arch/mips/include/asm/atomic.h
>> +++ b/arch/mips/include/asm/atomic.h
>> @@ -60,13 +60,13 @@ static __inline__ void atomic_##op(int i, atomic_t
>> * v)                \
>>                                           \
>>           do {                                \
>>               __asm__ __volatile__(                    \
>> -            "    .set    arch=r4000            \n"    \
>> -            "    ll    %0, %1        # atomic_" #op "\n"    \
>> +            "    .set    "MIPS_ISA_ARCH_LEVEL"        \n"    \
>> +            "    ll    %0, 0(%3)    # atomic_" #op "\n"    \
>>               "    " #asm_op " %0, %2            \n"    \
>> -            "    sc    %0, %1                \n"    \
>> +            "    sc    %0, 0(%3)            \n"    \
>>               "    .set    mips0                \n"    \
>>               : "=&r" (temp), "+m" (v->counter)            \
>> -            : "Ir" (i));                        \
>> +            : "Ir" (i), "r" (&v->counter));                \
> 
> You lost the "m" constraint, but are still modifying memory.  There is
> no "memory" clobber here, so we are no longer correctly describing what
> is happening.
> 
> 

Sorry I don't understand what you mean by  "you lost the "m"
constraint". +m (v->counter) is still there to denote that v->counter
memory is being modified no?

-- 
markos

WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org, Matthew Fortune <Matthew.Fortune@imgtec.com>
Subject: Re: [PATCH RFC 19/67] MIPS: asm: atomic: Update asm and ISA constrains for MIPS R6 support
Date: Fri, 19 Dec 2014 10:01:56 +0000	[thread overview]
Message-ID: <5493F794.9040200@imgtec.com> (raw)
Message-ID: <20141219100156.i-1FxOg51Mp6IwIb5whpwmeMnaIDqtu6RPeHKtPOmzs@z> (raw)
In-Reply-To: <549321F3.1090704@gmail.com>

On 12/18/2014 06:50 PM, David Daney wrote:
> On 12/18/2014 07:09 AM, Markos Chandras wrote:
>> MIPS R6 changed the opcodes for LL/SC instructions and reduced the
>> offset field to 9-bits. This has some undesired effects with the "m"
>> constrain since it implies a 16-bit immediate. As a result of which,
>> add a register ("r") constrain as well to make sure the entire address
>> is loaded to a register before the LL/SC operations. Also use macro
>> to set the appropriate ISA for the asm blocks
>>
> 
> Has support for MIPS R6 been added to GCC?
> 
> If so, that should include a proper constraint to be used with the new
> offset restrictions.  We should probably use that, instead of forcing to
> a "r" constraint.
> 
> 
>> Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>> ---
>>   arch/mips/include/asm/atomic.h | 50
>> +++++++++++++++++++++---------------------
>>   1 file changed, 25 insertions(+), 25 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/atomic.h
>> b/arch/mips/include/asm/atomic.h
>> index 6dd6bfc607e9..8669e0ec97e3 100644
>> --- a/arch/mips/include/asm/atomic.h
>> +++ b/arch/mips/include/asm/atomic.h
>> @@ -60,13 +60,13 @@ static __inline__ void atomic_##op(int i, atomic_t
>> * v)                \
>>                                           \
>>           do {                                \
>>               __asm__ __volatile__(                    \
>> -            "    .set    arch=r4000            \n"    \
>> -            "    ll    %0, %1        # atomic_" #op "\n"    \
>> +            "    .set    "MIPS_ISA_ARCH_LEVEL"        \n"    \
>> +            "    ll    %0, 0(%3)    # atomic_" #op "\n"    \
>>               "    " #asm_op " %0, %2            \n"    \
>> -            "    sc    %0, %1                \n"    \
>> +            "    sc    %0, 0(%3)            \n"    \
>>               "    .set    mips0                \n"    \
>>               : "=&r" (temp), "+m" (v->counter)            \
>> -            : "Ir" (i));                        \
>> +            : "Ir" (i), "r" (&v->counter));                \
> 
> You lost the "m" constraint, but are still modifying memory.  There is
> no "memory" clobber here, so we are no longer correctly describing what
> is happening.
> 
> 

Sorry I don't understand what you mean by  "you lost the "m"
constraint". +m (v->counter) is still there to denote that v->counter
memory is being modified no?

-- 
markos

  parent reply	other threads:[~2014-12-19 10:02 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
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 [this message]
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=5493F794.9040200@imgtec.com \
    --to=markos.chandras@imgtec.com \
    --cc=Matthew.Fortune@imgtec.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@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