qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcg/mips: mips sync* encode error
@ 2020-04-11 12:46 lixinyu
  2020-04-11 18:07 ` Richard Henderson
  2020-04-12 17:25 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 4+ messages in thread
From: lixinyu @ 2020-04-11 12:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: aurelien, arikalo, lixinyu

OPC_SYNC_WMB, OPC_SYNC_MB, OPC_SYNC_ACQUIRE, OPC_SYNC_RELEASE and
OPC_SYNC_RMB have wrong encode. According to the mips manual,
their encode should be 'OPC_SYNC | 0x?? << 6' rather than
'OPC_SYNC | 0x?? << 5'. Wrong encode can lead illegal instruction
errors. These instructions often appear with multi-threaded
simulation.

Signed-off-by: lixinyu <precinct@mail.ustc.edu.cn>
---
 tcg/mips/tcg-target.inc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c
index 1da663ce84..4d32ebc1df 100644
--- a/tcg/mips/tcg-target.inc.c
+++ b/tcg/mips/tcg-target.inc.c
@@ -404,11 +404,11 @@ typedef enum {
 
     /* MIPS r6 introduced names for weaker variants of SYNC.  These are
        backward compatible to previous architecture revisions.  */
-    OPC_SYNC_WMB     = OPC_SYNC | 0x04 << 5,
-    OPC_SYNC_MB      = OPC_SYNC | 0x10 << 5,
-    OPC_SYNC_ACQUIRE = OPC_SYNC | 0x11 << 5,
-    OPC_SYNC_RELEASE = OPC_SYNC | 0x12 << 5,
-    OPC_SYNC_RMB     = OPC_SYNC | 0x13 << 5,
+    OPC_SYNC_WMB     = OPC_SYNC | 0x04 << 6,
+    OPC_SYNC_MB      = OPC_SYNC | 0x10 << 6,
+    OPC_SYNC_ACQUIRE = OPC_SYNC | 0x11 << 6,
+    OPC_SYNC_RELEASE = OPC_SYNC | 0x12 << 6,
+    OPC_SYNC_RMB     = OPC_SYNC | 0x13 << 6,
 
     /* Aliases for convenience.  */
     ALIAS_PADD     = sizeof(void *) == 4 ? OPC_ADDU : OPC_DADDU,
-- 
2.20.1




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

* Re: [PATCH] tcg/mips: mips sync* encode error
  2020-04-11 12:46 [PATCH] tcg/mips: mips sync* encode error lixinyu
@ 2020-04-11 18:07 ` Richard Henderson
  2020-04-11 18:37   ` Aleksandar Markovic
  2020-04-12 17:25 ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2020-04-11 18:07 UTC (permalink / raw)
  To: lixinyu, qemu-devel; +Cc: arikalo, aurelien

On 4/11/20 5:46 AM, lixinyu wrote:
> OPC_SYNC_WMB, OPC_SYNC_MB, OPC_SYNC_ACQUIRE, OPC_SYNC_RELEASE and
> OPC_SYNC_RMB have wrong encode. According to the mips manual,
> their encode should be 'OPC_SYNC | 0x?? << 6' rather than
> 'OPC_SYNC | 0x?? << 5'. Wrong encode can lead illegal instruction
> errors. These instructions often appear with multi-threaded
> simulation.

Good catch.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Queued to tcg-for-5.0.


r~


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

* Re: [PATCH] tcg/mips: mips sync* encode error
  2020-04-11 18:07 ` Richard Henderson
