From nobody Fri May 3 12:11:58 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 1512392350270757.3486496272354; Mon, 4 Dec 2017 04:59:10 -0800 (PST) Received: from localhost ([::1]:42502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqKv-0001qO-0T for importer@patchew.org; Mon, 04 Dec 2017 07:59:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqHI-0006Bk-9F for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLqHC-0000D3-IH for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48072) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eLqHC-0000Cr-9V; Mon, 04 Dec 2017 07:55:14 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FCFBC0587C5; Mon, 4 Dec 2017 12:55:13 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id B52CF62670; Mon, 4 Dec 2017 12:55:08 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Mon, 4 Dec 2017 13:55:01 +0100 Message-Id: <20171204125505.29203-2-david@redhat.com> In-Reply-To: <20171204125505.29203-1-david@redhat.com> References: <20171204125505.29203-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 04 Dec 2017 12:55: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 v1 for-2.12 1/5] s390x/kvm: factor out build_channel_report_mcic() into cpu.h 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" We'll need it later on in two places. Refactor it to just indicate the valid bit. While at it, introduce a define for the used CR14 bit (we'll also need later on). Signed-off-by: David Hildenbrand --- target/s390x/cpu.h | 20 ++++++++++++++++++++ target/s390x/kvm.c | 25 ++----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 9cfbbbac04..4d3e7920f5 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -351,6 +351,9 @@ extern const struct VMStateDescription vmstate_s390_cpu; #define CR0_CPU_TIMER_SC 0x0000000000000400ULL #define CR0_SERVICE_SC 0x0000000000000200ULL =20 +/* Control register 14 bits */ +#define CR14_CHANNEL_REPORT_SC 0x0000000010000000ULL + /* MMU */ #define MMU_PRIMARY_IDX 0 #define MMU_SECONDARY_IDX 1 @@ -674,6 +677,23 @@ struct sysib_322 { #define MCIC_VB_CT 0x0000000000020000ULL #define MCIC_VB_CC 0x0000000000010000ULL =20 +static inline uint64_t s390_build_validity_mcic(void) +{ + uint64_t mcic; + + /* indicate all valid bits (no damage) */ + mcic =3D MCIC_VB_WP | MCIC_VB_MS | MCIC_VB_PM | MCIC_VB_IA | MCIC_VB_F= P | + MCIC_VB_GR | MCIC_VB_CR | MCIC_VB_ST | MCIC_VB_AR | MCIC_VB_PR | + MCIC_VB_FC | MCIC_VB_CT | MCIC_VB_CC; + if (s390_has_feat(S390_FEAT_VECTOR)) { + mcic |=3D MCIC_VB_VR; + } + if (s390_has_feat(S390_FEAT_GUARDED_STORAGE)) { + mcic |=3D MCIC_VB_GS; + } + return mcic; +} + =20 /* cpu.c */ int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low); diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 97c45d5537..9b8b59f2a2 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1852,33 +1852,12 @@ void kvm_s390_io_interrupt(uint16_t subchannel_id, kvm_s390_floating_interrupt(&irq); } =20 -static uint64_t build_channel_report_mcic(void) -{ - uint64_t mcic; - - /* subclass: indicate channel report pending */ - mcic =3D MCIC_SC_CP | - /* subclass modifiers: none */ - /* storage errors: none */ - /* validity bits: no damage */ - MCIC_VB_WP | MCIC_VB_MS | MCIC_VB_PM | MCIC_VB_IA | MCIC_VB_FP | - MCIC_VB_GR | MCIC_VB_CR | MCIC_VB_ST | MCIC_VB_AR | MCIC_VB_PR | - MCIC_VB_FC | MCIC_VB_CT | MCIC_VB_CC; - if (s390_has_feat(S390_FEAT_VECTOR)) { - mcic |=3D MCIC_VB_VR; - } - if (s390_has_feat(S390_FEAT_GUARDED_STORAGE)) { - mcic |=3D MCIC_VB_GS; - } - return mcic; -} - void kvm_s390_crw_mchk(void) { struct kvm_s390_irq irq =3D { .type =3D KVM_S390_MCHK, - .u.mchk.cr14 =3D 1 << 28, - .u.mchk.mcic =3D build_channel_report_mcic(), + .u.mchk.cr14 =3D CR14_CHANNEL_REPORT_SC, + .u.mchk.mcic =3D s390_build_validity_mcic() | MCIC_SC_CP, }; kvm_s390_floating_interrupt(&irq); } --=20 2.14.3 From nobody Fri May 3 12:11:58 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 1512392244851376.5608721668542; Mon, 4 Dec 2017 04:57:24 -0800 (PST) Received: from localhost ([::1]:42485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqJ5-0007FO-ND for importer@patchew.org; Mon, 04 Dec 2017 07:57:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqHF-00069j-M3 for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLqHE-0000El-Pl for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eLqHE-0000Dn-Ho; Mon, 04 Dec 2017 07:55:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 879927EA8C; Mon, 4 Dec 2017 12:55:15 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id A41DF5EE17; Mon, 4 Dec 2017 12:55:13 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Mon, 4 Dec 2017 13:55:02 +0100 Message-Id: <20171204125505.29203-3-david@redhat.com> In-Reply-To: <20171204125505.29203-1-david@redhat.com> References: <20171204125505.29203-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 04 Dec 2017 12:55:15 +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 v1 for-2.12 2/5] s390x/tcg: fix and cleanup mcck injection 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" The architecture mode indication wasn't stored. The split of certain 64bit fields was unnecessary. Also, the complete clock comparator, not just bit 0-55 (starting at byte 1) was stored. We now generate a proper MCIC via the same helper we use for KVM. While at it, also get rid of two local variables. There is be more to clean up, but we will change the other parts later on either way. Signed-off-by: David Hildenbrand --- target/s390x/excp_helper.c | 18 ++++++++---------- target/s390x/internal.h | 6 +++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index d831537544..840cf7641a 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -369,7 +369,6 @@ static void do_io_interrupt(CPUS390XState *env) static void do_mchk_interrupt(CPUS390XState *env) { S390CPU *cpu =3D s390_env_get_cpu(env); - uint64_t mask, addr; LowCore *lowcore; MchkQueue *q; int i; @@ -395,6 +394,9 @@ static void do_mchk_interrupt(CPUS390XState *env) =20 lowcore =3D cpu_map_lowcore(env); =20 + /* we are always in z/Architecture mode */ + lowcore->ar_access_id =3D 1; + for (i =3D 0; i < 16; i++) { lowcore->floating_pt_save_area[i] =3D cpu_to_be64(get_freg(env, i)= ->ll); lowcore->gpregs_save_area[i] =3D cpu_to_be64(env->regs[i]); @@ -404,17 +406,12 @@ static void do_mchk_interrupt(CPUS390XState *env) lowcore->prefixreg_save_area =3D cpu_to_be32(env->psa); lowcore->fpt_creg_save_area =3D cpu_to_be32(env->fpc); lowcore->tod_progreg_save_area =3D cpu_to_be32(env->todpr); - lowcore->cpu_timer_save_area[0] =3D cpu_to_be32(env->cputm >> 32); - lowcore->cpu_timer_save_area[1] =3D cpu_to_be32((uint32_t)env->cputm); - lowcore->clock_comp_save_area[0] =3D cpu_to_be32(env->ckc >> 32); - lowcore->clock_comp_save_area[1] =3D cpu_to_be32((uint32_t)env->ckc); + lowcore->cpu_timer_save_area =3D cpu_to_be64(env->cputm); + lowcore->clock_comp_save_area =3D cpu_to_be64(env->ckc >> 8); =20 - lowcore->mcck_interruption_code[0] =3D cpu_to_be32(0x00400f1d); - lowcore->mcck_interruption_code[1] =3D cpu_to_be32(0x40330000); + lowcore->mcic =3D cpu_to_be64(s390_build_validity_mcic() | MCIC_SC_CP); lowcore->mcck_old_psw.mask =3D cpu_to_be64(get_psw_mask(env)); lowcore->mcck_old_psw.addr =3D cpu_to_be64(env->psw.addr); - mask =3D be64_to_cpu(lowcore->mcck_new_psw.mask); - addr =3D be64_to_cpu(lowcore->mcck_new_psw.addr); =20 cpu_unmap_lowcore(lowcore); =20 @@ -426,7 +423,8 @@ static void do_mchk_interrupt(CPUS390XState *env) DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__, env->psw.mask, env->psw.addr); =20 - load_psw(env, mask, addr); + load_psw(env, be64_to_cpu(lowcore->mcck_new_psw.mask), + be64_to_cpu(lowcore->mcck_new_psw.addr)); } =20 void s390_cpu_do_interrupt(CPUState *cs) diff --git a/target/s390x/internal.h b/target/s390x/internal.h index 6817b2c432..1a88e4beb4 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -43,7 +43,7 @@ typedef struct LowCore { uint8_t pad3[0xc8 - 0xc4]; /* 0x0c4 */ uint32_t stfl_fac_list; /* 0x0c8 */ uint8_t pad4[0xe8 - 0xcc]; /* 0x0cc */ - uint32_t mcck_interruption_code[2]; /* 0x0e8 */ + uint64_t mcic; /* 0x0e8 */ uint8_t pad5[0xf4 - 0xf0]; /* 0x0f0 */ uint32_t external_damage_code; /* 0x0f4 */ uint64_t failing_storage_address; /* 0x0f8 */ @@ -118,8 +118,8 @@ typedef struct LowCore { uint32_t fpt_creg_save_area; /* 0x131c */ uint8_t pad16[0x1324 - 0x1320]; /* 0x1320 */ uint32_t tod_progreg_save_area; /* 0x1324 */ - uint32_t cpu_timer_save_area[2]; /* 0x1328 */ - uint32_t clock_comp_save_area[2]; /* 0x1330 */ + uint64_t cpu_timer_save_area; /* 0x1328 */ + uint64_t clock_comp_save_area; /* 0x1330 */ uint8_t pad17[0x1340 - 0x1338]; /* 0x1338 */ uint32_t access_regs_save_area[16]; /* 0x1340 */ uint64_t cregs_save_area[16]; /* 0x1380 */ --=20 2.14.3 From nobody Fri May 3 12:11:58 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 1512392436615449.62655499397647; Mon, 4 Dec 2017 05:00:36 -0800 (PST) Received: from localhost ([::1]:42526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqME-0002cC-RA for importer@patchew.org; Mon, 04 Dec 2017 08:00:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqHL-0006Dq-25 for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLqHG-0000Hm-RO for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38560) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eLqHG-0000H4-M2; Mon, 04 Dec 2017 07:55:18 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDD1A1112; Mon, 4 Dec 2017 12:55:17 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id D976761F25; Mon, 4 Dec 2017 12:55:15 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Mon, 4 Dec 2017 13:55:03 +0100 Message-Id: <20171204125505.29203-4-david@redhat.com> In-Reply-To: <20171204125505.29203-1-david@redhat.com> References: <20171204125505.29203-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 04 Dec 2017 12:55: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 v1 for-2.12 3/5] s390x/tcg: implement SET CLOCK PROGRAMMABLE FIELD 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 for machine check handling inside Linux (when restoring registers). Except for SIGP and machine checks, we don't make use of the register yet. Suficient for now. Signed-off-by: David Hildenbrand --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 2 ++ target/s390x/misc_helper.c | 11 +++++++++++ target/s390x/translate.c | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 9459b73c73..0281c286b8 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -127,6 +127,7 @@ DEF_HELPER_3(load_psw, noreturn, env, i64, i64) DEF_HELPER_FLAGS_2(spx, TCG_CALL_NO_RWG, void, env, i64) DEF_HELPER_FLAGS_1(stck, TCG_CALL_NO_RWG_SE, i64, env) DEF_HELPER_FLAGS_2(sckc, TCG_CALL_NO_RWG, void, env, i64) +DEF_HELPER_FLAGS_1(sckpf, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_1(stckc, TCG_CALL_NO_RWG, i64, env) DEF_HELPER_FLAGS_2(spt, TCG_CALL_NO_RWG, void, env, i64) DEF_HELPER_FLAGS_1(stpt, TCG_CALL_NO_RWG, i64, env) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 16e27c8a35..8c2541f545 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -999,6 +999,8 @@ C(0xb204, SCK, S, Z, 0, 0, 0, 0, 0, 0) /* SET CLOCK COMPARATOR */ C(0xb206, SCKC, S, Z, 0, m2_64, 0, 0, sckc, 0) +/* SET CLOCK PROGRAMMABLE FIELD */ + C(0x0107, SCKPF, E, Z, 0, 0, 0, 0, sckpf, 0) /* SET CPU TIMER */ C(0xb208, SPT, S, Z, 0, m2_64, 0, 0, spt, 0) /* SET PREFIX */ diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 6d766ce1e7..2c6ab329fb 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -146,6 +146,17 @@ void HELPER(sckc)(CPUS390XState *env, uint64_t time) timer_mod(env->tod_timer, env->tod_basetime + time); } =20 +/* Set Tod Programmable Field */ +void HELPER(sckpf)(CPUS390XState *env) +{ + uint32_t val =3D env->regs[0]; + + if (val & 0xffff0000UL) { + s390_program_interrupt(env, PGM_SPECIFICATION, 2, GETPC()); + } + env->todpr =3D val; +} + /* Store Clock Comparator */ uint64_t HELPER(stckc)(CPUS390XState *env) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 26cf993405..48b031894a 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3922,6 +3922,13 @@ static ExitStatus op_sckc(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_sckpf(DisasContext *s, DisasOps *o) +{ + check_privileged(s); + gen_helper_sckpf(cpu_env); + return NO_EXIT; +} + static ExitStatus op_stckc(DisasContext *s, DisasOps *o) { check_privileged(s); --=20 2.14.3 From nobody Fri May 3 12:11:58 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 1512392254172290.54159260499546; Mon, 4 Dec 2017 04:57:34 -0800 (PST) Received: from localhost ([::1]:42487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqJH-0007Q2-Az for importer@patchew.org; Mon, 04 Dec 2017 07:57:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqHN-0006Fx-2p for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLqHJ-0000JB-5N for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48154) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eLqHI-0000Ia-VK; Mon, 04 Dec 2017 07:55:21 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2946C0587EC; Mon, 4 Dec 2017 12:55:19 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D0E15EE16; Mon, 4 Dec 2017 12:55:17 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Mon, 4 Dec 2017 13:55:04 +0100 Message-Id: <20171204125505.29203-5-david@redhat.com> In-Reply-To: <20171204125505.29203-1-david@redhat.com> References: <20171204125505.29203-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 04 Dec 2017 12:55:20 +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 v1 for-2.12 4/5] s390x/tcg: indicate value of TODPR in STCKE 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" We were not yet using the value of the TOD Programmable Register. Signed-off-by: David Hildenbrand --- target/s390x/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 48b031894a..8da8610839 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3897,7 +3897,10 @@ static ExitStatus op_stcke(DisasContext *s, DisasOps= *o) { TCGv_i64 c1 =3D tcg_temp_new_i64(); TCGv_i64 c2 =3D tcg_temp_new_i64(); + TCGv_i64 todpr =3D tcg_temp_new_i64(); gen_helper_stck(c1, cpu_env); + /* 16 bit value store in an uint32_t (only valid bits set) */ + tcg_gen_ld32u_i64(todpr, cpu_env, offsetof(CPUS390XState, todpr)); /* Shift the 64-bit value into its place as a zero-extended 104-bit value. Note that "bit positions 64-103 are always non-zero so that they compare differently to STCK"; we set @@ -3905,11 +3908,13 @@ static ExitStatus op_stcke(DisasContext *s, DisasOp= s *o) tcg_gen_shli_i64(c2, c1, 56); tcg_gen_shri_i64(c1, c1, 8); tcg_gen_ori_i64(c2, c2, 0x10000); + tcg_gen_or_i64(c2, c2, todpr); tcg_gen_qemu_st64(c1, o->in2, get_mem_index(s)); tcg_gen_addi_i64(o->in2, o->in2, 8); tcg_gen_qemu_st64(c2, o->in2, get_mem_index(s)); tcg_temp_free_i64(c1); tcg_temp_free_i64(c2); + tcg_temp_free_i64(todpr); /* ??? We don't implement clock states. */ gen_op_movi_cc(s, 0); return NO_EXIT; --=20 2.14.3 From nobody Fri May 3 12:11:58 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 1512392259758547.058007332658; Mon, 4 Dec 2017 04:57:39 -0800 (PST) Received: from localhost ([::1]:42488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqJP-0007WZ-TJ for importer@patchew.org; Mon, 04 Dec 2017 07:57:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLqHQ-0006KZ-WF for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLqHL-0000KE-CP for qemu-devel@nongnu.org; Mon, 04 Dec 2017 07:55:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60962) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eLqHL-0000JZ-5o; Mon, 04 Dec 2017 07:55:23 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3525F7E436; Mon, 4 Dec 2017 12:55:22 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52BC461F25; Mon, 4 Dec 2017 12:55:20 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Mon, 4 Dec 2017 13:55:05 +0100 Message-Id: <20171204125505.29203-6-david@redhat.com> In-Reply-To: <20171204125505.29203-1-david@redhat.com> References: <20171204125505.29203-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 04 Dec 2017 12:55:22 +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 v1 for-2.12 5/5] s390x/tcg: wire up STORE CHANNEL REPORT WORD 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" We somehow missed that, new kernels require it. Signed-off-by: David Hildenbrand --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 1 + target/s390x/misc_helper.c | 9 +++++++++ target/s390x/translate.c | 8 ++++++++ 4 files changed, 19 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 0281c286b8..2ce57edc14 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -166,6 +166,7 @@ DEF_HELPER_3(msch, void, env, i64, i64) DEF_HELPER_2(rchp, void, env, i64) DEF_HELPER_2(rsch, void, env, i64) DEF_HELPER_3(ssch, void, env, i64, i64) +DEF_HELPER_2(stcrw, void, env, i64) DEF_HELPER_3(stsch, void, env, i64, i64) DEF_HELPER_3(tsch, void, env, i64, i64) DEF_HELPER_2(chsc, void, env, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 8c2541f545..43ab1963c8 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1055,6 +1055,7 @@ C(0xb23b, RCHP, S, Z, 0, 0, 0, 0, rchp, 0) C(0xb238, RSCH, S, Z, 0, 0, 0, 0, rsch, 0) C(0xb233, SSCH, S, Z, 0, insn, 0, 0, ssch, 0) + C(0xb239, STCRW, S, Z, 0, insn, 0, 0, stcrw, 0) C(0xb234, STSCH, S, Z, 0, insn, 0, 0, stsch, 0) C(0xb235, TSCH, S, Z, 0, insn, 0, 0, tsch, 0) /* ??? Not listed in PoO ninth edition, but there's a linux driver that diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 2c6ab329fb..55e78c56d2 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -385,6 +385,15 @@ void HELPER(ssch)(CPUS390XState *env, uint64_t r1, uin= t64_t inst) qemu_mutex_unlock_iothread(); } =20 +void HELPER(stcrw)(CPUS390XState *env, uint64_t inst) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + ioinst_handle_stcrw(cpu, inst >> 16, GETPC()); + qemu_mutex_unlock_iothread(); +} + void HELPER(stsch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 8da8610839..5e051fdd03 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4071,6 +4071,14 @@ static ExitStatus op_stsch(DisasContext *s, DisasOps= *o) return NO_EXIT; } =20 +static ExitStatus op_stcrw(DisasContext *s, DisasOps *o) +{ + check_privileged(s); + gen_helper_stcrw(cpu_env, o->in2); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_tsch(DisasContext *s, DisasOps *o) { check_privileged(s); --=20 2.14.3