From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151205941432447.6697207401819; Thu, 30 Nov 2017 08:30:14 -0800 (PST) Received: from localhost ([::1]:49118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRiv-00068b-AH for importer@patchew.org; Thu, 30 Nov 2017 11:30:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRgr-0004kK-Dg for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:27:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRgp-00031o-PA for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:27:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47596) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRgp-00031X-Fu; Thu, 30 Nov 2017 11:27:55 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C8F26A7D9; Thu, 30 Nov 2017 16:27:54 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D6E2620AC; Thu, 30 Nov 2017 16:27:48 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:29 +0100 Message-Id: <20171130162744.25442-2-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 16:27:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 01/16] s390x/tcg: introduce and use s390_program_interrupt() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Allows to easily convert more callers of program_interrupt() and to easily introduce new exceptions without forgetting about the cpu state reset. Use s390_program_interrupt() in places where we already had the same pattern. We will later get rid of program_interrupt(). RA !=3D 0 checks are already done behind the scenes. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/cpu.h | 2 ++ target/s390x/crypto_helper.c | 7 ++----- target/s390x/excp_helper.c | 5 +---- target/s390x/interrupt.c | 13 +++++++++++++ target/s390x/mem_helper.c | 35 +++++++++++------------------------ target/s390x/misc_helper.c | 3 +-- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 4db8b5409e..3340fdf4b5 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -720,6 +720,8 @@ void s390_io_interrupt(uint16_t subchannel_id, uint16_t= subchannel_nr, /* automatically detect the instruction length */ #define ILEN_AUTO 0xff void program_interrupt(CPUS390XState *env, uint32_t code, int ilen); +void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, + uintptr_t ra); /* service interrupts are floating therefore we must not pass an cpustate = */ void s390_sclp_extint(uint32_t parm); =20 diff --git a/target/s390x/crypto_helper.c b/target/s390x/crypto_helper.c index fa360a2d6e..5c79790187 100644 --- a/target/s390x/crypto_helper.c +++ b/target/s390x/crypto_helper.c @@ -23,7 +23,6 @@ uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uin= t32_t r2, uint32_t r3, const uintptr_t ra =3D GETPC(); const uint8_t mod =3D env->regs[0] & 0x80ULL; const uint8_t fc =3D env->regs[0] & 0x7fULL; - CPUState *cs =3D CPU(s390_env_get_cpu(env)); uint8_t subfunc[16] =3D { 0 }; uint64_t param_addr; int i; @@ -35,8 +34,7 @@ uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uin= t32_t r2, uint32_t r3, case S390_FEAT_TYPE_PCKMO: case S390_FEAT_TYPE_PCC: if (mod) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return 0; } break; @@ -44,8 +42,7 @@ uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uin= t32_t r2, uint32_t r3, =20 s390_get_feat_block(type, subfunc); if (!test_be_bit(fc, subfunc)) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return 0; } =20 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index e04b670663..d831537544 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -554,10 +554,7 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr= addr, S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; =20 - if (retaddr) { - cpu_restore_state(cs, retaddr); - } - program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, retaddr); } =20 #endif /* CONFIG_USER_ONLY */ diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index ce6177c141..b07e75daed 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -53,6 +53,19 @@ void program_interrupt(CPUS390XState *env, uint32_t code= , int ilen) } } =20 +void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, + uintptr_t ra) +{ +#ifdef CONFIG_TCG + S390CPU *cpu =3D s390_env_get_cpu(env); + + if (tcg_enabled()) { + cpu_restore_state(CPU(cpu), ra); + } +#endif + program_interrupt(env, code, ilen); +} + #if !defined(CONFIG_USER_ONLY) static void cpu_inject_service(S390CPU *cpu, uint32_t param) { diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index a1652d4849..2625d843b3 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -85,9 +85,7 @@ static inline void check_alignment(CPUS390XState *env, ui= nt64_t v, int wordsize, uintptr_t ra) { if (v % wordsize) { - CPUState *cs =3D CPU(s390_env_get_cpu(env)); - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); } } =20 @@ -545,8 +543,7 @@ void HELPER(srst)(CPUS390XState *env, uint32_t r1, uint= 32_t r2) =20 /* Bits 32-55 must contain all 0. */ if (env->regs[0] & 0xffffff00u) { - cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); } =20 str =3D get_address(env, r2); @@ -583,8 +580,7 @@ void HELPER(srstu)(CPUS390XState *env, uint32_t r1, uin= t32_t r2) =20 /* Bits 32-47 of R0 must be zero. */ if (env->regs[0] & 0xffff0000u) { - cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); } =20 str =3D get_address(env, r2); @@ -1600,8 +1596,7 @@ static uint32_t do_csst(CPUS390XState *env, uint32_t = r3, uint64_t a1, return cc; =20 spec_exception: - cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); g_assert_not_reached(); } =20 @@ -1865,8 +1860,7 @@ void HELPER(idte)(CPUS390XState *env, uint64_t r1, ui= nt64_t r2, uint32_t m4) uint16_t entries, i, index =3D 0; =20 if (r2 & 0xff000) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); } =20 if (!(r2 & 0x800)) { @@ -2014,8 +2008,7 @@ uint64_t HELPER(lra)(CPUS390XState *env, uint64_t add= r) =20 /* XXX incomplete - has more corner cases */ if (!(env->psw.mask & PSW_MASK_64) && (addr >> 32)) { - cpu_restore_state(cs, GETPC()); - program_interrupt(env, PGM_SPECIAL_OP, 2); + s390_program_interrupt(env, PGM_SPECIAL_OP, 2, GETPC()); } =20 old_exc =3D cs->exception_index; @@ -2185,7 +2178,6 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t d= est, uint64_t src, const uint8_t psw_as =3D (env->psw.mask & PSW_MASK_ASC) >> PSW_SHIFT_A= SC; const uint64_t r0 =3D env->regs[0]; const uintptr_t ra =3D GETPC(); - CPUState *cs =3D CPU(s390_env_get_cpu(env)); uint8_t dest_key, dest_as, dest_k, dest_a; uint8_t src_key, src_as, src_k, src_a; uint64_t val; @@ -2195,8 +2187,7 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t d= est, uint64_t src, __func__, dest, src, len); =20 if (!(env->psw.mask & PSW_MASK_DAT)) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIAL_OP, 6); + s390_program_interrupt(env, PGM_SPECIAL_OP, 6, ra); } =20 /* OAC (operand access control) for the first operand -> dest */ @@ -2227,17 +2218,14 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t= dest, uint64_t src, } =20 if (dest_a && dest_as =3D=3D AS_HOME && (env->psw.mask & PSW_MASK_PSTA= TE)) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIAL_OP, 6); + s390_program_interrupt(env, PGM_SPECIAL_OP, 6, ra); } if (!(env->cregs[0] & CR0_SECONDARY) && (dest_as =3D=3D AS_SECONDARY || src_as =3D=3D AS_SECONDARY)) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIAL_OP, 6); + s390_program_interrupt(env, PGM_SPECIAL_OP, 6, ra); } if (!psw_key_valid(env, dest_key) || !psw_key_valid(env, src_key)) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_PRIVILEGED, 6); + s390_program_interrupt(env, PGM_PRIVILEGED, 6, ra); } =20 len =3D wrap_length(env, len); @@ -2251,8 +2239,7 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t d= est, uint64_t src, (env->psw.mask & PSW_MASK_PSTATE)) { qemu_log_mask(LOG_UNIMP, "%s: AR-mode and PSTATE support missing\n= ", __func__); - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_ADDRESSING, 6); + s390_program_interrupt(env, PGM_ADDRESSING, 6, ra); } =20 /* FIXME: a) LAP diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index d272851e1c..1ccbafbb7d 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -519,8 +519,7 @@ uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t add= r) int i; =20 if (addr & 0x7) { - cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); } =20 prepare_stfl(); --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059414476274.39857748815496; Thu, 30 Nov 2017 08:30:14 -0800 (PST) Received: from localhost ([::1]:49119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRj0-0006Bl-JT for importer@patchew.org; Thu, 30 Nov 2017 11:30:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRgv-0004mv-8l for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRgs-00033w-2A for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40262) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRgr-00033A-Ok; Thu, 30 Nov 2017 11:27:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCD6D4A6F3; Thu, 30 Nov 2017 16:27:56 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE19C620B9; Thu, 30 Nov 2017 16:27:54 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:30 +0100 Message-Id: <20171130162744.25442-3-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 30 Nov 2017 16:27:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 02/16] s390x/tcg: get rid of runtime_exception() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's use s390_program_interrupt() instead. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/fpu_helper.c | 2 +- target/s390x/int_helper.c | 14 +++++++------- target/s390x/internal.h | 2 -- target/s390x/misc_helper.c | 16 ---------------- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index ffbeb3b2df..334159119f 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -44,7 +44,7 @@ static void ieee_exception(CPUS390XState *env, uint32_t d= xc, uintptr_t retaddr) /* Install the DXC code. */ env->fpc =3D (env->fpc & ~0xff00) | (dxc << 8); /* Trap. */ - runtime_exception(env, PGM_DATA, retaddr); + s390_program_interrupt(env, PGM_DATA, ILEN_AUTO, retaddr); } =20 /* Should be called after any operation that may raise IEEE exceptions. */ diff --git a/target/s390x/int_helper.c b/target/s390x/int_helper.c index 0076bea047..abf77a94e6 100644 --- a/target/s390x/int_helper.c +++ b/target/s390x/int_helper.c @@ -39,7 +39,7 @@ int64_t HELPER(divs32)(CPUS390XState *env, int64_t a, int= 64_t b64) int64_t q; =20 if (b =3D=3D 0) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC()); } =20 ret =3D q =3D a / b; @@ -47,7 +47,7 @@ int64_t HELPER(divs32)(CPUS390XState *env, int64_t a, int= 64_t b64) =20 /* Catch non-representable quotient. */ if (ret !=3D q) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC()); } =20 return ret; @@ -60,7 +60,7 @@ uint64_t HELPER(divu32)(CPUS390XState *env, uint64_t a, u= int64_t b64) uint64_t q; =20 if (b =3D=3D 0) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC()); } =20 ret =3D q =3D a / b; @@ -68,7 +68,7 @@ uint64_t HELPER(divu32)(CPUS390XState *env, uint64_t a, u= int64_t b64) =20 /* Catch non-representable quotient. */ if (ret !=3D q) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC()); } =20 return ret; @@ -79,7 +79,7 @@ int64_t HELPER(divs64)(CPUS390XState *env, int64_t a, int= 64_t b) { /* Catch divide by zero, and non-representable quotient (MIN / -1). */ if (b =3D=3D 0 || (b =3D=3D -1 && a =3D=3D (1ll << 63))) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC()); } env->retxl =3D a % b; return a / b; @@ -92,7 +92,7 @@ uint64_t HELPER(divu64)(CPUS390XState *env, uint64_t ah, = uint64_t al, uint64_t ret; /* Signal divide by zero. */ if (b =3D=3D 0) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC()); } if (ah =3D=3D 0) { /* 64 -> 64/64 case */ @@ -106,7 +106,7 @@ uint64_t HELPER(divu64)(CPUS390XState *env, uint64_t ah= , uint64_t al, env->retxl =3D a % b; ret =3D q; if (ret !=3D q) { - runtime_exception(env, PGM_FIXPT_DIVIDE, GETPC()); + s390_program_interrupt(env, PGM_FIXPT_DIVIDE, ILEN_AUTO, GETPC= ()); } #else S390CPU *cpu =3D s390_env_get_cpu(env); diff --git a/target/s390x/internal.h b/target/s390x/internal.h index 3aff54ada4..db39d5bfac 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -408,8 +408,6 @@ int mmu_translate_real(CPUS390XState *env, target_ulong= raddr, int rw, =20 =20 /* misc_helper.c */ -void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp, - uintptr_t retaddr); int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3); void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3); =20 diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 1ccbafbb7d..67628e690d 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -45,22 +45,6 @@ #define HELPER_LOG(x...) #endif =20 -/* Raise an exception dynamically from a helper function. */ -void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp, - uintptr_t retaddr) -{ - CPUState *cs =3D CPU(s390_env_get_cpu(env)); - - cs->exception_index =3D EXCP_PGM; - env->int_pgm_code =3D excp; - env->int_pgm_ilen =3D ILEN_AUTO; - - /* Use the (ultimate) callers address to find the insn that trapped. = */ - cpu_restore_state(cs, retaddr); - - cpu_loop_exit(cs); -} - /* Raise an exception statically from a TB. */ void HELPER(exception)(CPUS390XState *env, uint32_t excp) { --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059593547731.5966403004651; Thu, 30 Nov 2017 08:33:13 -0800 (PST) Received: from localhost ([::1]:49137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRlr-0000Fu-J5 for importer@patchew.org; Thu, 30 Nov 2017 11:33:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRgw-0004pe-Hp for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRgv-00035K-J1 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54948) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRgv-00034j-BD; Thu, 30 Nov 2017 11:28:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D6867F41D; Thu, 30 Nov 2017 16:28:00 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AB3D620BD; Thu, 30 Nov 2017 16:27:56 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:31 +0100 Message-Id: <20171130162744.25442-4-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Nov 2017 16:28:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 03/16] s390x/tcg: rip out dead tpi code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is broken and not even wired up. We'll add a new handler soon, but that will live somewhere else. Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- hw/s390x/css.c | 6 ------ include/hw/s390x/css.h | 1 - target/s390x/internal.h | 1 - target/s390x/ioinst.c | 26 -------------------------- 4 files changed, 34 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index f6b5c807cd..6bd0fedc78 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -1723,12 +1723,6 @@ void css_undo_stcrw(CRW *crw) QTAILQ_INSERT_HEAD(&channel_subsys.pending_crws, crw_cont, sibling); } =20 -int css_do_tpi(IOIntCode *int_code, int lowcore) -{ - /* No pending interrupts for !KVM. */ - return 0; - } - int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_= chpid, int rfmt, void *buf) { diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index ab6ebe66b5..0a14f76fea 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -248,7 +248,6 @@ int css_do_tsch_get_irb(SubchDev *sch, IRB *irb, int *i= rb_len); void css_do_tsch_update_subch(SubchDev *sch); int css_do_stcrw(CRW *crw); void css_undo_stcrw(CRW *crw); -int css_do_tpi(IOIntCode *int_code, int lowcore); int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_= chpid, int rfmt, void *buf); void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo); diff --git a/target/s390x/internal.h b/target/s390x/internal.h index db39d5bfac..603b0d7a7c 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -388,7 +388,6 @@ void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb); void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb); -int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb); void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2, uint32_t ipb); void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1); diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 23962fbebc..1d6857c14d 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -647,32 +647,6 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) } } =20 -int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb) -{ - CPUS390XState *env =3D &cpu->env; - uint64_t addr; - int lowcore; - IOIntCode int_code; - hwaddr len; - int ret; - uint8_t ar; - - trace_ioinst("tpi"); - addr =3D decode_basedisp_s(env, ipb, &ar); - if (addr & 3) { - program_interrupt(env, PGM_SPECIFICATION, 4); - return -EIO; - } - - lowcore =3D addr ? 0 : 1; - len =3D lowcore ? 8 /* two words */ : 12 /* three words */; - ret =3D css_do_tpi(&int_code, lowcore); - if (ret =3D=3D 1) { - s390_cpu_virt_mem_write(cpu, lowcore ? 184 : addr, ar, &int_code, = len); - } - return ret; -} - #define SCHM_REG1_RES(_reg) (_reg & 0x000000000ffffffc) #define SCHM_REG1_MBK(_reg) ((_reg & 0x00000000f0000000) >> 28) #define SCHM_REG1_UPD(_reg) ((_reg & 0x0000000000000002) >> 1) --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059621525313.89870455027665; Thu, 30 Nov 2017 08:33:41 -0800 (PST) Received: from localhost ([::1]:49139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRmJ-0000Ym-KQ for importer@patchew.org; Thu, 30 Nov 2017 11:33:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRh4-00054c-KS for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRh1-00036h-D5 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47238) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRh1-00036Y-3v; Thu, 30 Nov 2017 11:28:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46B3B82108; Thu, 30 Nov 2017 16:28:06 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEB08620BD; Thu, 30 Nov 2017 16:28:00 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:32 +0100 Message-Id: <20171130162744.25442-5-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Nov 2017 16:28:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 04/16] s390x/ioinst: pass the retaddr to all IO instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" TCG needs the retaddr when injecting an interrupt. Let's just pass it along and use RA_IGNORED for KVM. The value will be completely ignored for KVM. Convert program_interrupt() to s390_program_interrupt() directly, making use of the passed address. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/cpu.h | 1 + target/s390x/internal.h | 29 +++++++++++--------- target/s390x/ioinst.c | 67 +++++++++++++++++++++++-------------------= ---- target/s390x/kvm.c | 27 ++++++++++--------- target/s390x/misc_helper.c | 20 +++++++------- 5 files changed, 75 insertions(+), 69 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 3340fdf4b5..96abb2976b 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -720,6 +720,7 @@ void s390_io_interrupt(uint16_t subchannel_id, uint16_t= subchannel_nr, /* automatically detect the instruction length */ #define ILEN_AUTO 0xff void program_interrupt(CPUS390XState *env, uint32_t code, int ilen); +#define RA_IGNORED 0 void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, uintptr_t ra); /* service interrupts are floating therefore we must not pass an cpustate = */ diff --git a/target/s390x/internal.h b/target/s390x/internal.h index 603b0d7a7c..9db5f2d49d 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -379,20 +379,23 @@ void cpu_inject_stop(S390CPU *cpu); =20 =20 /* ioinst.c */ -void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1); -void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1); -void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1); -void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); -void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); -void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb); -void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); -int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); -void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb); +void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra); +void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1, uintptr_t ra); +void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra); +void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, + uintptr_t ra); +void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, + uintptr_t ra); +void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb, uintptr_t ra); +void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, + uintptr_t ra); +int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, uintptr_= t ra); +void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb, uintptr_t ra); void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2, - uint32_t ipb); -void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1); -void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1); -void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1); + uint32_t ipb, uintptr_t ra); +void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra); +void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1, uintptr_t ra); +void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1, uintptr_t ra); =20 =20 /* mem_helper.c */ diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 1d6857c14d..25e0ad6f77 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -38,13 +38,13 @@ int ioinst_disassemble_sch_ident(uint32_t value, int *m= , int *cssid, int *ssid, return 0; } =20 -void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1) +void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra) { int cssid, ssid, schid, m; SubchDev *sch; =20 if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { - program_interrupt(&cpu->env, PGM_OPERAND, 4); + s390_program_interrupt(&cpu->env, PGM_OPERAND, 4, ra); return; } trace_ioinst_sch_id("xsch", cssid, ssid, schid); @@ -56,13 +56,13 @@ void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1) setcc(cpu, css_do_xsch(sch)); } =20 -void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1) +void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1, uintptr_t ra) { int cssid, ssid, schid, m; SubchDev *sch; =20 if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { - program_interrupt(&cpu->env, PGM_OPERAND, 4); + s390_program_interrupt(&cpu->env, PGM_OPERAND, 4, ra); return; } trace_ioinst_sch_id("csch", cssid, ssid, schid); @@ -74,13 +74,13 @@ void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1) setcc(cpu, css_do_csch(sch)); } =20 -void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1) +void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra) { int cssid, ssid, schid, m; SubchDev *sch; =20 if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { - program_interrupt(&cpu->env, PGM_OPERAND, 4); + s390_program_interrupt(&cpu->env, PGM_OPERAND, 4, ra); return; } trace_ioinst_sch_id("hsch", cssid, ssid, schid); @@ -105,7 +105,7 @@ static int ioinst_schib_valid(SCHIB *schib) return 1; } =20 -void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) +void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, uintptr= _t ra) { int cssid, ssid, schid, m; SubchDev *sch; @@ -116,7 +116,7 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb) =20 addr =3D decode_basedisp_s(env, ipb, &ar); if (addr & 3) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &schib, sizeof(schib))) { @@ -124,7 +124,7 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb) } if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || !ioinst_schib_valid(&schib)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } trace_ioinst_sch_id("msch", cssid, ssid, schid); @@ -161,7 +161,7 @@ static int ioinst_orb_valid(ORB *orb) return 1; } =20 -void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) +void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, uintptr= _t ra) { int cssid, ssid, schid, m; SubchDev *sch; @@ -172,7 +172,7 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb) =20 addr =3D decode_basedisp_s(env, ipb, &ar); if (addr & 3) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { @@ -181,7 +181,7 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb) copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || !ioinst_orb_valid(&orb)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } trace_ioinst_sch_id("ssch", cssid, ssid, schid); @@ -193,7 +193,7 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb) setcc(cpu, css_do_ssch(sch, &orb)); } =20 -void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb) +void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb, uintptr_t ra) { CRW crw; uint64_t addr; @@ -203,7 +203,7 @@ void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb) =20 addr =3D decode_basedisp_s(env, ipb, &ar); if (addr & 3) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return; } =20 @@ -218,7 +218,8 @@ void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb) } } =20 -void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) +void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, + uintptr_t ra) { int cssid, ssid, schid, m; SubchDev *sch; @@ -230,7 +231,7 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, u= int32_t ipb) =20 addr =3D decode_basedisp_s(env, ipb, &ar); if (addr & 3) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return; } =20 @@ -241,7 +242,7 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, u= int32_t ipb) * access execption if it is not) first. */ if (!s390_cpu_virt_mem_check_write(cpu, addr, ar, sizeof(schib))) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); } return; } @@ -278,7 +279,7 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, u= int32_t ipb) setcc(cpu, cc); } =20 -int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) +int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb, uintptr_= t ra) { CPUS390XState *env =3D &cpu->env; int cssid, ssid, schid, m; @@ -289,13 +290,13 @@ int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, u= int32_t ipb) uint8_t ar; =20 if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return -EIO; } trace_ioinst_sch_id("tsch", cssid, ssid, schid); addr =3D decode_basedisp_s(env, ipb, &ar); if (addr & 3) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return -EIO; } =20 @@ -585,7 +586,7 @@ static void ioinst_handle_chsc_unimplemented(ChscResp *= res) res->param =3D 0; } =20 -void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) +void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb, uintptr_t ra) { ChscReq *req; ChscResp *res; @@ -601,7 +602,7 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) addr =3D env->regs[reg]; /* Page boundary? */ if (addr & 0xfff) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return; } /* @@ -616,7 +617,7 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) len =3D be16_to_cpu(req->len); /* Length field valid? */ if ((len < 16) || (len > 4088) || (len & 7)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } memset((char *)req + len, 0, TARGET_PAGE_SIZE - len); @@ -653,7 +654,7 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb) #define SCHM_REG1_DCT(_reg) (_reg & 0x0000000000000001) =20 void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2, - uint32_t ipb) + uint32_t ipb, uintptr_t ra) { uint8_t mbk; int update; @@ -663,7 +664,7 @@ void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, ui= nt64_t reg2, trace_ioinst("schm"); =20 if (SCHM_REG1_RES(reg1)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } =20 @@ -672,20 +673,20 @@ void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, = uint64_t reg2, dct =3D SCHM_REG1_DCT(reg1); =20 if (update && (reg2 & 0x000000000000001f)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } =20 css_do_schm(mbk, update, dct, update ? reg2 : 0); } =20 -void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1) +void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra) { int cssid, ssid, schid, m; SubchDev *sch; =20 if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { - program_interrupt(&cpu->env, PGM_OPERAND, 4); + s390_program_interrupt(&cpu->env, PGM_OPERAND, 4, ra); return; } trace_ioinst_sch_id("rsch", cssid, ssid, schid); @@ -700,7 +701,7 @@ void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1) #define RCHP_REG1_RES(_reg) (_reg & 0x00000000ff00ff00) #define RCHP_REG1_CSSID(_reg) ((_reg & 0x0000000000ff0000) >> 16) #define RCHP_REG1_CHPID(_reg) (_reg & 0x00000000000000ff) -void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1) +void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1, uintptr_t ra) { int cc; uint8_t cssid; @@ -709,7 +710,7 @@ void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1) CPUS390XState *env =3D &cpu->env; =20 if (RCHP_REG1_RES(reg1)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } =20 @@ -732,17 +733,17 @@ void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1) break; default: /* Invalid channel subsystem. */ - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return; } setcc(cpu, cc); } =20 #define SAL_REG1_INVALID(_reg) (_reg & 0x0000000080000000) -void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1) +void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1, uintptr_t ra) { /* We do not provide address limit checking, so let's suppress it. */ if (SAL_REG1_INVALID(reg1) || reg1 & 0x000000000000ffff) { - program_interrupt(&cpu->env, PGM_OPERAND, 4); + s390_program_interrupt(&cpu->env, PGM_OPERAND, 4, ra); } } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index b03f583032..b3ed3db2c2 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1124,32 +1124,32 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *= run, uint8_t ipa1) =20 switch (ipa1) { case PRIV_B2_XSCH: - ioinst_handle_xsch(cpu, env->regs[1]); + ioinst_handle_xsch(cpu, env->regs[1], RA_IGNORED); break; case PRIV_B2_CSCH: - ioinst_handle_csch(cpu, env->regs[1]); + ioinst_handle_csch(cpu, env->regs[1], RA_IGNORED); break; case PRIV_B2_HSCH: - ioinst_handle_hsch(cpu, env->regs[1]); + ioinst_handle_hsch(cpu, env->regs[1], RA_IGNORED); break; case PRIV_B2_MSCH: - ioinst_handle_msch(cpu, env->regs[1], run->s390_sieic.ipb); + ioinst_handle_msch(cpu, env->regs[1], run->s390_sieic.ipb, RA_IGNO= RED); break; case PRIV_B2_SSCH: - ioinst_handle_ssch(cpu, env->regs[1], run->s390_sieic.ipb); + ioinst_handle_ssch(cpu, env->regs[1], run->s390_sieic.ipb, RA_IGNO= RED); break; case PRIV_B2_STCRW: - ioinst_handle_stcrw(cpu, run->s390_sieic.ipb); + ioinst_handle_stcrw(cpu, run->s390_sieic.ipb, RA_IGNORED); break; case PRIV_B2_STSCH: - ioinst_handle_stsch(cpu, env->regs[1], run->s390_sieic.ipb); + ioinst_handle_stsch(cpu, env->regs[1], run->s390_sieic.ipb, RA_IGN= ORED); break; case PRIV_B2_TSCH: /* We should only get tsch via KVM_EXIT_S390_TSCH. */ fprintf(stderr, "Spurious tsch intercept\n"); break; case PRIV_B2_CHSC: - ioinst_handle_chsc(cpu, run->s390_sieic.ipb); + ioinst_handle_chsc(cpu, run->s390_sieic.ipb, RA_IGNORED); break; case PRIV_B2_TPI: /* This should have been handled by kvm already. */ @@ -1157,19 +1157,19 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *= run, uint8_t ipa1) break; case PRIV_B2_SCHM: ioinst_handle_schm(cpu, env->regs[1], env->regs[2], - run->s390_sieic.ipb); + run->s390_sieic.ipb, RA_IGNORED); break; case PRIV_B2_RSCH: - ioinst_handle_rsch(cpu, env->regs[1]); + ioinst_handle_rsch(cpu, env->regs[1], RA_IGNORED); break; case PRIV_B2_RCHP: - ioinst_handle_rchp(cpu, env->regs[1]); + ioinst_handle_rchp(cpu, env->regs[1], RA_IGNORED); break; case PRIV_B2_STCPS: /* We do not provide this instruction, it is suppressed. */ break; case PRIV_B2_SAL: - ioinst_handle_sal(cpu, env->regs[1]); + ioinst_handle_sal(cpu, env->regs[1], RA_IGNORED); break; case PRIV_B2_SIGA: /* Not provided, set CC =3D 3 for subchannel not operational */ @@ -1673,7 +1673,8 @@ static int handle_tsch(S390CPU *cpu) =20 cpu_synchronize_state(cs); =20 - ret =3D ioinst_handle_tsch(cpu, cpu->env.regs[1], run->s390_tsch.ipb); + ret =3D ioinst_handle_tsch(cpu, cpu->env.regs[1], run->s390_tsch.ipb, + RA_IGNORED); if (ret < 0) { /* * Failure. diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 67628e690d..9b53abbfa7 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -323,7 +323,7 @@ void HELPER(xsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_xsch(cpu, r1); + ioinst_handle_xsch(cpu, r1, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -331,7 +331,7 @@ void HELPER(csch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_csch(cpu, r1); + ioinst_handle_csch(cpu, r1, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -339,7 +339,7 @@ void HELPER(hsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_hsch(cpu, r1); + ioinst_handle_hsch(cpu, r1, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -347,7 +347,7 @@ void HELPER(msch)(CPUS390XState *env, uint64_t r1, uint= 64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_msch(cpu, r1, inst >> 16); + ioinst_handle_msch(cpu, r1, inst >> 16, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -355,7 +355,7 @@ void HELPER(rchp)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_rchp(cpu, r1); + ioinst_handle_rchp(cpu, r1, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -363,7 +363,7 @@ void HELPER(rsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_rsch(cpu, r1); + ioinst_handle_rsch(cpu, r1, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -371,7 +371,7 @@ void HELPER(ssch)(CPUS390XState *env, uint64_t r1, uint= 64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_ssch(cpu, r1, inst >> 16); + ioinst_handle_ssch(cpu, r1, inst >> 16, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -379,7 +379,7 @@ void HELPER(stsch)(CPUS390XState *env, uint64_t r1, uin= t64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_stsch(cpu, r1, inst >> 16); + ioinst_handle_stsch(cpu, r1, inst >> 16, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -387,7 +387,7 @@ void HELPER(tsch)(CPUS390XState *env, uint64_t r1, uint= 64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_tsch(cpu, r1, inst >> 16); + ioinst_handle_tsch(cpu, r1, inst >> 16, GETPC()); qemu_mutex_unlock_iothread(); } =20 @@ -395,7 +395,7 @@ void HELPER(chsc)(CPUS390XState *env, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); qemu_mutex_lock_iothread(); - ioinst_handle_chsc(cpu, inst >> 16); + ioinst_handle_chsc(cpu, inst >> 16, GETPC()); qemu_mutex_unlock_iothread(); } #endif --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059431464462.4960978021834; Thu, 30 Nov 2017 08:30:31 -0800 (PST) Received: from localhost ([::1]:49120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRjI-0006PQ-Jb for importer@patchew.org; Thu, 30 Nov 2017 11:30:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhA-00058A-M7 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRh8-00038I-Er for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63088) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRh8-00038C-6D; Thu, 30 Nov 2017 11:28:14 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 625D680478; Thu, 30 Nov 2017 16:28:13 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 910A5620C2; Thu, 30 Nov 2017 16:28:06 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:33 +0100 Message-Id: <20171130162744.25442-6-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 30 Nov 2017 16:28:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 05/16] s390x/pci: pass the retaddr to all PCI instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Once we wire up TCG, we will need the retaddr to correctly inject program interrupts. As we want to get rid of the function program_interrupt(), convert PCI code too. For KVM, we can simply use RA_IGNORED. Convert program_interrupt() to s390_program_interrupt() directly, making use of the passed address. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- hw/s390x/s390-pci-inst.c | 83 +++++++++++++++++++++++++-------------------= ---- hw/s390x/s390-pci-inst.h | 16 ++++++---- target/s390x/kvm.c | 14 ++++---- 3 files changed, 59 insertions(+), 54 deletions(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 8e088f3dc9..8123705dfd 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -142,7 +142,7 @@ out: return rc; } =20 -int clp_service_call(S390CPU *cpu, uint8_t r2) +int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) { ClpReqHdr *reqh; ClpRspHdr *resh; @@ -158,7 +158,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) cpu_synchronize_state(CPU(cpu)); =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 4); + s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; } =20 @@ -168,7 +168,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) reqh =3D (ClpReqHdr *)buffer; req_len =3D lduw_p(&reqh->len); if (req_len < 16 || req_len > 8184 || (req_len % 8 !=3D 0)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } =20 @@ -179,11 +179,11 @@ int clp_service_call(S390CPU *cpu, uint8_t r2) resh =3D (ClpRspHdr *)(buffer + req_len); res_len =3D lduw_p(&resh->len); if (res_len < 8 || res_len > 8176 || (res_len % 8 !=3D 0)) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } if ((req_len + res_len) > 8192) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } =20 @@ -314,7 +314,7 @@ out: return 0; } =20 -int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) +int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) { CPUS390XState *env =3D &cpu->env; S390PCIBusDevice *pbdev; @@ -329,12 +329,12 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2) cpu_synchronize_state(CPU(cpu)); =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 4); + s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; } =20 if (r2 & 0x1) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return 0; } =20 @@ -367,19 +367,19 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2) =20 if (pcias < 6) { if ((8 - (offset & 0x7)) < len) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } mr =3D pbdev->pdev->io_regions[pcias].memory; result =3D memory_region_dispatch_read(mr, offset, &data, len, MEMTXATTRS_UNSPECIFIED); if (result !=3D MEMTX_OK) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } } else if (pcias =3D=3D 15) { if ((4 - (offset & 0x3)) < len) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } data =3D pci_host_config_read_common( @@ -398,7 +398,7 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2) data =3D bswap64(data); break; default: - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } } else { @@ -425,7 +425,7 @@ static int trap_msix(S390PCIBusDevice *pbdev, uint64_t = offset, uint8_t pcias) } } =20 -int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) +int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) { CPUS390XState *env =3D &cpu->env; uint64_t offset, data; @@ -439,12 +439,12 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uin= t8_t r2) cpu_synchronize_state(CPU(cpu)); =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 4); + s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; } =20 if (r2 & 0x1) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); return 0; } =20 @@ -478,7 +478,7 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r2) data =3D env->regs[r1]; if (pcias < 6) { if ((8 - (offset & 0x7)) < len) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } =20 @@ -492,12 +492,12 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uin= t8_t r2) result =3D memory_region_dispatch_write(mr, offset, data, len, MEMTXATTRS_UNSPECIFIED); if (result !=3D MEMTX_OK) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } } else if (pcias =3D=3D 15) { if ((4 - (offset & 0x3)) < len) { - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } switch (len) { @@ -513,7 +513,7 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r2) data =3D bswap64(data); break; default: - program_interrupt(env, PGM_OPERAND, 4); + s390_program_interrupt(env, PGM_OPERAND, 4, ra); return 0; } =20 @@ -531,7 +531,7 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r2) return 0; } =20 -int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) +int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) { CPUS390XState *env =3D &cpu->env; uint32_t fh; @@ -545,12 +545,12 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2) cpu_synchronize_state(CPU(cpu)); =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 4); + s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); goto out; } =20 if (r2 & 0x1) { - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); goto out; } =20 @@ -624,7 +624,7 @@ out: } =20 int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gad= dr, - uint8_t ar) + uint8_t ar, uintptr_t ra) { CPUS390XState *env =3D &cpu->env; S390PCIBusDevice *pbdev; @@ -637,7 +637,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r3, uint64_t gaddr, uint8_t buffer[128]; =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 6); + s390_program_interrupt(env, PGM_PRIVILEGED, 6, ra); return 0; } =20 @@ -659,7 +659,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r3, uint64_t gaddr, case 128: break; default: - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); return 0; } =20 @@ -687,7 +687,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r3, uint64_t gaddr, =20 mr =3D pbdev->pdev->io_regions[pcias].memory; if (!memory_region_access_valid(mr, env->regs[r3], len, true)) { - program_interrupt(env, PGM_OPERAND, 6); + s390_program_interrupt(env, PGM_OPERAND, 6, ra); return 0; } =20 @@ -700,7 +700,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r3, uint64_t gaddr, ldq_p(buffer + i * 8), 8, MEMTXATTRS_UNSPECIFIED); if (result !=3D MEMTX_OK) { - program_interrupt(env, PGM_OPERAND, 6); + s390_program_interrupt(env, PGM_OPERAND, 6, ra); return 0; } } @@ -767,7 +767,8 @@ int pci_dereg_irqs(S390PCIBusDevice *pbdev) return 0; } =20 -static int reg_ioat(CPUS390XState *env, S390PCIIOMMU *iommu, ZpciFib fib) +static int reg_ioat(CPUS390XState *env, S390PCIIOMMU *iommu, ZpciFib fib, + uintptr_t ra) { uint64_t pba =3D ldq_p(&fib.pba); uint64_t pal =3D ldq_p(&fib.pal); @@ -776,14 +777,14 @@ static int reg_ioat(CPUS390XState *env, S390PCIIOMMU = *iommu, ZpciFib fib) uint8_t t =3D (g_iota >> 11) & 0x1; =20 if (pba > pal || pba < ZPCI_SDMA_ADDR || pal > ZPCI_EDMA_ADDR) { - program_interrupt(env, PGM_OPERAND, 6); + s390_program_interrupt(env, PGM_OPERAND, 6, ra); return -EINVAL; } =20 /* currently we only support designation type 1 with translation */ if (!(dt =3D=3D ZPCI_IOTA_RTTO && t)) { error_report("unsupported ioat dt %d t %d", dt, t); - program_interrupt(env, PGM_OPERAND, 6); + s390_program_interrupt(env, PGM_OPERAND, 6, ra); return -EINVAL; } =20 @@ -804,7 +805,8 @@ void pci_dereg_ioat(S390PCIIOMMU *iommu) iommu->g_iota =3D 0; } =20 -int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t a= r) +int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t a= r, + uintptr_t ra) { CPUS390XState *env =3D &cpu->env; uint8_t oc, dmaas; @@ -814,7 +816,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) uint64_t cc =3D ZPCI_PCI_LS_OK; =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 6); + s390_program_interrupt(env, PGM_PRIVILEGED, 6, ra); return 0; } =20 @@ -823,7 +825,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) fh =3D env->regs[r1] >> 32; =20 if (fiba & 0x7) { - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); return 0; } =20 @@ -850,7 +852,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) } =20 if (fib.fmt !=3D 0) { - program_interrupt(env, PGM_OPERAND, 6); + s390_program_interrupt(env, PGM_OPERAND, 6, ra); return 0; } =20 @@ -879,7 +881,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) } else if (pbdev->iommu->enabled) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); - } else if (reg_ioat(env, pbdev->iommu, fib)) { + } else if (reg_ioat(env, pbdev->iommu, fib, ra)) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_INSUF_RES); } @@ -904,7 +906,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE); } else { pci_dereg_ioat(pbdev->iommu); - if (reg_ioat(env, pbdev->iommu, fib)) { + if (reg_ioat(env, pbdev->iommu, fib, ra)) { cc =3D ZPCI_PCI_LS_ERR; s390_set_status_code(env, r1, ZPCI_MOD_ST_INSUF_RES); } @@ -935,7 +937,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) pbdev->fmb_addr =3D ldq_p(&fib.fmb_addr); break; default: - program_interrupt(&cpu->env, PGM_OPERAND, 6); + s390_program_interrupt(&cpu->env, PGM_OPERAND, 6, ra); cc =3D ZPCI_PCI_LS_ERR; } =20 @@ -943,7 +945,8 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar) return 0; } =20 -int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar) +int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar, + uintptr_t ra) { CPUS390XState *env =3D &cpu->env; uint8_t dmaas; @@ -954,7 +957,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint= 64_t fiba, uint8_t ar) uint64_t cc =3D ZPCI_PCI_LS_OK; =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, 6); + s390_program_interrupt(env, PGM_PRIVILEGED, 6, ra); return 0; } =20 @@ -968,7 +971,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint= 64_t fiba, uint8_t ar) } =20 if (fiba & 0x7) { - program_interrupt(env, PGM_SPECIFICATION, 6); + s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra); return 0; } =20 diff --git a/hw/s390x/s390-pci-inst.h b/hw/s390x/s390-pci-inst.h index 94a959f91c..93ef290101 100644 --- a/hw/s390x/s390-pci-inst.h +++ b/hw/s390x/s390-pci-inst.h @@ -293,13 +293,15 @@ typedef struct ZpciFib { =20 int pci_dereg_irqs(S390PCIBusDevice *pbdev); void pci_dereg_ioat(S390PCIIOMMU *iommu); -int clp_service_call(S390CPU *cpu, uint8_t r2); -int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); -int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); -int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2); +int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra); +int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra); +int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra= ); +int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra); int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gad= dr, - uint8_t ar); -int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t a= r); -int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar); + uint8_t ar, uintptr_t ra); +int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t a= r, + uintptr_t ra); +int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t = ar, + uintptr_t ra); =20 #endif diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index b3ed3db2c2..fb20435e50 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1230,7 +1230,7 @@ static int kvm_clp_service_call(S390CPU *cpu, struct = kvm_run *run) uint8_t r2 =3D (run->s390_sieic.ipb & 0x000f0000) >> 16; =20 if (s390_has_feat(S390_FEAT_ZPCI)) { - return clp_service_call(cpu, r2); + return clp_service_call(cpu, r2, RA_IGNORED); } else { return -1; } @@ -1242,7 +1242,7 @@ static int kvm_pcilg_service_call(S390CPU *cpu, struc= t kvm_run *run) uint8_t r2 =3D (run->s390_sieic.ipb & 0x000f0000) >> 16; =20 if (s390_has_feat(S390_FEAT_ZPCI)) { - return pcilg_service_call(cpu, r1, r2); + return pcilg_service_call(cpu, r1, r2, RA_IGNORED); } else { return -1; } @@ -1254,7 +1254,7 @@ static int kvm_pcistg_service_call(S390CPU *cpu, stru= ct kvm_run *run) uint8_t r2 =3D (run->s390_sieic.ipb & 0x000f0000) >> 16; =20 if (s390_has_feat(S390_FEAT_ZPCI)) { - return pcistg_service_call(cpu, r1, r2); + return pcistg_service_call(cpu, r1, r2, RA_IGNORED); } else { return -1; } @@ -1270,7 +1270,7 @@ static int kvm_stpcifc_service_call(S390CPU *cpu, str= uct kvm_run *run) cpu_synchronize_state(CPU(cpu)); fiba =3D get_base_disp_rxy(cpu, run, &ar); =20 - return stpcifc_service_call(cpu, r1, fiba, ar); + return stpcifc_service_call(cpu, r1, fiba, ar, RA_IGNORED); } else { return -1; } @@ -1302,7 +1302,7 @@ static int kvm_rpcit_service_call(S390CPU *cpu, struc= t kvm_run *run) uint8_t r2 =3D (run->s390_sieic.ipb & 0x000f0000) >> 16; =20 if (s390_has_feat(S390_FEAT_ZPCI)) { - return rpcit_service_call(cpu, r1, r2); + return rpcit_service_call(cpu, r1, r2, RA_IGNORED); } else { return -1; } @@ -1319,7 +1319,7 @@ static int kvm_pcistb_service_call(S390CPU *cpu, stru= ct kvm_run *run) cpu_synchronize_state(CPU(cpu)); gaddr =3D get_base_disp_rsy(cpu, run, &ar); =20 - return pcistb_service_call(cpu, r1, r3, gaddr, ar); + return pcistb_service_call(cpu, r1, r3, gaddr, ar, RA_IGNORED); } else { return -1; } @@ -1335,7 +1335,7 @@ static int kvm_mpcifc_service_call(S390CPU *cpu, stru= ct kvm_run *run) cpu_synchronize_state(CPU(cpu)); fiba =3D get_base_disp_rxy(cpu, run, &ar); =20 - return mpcifc_service_call(cpu, r1, fiba, ar); + return mpcifc_service_call(cpu, r1, fiba, ar, RA_IGNORED); } else { return -1; } --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059827921502.75536282645623; Thu, 30 Nov 2017 08:37:07 -0800 (PST) Received: from localhost ([::1]:49175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRpS-0002u6-0G for importer@patchew.org; Thu, 30 Nov 2017 11:36:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhE-0005BC-7h for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhC-00039z-F2 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32920) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhC-00039Z-6r; Thu, 30 Nov 2017 11:28:18 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 585E8C0587C0; Thu, 30 Nov 2017 16:28:17 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E77620C2; Thu, 30 Nov 2017 16:28:13 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:34 +0100 Message-Id: <20171130162744.25442-7-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 30 Nov 2017 16:28:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 06/16] s390x/diag: pass the retaddr into handle_diag_308() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Needed to later drop potential_page_fault() from the diag TCG translate function. Convert program_interrupt() to s390_program_interrupt() directly, making use of the passed address. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/diag.c | 14 +++++++------- target/s390x/internal.h | 3 ++- target/s390x/kvm.c | 2 +- target/s390x/misc_helper.c | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/target/s390x/diag.c b/target/s390x/diag.c index dbbb9e886f..a755837ad5 100644 --- a/target/s390x/diag.c +++ b/target/s390x/diag.c @@ -99,19 +99,19 @@ int handle_diag_288(CPUS390XState *env, uint64_t r1, ui= nt64_t r3) #define DIAG_308_RC_NO_CONF 0x0102 #define DIAG_308_RC_INVALID 0x0402 =20 -void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3) +void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr= _t ra) { uint64_t addr =3D env->regs[r1]; uint64_t subcode =3D env->regs[r3]; IplParameterBlock *iplb; =20 if (env->psw.mask & PSW_MASK_PSTATE) { - program_interrupt(env, PGM_PRIVILEGED, ILEN_AUTO); + s390_program_interrupt(env, PGM_PRIVILEGED, ILEN_AUTO, ra); return; } =20 if ((subcode & ~0x0ffffULL) || (subcode > 6)) { - program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra); return; } =20 @@ -136,12 +136,12 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1,= uint64_t r3) break; case 5: if ((r1 & 1) || (addr & 0x0fffULL)) { - program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra); return; } if (!address_space_access_valid(&address_space_memory, addr, sizeof(IplParameterBlock), false))= { - program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO); + s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); return; } iplb =3D g_new0(IplParameterBlock, 1); @@ -165,12 +165,12 @@ out: return; case 6: if ((r1 & 1) || (addr & 0x0fffULL)) { - program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, ra); return; } if (!address_space_access_valid(&address_space_memory, addr, sizeof(IplParameterBlock), true)) { - program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO); + s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); return; } iplb =3D s390_ipl_get_iplb(); diff --git a/target/s390x/internal.h b/target/s390x/internal.h index 9db5f2d49d..6817b2c432 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -411,7 +411,8 @@ int mmu_translate_real(CPUS390XState *env, target_ulong= raddr, int rw, =20 /* misc_helper.c */ int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3); -void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3); +void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, + uintptr_t ra); =20 =20 /* translate.c */ diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index fb20435e50..05db242563 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1451,7 +1451,7 @@ static void kvm_handle_diag_308(S390CPU *cpu, struct = kvm_run *run) cpu_synchronize_state(CPU(cpu)); r1 =3D (run->s390_sieic.ipa & 0x00f0) >> 4; r3 =3D run->s390_sieic.ipa & 0x000f; - handle_diag_308(&cpu->env, r1, r3); + handle_diag_308(&cpu->env, r1, r3, RA_IGNORED); } =20 static int handle_sw_breakpoint(S390CPU *cpu, struct kvm_run *run) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 9b53abbfa7..556340756c 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -88,7 +88,7 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32= _t r3, uint32_t num) case 0x308: /* ipl */ qemu_mutex_lock_iothread(); - handle_diag_308(env, r1, r3); + handle_diag_308(env, r1, r3, GETPC()); qemu_mutex_unlock_iothread(); r =3D 0; break; --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059635997656.9810701587935; Thu, 30 Nov 2017 08:33:55 -0800 (PST) Received: from localhost ([::1]:49140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRma-0000nE-4d for importer@patchew.org; Thu, 30 Nov 2017 11:33:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhG-0005BS-Bu for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhE-0003Bq-SX for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhE-0003BM-Cg; Thu, 30 Nov 2017 11:28:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D2FC81DE5; Thu, 30 Nov 2017 16:28:19 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB8E464426; Thu, 30 Nov 2017 16:28:17 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:35 +0100 Message-Id: <20171130162744.25442-8-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Nov 2017 16:28:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 07/16] s390x: handle exceptions during s390_cpu_virt_mem_rw() correctly (TCG) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" s390_cpu_virt_mem_rw() must always return, so callers can react on an exception (e.g. see ioinst_handle_stcrw()). However, for TCG we always have to exit the cpu loop (and restore the cpu state before that) if we injected a program interrupt. So let's introduce and use s390_cpu_virt_mem_handle_exc() in code that is not purely KVM. Directly pass the retaddr we already have available in these functions. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- hw/s390x/s390-pci-inst.c | 7 +++++++ target/s390x/cpu.h | 1 + target/s390x/ioinst.c | 20 +++++++++++++++++--- target/s390x/mmu_helper.c | 14 ++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 8123705dfd..6f41083244 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -163,6 +163,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_= t ra) } =20 if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, sizeof(*req= h))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } reqh =3D (ClpReqHdr *)buffer; @@ -174,6 +175,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_= t ra) =20 if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, req_len + sizeof(*resh))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } resh =3D (ClpRspHdr *)(buffer + req_len); @@ -189,6 +191,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_= t ra) =20 if (s390_cpu_virt_mem_read(cpu, env->regs[r2], r2, buffer, req_len + res_len)) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } =20 @@ -308,6 +311,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_= t ra) out: if (s390_cpu_virt_mem_write(cpu, env->regs[r2], r2, buffer, req_len + res_len)) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } setcc(cpu, cc); @@ -692,6 +696,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8= _t r3, uint64_t gaddr, } =20 if (s390_cpu_virt_mem_read(cpu, gaddr, ar, buffer, len)) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } =20 @@ -848,6 +853,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint6= 4_t fiba, uint8_t ar, } =20 if (s390_cpu_virt_mem_read(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib)= )) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } =20 @@ -1029,6 +1035,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, ui= nt64_t fiba, uint8_t ar, =20 out: if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib= ))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return 0; } =20 diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 96abb2976b..ae61d18c0a 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -736,6 +736,7 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, s390_cpu_virt_mem_rw(cpu, laddr, ar, dest, len, true) #define s390_cpu_virt_mem_check_write(cpu, laddr, ar, len) \ s390_cpu_virt_mem_rw(cpu, laddr, ar, NULL, len, true) +void s390_cpu_virt_mem_handle_exc(S390CPU *cpu, uintptr_t ra); =20 =20 /* sigp.c */ diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 25e0ad6f77..83c164a168 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -120,6 +120,7 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb, uintptr_t ra) return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &schib, sizeof(schib))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return; } if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || @@ -176,6 +177,7 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, ui= nt32_t ipb, uintptr_t ra) return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return; } copy_orb_from_guest(&orb, &orig_orb); @@ -212,9 +214,12 @@ void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb, u= intptr_t ra) =20 if (s390_cpu_virt_mem_write(cpu, addr, ar, &crw, sizeof(crw)) =3D=3D 0= ) { setcc(cpu, cc); - } else if (cc =3D=3D 0) { - /* Write failed: requeue CRW since STCRW is a suppressing instruct= ion */ - css_undo_stcrw(&crw); + } else { + if (cc =3D=3D 0) { + /* Write failed: requeue CRW since STCRW is suppressing */ + css_undo_stcrw(&crw); + } + s390_cpu_virt_mem_handle_exc(cpu, ra); } } =20 @@ -243,6 +248,8 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, u= int32_t ipb, */ if (!s390_cpu_virt_mem_check_write(cpu, addr, ar, sizeof(schib))) { s390_program_interrupt(env, PGM_OPERAND, 4, ra); + } else { + s390_cpu_virt_mem_handle_exc(cpu, ra); } return; } @@ -268,11 +275,13 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1,= uint32_t ipb, if (cc !=3D 3) { if (s390_cpu_virt_mem_write(cpu, addr, ar, &schib, sizeof(schib)) !=3D 0) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return; } } else { /* Access exceptions have a higher priority than cc3 */ if (s390_cpu_virt_mem_check_write(cpu, addr, ar, sizeof(schib)) != =3D 0) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return; } } @@ -309,6 +318,7 @@ int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uin= t32_t ipb, uintptr_t ra) /* 0 - status pending, 1 - not status pending, 3 - not operational */ if (cc !=3D 3) { if (s390_cpu_virt_mem_write(cpu, addr, ar, &irb, irb_len) !=3D 0) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return -EFAULT; } css_do_tsch_update_subch(sch); @@ -316,6 +326,7 @@ int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uin= t32_t ipb, uintptr_t ra) irb_len =3D sizeof(irb) - sizeof(irb.emw); /* Access exceptions have a higher priority than cc3 */ if (s390_cpu_virt_mem_check_write(cpu, addr, ar, irb_len) !=3D 0) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return -EFAULT; } } @@ -611,6 +622,7 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb, uin= tptr_t ra) * care of req->len here first. */ if (s390_cpu_virt_mem_read(cpu, addr, reg, buf, sizeof(ChscReq))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); return; } req =3D (ChscReq *)buf; @@ -645,6 +657,8 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb, uin= tptr_t ra) if (!s390_cpu_virt_mem_write(cpu, addr + len, reg, res, be16_to_cpu(res->len))) { setcc(cpu, 0); /* Command execution complete */ + } else { + s390_cpu_virt_mem_handle_exc(cpu, ra); } } =20 diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 31e3f3f415..dbe2f511f8 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -22,6 +22,7 @@ #include "internal.h" #include "kvm_s390x.h" #include "sysemu/kvm.h" +#include "exec/exec-all.h" #include "trace.h" #include "hw/s390x/storage-keys.h" =20 @@ -478,6 +479,9 @@ static int translate_pages(S390CPU *cpu, vaddr addr, in= t nr_pages, * * Copy from/to guest memory using logical addresses. Note that we inject a * program interrupt in case there is an error while accessing the memory. + * + * This function will always return (also for TCG), make sure to call + * s390_cpu_virt_mem_handle_exc() to properly exit the CPU loop. */ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *host= buf, int len, bool is_write) @@ -514,6 +518,16 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, ui= nt8_t ar, void *hostbuf, return ret; } =20 +void s390_cpu_virt_mem_handle_exc(S390CPU *cpu, uintptr_t ra) +{ + /* KVM will handle the interrupt automatically, TCG has to exit the TB= */ +#ifdef CONFIG_TCG + if (tcg_enabled()) { + cpu_loop_exit_restore(CPU(cpu), ra); + } +#endif +} + /** * Translate a real address into a physical (absolute) address. * @param raddr the real address --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059973734848.60920633051; Thu, 30 Nov 2017 08:39:33 -0800 (PST) Received: from localhost ([::1]:49193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRrw-0005MU-DF for importer@patchew.org; Thu, 30 Nov 2017 11:39:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhJ-0005EG-DQ for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhI-0003Cu-Gs for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhI-0003CY-Am; Thu, 30 Nov 2017 11:28:24 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7239A6A7DD; Thu, 30 Nov 2017 16:28:23 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF0C6620B6; Thu, 30 Nov 2017 16:28:19 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:36 +0100 Message-Id: <20171130162744.25442-9-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 16:28:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 08/16] s390x/tcg: don't exit the cpu loop in s390_cpu_virt_mem_rw() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" s390_cpu_virt_mem_rw() must always return, so callers can react on an exception (e.g. see ioinst_handle_stcrw()). Therefore, using program_interrupt() is wrong. Fix that up. Signed-off-by: David Hildenbrand --- target/s390x/mmu_helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index dbe2f511f8..f477cc006a 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -64,7 +64,9 @@ static void trigger_access_exception(CPUS390XState *env, = uint32_t type, kvm_s390_access_exception(cpu, type, tec); } else { CPUState *cs =3D CPU(cpu); - stq_phys(cs->as, env->psa + offsetof(LowCore, trans_exc_code), tec= ); + if (type !=3D PGM_ADDRESSING) { + stq_phys(cs->as, env->psa + offsetof(LowCore, trans_exc_code),= tec); + } trigger_pgm_exception(env, type, ilen); } } @@ -443,7 +445,8 @@ int mmu_translate(CPUS390XState *env, target_ulong vadd= r, int rw, uint64_t asc, =20 /** * translate_pages: Translate a set of consecutive logical page addresses - * to absolute addresses + * to absolute addresses. This function is used for TCG and old KVM without + * the MEMOP interface. */ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, target_ulong *pages, bool is_write) @@ -459,7 +462,7 @@ static int translate_pages(S390CPU *cpu, vaddr addr, in= t nr_pages, } if (!address_space_access_valid(&address_space_memory, pages[i], TARGET_PAGE_SIZE, is_write)) { - program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO); + trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0); return -EFAULT; } addr +=3D TARGET_PAGE_SIZE; --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059614395492.5203969852779; Thu, 30 Nov 2017 08:33:34 -0800 (PST) Received: from localhost ([::1]:49138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRmE-0000XS-K6 for importer@patchew.org; Thu, 30 Nov 2017 11:33:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhN-0005IJ-5Y for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhL-0003Et-N7 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55162) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhL-0003EL-EA; Thu, 30 Nov 2017 11:28:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8721F81DE5; Thu, 30 Nov 2017 16:28:26 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5656620B6; Thu, 30 Nov 2017 16:28:23 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:37 +0100 Message-Id: <20171130162744.25442-10-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Nov 2017 16:28:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 09/16] s390x/tcg: io instructions don't need potential_page_fault() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As we handle the retaddr in all cases properly now, we can drop it. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/translate.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 85d0a6c3af..d0859c4bc7 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4008,7 +4008,6 @@ static ExitStatus op_spx(DisasContext *s, DisasOps *o) static ExitStatus op_xsch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_xsch(cpu_env, regs[1]); set_cc_static(s); return NO_EXIT; @@ -4017,7 +4016,6 @@ static ExitStatus op_xsch(DisasContext *s, DisasOps *= o) static ExitStatus op_csch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_csch(cpu_env, regs[1]); set_cc_static(s); return NO_EXIT; @@ -4026,7 +4024,6 @@ static ExitStatus op_csch(DisasContext *s, DisasOps *= o) static ExitStatus op_hsch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_hsch(cpu_env, regs[1]); set_cc_static(s); return NO_EXIT; @@ -4035,7 +4032,6 @@ static ExitStatus op_hsch(DisasContext *s, DisasOps *= o) static ExitStatus op_msch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_msch(cpu_env, regs[1], o->in2); set_cc_static(s); return NO_EXIT; @@ -4044,7 +4040,6 @@ static ExitStatus op_msch(DisasContext *s, DisasOps *= o) static ExitStatus op_rchp(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_rchp(cpu_env, regs[1]); set_cc_static(s); return NO_EXIT; @@ -4053,7 +4048,6 @@ static ExitStatus op_rchp(DisasContext *s, DisasOps *= o) static ExitStatus op_rsch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_rsch(cpu_env, regs[1]); set_cc_static(s); return NO_EXIT; @@ -4062,7 +4056,6 @@ static ExitStatus op_rsch(DisasContext *s, DisasOps *= o) static ExitStatus op_ssch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_ssch(cpu_env, regs[1], o->in2); set_cc_static(s); return NO_EXIT; @@ -4071,7 +4064,6 @@ static ExitStatus op_ssch(DisasContext *s, DisasOps *= o) static ExitStatus op_stsch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_stsch(cpu_env, regs[1], o->in2); set_cc_static(s); return NO_EXIT; @@ -4080,7 +4072,6 @@ static ExitStatus op_stsch(DisasContext *s, DisasOps = *o) static ExitStatus op_tsch(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_tsch(cpu_env, regs[1], o->in2); set_cc_static(s); return NO_EXIT; @@ -4089,7 +4080,6 @@ static ExitStatus op_tsch(DisasContext *s, DisasOps *= o) static ExitStatus op_chsc(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_chsc(cpu_env, o->in2); set_cc_static(s); return NO_EXIT; --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512060110583121.14525509980695; Thu, 30 Nov 2017 08:41:50 -0800 (PST) Received: from localhost ([::1]:49223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRuC-0007KW-Th for importer@patchew.org; Thu, 30 Nov 2017 11:41:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhQ-0005MT-VK for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhQ-0003IU-5f for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47488) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhP-0003IH-VF; Thu, 30 Nov 2017 11:28:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D72782100; Thu, 30 Nov 2017 16:28:31 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id D97BE620B6; Thu, 30 Nov 2017 16:28:26 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:38 +0100 Message-Id: <20171130162744.25442-11-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Nov 2017 16:28:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 10/16] s390x/tcg: use s390_program_interrupt() in SCLP Service Call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now we can drop potential_page_fault(). While at it, move the unlock further up, looks cleaner. Signed-off-by: David Hildenbrand --- target/s390x/misc_helper.c | 5 ++--- target/s390x/translate.c | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 556340756c..02654617b3 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -62,11 +62,10 @@ uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1,= uint64_t r2) { qemu_mutex_lock_iothread(); int r =3D sclp_service_call(env, r1, r2); + qemu_mutex_unlock_iothread(); if (r < 0) { - program_interrupt(env, -r, 4); - r =3D 0; + s390_program_interrupt(env, -r, 4, GETPC()); } - qemu_mutex_unlock_iothread(); return r; } =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index d0859c4bc7..76b222b0ce 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3704,7 +3704,6 @@ static ExitStatus op_sqxb(DisasContext *s, DisasOps *= o) static ExitStatus op_servc(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_servc(cc_op, cpu_env, o->in2, o->in1); set_cc_static(s); return NO_EXIT; --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059827305333.7640222043109; Thu, 30 Nov 2017 08:37:07 -0800 (PST) Received: from localhost ([::1]:49172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRpQ-0002sE-9h for importer@patchew.org; Thu, 30 Nov 2017 11:36:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhZ-0005VC-RN for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhW-0003L1-MN for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40878) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhW-0003Kh-Fz; Thu, 30 Nov 2017 11:28:38 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A785649007; Thu, 30 Nov 2017 16:28:37 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B727620CB; Thu, 30 Nov 2017 16:28:31 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:39 +0100 Message-Id: <20171130162744.25442-12-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 30 Nov 2017 16:28:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 11/16] s390x/tcg: use s390_program_interrupt() in DIAG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now we can drop the two save statements in the translate function. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/misc_helper.c | 2 +- target/s390x/translate.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 02654617b3..ee6179ef89 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -101,7 +101,7 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint= 32_t r3, uint32_t num) } =20 if (r) { - program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, GETPC()); } } =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 76b222b0ce..cf8ffa217e 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2124,9 +2124,6 @@ static ExitStatus op_diag(DisasContext *s, DisasOps *= o) TCGv_i32 func_code =3D tcg_const_i32(get_field(s->fields, i2)); =20 check_privileged(s); - update_psw_addr(s); - gen_op_calc_cc(s); - gen_helper_diag(cpu_env, r1, r3, func_code); =20 tcg_temp_free_i32(func_code); --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059846480349.73428211528676; Thu, 30 Nov 2017 08:37:26 -0800 (PST) Received: from localhost ([::1]:49183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRpm-0003AK-JQ for importer@patchew.org; Thu, 30 Nov 2017 11:37:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRha-0005VZ-8N for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhZ-0003Ne-F8 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhZ-0003Mu-94; Thu, 30 Nov 2017 11:28:41 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C8286A7DC; Thu, 30 Nov 2017 16:28:40 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05363620B6; Thu, 30 Nov 2017 16:28:37 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:40 +0100 Message-Id: <20171130162744.25442-13-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 16:28:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 12/16] s390x/tcg: use s390_program_interrupt() in per_check_exception() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can now drop updating the cc. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/misc_helper.c | 2 +- target/s390x/translate.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index ee6179ef89..a911bff706 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -412,7 +412,7 @@ void HELPER(per_check_exception)(CPUS390XState *env) * of EXECUTE, while per_address contains the target of EXECUTE. */ ilen =3D get_ilen(cpu_ldub_code(env, env->per_address)); - program_interrupt(env, PGM_PER, ilen); + s390_program_interrupt(env, PGM_PER, ilen, GETPC()); } } =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index cf8ffa217e..f26fa64a78 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -5837,9 +5837,6 @@ static ExitStatus translate_one(CPUS390XState *env, D= isasContext *s) tcg_gen_movi_i64(psw_addr, s->next_pc); } =20 - /* Save off cc. */ - update_cc_op(s); - /* Call the helper to check for a possible PER exception. */ gen_helper_per_check_exception(cpu_env); } --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512060218044681.3067234935908; Thu, 30 Nov 2017 08:43:38 -0800 (PST) Received: from localhost ([::1]:49234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRvj-0000jB-BU for importer@patchew.org; Thu, 30 Nov 2017 11:43:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhd-0005Wq-C8 for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhb-0003PX-Vf for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47662) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhb-0003PB-PN; Thu, 30 Nov 2017 11:28:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EAD76820F4; Thu, 30 Nov 2017 16:28:42 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DF83620C2; Thu, 30 Nov 2017 16:28:40 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:41 +0100 Message-Id: <20171130162744.25442-14-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Nov 2017 16:28:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 13/16] s390x/tcg: use s390_program_interrupt() in SACF X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Convert this user, too. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/cc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/cc_helper.c b/target/s390x/cc_helper.c index f008897e84..5d91e458a8 100644 --- a/target/s390x/cc_helper.c +++ b/target/s390x/cc_helper.c @@ -564,7 +564,7 @@ void HELPER(sacf)(CPUS390XState *env, uint64_t a1) break; default: HELPER_LOG("unknown sacf mode: %" PRIx64 "\n", a1); - program_interrupt(env, PGM_SPECIFICATION, 2); + s390_program_interrupt(env, PGM_SPECIFICATION, 2, GETPC()); break; } } --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059986966904.1564426370751; Thu, 30 Nov 2017 08:39:46 -0800 (PST) Received: from localhost ([::1]:49194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRsD-0005Zz-7N for importer@patchew.org; Thu, 30 Nov 2017 11:39:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhi-0005c1-KS for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhf-0003Rw-EH for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40178) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhf-0003RW-8L; Thu, 30 Nov 2017 11:28:47 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DBE0C01B3F9; Thu, 30 Nov 2017 16:28:46 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44E726031E; Thu, 30 Nov 2017 16:28:43 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:42 +0100 Message-Id: <20171130162744.25442-15-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Nov 2017 16:28:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 14/16] s390x/tcg: use s390_program_interrupt() in STSI X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" STSI needs some more love, but let's do one step at a time. We can now drop potential_page_fault(). Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/misc_helper.c | 2 +- target/s390x/translate.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index a911bff706..6d766ce1e7 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -184,7 +184,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, if ((r0 & STSI_LEVEL_MASK) <=3D STSI_LEVEL_3 && ((r0 & STSI_R0_RESERVED_MASK) || (r1 & STSI_R1_RESERVED_MASK))) { /* valid function code, invalid reserved bits */ - program_interrupt(env, PGM_SPECIFICATION, 4); + s390_program_interrupt(env, PGM_SPECIFICATION, 4, GETPC()); } =20 sel1 =3D r0 & STSI_R0_SEL1_MASK; diff --git a/target/s390x/translate.c b/target/s390x/translate.c index f26fa64a78..1ce1390699 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3988,7 +3988,6 @@ static ExitStatus op_stpt(DisasContext *s, DisasOps *= o) static ExitStatus op_stsi(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_stsi(cc_op, cpu_env, o->in2, regs[0], regs[1]); set_cc_static(s); return NO_EXIT; --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512059967985315.7348006523266; Thu, 30 Nov 2017 08:39:27 -0800 (PST) Received: from localhost ([::1]:49192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRrt-0005Ir-1U for importer@patchew.org; Thu, 30 Nov 2017 11:39:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhk-0005e7-Ok for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhj-0003Td-UK for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhj-0003TG-Lt; Thu, 30 Nov 2017 11:28:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A80B3C01279A; Thu, 30 Nov 2017 16:28:50 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE291620B6; Thu, 30 Nov 2017 16:28:46 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:43 +0100 Message-Id: <20171130162744.25442-16-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Nov 2017 16:28:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 15/16] s390x/tcg: drop program_interrupt() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All users are gone, we can finally drop it and make sure that all new program interrupt injections are reminded of the retaddr - as they have to use s390_program_interrupt() now. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/cpu.h | 1 - target/s390x/interrupt.c | 22 +++++----------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index ae61d18c0a..9cfbbbac04 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -719,7 +719,6 @@ void s390_io_interrupt(uint16_t subchannel_id, uint16_t= subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word); /* automatically detect the instruction length */ #define ILEN_AUTO 0xff -void program_interrupt(CPUS390XState *env, uint32_t code, int ilen); #define RA_IGNORED 0 void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, uintptr_t ra); diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index b07e75daed..39c026b8b5 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -27,17 +27,18 @@ void trigger_pgm_exception(CPUS390XState *env, uint32_t= code, uint32_t ilen) } =20 static void tcg_s390_program_interrupt(CPUS390XState *env, uint32_t code, - int ilen) + int ilen, uintptr_t ra) { #ifdef CONFIG_TCG trigger_pgm_exception(env, code, ilen); - cpu_loop_exit(CPU(s390_env_get_cpu(env))); + cpu_loop_exit_restore(CPU(s390_env_get_cpu(env)), ra); #else g_assert_not_reached(); #endif } =20 -void program_interrupt(CPUS390XState *env, uint32_t code, int ilen) +void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, + uintptr_t ra) { S390CPU *cpu =3D s390_env_get_cpu(env); =20 @@ -47,25 +48,12 @@ void program_interrupt(CPUS390XState *env, uint32_t cod= e, int ilen) if (kvm_enabled()) { kvm_s390_program_interrupt(cpu, code); } else if (tcg_enabled()) { - tcg_s390_program_interrupt(env, code, ilen); + tcg_s390_program_interrupt(env, code, ilen, ra); } else { g_assert_not_reached(); } } =20 -void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, - uintptr_t ra) -{ -#ifdef CONFIG_TCG - S390CPU *cpu =3D s390_env_get_cpu(env); - - if (tcg_enabled()) { - cpu_restore_state(CPU(cpu), ra); - } -#endif - program_interrupt(env, code, ilen); -} - #if !defined(CONFIG_USER_ONLY) static void cpu_inject_service(S390CPU *cpu, uint32_t param) { --=20 2.14.3 From nobody Fri May 3 00:59:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512060299276273.2643100813417; Thu, 30 Nov 2017 08:44:59 -0800 (PST) Received: from localhost ([::1]:49243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRxF-0002Re-BM for importer@patchew.org; Thu, 30 Nov 2017 11:44:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhs-0005he-0b for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:29:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRho-0003WM-Rn for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:29:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54786) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRho-0003V5-MA; Thu, 30 Nov 2017 11:28:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6A0761D0D; Thu, 30 Nov 2017 16:28:55 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 054A2620BE; Thu, 30 Nov 2017 16:28:50 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:44 +0100 Message-Id: <20171130162744.25442-17-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 30 Nov 2017 16:28:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 16/16] s390x/tcg: drop potential_page_fault() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Only one user left, get rid of it so we don't get any new users. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/translate.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 1ce1390699..26cf993405 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -240,12 +240,6 @@ static void update_cc_op(DisasContext *s) } } =20 -static void potential_page_fault(DisasContext *s) -{ - update_psw_addr(s); - update_cc_op(s); -} - static inline uint64_t ld_code2(CPUS390XState *env, uint64_t pc) { return (uint64_t)cpu_lduw_code(env, pc); @@ -2939,7 +2933,8 @@ static ExitStatus op_lpd(DisasContext *s, DisasOps *o) =20 /* In a parallel context, stop the world and single step. */ if (tb_cflags(s->tb) & CF_PARALLEL) { - potential_page_fault(s); + update_psw_addr(s); + update_cc_op(s); gen_exception(EXCP_ATOMIC); return EXIT_NORETURN; } --=20 2.14.3