public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avr32: fix asm operand constraint in cmpxchg()
@ 2016-03-10 14:23 Mans Rullgard
  2016-03-10 14:26 ` Hans-Christian Noren Egtvedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mans Rullgard @ 2016-03-10 14:23 UTC (permalink / raw)
  To: Haavard Skinnemoen, Hans-Christian Egtvedt
  Cc: Andy Shevchenko, Guenter Roeck, Sudip Mukherjee, linux-kernel

If the 'old' operand to cmpxchg() is a constant wider than 21 bits,
linking fails with a "relocation truncated to fit: R_AVR32_21S" error.

Fix this by replacing the "i" constraint with "Ks21" which makes the
compiler use a temporary register for out of range constants.

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
This fixes link errors in linux-next with CONFIG_AIO_THREAD enabled.
---
 arch/avr32/include/asm/cmpxchg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h
index 366bbeaeb405..572739b4c4b4 100644
--- a/arch/avr32/include/asm/cmpxchg.h
+++ b/arch/avr32/include/asm/cmpxchg.h
@@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
 		"	brne	1b\n"
 		"2:\n"
 		: [ret] "=&r"(ret), [m] "=m"(*m)
-		: "m"(m), [old] "ir"(old), [new] "r"(new)
+		: "m"(m), [old] "Ks21r"(old), [new] "r"(new)
 		: "memory", "cc");
 	return ret;
 }
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] avr32: fix asm operand constraint in cmpxchg()
  2016-03-10 14:23 [PATCH] avr32: fix asm operand constraint in cmpxchg() Mans Rullgard
@ 2016-03-10 14:26 ` Hans-Christian Noren Egtvedt
  2016-03-10 15:26 ` Andy Shevchenko
  2016-03-10 17:39 ` Sudip Mukherjee
  2 siblings, 0 replies; 4+ messages in thread
From: Hans-Christian Noren Egtvedt @ 2016-03-10 14:26 UTC (permalink / raw)
  To: Mans Rullgard
  Cc: Haavard Skinnemoen, Andy Shevchenko, Guenter Roeck,
	Sudip Mukherjee, linux-kernel

Around Thu 10 Mar 2016 14:23:49 +0000 or thereabout, Mans Rullgard wrote:
> If the 'old' operand to cmpxchg() is a constant wider than 21 bits,
> linking fails with a "relocation truncated to fit: R_AVR32_21S" error.
> 
> Fix this by replacing the "i" constraint with "Ks21" which makes the
> compiler use a temporary register for out of range constants.
> 
> Signed-off-by: Mans Rullgard <mans@mansr.com>
> ---
> This fixes link errors in linux-next with CONFIG_AIO_THREAD enabled.

Good find, thank you for fixing.

Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>

I'll push this for next merge window.

> ---
>  arch/avr32/include/asm/cmpxchg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h
> index 366bbeaeb405..572739b4c4b4 100644
> --- a/arch/avr32/include/asm/cmpxchg.h
> +++ b/arch/avr32/include/asm/cmpxchg.h
> @@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
>  		"	brne	1b\n"
>  		"2:\n"
>  		: [ret] "=&r"(ret), [m] "=m"(*m)
> -		: "m"(m), [old] "ir"(old), [new] "r"(new)
> +		: "m"(m), [old] "Ks21r"(old), [new] "r"(new)
>  		: "memory", "cc");
>  	return ret;
>  }
-- 
mvh
Hans-Christian Egtvedt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avr32: fix asm operand constraint in cmpxchg()
  2016-03-10 14:23 [PATCH] avr32: fix asm operand constraint in cmpxchg() Mans Rullgard
  2016-03-10 14:26 ` Hans-Christian Noren Egtvedt
@ 2016-03-10 15:26 ` Andy Shevchenko
  2016-03-10 17:39 ` Sudip Mukherjee
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2016-03-10 15:26 UTC (permalink / raw)
  To: Mans Rullgard
  Cc: Haavard Skinnemoen, Hans-Christian Egtvedt, Guenter Roeck,
	Sudip Mukherjee, linux-kernel@vger.kernel.org

On Thu, Mar 10, 2016 at 4:23 PM, Mans Rullgard <mans@mansr.com> wrote:
> If the 'old' operand to cmpxchg() is a constant wider than 21 bits,
> linking fails with a "relocation truncated to fit: R_AVR32_21S" error.
>
> Fix this by replacing the "i" constraint with "Ks21" which makes the
> compiler use a temporary register for out of range constants.
>
> Signed-off-by: Mans Rullgard <mans@mansr.com>

Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> This fixes link errors in linux-next with CONFIG_AIO_THREAD enabled.
> ---
>  arch/avr32/include/asm/cmpxchg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h
> index 366bbeaeb405..572739b4c4b4 100644
> --- a/arch/avr32/include/asm/cmpxchg.h
> +++ b/arch/avr32/include/asm/cmpxchg.h
> @@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
>                 "       brne    1b\n"
>                 "2:\n"
>                 : [ret] "=&r"(ret), [m] "=m"(*m)
> -               : "m"(m), [old] "ir"(old), [new] "r"(new)
> +               : "m"(m), [old] "Ks21r"(old), [new] "r"(new)
>                 : "memory", "cc");
>         return ret;
>  }
> --
> 2.7.2
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avr32: fix asm operand constraint in cmpxchg()
  2016-03-10 14:23 [PATCH] avr32: fix asm operand constraint in cmpxchg() Mans Rullgard
  2016-03-10 14:26 ` Hans-Christian Noren Egtvedt
  2016-03-10 15:26 ` Andy Shevchenko
@ 2016-03-10 17:39 ` Sudip Mukherjee
  2 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2016-03-10 17:39 UTC (permalink / raw)
  To: Mans Rullgard, Haavard Skinnemoen, Hans-Christian Egtvedt
  Cc: Andy Shevchenko, Guenter Roeck, linux-kernel

On Thursday 10 March 2016 07:53 PM, Mans Rullgard wrote:
> If the 'old' operand to cmpxchg() is a constant wider than 21 bits,
> linking fails with a "relocation truncated to fit: R_AVR32_21S" error.
>
> Fix this by replacing the "i" constraint with "Ks21" which makes the
> compiler use a temporary register for out of range constants.
>
> Signed-off-by: Mans Rullgard <mans@mansr.com>

build log at: https://gitlab.com/sudipm/linux-next/builds/839572

Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

regards
sudip

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-10 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 14:23 [PATCH] avr32: fix asm operand constraint in cmpxchg() Mans Rullgard
2016-03-10 14:26 ` Hans-Christian Noren Egtvedt
2016-03-10 15:26 ` Andy Shevchenko
2016-03-10 17:39 ` Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox