[PATCH v3 0/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr

Richard Henderson posted 8 patches 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230628071202.230991-1-richard.henderson@linaro.org
Maintainers: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
target/sparc/translate.c | 402 ++++++++++++++++++++++-----------------
1 file changed, 225 insertions(+), 177 deletions(-)
[PATCH v3 0/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr
Posted by Richard Henderson 1 year, 2 months ago
Changes from v2:
  * Patch 4 relaxes the checking on NPC:
    (1) save_npc has just asserted that if the low 2 bits are non-zero,
        then we have exactly one of our 3 special cases.
    (2) The difference between DYNAMIC_PC_LOOKUP and DYNAMIC_PC within
        NPC are not relevant to chaining, only those two values within PC.
    Therefore simplify the test in sparc_tr_tb_stop.


r~


Richard Henderson (8):
  target/sparc: Use tcg_gen_lookup_and_goto_ptr in gen_goto_tb
  target/sparc: Fix npc comparison in sparc_tr_insn_start
  target/sparc: Drop inline markers from translate.c
  target/sparc: Introduce DYNAMIC_PC_LOOKUP
  target/sparc: Use DYNAMIC_PC_LOOKUP for conditional branches
  target/sparc: Use DYNAMIC_PC_LOOKUP for JMPL
  target/sparc: Use DYNAMIC_PC_LOOKUP for v9 RETURN
  target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI

 target/sparc/translate.c | 402 ++++++++++++++++++++++-----------------
 1 file changed, 225 insertions(+), 177 deletions(-)

-- 
2.34.1
Re: [PATCH v3 0/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr
Posted by Mark Cave-Ayland 1 year, 2 months ago
On 28/06/2023 08:11, Richard Henderson wrote:

> Changes from v2:
>    * Patch 4 relaxes the checking on NPC:
>      (1) save_npc has just asserted that if the low 2 bits are non-zero,
>          then we have exactly one of our 3 special cases.
>      (2) The difference between DYNAMIC_PC_LOOKUP and DYNAMIC_PC within
>          NPC are not relevant to chaining, only those two values within PC.
>      Therefore simplify the test in sparc_tr_tb_stop.
> 
> 
> r~
> 
> 
> Richard Henderson (8):
>    target/sparc: Use tcg_gen_lookup_and_goto_ptr in gen_goto_tb
>    target/sparc: Fix npc comparison in sparc_tr_insn_start
>    target/sparc: Drop inline markers from translate.c
>    target/sparc: Introduce DYNAMIC_PC_LOOKUP
>    target/sparc: Use DYNAMIC_PC_LOOKUP for conditional branches
>    target/sparc: Use DYNAMIC_PC_LOOKUP for JMPL
>    target/sparc: Use DYNAMIC_PC_LOOKUP for v9 RETURN
>    target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI
> 
>   target/sparc/translate.c | 402 ++++++++++++++++++++++-----------------
>   1 file changed, 225 insertions(+), 177 deletions(-)

This fixes the issue seen with the real PROM and a run of my OpenBIOS boot tests 
shows all is still well, so I'll get this queued to qemu-sparc and send a PR shortly.


ATB,

Mark.
Re: [PATCH v3 0/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr
Posted by Philippe Mathieu-Daudé 1 year, 2 months ago
On 28/6/23 09:11, Richard Henderson wrote:
> Changes from v2:
>    * Patch 4 relaxes the checking on NPC:
>      (1) save_npc has just asserted that if the low 2 bits are non-zero,
>          then we have exactly one of our 3 special cases.
>      (2) The difference between DYNAMIC_PC_LOOKUP and DYNAMIC_PC within
>          NPC are not relevant to chaining, only those two values within PC.
>      Therefore simplify the test in sparc_tr_tb_stop.

$ git diff v2..v3
-- >8 --
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index fcc1054943..bd877a5e4a 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -5683,14 +5683,6 @@ static void sparc_tr_tb_stop(DisasContextBase 
*dcbase, CPUState *cs)
          save_npc(dc);
-        switch (dc->npc) {
-        case DYNAMIC_PC_LOOKUP:
-            if (may_lookup) {
-                tcg_gen_lookup_and_goto_ptr();
-                break;
-            }
-            /* fall through */
-        case DYNAMIC_PC:
+        if (may_lookup) {
+            tcg_gen_lookup_and_goto_ptr();
+        } else {
              tcg_gen_exit_tb(NULL, 0);
-            break;
-        default:
-            g_assert_not_reached();
          }
---

OK, this makes sense.