* [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000
@ 2013-08-01 9:55 Jonas Gorski
2013-08-01 13:55 ` Ralf Baechle
0 siblings, 1 reply; 6+ messages in thread
From: Jonas Gorski @ 2013-08-01 9:55 UTC (permalink / raw)
To: linux-mips; +Cc: Ralf Baechle, John Crispin, Florian Fainelli, Kevin Cernekee
Commit 02b849f7613003fe5f9e58bf233d49b0ebd4a5e8 ("MIPS: Get rid of the
use of .macro in C code.") replaced the macro usage but missed
the accessors in bmips.h, causing the following build error:
CC arch/mips/kernel/smp-bmips.o
{standard input}: Assembler messages:
{standard input}:951: Error: Unrecognized opcode `_ssnop'
{standard input}:952: Error: Unrecognized opcode `_ssnop'
(...)
make[6]: *** [arch/mips/kernel/smp-bmips.o] Error 1
Fix this by also replacing the macros here, fixing the last occurrence
in mips.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
* V1 -> V2
Reworded and split out of patchset after finding the commmit
introducing the build failure.
While this is technically a regression introduced in 3.10, the code requires
OOT arch code to get compiled, so I'm not sure if that is critical enough to
warrant a stable tag.
arch/mips/include/asm/bmips.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
index 552a65a..87a253d 100644
--- a/arch/mips/include/asm/bmips.h
+++ b/arch/mips/include/asm/bmips.h
@@ -70,15 +70,15 @@ static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
".set noreorder\n"
"cache %1, 0(%2)\n"
"sync\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
"mfc0 %0, $28, 3\n"
- "_ssnop\n"
+ __stringify(___ssnop) "\n"
".set pop\n"
: "=&r" (ret)
: "i" (Index_Load_Tag_S), "r" (ZSCM_REG_BASE + offset)
@@ -92,13 +92,13 @@ static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
".set push\n"
".set noreorder\n"
"mtc0 %0, $28, 3\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
"cache %1, 0(%2)\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
+ __stringify(___ssnop) "\n"
: /* no outputs */
: "r" (data),
"i" (Index_Store_Tag_S), "r" (ZSCM_REG_BASE + offset)
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000
2013-08-01 9:55 [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000 Jonas Gorski
@ 2013-08-01 13:55 ` Ralf Baechle
2013-08-01 14:14 ` Jonas Gorski
2013-08-20 17:24 ` Florian Fainelli
0 siblings, 2 replies; 6+ messages in thread
From: Ralf Baechle @ 2013-08-01 13:55 UTC (permalink / raw)
To: Jonas Gorski; +Cc: linux-mips, John Crispin, Florian Fainelli, Kevin Cernekee
On Thu, Aug 01, 2013 at 11:55:38AM +0200, Jonas Gorski wrote:
> Commit 02b849f7613003fe5f9e58bf233d49b0ebd4a5e8 ("MIPS: Get rid of the
> use of .macro in C code.") replaced the macro usage but missed
> the accessors in bmips.h, causing the following build error:
>
> CC arch/mips/kernel/smp-bmips.o
> {standard input}: Assembler messages:
> {standard input}:951: Error: Unrecognized opcode `_ssnop'
> {standard input}:952: Error: Unrecognized opcode `_ssnop'
> (...)
> make[6]: *** [arch/mips/kernel/smp-bmips.o] Error 1
>
> Fix this by also replacing the macros here, fixing the last occurrence
> in mips.
How about getting rid of the entire inline assembler code by something
like below patch?
Ralf
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/bmips.h | 56 ++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 33 deletions(-)
diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
index 552a65a..6483d26 100644
--- a/arch/mips/include/asm/bmips.h
+++ b/arch/mips/include/asm/bmips.h
@@ -13,6 +13,7 @@
#include <linux/compiler.h>
#include <linux/linkage.h>
#include <asm/addrspace.h>
+#include <asm/r4kcache.h>
#include <asm/mipsregs.h>
#include <asm/hazards.h>
@@ -65,44 +66,33 @@ static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
{
unsigned long ret;
- __asm__ __volatile__(
- ".set push\n"
- ".set noreorder\n"
- "cache %1, 0(%2)\n"
- "sync\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "mfc0 %0, $28, 3\n"
- "_ssnop\n"
- ".set pop\n"
- : "=&r" (ret)
- : "i" (Index_Load_Tag_S), "r" (ZSCM_REG_BASE + offset)
- : "memory");
+ barrier();
+ cache_op(Index_Load_Tag_S, ZSCM_REG_BASE + offset);
+ __sync();
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ ret = read_c0_ddatalo();
+ __ssnop();
+
return ret;
}
static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
{
- __asm__ __volatile__(
- ".set push\n"
- ".set noreorder\n"
- "mtc0 %0, $28, 3\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- "cache %1, 0(%2)\n"
- "_ssnop\n"
- "_ssnop\n"
- "_ssnop\n"
- : /* no outputs */
- : "r" (data),
- "i" (Index_Store_Tag_S), "r" (ZSCM_REG_BASE + offset)
- : "memory");
+ write_c0_ddatalo(3);
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ cache_op(Index_Store_Tag_S, ZSCM_REG_BASE + offset);
+ __ssnop();
+ __ssnop();
+ __ssnop();
+ barrier();
}
#endif /* !defined(__ASSEMBLY__) */
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000
2013-08-01 13:55 ` Ralf Baechle
@ 2013-08-01 14:14 ` Jonas Gorski
2013-08-31 10:22 ` John Crispin
2013-08-20 17:24 ` Florian Fainelli
1 sibling, 1 reply; 6+ messages in thread
From: Jonas Gorski @ 2013-08-01 14:14 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, John Crispin, Florian Fainelli, Kevin Cernekee
On Thu, Aug 1, 2013 at 3:55 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Thu, Aug 01, 2013 at 11:55:38AM +0200, Jonas Gorski wrote:
>
>> Commit 02b849f7613003fe5f9e58bf233d49b0ebd4a5e8 ("MIPS: Get rid of the
>> use of .macro in C code.") replaced the macro usage but missed
>> the accessors in bmips.h, causing the following build error:
>>
>> CC arch/mips/kernel/smp-bmips.o
>> {standard input}: Assembler messages:
>> {standard input}:951: Error: Unrecognized opcode `_ssnop'
>> {standard input}:952: Error: Unrecognized opcode `_ssnop'
>> (...)
>> make[6]: *** [arch/mips/kernel/smp-bmips.o] Error 1
>>
>> Fix this by also replacing the macros here, fixing the last occurrence
>> in mips.
>
> How about getting rid of the entire inline assembler code by something
> like below patch?
It certainly does look neater. One small issue though ...
> arch/mips/include/asm/bmips.h | 56 ++++++++++++++++++-------------------------
> 1 file changed, 23 insertions(+), 33 deletions(-)
>
> diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
> index 552a65a..6483d26 100644
> --- a/arch/mips/include/asm/bmips.h
> +++ b/arch/mips/include/asm/bmips.h
> @@ -13,6 +13,7 @@
> #include <linux/compiler.h>
> #include <linux/linkage.h>
> #include <asm/addrspace.h>
> +#include <asm/r4kcache.h>
> #include <asm/mipsregs.h>
> #include <asm/hazards.h>
>
> @@ -65,44 +66,33 @@ static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
> {
> unsigned long ret;
>
> - __asm__ __volatile__(
> - ".set push\n"
> - ".set noreorder\n"
> - "cache %1, 0(%2)\n"
> - "sync\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "mfc0 %0, $28, 3\n"
> - "_ssnop\n"
> - ".set pop\n"
> - : "=&r" (ret)
> - : "i" (Index_Load_Tag_S), "r" (ZSCM_REG_BASE + offset)
> - : "memory");
> + barrier();
> + cache_op(Index_Load_Tag_S, ZSCM_REG_BASE + offset);
> + __sync();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + ret = read_c0_ddatalo();
> + __ssnop();
> +
> return ret;
> }
>
> static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
> {
> - __asm__ __volatile__(
> - ".set push\n"
> - ".set noreorder\n"
> - "mtc0 %0, $28, 3\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "cache %1, 0(%2)\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - : /* no outputs */
> - : "r" (data),
> - "i" (Index_Store_Tag_S), "r" (ZSCM_REG_BASE + offset)
> - : "memory");
> + write_c0_ddatalo(3);
I guess this needs to be write_c0_ddatalo(data);
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + cache_op(Index_Store_Tag_S, ZSCM_REG_BASE + offset);
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + barrier();
> }
>
> #endif /* !defined(__ASSEMBLY__) */
>
Kevin or Florian, can you comment on this?
Regards
Jonas
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000
2013-08-01 14:14 ` Jonas Gorski
@ 2013-08-31 10:22 ` John Crispin
2013-08-31 17:57 ` Kevin Cernekee
0 siblings, 1 reply; 6+ messages in thread
From: John Crispin @ 2013-08-31 10:22 UTC (permalink / raw)
To: Florian Fainelli, Kevin Cernekee; +Cc: linux-mips
Hi Kevin,
Hi Florian,
>> + write_c0_ddatalo(3);
> I guess this needs to be write_c0_ddatalo(data);
>
>> > + __ssnop();
>> > + __ssnop();
>> > + __ssnop();
>> > + cache_op(Index_Store_Tag_S, ZSCM_REG_BASE + offset);
>> > + __ssnop();
>> > + __ssnop();
>> > + __ssnop();
>> > + barrier();
>> > }
>> >
>> > #endif /* !defined(__ASSEMBLY__) */
>> >
> Kevin or Florian, can you comment on this?
>
any comments on this ?
John
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000
2013-08-31 10:22 ` John Crispin
@ 2013-08-31 17:57 ` Kevin Cernekee
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Cernekee @ 2013-08-31 17:57 UTC (permalink / raw)
To: John Crispin; +Cc: Florian Fainelli, Linux MIPS Mailing List
On Sat, Aug 31, 2013 at 3:22 AM, John Crispin <john@phrozen.org> wrote:
> Hi Kevin,
> Hi Florian,
>
>
>>> + write_c0_ddatalo(3);
>>
>> I guess this needs to be write_c0_ddatalo(data);
>
> any comments on this ?
Commit 43d309390349010cd384ab5a0feebf16b03b9a94 from the
mips-for-linux-next branch has this fix (and the __ssnop -> _ssnop
renaming). From comparing the assembly output it looks OK to me.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000
2013-08-01 13:55 ` Ralf Baechle
2013-08-01 14:14 ` Jonas Gorski
@ 2013-08-20 17:24 ` Florian Fainelli
1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2013-08-20 17:24 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Jonas Gorski, Linux-MIPS, John Crispin, Kevin Cernekee
2013/8/1 Ralf Baechle <ralf@linux-mips.org>:
> On Thu, Aug 01, 2013 at 11:55:38AM +0200, Jonas Gorski wrote:
>
>> Commit 02b849f7613003fe5f9e58bf233d49b0ebd4a5e8 ("MIPS: Get rid of the
>> use of .macro in C code.") replaced the macro usage but missed
>> the accessors in bmips.h, causing the following build error:
>>
>> CC arch/mips/kernel/smp-bmips.o
>> {standard input}: Assembler messages:
>> {standard input}:951: Error: Unrecognized opcode `_ssnop'
>> {standard input}:952: Error: Unrecognized opcode `_ssnop'
>> (...)
>> make[6]: *** [arch/mips/kernel/smp-bmips.o] Error 1
>>
>> Fix this by also replacing the macros here, fixing the last occurrence
>> in mips.
>
> How about getting rid of the entire inline assembler code by something
> like below patch?
>
> Ralf
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Better late than never:
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
>
> arch/mips/include/asm/bmips.h | 56 ++++++++++++++++++-------------------------
> 1 file changed, 23 insertions(+), 33 deletions(-)
>
> diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
> index 552a65a..6483d26 100644
> --- a/arch/mips/include/asm/bmips.h
> +++ b/arch/mips/include/asm/bmips.h
> @@ -13,6 +13,7 @@
> #include <linux/compiler.h>
> #include <linux/linkage.h>
> #include <asm/addrspace.h>
> +#include <asm/r4kcache.h>
> #include <asm/mipsregs.h>
> #include <asm/hazards.h>
>
> @@ -65,44 +66,33 @@ static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
> {
> unsigned long ret;
>
> - __asm__ __volatile__(
> - ".set push\n"
> - ".set noreorder\n"
> - "cache %1, 0(%2)\n"
> - "sync\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "mfc0 %0, $28, 3\n"
> - "_ssnop\n"
> - ".set pop\n"
> - : "=&r" (ret)
> - : "i" (Index_Load_Tag_S), "r" (ZSCM_REG_BASE + offset)
> - : "memory");
> + barrier();
> + cache_op(Index_Load_Tag_S, ZSCM_REG_BASE + offset);
> + __sync();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + ret = read_c0_ddatalo();
> + __ssnop();
> +
> return ret;
> }
>
> static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
> {
> - __asm__ __volatile__(
> - ".set push\n"
> - ".set noreorder\n"
> - "mtc0 %0, $28, 3\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "cache %1, 0(%2)\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - "_ssnop\n"
> - : /* no outputs */
> - : "r" (data),
> - "i" (Index_Store_Tag_S), "r" (ZSCM_REG_BASE + offset)
> - : "memory");
> + write_c0_ddatalo(3);
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + cache_op(Index_Store_Tag_S, ZSCM_REG_BASE + offset);
> + __ssnop();
> + __ssnop();
> + __ssnop();
> + barrier();
> }
>
> #endif /* !defined(__ASSEMBLY__) */
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-31 17:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01 9:55 [PATCH V2] MIPS: BMIPS: fix compilation for BMIPS5000 Jonas Gorski
2013-08-01 13:55 ` Ralf Baechle
2013-08-01 14:14 ` Jonas Gorski
2013-08-31 10:22 ` John Crispin
2013-08-31 17:57 ` Kevin Cernekee
2013-08-20 17:24 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox