diff mbox series

[2/3] target/ppc: Fix embedded memory barriers

Message ID 20240501130435.941189-3-npiggin@gmail.com
State New
Headers show
Series target/ppc: Fixes and updates for sync instructions | expand

Commit Message

Nicholas Piggin May 1, 2024, 1:04 p.m. UTC
Memory barriers are supposed to do something on BookE systems, these
were probably just missed during MTTCG enablement, maybe no targets
support SMP. Either way, add proper BookE implementations.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 target/ppc/translate/misc-impl.c.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chinmay Rath May 7, 2024, 7:24 a.m. UTC | #1
On 5/1/24 18:34, Nicholas Piggin wrote:
> Memory barriers are supposed to do something on BookE systems, these
> were probably just missed during MTTCG enablement, maybe no targets
> support SMP. Either way, add proper BookE implementations.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Chinmay Rath <rathc@linux.ibm.com>
> ---
>   target/ppc/translate/misc-impl.c.inc | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/ppc/translate/misc-impl.c.inc b/target/ppc/translate/misc-impl.c.inc
> index f58bf8b848..9226467f81 100644
> --- a/target/ppc/translate/misc-impl.c.inc
> +++ b/target/ppc/translate/misc-impl.c.inc
> @@ -34,8 +34,7 @@ static bool trans_SYNC(DisasContext *ctx, arg_X_sync *a)
>        */
>       if (!(ctx->insns_flags & PPC_MEM_SYNC)) {
>           if (ctx->insns_flags & PPC_BOOKE) {
> -            /* msync replaces sync on 440, interpreted as nop */
> -            /* XXX: this also catches e200 */
> +            tcg_gen_mb(bar | TCG_BAR_SC);
>               return true;
>           }
>   
> @@ -80,6 +79,7 @@ static bool trans_EIEIO(DisasContext *ctx, arg_EIEIO *a)
>       if (!(ctx->insns_flags & PPC_MEM_EIEIO)) {
>           if ((ctx->insns_flags & PPC_BOOKE) ||
>               (ctx->insns_flags2 & PPC2_BOOKE206)) {
> +            tcg_gen_mb(bar | TCG_BAR_SC);
>               return true;
>           }
>           return false;
diff mbox series

Patch

diff --git a/target/ppc/translate/misc-impl.c.inc b/target/ppc/translate/misc-impl.c.inc
index f58bf8b848..9226467f81 100644
--- a/target/ppc/translate/misc-impl.c.inc
+++ b/target/ppc/translate/misc-impl.c.inc
@@ -34,8 +34,7 @@  static bool trans_SYNC(DisasContext *ctx, arg_X_sync *a)
      */
     if (!(ctx->insns_flags & PPC_MEM_SYNC)) {
         if (ctx->insns_flags & PPC_BOOKE) {
-            /* msync replaces sync on 440, interpreted as nop */
-            /* XXX: this also catches e200 */
+            tcg_gen_mb(bar | TCG_BAR_SC);
             return true;
         }
 
@@ -80,6 +79,7 @@  static bool trans_EIEIO(DisasContext *ctx, arg_EIEIO *a)
     if (!(ctx->insns_flags & PPC_MEM_EIEIO)) {
         if ((ctx->insns_flags & PPC_BOOKE) ||
             (ctx->insns_flags2 & PPC2_BOOKE206)) {
+            tcg_gen_mb(bar | TCG_BAR_SC);
             return true;
         }
         return false;