On 11/01/2016 12:12 PM, Artyom Tarasenko wrote:
While playing with your patch set, I discovered that we also need a
patch to get_asi for ASI_N et al to retain MMU_HYPV_IDX, and not
decrease privilege. This happens *very* early in the prom boot, with
the first casx (when casx is implemented inline).

Why is the bug not visible with the current master? I wonder if we
have a symmetrical bug somewhere.


Hmm, I dunno.  I assume it has something to do with casx being implemented
out of line, and using helper_ld_asi instead of tcg_gen_qemu_ld_tl directly.

Actually I don't see where the  privilege is decreased: get_asi uses a
local mem_idx variable, the dc->mem_idx is retained.
What patch do you have in mind?

Like this. Anyway, now that PMM has my atomic and sparc patch sets, you should be able to see the problem yourself with your patch set and your rom.


r~
From fa75ae10f26b7611f9f36013a11b066766b9faee Mon Sep 17 00:00:00 2001
From: Richard Henderson <r...@twiddle.net>
Date: Mon, 10 Oct 2016 15:52:49 -0500
Subject: target-sparc: Override ASI_N for hypervisor

Signed-off-by: Richard Henderson <r...@twiddle.net>

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 43f89d4..2b80d79 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -2139,7 +2139,11 @@ static DisasASI get_asi(DisasContext *dc, int insn, 
TCGMemOp memop)
         case ASI_TWINX_NL:
         case ASI_NUCLEUS_QUAD_LDD:
         case ASI_NUCLEUS_QUAD_LDD_L:
-            mem_idx = MMU_NUCLEUS_IDX;
+            if (hypervisor(dc)) {
+                mem_idx = MMU_PHYS_IDX;
+            } else {
+                mem_idx = MMU_NUCLEUS_IDX;
+            }
             break;
         case ASI_AIUP:  /* As if user primary */
         case ASI_AIUPL: /* As if user primary LE */

Reply via email to