@ 2020-04-11 18:37   ` Aleksandar Markovic
  0 siblings, 0 replies; 4+ messages in thread
From: Aleksandar Markovic @ 2020-04-11 18:37 UTC (permalink / raw)
  To: Richard Henderson; +Cc: arikalo, Aurelien Jarno, QEMU Developers, lixinyu

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

20:08 Sub, 11.04.2020. Richard Henderson <richard.henderson@linaro.org> је
написао/ла:
>
> On 4/11/20 5:46 AM, lixinyu wrote:
> > OPC_SYNC_WMB, OPC_SYNC_MB, OPC_SYNC_ACQUIRE, OPC_SYNC_RELEASE and
> > OPC_SYNC_RMB have wrong encode. According to the mips manual,
> > their encode should be 'OPC_SYNC | 0x?? << 6' rather than
> > 'OPC_SYNC | 0x?? << 5'. Wrong encode can lead illegal instruction
> > errors. These instructions often appear with multi-threaded
> > simulation.
>
> Good catch.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> Queued to tcg-for-5.0.
>

Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>

Thanks to Lixinyu, in the first place, for reporting the problem, and also
thanks to Richard for reviewing and incorporating this patch into his queue
for 5.0. I also think, as Richard does, that this should go into 5.0, even
in this final stages.

Happy Easter, or hapy and sunny weekend, whatever you choose.

Aleksandar

>
> r~
>

[-- Attachment #2: Type: text/html, Size: 1490 bytes --]

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

* Re: [PATCH] tcg/mips: mips sync* encode error
  2020-04-11 12:46 [PATCH] tcg/mips: mips sync* encode error lixinyu
  2020-04-11 18:07 ` Richard Henderson
@ 2020-04-12 17:25 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-12 17:25 UTC (permalink / raw)
  To: lixinyu, qemu-devel; +Cc: arikalo, Pranith Kumar, aurelien

On 4/11/20 2:46 PM, lixinyu wrote:
> OPC_SYNC_WMB, OPC_SYNC_MB, OPC_SYNC_ACQUIRE, OPC_SYNC_RELEASE and
> OPC_SYNC_RMB have wrong encode. According to the mips manual,
> their encode should be 'OPC_SYNC | 0x?? << 6' rather than
> 'OPC_SYNC | 0x?? << 5'. Wrong encode can lead illegal instruction
> errors. These instructions often appear with multi-threaded
> simulation.
> 

Fixes: 6f0b99104a3

> Signed-off-by: lixinyu <precinct@mail.ustc.edu.cn>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tcg/mips/tcg-target.inc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c
> index 1da663ce84..4d32ebc1df 100644
> --- a/tcg/mips/tcg-target.inc.c
> +++ b/tcg/mips/tcg-target.inc.c
> @@ -404,11 +404,11 @@ typedef enum {
>  
>      /* MIPS r6 introduced names for weaker variants of SYNC.  These are
>         backward compatible to previous architecture revisions.  */
> -    OPC_SYNC_WMB     = OPC_SYNC | 0x04 << 5,
> -    OPC_SYNC_MB      = OPC_SYNC | 0x10 << 5,
> -    OPC_SYNC_ACQUIRE = OPC_SYNC | 0x11 << 5,
> -    OPC_SYNC_RELEASE = OPC_SYNC | 0x12 << 5,
> -    OPC_SYNC_RMB     = OPC_SYNC | 0x13 << 5,
> +    OPC_SYNC_WMB     = OPC_SYNC | 0x04 << 6,
> +    OPC_SYNC_MB      = OPC_SYNC | 0x10 << 6,
> +    OPC_SYNC_ACQUIRE = OPC_SYNC | 0x11 << 6,
> +    OPC_SYNC_RELEASE = OPC_SYNC | 0x12 << 6,
> +    OPC_SYNC_RMB     = OPC_SYNC | 0x13 << 6,
>  
>      /* Aliases for convenience.  */
>      ALIAS_PADD     = sizeof(void *) == 4 ? OPC_ADDU : OPC_DADDU,
> 


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

end of thread, other threads:[~2020-04-12 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-11 12:46 [PATCH] tcg/mips: mips sync* encode error lixinyu
2020-04-11 18:07 ` Richard Henderson
2020-04-11 18:37   ` Aleksandar Markovic
2020-04-12 17:25 ` Philippe Mathieu-Daudé

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).