qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 12/14] target/s390x: Simplify per_ifetch, per_check_exception


From: Thomas Huth
Subject: Re: [PATCH 12/14] target/s390x: Simplify per_ifetch, per_check_exception
Date: Wed, 29 May 2024 12:17:20 +0200
User-agent: Mozilla Thunderbird

On 02/05/2024 07.44, Richard Henderson wrote:
Set per_address and ilen in per_ifetch; this is valid for
all PER exceptions and will last until the end of the
instruction.  Therefore we don't need to give the same
data to per_check_exception.

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

# Conflicts:
#       target/s390x/tcg/misc_helper.c
---
  target/s390x/helper.h          |  4 ++--
  target/s390x/tcg/misc_helper.c | 23 +++++++++--------------
  target/s390x/tcg/translate.c   | 20 ++++++++++++--------
  3 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/target/s390x/helper.h b/target/s390x/helper.h
index 31bd193322..1a8a76abb9 100644
--- a/target/s390x/helper.h
+++ b/target/s390x/helper.h
@@ -359,9 +359,9 @@ DEF_HELPER_FLAGS_4(ipte, TCG_CALL_NO_RWG, void, env, i64, 
i64, i32)
  DEF_HELPER_FLAGS_1(ptlb, TCG_CALL_NO_RWG, void, env)
  DEF_HELPER_FLAGS_1(purge, TCG_CALL_NO_RWG, void, env)
  DEF_HELPER_3(lra, i64, env, i64, i64)
-DEF_HELPER_FLAGS_3(per_check_exception, TCG_CALL_NO_WG, void, env, i64, i32)
+DEF_HELPER_FLAGS_1(per_check_exception, TCG_CALL_NO_WG, void, env)
  DEF_HELPER_FLAGS_3(per_branch, TCG_CALL_NO_WG, void, env, i64, i32)
-DEF_HELPER_FLAGS_2(per_ifetch, TCG_CALL_NO_WG, void, env, i64)
+DEF_HELPER_FLAGS_2(per_ifetch, TCG_CALL_NO_WG, void, env, i32)
  DEF_HELPER_FLAGS_2(per_store_real, TCG_CALL_NO_WG, noreturn, env, i32)
  DEF_HELPER_FLAGS_1(stfl, TCG_CALL_NO_RWG, void, env)
diff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c
index 5f1efc6a32..f5e674a26e 100644
--- a/target/s390x/tcg/misc_helper.c
+++ b/target/s390x/tcg/misc_helper.c
@@ -604,12 +604,10 @@ G_NORETURN static void 
per_raise_exception_log(CPUS390XState *env)
      per_raise_exception(env);
  }
-void HELPER(per_check_exception)(CPUS390XState *env, uint64_t next_pc,
-                                 uint32_t ilen)
+void HELPER(per_check_exception)(CPUS390XState *env)
  {
+    /* psw_addr, per_address and int_pgm_ilen are already set. */
      if (unlikely(env->per_perc_atmid)) {
-        env->psw.addr = next_pc;
-        env->int_pgm_ilen = ilen;
          per_raise_exception_log(env);
      }
  }
@@ -639,23 +637,20 @@ void HELPER(per_branch)(CPUS390XState *env, uint64_t 
dest, uint32_t ilen)
      per_raise_exception_log(env);
  }
-void HELPER(per_ifetch)(CPUS390XState *env, uint64_t addr)
+void HELPER(per_ifetch)(CPUS390XState *env, uint32_t ilen)
  {
-    if (get_per_in_range(env, addr)) {
-        env->per_address = addr;
+    if (get_per_in_range(env, env->psw.addr)) {
+        env->per_address = env->psw.addr;
+        env->int_pgm_ilen = ilen;
          env->per_perc_atmid = PER_CODE_EVENT_IFETCH | get_per_atmid(env);
/* If the instruction has to be nullified, trigger the
             exception immediately. */
          if (env->cregs[9] & PER_CR9_EVENT_IFETCH_NULLIFICATION) {
-            CPUState *cs = env_cpu(env);
-
              env->per_perc_atmid |= PER_CODE_EVENT_NULLIFICATION;
-            env->int_pgm_code = PGM_PER;
-            env->int_pgm_ilen = get_ilen(cpu_ldub_code(env, addr));
-
-            cs->exception_index = EXCP_PGM;
-            cpu_loop_exit(cs);
+            qemu_log_mask(CPU_LOG_INT, "PER interrupt before %#" PRIx64 "\n",
+                          env->per_address);

FYI, checkpatch.pl complains:

ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead
#84: FILE: target/s390x/tcg/misc_helper.c:651:
+            qemu_log_mask(CPU_LOG_INT, "PER interrupt before %#" PRIx64

I'll fix it up while picking up your patch.

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]