* [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language.
@ 2013-04-19 11:45 Chen Gang
2013-04-19 12:12 ` Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: Chen Gang @ 2013-04-19 11:45 UTC (permalink / raw)
To: linux-arm-kernel
in arch/arm64/include/asm, not define the function cmpxchg64
when compiling with allmodconfig,
drivers/block/blockconsole.c will need this function.
I am not quite familiar with ARM64 (neither ARM64 assembler)
can any member helps to send related patch ?
if no one have time to send related patch, I should try.
and I am glad to try, but need additional time resources,
if I try, I should finish it within this month (2013-4-30).
welcome any suggestions or completions.
thanks.
gchen.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language.
2013-04-19 11:45 [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language Chen Gang
@ 2013-04-19 12:12 ` Arnd Bergmann
2013-04-20 2:28 ` Chen Gang
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2013-04-19 12:12 UTC (permalink / raw)
To: linux-arm-kernel
On Friday 19 April 2013, Chen Gang wrote:
> in arch/arm64/include/asm, not define the function cmpxchg64
>
> when compiling with allmodconfig,
> drivers/block/blockconsole.c will need this function.
>
> I am not quite familiar with ARM64 (neither ARM64 assembler)
>
> can any member helps to send related patch ?
> if no one have time to send related patch, I should try.
> and I am glad to try, but need additional time resources,
> if I try, I should finish it within this month (2013-4-30).
>
> welcome any suggestions or completions.
cmpxchg64 is the same as cmpxchg on 64-bit platforms, can't the
driver be changed to use the latter?
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language.
2013-04-19 12:12 ` Arnd Bergmann
@ 2013-04-20 2:28 ` Chen Gang
2013-04-20 7:32 ` Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: Chen Gang @ 2013-04-20 2:28 UTC (permalink / raw)
To: linux-arm-kernel
On 2013?04?19? 20:12, Arnd Bergmann wrote:
> On Friday 19 April 2013, Chen Gang wrote:
>> in arch/arm64/include/asm, not define the function cmpxchg64
>>
>> when compiling with allmodconfig,
>> drivers/block/blockconsole.c will need this function.
>>
>> I am not quite familiar with ARM64 (neither ARM64 assembler)
>>
>> can any member helps to send related patch ?
>> if no one have time to send related patch, I should try.
>> and I am glad to try, but need additional time resources,
>> if I try, I should finish it within this month (2013-4-30).
>>
>> welcome any suggestions or completions.
>
> cmpxchg64 is the same as cmpxchg on 64-bit platforms, can't the
> driver be changed to use the latter?
>
> Arnd
>
>
can we be sure that cmpxchg64 is equal to cmpchg on all 64-bit platforms ?
(I guess, the driver may need cross multiple platforms)
(it seems, under x86, s390, better use cmpxchg64, at least they define it).
whether we can be sure or not,
I still prefer to define the macro cmpxchg64 just the alias of cmpxchg.
(and I also guess ARM64 is always on 64-bit platform)
the related patch may be like below.
-------------------------------patch begin--------------------------------------
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 968b5cb..b572d2b 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -170,4 +170,6 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
(unsigned long)(n), \
sizeof(*(ptr))))
+#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
+
#endif /* __ASM_CMPXCHG_H */
-------------------------------patch end----------------------------------------
I think, we can also reference the implementation of s390:
it is in arch/s390/include/asm/cmpxchg.h.
since we are ARM64, excluding ARM(32,16...), we can only consider 64-bit.
if in the future, ARM64 and ARM are merged together:
we can use CONFIG_64BIT to switch the cmpxchg64 definition.
if define CONFIG_64BIT, use cmpxchg instead of cmpxchg64.
else, use the definition of ARM (arch/arm/include/asm/cmpxchg.h already defines cmpxchg64)
-------------------------------reference begin----------------------------------
#ifdef CONFIG_64BIT
#define cmpxchg64(ptr, o, n) \
({ \
cmpxchg((ptr), (o), (n)); \
})
#else /* CONFIG_64BIT */
...
-------------------------------reference end------------------------------------
:-)
--
Chen Gang
Asianux Corporation
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language.
2013-04-20 2:28 ` Chen Gang
@ 2013-04-20 7:32 ` Arnd Bergmann
2013-04-22 5:08 ` Chen Gang
2013-04-22 5:08 ` [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using Chen Gang
0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2013-04-20 7:32 UTC (permalink / raw)
To: linux-arm-kernel
On Saturday 20 April 2013 10:28:55 Chen Gang wrote:
>
> -------------------------------patch begin--------------------------------------
>
> diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
> index 968b5cb..b572d2b 100644
> --- a/arch/arm64/include/asm/cmpxchg.h
> +++ b/arch/arm64/include/asm/cmpxchg.h
> @@ -170,4 +170,6 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
> (unsigned long)(n), \
> sizeof(*(ptr))))
>
> +#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
> +
> #endif /* __ASM_CMPXCHG_H */
Yes, this looks good. Please provide the same for cmpxchg64_local.
> -------------------------------patch end----------------------------------------
>
>
>
> I think, we can also reference the implementation of s390:
> it is in arch/s390/include/asm/cmpxchg.h.
> since we are ARM64, excluding ARM(32,16...), we can only consider 64-bit.
> if in the future, ARM64 and ARM are merged together:
> we can use CONFIG_64BIT to switch the cmpxchg64 definition.
> if define CONFIG_64BIT, use cmpxchg instead of cmpxchg64.
> else, use the definition of ARM (arch/arm/include/asm/cmpxchg.h already defines cmpxchg64)
I would not worry aobut merging the two at the moment.
> -------------------------------reference begin----------------------------------
>
> #ifdef CONFIG_64BIT
> #define cmpxchg64(ptr, o, n) \
> ({ \
> cmpxchg((ptr), (o), (n)); \
> })
> #else /* CONFIG_64BIT */
> ...
> -------------------------------reference end------------------------------------
This implementation in unnecessarily verbose, I think the one you have
above is nicer.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language.
2013-04-20 7:32 ` Arnd Bergmann
@ 2013-04-22 5:08 ` Chen Gang
2013-04-22 5:08 ` [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using Chen Gang
1 sibling, 0 replies; 8+ messages in thread
From: Chen Gang @ 2013-04-22 5:08 UTC (permalink / raw)
To: linux-arm-kernel
On 2013?04?20? 15:32, Arnd Bergmann wrote:
> On Saturday 20 April 2013 10:28:55 Chen Gang wrote:
>>
>> -------------------------------patch begin--------------------------------------
>>
>> diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
>> index 968b5cb..b572d2b 100644
>> --- a/arch/arm64/include/asm/cmpxchg.h
>> +++ b/arch/arm64/include/asm/cmpxchg.h
>> @@ -170,4 +170,6 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
>> (unsigned long)(n), \
>> sizeof(*(ptr))))
>>
>> +#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
>> +
>> #endif /* __ASM_CMPXCHG_H */
>
> Yes, this looks good. Please provide the same for cmpxchg64_local.
>
ok, thanks, I will send related patch.
gchen.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using.
2013-04-20 7:32 ` Arnd Bergmann
2013-04-22 5:08 ` Chen Gang
@ 2013-04-22 5:08 ` Chen Gang
2013-04-23 10:48 ` Catalin Marinas
1 sibling, 1 reply; 8+ messages in thread
From: Chen Gang @ 2013-04-22 5:08 UTC (permalink / raw)
To: linux-arm-kernel
drivers use cmpxchg64, cmpxchg64_local ... to perform 64-bit operation,
so they can cross 32-bit and 64-bit platforms (it is a standard way).
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
arch/arm64/include/asm/cmpxchg.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 968b5cb..8a8ce0e 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -170,4 +170,7 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
(unsigned long)(n), \
sizeof(*(ptr))))
+#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
+#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n))
+
#endif /* __ASM_CMPXCHG_H */
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using.
2013-04-22 5:08 ` [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using Chen Gang
@ 2013-04-23 10:48 ` Catalin Marinas
2013-04-23 10:54 ` Chen Gang
0 siblings, 1 reply; 8+ messages in thread
From: Catalin Marinas @ 2013-04-23 10:48 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 22, 2013 at 06:08:41AM +0100, Chen Gang wrote:
>
> drivers use cmpxchg64, cmpxchg64_local ... to perform 64-bit operation,
> so they can cross 32-bit and 64-bit platforms (it is a standard way).
>
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
Applied, thanks.
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using.
2013-04-23 10:48 ` Catalin Marinas
@ 2013-04-23 10:54 ` Chen Gang
0 siblings, 0 replies; 8+ messages in thread
From: Chen Gang @ 2013-04-23 10:54 UTC (permalink / raw)
To: linux-arm-kernel
On 2013?04?23? 18:48, Catalin Marinas wrote:
> On Mon, Apr 22, 2013 at 06:08:41AM +0100, Chen Gang wrote:
>> >
>> > drivers use cmpxchg64, cmpxchg64_local ... to perform 64-bit operation,
>> > so they can cross 32-bit and 64-bit platforms (it is a standard way).
>> >
>> >
>> > Signed-off-by: Chen Gang <gang.chen@asianux.com>
> Applied, thanks.
Thanks too. I should continue to find and make new patches for arm64.
--
Chen Gang
Asianux Corporation
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-23 10:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19 11:45 [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language Chen Gang
2013-04-19 12:12 ` Arnd Bergmann
2013-04-20 2:28 ` Chen Gang
2013-04-20 7:32 ` Arnd Bergmann
2013-04-22 5:08 ` Chen Gang
2013-04-22 5:08 ` [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using Chen Gang
2013-04-23 10:48 ` Catalin Marinas
2013-04-23 10:54 ` Chen Gang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).