From nobody Sun May 5 10:05:44 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 1505831337996756.448301354519; Tue, 19 Sep 2017 07:28:57 -0700 (PDT) Received: from localhost ([::1]:43234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duJWC-000778-Su for importer@patchew.org; Tue, 19 Sep 2017 10:28:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duJUS-0005to-3W for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duJUM-0004Ru-Ak for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duJUM-0004RI-4y for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F35C68D3; Tue, 19 Sep 2017 14:27:01 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F3655C542; Tue, 19 Sep 2017 14:26:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F35C68D3 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 16:26:52 +0200 Message-Id: <20170919142654.16369-2-david@redhat.com> In-Reply-To: <20170919142654.16369-1-david@redhat.com> References: <20170919142654.16369-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 19 Sep 2017 14:27:01 +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 v2 1/3] s390x/tcg: implement spm (SET PROGRAM MASK) 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , Aurelien Jarno 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" Missing and is used inside Linux in the context of CPACF. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- target/s390x/cpu.h | 2 ++ target/s390x/insn-data.def | 2 ++ target/s390x/translate.c | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 9b549dc491..4414485089 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -292,6 +292,7 @@ extern const struct VMStateDescription vmstate_s390_cpu; #undef PSW_SHIFT_ASC #undef PSW_MASK_CC #undef PSW_MASK_PM +#undef PSW_SHIFT_MASK_PM #undef PSW_MASK_64 #undef PSW_MASK_32 #undef PSW_MASK_ESA_ADDR @@ -309,6 +310,7 @@ extern const struct VMStateDescription vmstate_s390_cpu; #define PSW_SHIFT_ASC 46 #define PSW_MASK_CC 0x0000300000000000ULL #define PSW_MASK_PM 0x00000F0000000000ULL +#define PSW_SHIFT_MASK_PM 40 #define PSW_MASK_64 0x0000000100000000ULL #define PSW_MASK_32 0x0000000080000000ULL #define PSW_MASK_ESA_ADDR 0x000000007fffffffULL diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index ad84c748e3..84233a456d 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -755,6 +755,8 @@ C(0xb2b8, SRNMB, S, FPE, 0, 0, 0, 0, srnm, 0) /* SET DFP ROUNDING MODE */ C(0xb2b9, SRNMT, S, DFPR, 0, 0, 0, 0, srnm, 0) +/* SET PROGRAM MASK */ + C(0x0400, SPM, RR_a, Z, r1, 0, 0, 0, spm, 0) =20 /* SHIFT LEFT SINGLE */ D(0x8b00, SLA, RS_a, Z, r1, sh32, new, r1_32, sla, 0, 31) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 5abd34fb34..59fde44d55 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3796,6 +3796,17 @@ static ExitStatus op_srnm(DisasContext *s, DisasOps = *o) return NO_EXIT; } =20 +static ExitStatus op_spm(DisasContext *s, DisasOps *o) +{ + tcg_gen_extrl_i64_i32(cc_op, o->in1); + tcg_gen_extract_i32(cc_op, cc_op, 28, 2); + set_cc_static(s); + + tcg_gen_shri_i64(o->in1, o->in1, 24); + tcg_gen_deposit_i64(psw_mask, psw_mask, o->in1, PSW_SHIFT_MASK_PM, 4); + return NO_EXIT; +} + #ifndef CONFIG_USER_ONLY static ExitStatus op_spka(DisasContext *s, DisasOps *o) { --=20 2.13.5 From nobody Sun May 5 10:05:44 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 15058315929691015.2762797103887; Tue, 19 Sep 2017 07:33:12 -0700 (PDT) Received: from localhost ([::1]:43255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duJaK-0002XL-8h for importer@patchew.org; Tue, 19 Sep 2017 10:33:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duJUU-0005ve-8x for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duJUO-0004TB-Hi for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duJUO-0004Sl-C6 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:04 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B7AD7E445; Tue, 19 Sep 2017 14:27:03 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F3F35C541; Tue, 19 Sep 2017 14:27:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B7AD7E445 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 16:26:53 +0200 Message-Id: <20170919142654.16369-3-david@redhat.com> In-Reply-To: <20170919142654.16369-1-david@redhat.com> References: <20170919142654.16369-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 19 Sep 2017 14:27:03 +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 v2 2/3] s390x/tcg: move wrap_address() to internal.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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , Aurelien Jarno 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 want to use it in another file. Signed-off-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/s390x/internal.h | 14 ++++++++++++++ target/s390x/mem_helper.c | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/target/s390x/internal.h b/target/s390x/internal.h index bc8f83129a..70d2b87e55 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -162,6 +162,20 @@ static inline uint8_t get_per_atmid(CPUS390XState *env) ((env->psw.mask & PSW_ASC_ACCREG) ? (1 << 2) : 0); } =20 +static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a) +{ + if (!(env->psw.mask & PSW_MASK_64)) { + if (!(env->psw.mask & PSW_MASK_32)) { + /* 24-Bit mode */ + a &=3D 0x00ffffff; + } else { + /* 31-Bit mode */ + a &=3D 0x7fffffff; + } + } + return a; +} + /* CC optimization */ =20 /* Instead of computing the condition codes after each x86 instruction, diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index ec4760e390..a254613dc2 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -122,20 +122,6 @@ static inline void cpu_stsize_data_ra(CPUS390XState *e= nv, uint64_t addr, } } =20 -static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a) -{ - if (!(env->psw.mask & PSW_MASK_64)) { - if (!(env->psw.mask & PSW_MASK_32)) { - /* 24-Bit mode */ - a &=3D 0x00ffffff; - } else { - /* 31-Bit mode */ - a &=3D 0x7fffffff; - } - } - return a; -} - static void fast_memset(CPUS390XState *env, uint64_t dest, uint8_t byte, uint32_t l, uintptr_t ra) { --=20 2.13.5 From nobody Sun May 5 10:05:44 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 1505831491731593.3467387425862; Tue, 19 Sep 2017 07:31:31 -0700 (PDT) Received: from localhost ([::1]:43248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duJYg-0000wy-UI for importer@patchew.org; Tue, 19 Sep 2017 10:31:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duJUS-0005u3-D8 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duJUQ-0004W8-RN for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37538) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duJUQ-0004UJ-Iu for qemu-devel@nongnu.org; Tue, 19 Sep 2017 10:27:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A89554A6EA; Tue, 19 Sep 2017 14:27:05 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE5A75C541; Tue, 19 Sep 2017 14:27:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A89554A6EA Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 16:26:54 +0200 Message-Id: <20170919142654.16369-4-david@redhat.com> In-Reply-To: <20170919142654.16369-1-david@redhat.com> References: <20170919142654.16369-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 19 Sep 2017 14:27:05 +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 v2 3/3] s390x/tcg: add basic MSA features 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , Aurelien Jarno 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 STFLE bits for the MSA (extension) facilities simply indicate that the respective instructions can be executed. The QUERY subfunction can then be used to identify which features exactly are available. Availability of subfunctions can also vary on real hardware. For now, we simply implement a CPU model without any available subfunctions except QUERY (which is always around). As all MSA functions behave quite similarly, we can use one translation handler for now. Prepare the code for implementation of actual subfunctions. At least MSA is helpful for now, as older Linux kernels require this facility when compiled for a z9 model. Allow to enable the facilities for the qemu cpu model. Signed-off-by: David Hildenbrand --- target/s390x/Makefile.objs | 2 +- target/s390x/cpu_models.c | 4 +++ target/s390x/crypto_helper.c | 65 ++++++++++++++++++++++++++++++++++++++++= ++++ target/s390x/helper.h | 1 + target/s390x/insn-data.def | 13 +++++++++ target/s390x/translate.c | 56 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 target/s390x/crypto_helper.c diff --git a/target/s390x/Makefile.objs b/target/s390x/Makefile.objs index 9615256d81..c88ac81e84 100644 --- a/target/s390x/Makefile.objs +++ b/target/s390x/Makefile.objs @@ -1,6 +1,6 @@ obj-y +=3D cpu.o cpu_models.o cpu_features.o gdbstub.o interrupt.o helper.o obj-$(CONFIG_TCG) +=3D translate.o cc_helper.o excp_helper.o fpu_helper.o -obj-$(CONFIG_TCG) +=3D int_helper.o mem_helper.o misc_helper.o +obj-$(CONFIG_TCG) +=3D int_helper.o mem_helper.o misc_helper.o crypto_help= er.o obj-$(CONFIG_SOFTMMU) +=3D machine.o ioinst.o arch_dump.o mmu_helper.o dia= g.o obj-$(CONFIG_KVM) +=3D kvm.o obj-$(call lnot,$(CONFIG_KVM)) +=3D kvm-stub.o diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 5169379db5..1051a16ece 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -825,6 +825,7 @@ static void add_qemu_cpu_model_features(S390FeatBitmap = fbm) S390_FEAT_STFLE, S390_FEAT_EXTENDED_IMMEDIATE, S390_FEAT_EXTENDED_TRANSLATION_2, + S390_FEAT_MSA, S390_FEAT_EXTENDED_TRANSLATION_3, S390_FEAT_LONG_DISPLACEMENT, S390_FEAT_LONG_DISPLACEMENT_FAST, @@ -841,6 +842,9 @@ static void add_qemu_cpu_model_features(S390FeatBitmap = fbm) S390_FEAT_STFLE_49, S390_FEAT_LOCAL_TLB_CLEARING, S390_FEAT_STFLE_53, + S390_FEAT_MSA_EXT_5, + S390_FEAT_MSA_EXT_3, + S390_FEAT_MSA_EXT_4, }; int i; =20 diff --git a/target/s390x/crypto_helper.c b/target/s390x/crypto_helper.c new file mode 100644 index 0000000000..5b210b4080 --- /dev/null +++ b/target/s390x/crypto_helper.c @@ -0,0 +1,65 @@ +/* + * s390x crypto helpers + * + * Copyright (c) 2017 Red Hat Inc + * + * Authors: + * David Hildenbrand + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/main-loop.h" +#include "internal.h" +#include "exec/helper-proto.h" +#include "exec/exec-all.h" +#include "exec/cpu_ldst.h" + +uint32_t HELPER(msa)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_= t r3, + uint32_t type) +{ + 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; + + switch (type) { + case S390_FEAT_TYPE_KMAC: + case S390_FEAT_TYPE_KIMD: + case S390_FEAT_TYPE_KLMD: + case S390_FEAT_TYPE_PCKMO: + case S390_FEAT_TYPE_PCC: + if (mod) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + return 0; + } + break; + } + + s390_get_feat_block(type, subfunc); + if (fc >=3D 128 || !test_be_bit(fc, subfunc)) { + cpu_restore_state(cs, ra); + program_interrupt(env, PGM_SPECIFICATION, 4); + return 0; + } + + switch (fc) { + case 0: /* query subfunction */ + for (i =3D 0; i < 16; i++) { + param_addr =3D wrap_address(env, env->regs[1] + i); + cpu_stb_data_ra(env, param_addr, subfunc[i], ra); + } + break; + default: + /* we don't implement any other subfunction yet */ + g_assert_not_reached(); + } + + return 0; +} diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 4b0290774e..75ba04fc15 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -115,6 +115,7 @@ DEF_HELPER_4(cu21, i32, env, i32, i32, i32) DEF_HELPER_4(cu24, i32, env, i32, i32, i32) DEF_HELPER_4(cu41, i32, env, i32, i32, i32) DEF_HELPER_4(cu42, i32, env, i32, i32, i32) +DEF_HELPER_5(msa, i32, env, i32, i32, i32, i32) =20 #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 84233a456d..d09f2ed538 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -941,6 +941,19 @@ /* UNPACK UNICODE */ C(0xe200, UNPKU, SS_a, E2, la1, a2, 0, 0, unpku, 0) =20 +/* MSA Instructions */ + D(0xb91e, KMAC, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMA= C) + D(0xb928, PCKMO, RRE, MSA3, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PCK= MO) + D(0xb92a, KMF, RRE, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMF) + D(0xb92b, KMO, RRE, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMO) + D(0xb92c, PCC, RRE, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PCC) + D(0xb92d, KMCTR, RRF_b, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC= TR) + D(0xb92e, KM, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KM) + D(0xb92f, KMC, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC) + D(0xb93c, PPNO, RRE, MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPN= O) + D(0xb93e, KIMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIM= D) + D(0xb93f, KLMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLM= D) + #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ D(0xb250, CSP, RRE, Z, r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 59fde44d55..78ffd8ff24 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2422,6 +2422,58 @@ static ExitStatus op_iske(DisasContext *s, DisasOps = *o) } #endif =20 +static ExitStatus op_msa(DisasContext *s, DisasOps *o) +{ + int r1 =3D have_field(s->fields, r1) ? get_field(s->fields, r1) : 0; + int r2 =3D have_field(s->fields, r2) ? get_field(s->fields, r2) : 0; + int r3 =3D have_field(s->fields, r3) ? get_field(s->fields, r3) : 0; + TCGv_i32 t_r1, t_r2, t_r3, type; + + switch (s->insn->data) { + case S390_FEAT_TYPE_KMCTR: + if (r3 & 1 || !r3) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + /* FALL THROUGH */ + case S390_FEAT_TYPE_PPNO: + case S390_FEAT_TYPE_KMF: + case S390_FEAT_TYPE_KMC: + case S390_FEAT_TYPE_KMO: + case S390_FEAT_TYPE_KM: + if (r1 & 1 || !r1) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + /* FALL THROUGH */ + case S390_FEAT_TYPE_KMAC: + case S390_FEAT_TYPE_KIMD: + case S390_FEAT_TYPE_KLMD: + if (r2 & 1 || !r2) { + gen_program_exception(s, PGM_SPECIFICATION); + return EXIT_NORETURN; + } + /* FALL THROUGH */ + case S390_FEAT_TYPE_PCKMO: + case S390_FEAT_TYPE_PCC: + break; + default: + g_assert_not_reached(); + }; + + t_r1 =3D tcg_const_i32(r1); + t_r2 =3D tcg_const_i32(r2); + t_r3 =3D tcg_const_i32(r3); + type =3D tcg_const_i32(s->insn->data); + gen_helper_msa(cc_op, cpu_env, t_r1, t_r2, t_r3, type); + set_cc_static(s); + tcg_temp_free_i32(t_r1); + tcg_temp_free_i32(t_r2); + tcg_temp_free_i32(t_r3); + tcg_temp_free_i32(type); + return NO_EXIT; +} + static ExitStatus op_keb(DisasContext *s, DisasOps *o) { gen_helper_keb(cc_op, cpu_env, o->in1, o->in2); @@ -5505,6 +5557,10 @@ enum DisasInsnEnum { #define FAC_PPA S390_FEAT_STFLE_49 /* processor-assist */ #define FAC_LZRB S390_FEAT_STFLE_53 /* load-and-zero-rightmost-byte= */ #define FAC_ETF3 S390_FEAT_EXTENDED_TRANSLATION_3 +#define FAC_MSA S390_FEAT_MSA /* message-security-assist facility = */ +#define FAC_MSA3 S390_FEAT_MSA_EXT_3 /* msa-extension-3 facility */ +#define FAC_MSA4 S390_FEAT_MSA_EXT_4 /* msa-extension-4 facility */ +#define FAC_MSA5 S390_FEAT_MSA_EXT_5 /* msa-extension-5 facility */ =20 static const DisasInsn insn_info[] =3D { #include "insn-data.def" --=20 2.13.5