From nobody Wed May 1 22:34:28 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 1516622568895440.44400637986394; Mon, 22 Jan 2018 04:02:48 -0800 (PST) Received: from localhost ([::1]:38006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edaoB-0002Uu-LD for importer@patchew.org; Mon, 22 Jan 2018 07:02:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edamY-0001XJ-Cw for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:00:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamX-0005nk-IP for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:00:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamX-0005nG-DH; Mon, 22 Jan 2018 07:00: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 5BE912D1CD; Mon, 22 Jan 2018 12:00:56 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DBB58120A; Mon, 22 Jan 2018 12:00:52 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:37 +0100 Message-Id: <20180122120045.13538-2-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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]); Mon, 22 Jan 2018 12:00: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] [PULL 1/9] s390x/sclp: fixup highest CPU address 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, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Christian Borntraeger The highest cpu address is not the same as max_cpus. max_cpus counts from 1 while the cpu address starts at 0. Signed-off-by: Christian Borntraeger Reviewed-by: Jason J. Herne Message-Id: <20171219082807.84494-1-borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 9be0cb80ad..21351ffffc 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -67,7 +67,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) prepare_cpu_entries(sclp, read_info->entries, &cpu_count); read_info->entries_cpu =3D cpu_to_be16(cpu_count); read_info->offset_cpu =3D cpu_to_be16(offsetof(ReadInfo, entries)); - read_info->highest_cpu =3D cpu_to_be16(max_cpus); + read_info->highest_cpu =3D cpu_to_be16(max_cpus - 1); =20 read_info->ibc_val =3D cpu_to_be32(s390_get_ibc_val()); =20 --=20 2.13.6 From nobody Wed May 1 22:34:28 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 151662291224420.351745872612014; Mon, 22 Jan 2018 04:08:32 -0800 (PST) Received: from localhost ([::1]:38093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edato-00074k-4T for importer@patchew.org; Mon, 22 Jan 2018 07:08:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edame-0001cI-H4 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamZ-0005qn-Ka for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamZ-0005pG-Cz; Mon, 22 Jan 2018 07:00:59 -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 6B11A7CBA3; Mon, 22 Jan 2018 12:00:58 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA98380F7F; Mon, 22 Jan 2018 12:00:57 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:38 +0100 Message-Id: <20180122120045.13538-3-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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]); Mon, 22 Jan 2018 12:00:58 +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] [PULL 2/9] s390x/tcg: implement TEST PROTECTION 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, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: David Hildenbrand Linux uses TEST PROTECTION to sense for available memory locations. Let's implement what we can for now (just as for the other instructions, excluding AR mode and special protection mechanisms). Signed-off-by: David Hildenbrand Message-Id: <20171218224616.21030-2-david@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- target/s390x/helper.h | 2 +- target/s390x/mem_helper.c | 41 +++++++++++++++++++++++++++++++++++++++-- target/s390x/translate.c | 2 +- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 2f17b62d3d..26c1b07b44 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -137,7 +137,7 @@ DEF_HELPER_FLAGS_4(lctlg, TCG_CALL_NO_WG, void, env, i3= 2, i64, i32) DEF_HELPER_FLAGS_4(stctl, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_FLAGS_4(stctg, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_FLAGS_2(testblock, TCG_CALL_NO_WG, i32, env, i64) -DEF_HELPER_FLAGS_2(tprot, TCG_CALL_NO_RWG, i32, i64, i64) +DEF_HELPER_FLAGS_3(tprot, TCG_CALL_NO_RWG, i32, env, i64, i64) DEF_HELPER_FLAGS_2(iske, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_3(sske, TCG_CALL_NO_RWG, void, env, i64, i64) DEF_HELPER_FLAGS_2(rrbe, TCG_CALL_NO_RWG, i32, env, i64) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 2625d843b3..359e446c6f 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1717,9 +1717,46 @@ uint32_t HELPER(testblock)(CPUS390XState *env, uint6= 4_t real_addr) return 0; } =20 -uint32_t HELPER(tprot)(uint64_t a1, uint64_t a2) +uint32_t HELPER(tprot)(CPUS390XState *env, uint64_t a1, uint64_t a2) { - /* XXX implement */ + S390CPU *cpu =3D s390_env_get_cpu(env); + CPUState *cs =3D CPU(cpu); + + /* + * TODO: we currently don't handle all access protection types + * (including access-list and key-controlled) as well as AR mode. + */ + if (!s390_cpu_virt_mem_check_write(cpu, a1, 0, 1)) { + /* Fetching permitted; storing permitted */ + return 0; + } + switch (env->int_pgm_code) { + case PGM_PROTECTION: + /* Fetching permitted; storing not permitted */ + cs->exception_index =3D 0; + return 1; + case PGM_ADDRESSING: + /* Fetching not permitted; storing not permitted */ + cs->exception_index =3D 0; + return 2; + case PGM_ASCE_TYPE: + case PGM_REG_FIRST_TRANS: + case PGM_REG_SEC_TRANS: + case PGM_REG_THIRD_TRANS: + case PGM_SEGMENT_TRANS: + case PGM_PAGE_TRANS: + case PGM_ALET_SPEC: + case PGM_ALEN_SPEC: + case PGM_ALE_SEQ: + case PGM_ASTE_VALID: + case PGM_ASTE_SEQ: + case PGM_EXT_AUTH: + /* Translation not available */ + cs->exception_index =3D 0; + return 3; + } + /* any other exception is forwarded to the guest */ + s390_cpu_virt_mem_handle_exc(cpu, GETPC()); return 0; } =20 diff --git a/target/s390x/translate.c b/target/s390x/translate.c index ac55886792..df0b41606d 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4532,7 +4532,7 @@ static ExitStatus op_testblock(DisasContext *s, Disas= Ops *o) =20 static ExitStatus op_tprot(DisasContext *s, DisasOps *o) { - gen_helper_tprot(cc_op, o->addr1, o->in2); + gen_helper_tprot(cc_op, cpu_env, o->addr1, o->in2); set_cc_static(s); return NO_EXIT; } --=20 2.13.6 From nobody Wed May 1 22:34:28 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 1516622733777262.83772713148244; Mon, 22 Jan 2018 04:05:33 -0800 (PST) Received: from localhost ([::1]:38042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edaqz-0004dj-31 for importer@patchew.org; Mon, 22 Jan 2018 07:05:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edamc-0001Zt-4c for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamb-0005sK-Ce for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30367) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamb-0005ru-6u; Mon, 22 Jan 2018 07:01: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 3E8115587A; Mon, 22 Jan 2018 12:01:00 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB6DF9065; Mon, 22 Jan 2018 12:00:59 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:39 +0100 Message-Id: <20180122120045.13538-4-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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.30]); Mon, 22 Jan 2018 12:01: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] [PULL 3/9] s390x/sclp: fix missing be conversion 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, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: David Hildenbrand Linux crashes right now if maxmem > mem is specified on the command line. On s390x, the guest can hotplug memory itself right now - very weird - and e.g. Fedora 27 will simply add all memory it can when booting. So now, we have at least the same behavior on TCG and KVM. Signed-off-by: David Hildenbrand Message-Id: <20171218224616.21030-3-david@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 21351ffffc..276972b59f 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -233,7 +233,7 @@ static void assign_storage(SCLPDevice *sclp, SCCB *sccb) sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND= ); return; } - assign_addr =3D (assign_info->rn - 1) * mhd->rzm; + assign_addr =3D (be16_to_cpu(assign_info->rn) - 1) * mhd->rzm; =20 if ((assign_addr % MEM_SECTION_SIZE =3D=3D 0) && (assign_addr >=3D mhd->padded_ram_size)) { @@ -292,7 +292,7 @@ static void unassign_storage(SCLPDevice *sclp, SCCB *sc= cb) sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND= ); return; } - unassign_addr =3D (assign_info->rn - 1) * mhd->rzm; + unassign_addr =3D (be16_to_cpu(assign_info->rn) - 1) * mhd->rzm; =20 /* if the addr is a multiple of 256 MB */ if ((unassign_addr % MEM_SECTION_SIZE =3D=3D 0) && --=20 2.13.6 From nobody Wed May 1 22:34:28 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 1516623084722439.6365955493915; Mon, 22 Jan 2018 04:11:24 -0800 (PST) Received: from localhost ([::1]:38144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edawe-0001Ea-2C for importer@patchew.org; Mon, 22 Jan 2018 07:11:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edaml-0001jd-Q5 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamh-0005uk-BD for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4315) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamh-0005uM-59; Mon, 22 Jan 2018 07:01: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 2B0376A7C8; Mon, 22 Jan 2018 12:01:06 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1CB4189F3; Mon, 22 Jan 2018 12:01:01 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:40 +0100 Message-Id: <20180122120045.13538-5-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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]); Mon, 22 Jan 2018 12:01: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] [PULL 4/9] hw/s390x: Replace fprintf(stderr, "*\n" with qemu_log_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, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Alistair Francis , rth@twiddle.net 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" From: Alistair Francis One fprintf(stderr, was manually converted to a qemu_log_mask(LOG_GUEST_ERROR, Signed-off-by: Alistair Francis Reviewed-by: Thomas Huth Message-Id: <3f49c0ff601f27534d4536c87c00d01c233e067f.1513790495.git.alista= ir.francis@xilinx.com> [CH: tweaked commit message] Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 38f6a8afc9..3d8f26949b 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -426,8 +426,9 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) * passes us zeroes for those we don't support. */ if (features.features) { - fprintf(stderr, "Guest bug: features[%i]=3D%x (expecte= d 0)\n", - features.index, features.features); + qemu_log_mask(LOG_GUEST_ERROR, + "Guest bug: features[%i]=3D%x (expected = 0)", + features.index, features.features); /* XXX: do a unit check here? */ } } --=20 2.13.6 From nobody Wed May 1 22:34:28 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 1516622591175498.4155357014454; Mon, 22 Jan 2018 04:03:11 -0800 (PST) Received: from localhost ([::1]:38012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edaog-0002nQ-Fw for importer@patchew.org; Mon, 22 Jan 2018 07:03:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edamn-0001l9-Ez for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamj-0005vd-IE for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamj-0005vR-C4; Mon, 22 Jan 2018 07:01:09 -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 5522478222; Mon, 22 Jan 2018 12:01:08 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 906BA81219; Mon, 22 Jan 2018 12:01:07 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:41 +0100 Message-Id: <20180122120045.13538-6-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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]); Mon, 22 Jan 2018 12:01:08 +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] [PULL 5/9] s390x: fix storage attributes migration for non-small guests 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, qemu-stable@nongnu.org, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Claudio Imbrenda , rth@twiddle.net 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" From: Claudio Imbrenda Fix storage attribute migration so that it does not fail for guests with more than a few GB of RAM. With such guests, the index in the buffer would go out of bounds, usually by large amounts, thus receiving -EFAULT from the kernel. Migration itself would be successful, but storage attributes would then not be migrated completely. This patch fixes the out of bounds access, and thus migration of all storage attributes when the guest have large amounts of memory. Cc: qemu-stable@nongnu.org Signed-off-by: Claudio Imbrenda Fixes: 903fd80b03243476 ("s390x/migration: Storage attributes device") Message-Id: <1516297904-18188-1-git-send-email-imbrenda@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/s390-stattrib-kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c index 41770a7dec..480551c3db 100644 --- a/hw/s390x/s390-stattrib-kvm.c +++ b/hw/s390x/s390-stattrib-kvm.c @@ -116,7 +116,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribS= tate *sa) for (cx =3D 0; cx + len <=3D max; cx +=3D len) { clog.start_gfn =3D cx; clog.count =3D len; - clog.values =3D (uint64_t)(sas->incoming_buffer + cx * len); + clog.values =3D (uint64_t)(sas->incoming_buffer + cx); r =3D kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog); if (r) { error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror= (-r)); @@ -126,7 +126,7 @@ static void kvm_s390_stattrib_synchronize(S390StAttribS= tate *sa) if (cx < max) { clog.start_gfn =3D cx; clog.count =3D max - cx; - clog.values =3D (uint64_t)(sas->incoming_buffer + cx * len); + clog.values =3D (uint64_t)(sas->incoming_buffer + cx); r =3D kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog); if (r) { error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror= (-r)); --=20 2.13.6 From nobody Wed May 1 22:34:28 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 151662325726071.05379714586661; Mon, 22 Jan 2018 04:14:17 -0800 (PST) Received: from localhost ([::1]:38241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edazQ-0003h1-Bx for importer@patchew.org; Mon, 22 Jan 2018 07:14:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edamu-0001pz-90 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamo-0005xB-J2 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamo-0005wq-Ac; Mon, 22 Jan 2018 07:01:14 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65DFF2CE91D; Mon, 22 Jan 2018 12:01:13 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C63A57F5EF; Mon, 22 Jan 2018 12:01:09 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:42 +0100 Message-Id: <20180122120045.13538-7-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 22 Jan 2018 12:01: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] [PULL 6/9] s390x/tcg: fixup TEST PROTECTION 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, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: David Hildenbrand CC =3D=3D 2 can only happen due to a protection exception, not if memory is not available (PGM_ADDRESSING). So all PGM_ADDRESSING exceptions have to be forwarded to the guest. Since the initial definition of TEST PROTECTION, we now read globals (e.g. PSW mask), so we have to correctly mark the instruction (otherwise, e.g. booting fedora 27 fails). Also, the architecture explicitly specifies which exceptions are forwarded to the guest, this makes the code a little nicer. Signed-off-by: David Hildenbrand Message-Id: <20180112125452.8569-1-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.h | 2 ++ target/s390x/helper.h | 2 +- target/s390x/mem_helper.c | 41 +++++++++++++++++++---------------------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 1a8b6b9ae9..915bccbc75 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -759,6 +759,8 @@ 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, false) #define s390_cpu_virt_mem_write(cpu, laddr, ar, dest, len) \ s390_cpu_virt_mem_rw(cpu, laddr, ar, dest, len, true) +#define s390_cpu_virt_mem_check_read(cpu, laddr, ar, len) \ + s390_cpu_virt_mem_rw(cpu, laddr, ar, NULL, len, false) #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); diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 26c1b07b44..59a1d9869b 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -137,7 +137,7 @@ DEF_HELPER_FLAGS_4(lctlg, TCG_CALL_NO_WG, void, env, i3= 2, i64, i32) DEF_HELPER_FLAGS_4(stctl, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_FLAGS_4(stctg, TCG_CALL_NO_WG, void, env, i32, i64, i32) DEF_HELPER_FLAGS_2(testblock, TCG_CALL_NO_WG, i32, env, i64) -DEF_HELPER_FLAGS_3(tprot, TCG_CALL_NO_RWG, i32, env, i64, i64) +DEF_HELPER_FLAGS_3(tprot, TCG_CALL_NO_WG, i32, env, i64, i64) DEF_HELPER_FLAGS_2(iske, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_3(sske, TCG_CALL_NO_RWG, void, env, i64, i64) DEF_HELPER_FLAGS_2(rrbe, TCG_CALL_NO_RWG, i32, env, i64) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 359e446c6f..c957febc6d 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1730,34 +1730,31 @@ uint32_t HELPER(tprot)(CPUS390XState *env, uint64_t= a1, uint64_t a2) /* Fetching permitted; storing permitted */ return 0; } + + if (env->int_pgm_code =3D=3D PGM_PROTECTION) { + /* retry if reading is possible */ + cs->exception_index =3D 0; + if (!s390_cpu_virt_mem_check_read(cpu, a1, 0, 1)) { + /* Fetching permitted; storing not permitted */ + return 1; + } + } + switch (env->int_pgm_code) { case PGM_PROTECTION: - /* Fetching permitted; storing not permitted */ - cs->exception_index =3D 0; - return 1; - case PGM_ADDRESSING: /* Fetching not permitted; storing not permitted */ cs->exception_index =3D 0; return 2; - case PGM_ASCE_TYPE: - case PGM_REG_FIRST_TRANS: - case PGM_REG_SEC_TRANS: - case PGM_REG_THIRD_TRANS: - case PGM_SEGMENT_TRANS: - case PGM_PAGE_TRANS: - case PGM_ALET_SPEC: - case PGM_ALEN_SPEC: - case PGM_ALE_SEQ: - case PGM_ASTE_VALID: - case PGM_ASTE_SEQ: - case PGM_EXT_AUTH: - /* Translation not available */ - cs->exception_index =3D 0; - return 3; + case PGM_ADDRESSING: + case PGM_TRANS_SPEC: + /* exceptions forwarded to the guest */ + s390_cpu_virt_mem_handle_exc(cpu, GETPC()); + return 0; } - /* any other exception is forwarded to the guest */ - s390_cpu_virt_mem_handle_exc(cpu, GETPC()); - return 0; + + /* Translation not available */ + cs->exception_index =3D 0; + return 3; } =20 /* insert storage key extended */ --=20 2.13.6 From nobody Wed May 1 22:34:28 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 1516623440423944.9176024637832; Mon, 22 Jan 2018 04:17:20 -0800 (PST) Received: from localhost ([::1]:38294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edb2N-0006Hy-I3 for importer@patchew.org; Mon, 22 Jan 2018 07:17:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edan2-0001xD-Lf for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edams-00060S-Tw for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34588) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edams-0005zW-Mf; Mon, 22 Jan 2018 07:01: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 BA8075F15D; Mon, 22 Jan 2018 12:01:17 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6FCD62667; Mon, 22 Jan 2018 12:01:14 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:43 +0100 Message-Id: <20180122120045.13538-8-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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.25]); Mon, 22 Jan 2018 12:01: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] [PULL 7/9] linux-headers: update 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, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" Update headers against 4.15-rc9. Signed-off-by: Cornelia Huck --- include/standard-headers/asm-s390/virtio-ccw.h | 6 +----- linux-headers/asm-powerpc/kvm.h | 25 ++++++++++++++++++++++= +++ linux-headers/asm-s390/kvm.h | 9 ++++----- linux-headers/asm-s390/kvm_para.h | 4 ---- linux-headers/linux/kvm.h | 8 ++++++-- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/include/standard-headers/asm-s390/virtio-ccw.h b/include/stand= ard-headers/asm-s390/virtio-ccw.h index 967aad3901..2b605f7e84 100644 --- a/include/standard-headers/asm-s390/virtio-ccw.h +++ b/include/standard-headers/asm-s390/virtio-ccw.h @@ -1,13 +1,9 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) */ /* * Definitions for virtio-ccw devices. * * Copyright IBM Corp. 2013 * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (version 2 only) - * as published by the Free Software Foundation. - * * Author(s): Cornelia Huck */ #ifndef __KVM_VIRTIO_CCW_H diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kv= m.h index 61d6049f4c..637b7263cb 100644 --- a/linux-headers/asm-powerpc/kvm.h +++ b/linux-headers/asm-powerpc/kvm.h @@ -443,6 +443,31 @@ struct kvm_ppc_rmmu_info { __u32 ap_encodings[8]; }; =20 +/* For KVM_PPC_GET_CPU_CHAR */ +struct kvm_ppc_cpu_char { + __u64 character; /* characteristics of the CPU */ + __u64 behaviour; /* recommended software behaviour */ + __u64 character_mask; /* valid bits in character */ + __u64 behaviour_mask; /* valid bits in behaviour */ +}; + +/* + * Values for character and character_mask. + * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. + */ +#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) +#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) +#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) +#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) +#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) +#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) + +#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) +#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) +#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) + /* Per-vcpu XICS interrupt controller state */ #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) =20 diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h index 32d372e977..11def14301 100644 --- a/linux-headers/asm-s390/kvm.h +++ b/linux-headers/asm-s390/kvm.h @@ -6,10 +6,6 @@ * * Copyright IBM Corp. 2008 * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (version 2 only) - * as published by the Free Software Foundation. - * * Author(s): Carsten Otte * Christian Borntraeger */ @@ -228,6 +224,7 @@ struct kvm_guest_debug_arch { #define KVM_SYNC_RICCB (1UL << 7) #define KVM_SYNC_FPRS (1UL << 8) #define KVM_SYNC_GSCB (1UL << 9) +#define KVM_SYNC_BPBC (1UL << 10) /* length and alignment of the sdnx as a power of two */ #define SDNXC 8 #define SDNXL (1UL << SDNXC) @@ -251,7 +248,9 @@ struct kvm_sync_regs { }; __u8 reserved[512]; /* for future vector expansion */ __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ - __u8 padding1[52]; /* riccb needs to be 64byte aligned */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; + __u8 padding1[51]; /* riccb needs to be 64byte aligned */ __u8 riccb[64]; /* runtime instrumentation controls block */ __u8 padding2[192]; /* sdnx needs to be 256byte aligned */ union { diff --git a/linux-headers/asm-s390/kvm_para.h b/linux-headers/asm-s390/kvm= _para.h index 0dc86b3a7c..b9ab584adf 100644 --- a/linux-headers/asm-s390/kvm_para.h +++ b/linux-headers/asm-s390/kvm_para.h @@ -4,9 +4,5 @@ * * Copyright IBM Corp. 2008 * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (version 2 only) - * as published by the Free Software Foundation. - * * Author(s): Christian Borntraeger */ diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index ce6c2f11f4..d92c9b2f0e 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -630,9 +630,9 @@ struct kvm_s390_irq { =20 struct kvm_s390_irq_state { __u64 buf; - __u32 flags; + __u32 flags; /* will stay unused for compatibility reasons */ __u32 len; - __u32 reserved[4]; + __u32 reserved[4]; /* will stay unused for compatibility reasons */ }; =20 /* for KVM_SET_GUEST_DEBUG */ @@ -932,6 +932,8 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_HYPERV_SYNIC2 148 #define KVM_CAP_HYPERV_VP_INDEX 149 #define KVM_CAP_S390_AIS_MIGRATION 150 +#define KVM_CAP_PPC_GET_CPU_CHAR 151 +#define KVM_CAP_S390_BPB 152 =20 #ifdef KVM_CAP_IRQ_ROUTING =20 @@ -1261,6 +1263,8 @@ struct kvm_s390_ucas_mapping { #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_= cfg) /* Available with KVM_CAP_PPC_RADIX_MMU */ #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_inf= o) +/* Available with KVM_CAP_PPC_GET_CPU_CHAR */ +#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) =20 /* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) --=20 2.13.6 From nobody Wed May 1 22:34:28 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 1516622766649527.4577258757116; Mon, 22 Jan 2018 04:06:06 -0800 (PST) Received: from localhost ([::1]:38048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edarQ-00057H-P2 for importer@patchew.org; Mon, 22 Jan 2018 07:06:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edan4-0001zM-OM for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edamy-0006CX-I5 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edamy-00069y-A3; Mon, 22 Jan 2018 07:01:24 -0500 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 5DB611A407A; Mon, 22 Jan 2018 12:01:23 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 379147A2E0; Mon, 22 Jan 2018 12:01:19 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:44 +0100 Message-Id: <20180122120045.13538-9-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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]); Mon, 22 Jan 2018 12:01: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] [PULL 8/9] s390x/kvm: Handle bpb feature 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, qemu-stable@nongnu.org, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Christian Borntraeger We need to handle the bpb control on reset and migration. Normally stfle.82 is transparent (and the normal guest part works without hypervisor activity). To prevent any issues we require full host kernel support for this feature. Cc: qemu-stable@nongnu.org Signed-off-by: Christian Borntraeger Message-Id: <20180118085628.40798-3-borntraeger@de.ibm.com> Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand [CH: 'Branch Prediction Blocking' -> 'Branch prediction blocking'] Signed-off-by: Cornelia Huck --- target/s390x/cpu.c | 1 + target/s390x/cpu.h | 1 + target/s390x/cpu_features.c | 1 + target/s390x/cpu_features_def.h | 1 + target/s390x/gen-features.c | 1 + target/s390x/kvm.c | 14 ++++++++++++++ target/s390x/machine.c | 17 +++++++++++++++++ 7 files changed, 36 insertions(+) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index ae3cee91a2..d2e6b9f5c7 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -89,6 +89,7 @@ static void s390_cpu_reset(CPUState *s) CPUS390XState *env =3D &cpu->env; =20 env->pfault_token =3D -1UL; + env->bpbc =3D false; scc->parent_reset(s); cpu->env.sigp_order =3D 0; s390_cpu_set_state(CPU_STATE_STOPPED, cpu); diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 915bccbc75..a1123ad621 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -93,6 +93,7 @@ struct CPUS390XState { =20 uint32_t fpc; /* floating-point control register */ uint32_t cc_op; + bool bpbc; /* branch prediction blocking */ =20 float_status fpu_status; /* passed to softfloat lib */ =20 diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index 31a4676f05..b45ef09f93 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -89,6 +89,7 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("msa4-base", S390_FEAT_TYPE_STFL, 77, "Message-security-assi= st-extension-4 facility (excluding subfunctions)"), FEAT_INIT("edat2", S390_FEAT_TYPE_STFL, 78, "Enhanced-DAT facility 2"), FEAT_INIT("dfppc", S390_FEAT_TYPE_STFL, 80, "Decimal-floating-point pa= cked-conversion facility"), + FEAT_INIT("bpb", S390_FEAT_TYPE_STFL, 82, "Branch prediction blocking"= ), FEAT_INIT("vx", S390_FEAT_TYPE_STFL, 129, "Vector facility"), FEAT_INIT("iep", S390_FEAT_TYPE_STFL, 130, "Instruction-execution-prot= ection facility"), FEAT_INIT("sea_esop2", S390_FEAT_TYPE_STFL, 131, "Side-effect-access f= acility and Enhanced-suppression-on-protection facility 2"), diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_de= f.h index 4b6d4e9cc0..4487cfd53b 100644 --- a/target/s390x/cpu_features_def.h +++ b/target/s390x/cpu_features_def.h @@ -80,6 +80,7 @@ typedef enum { S390_FEAT_MSA_EXT_4, S390_FEAT_EDAT_2, S390_FEAT_DFP_PACKED_CONVERSION, + S390_FEAT_BPB, S390_FEAT_VECTOR, S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index b24f6ada5b..563aced35e 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -352,6 +352,7 @@ static uint16_t base_GEN14_GA1[] =3D { * support these features yet. */ static uint16_t full_GEN7_GA1[] =3D { + S390_FEAT_BPB, S390_FEAT_SIE_F2, S390_FEAT_SIE_SKEY, S390_FEAT_SIE_GPERE, diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 6a18a413b4..8736001156 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -490,6 +490,11 @@ int kvm_arch_put_registers(CPUState *cs, int level) cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_GSCB; } =20 + if (can_sync_regs(cs, KVM_SYNC_BPBC)) { + cs->kvm_run->s.regs.bpbc =3D env->bpbc; + cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_BPBC; + } + /* Finally the prefix */ if (can_sync_regs(cs, KVM_SYNC_PREFIX)) { cs->kvm_run->s.regs.prefix =3D env->psa; @@ -600,6 +605,10 @@ int kvm_arch_get_registers(CPUState *cs) memcpy(env->gscb, cs->kvm_run->s.regs.gscb, 32); } =20 + if (can_sync_regs(cs, KVM_SYNC_BPBC)) { + env->bpbc =3D cs->kvm_run->s.regs.bpbc; + } + /* pfault parameters */ if (can_sync_regs(cs, KVM_SYNC_PFAULT)) { env->pfault_token =3D cs->kvm_run->s.regs.pft; @@ -2278,6 +2287,11 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model= , Error **errp) clear_bit(S390_FEAT_CMM_NT, model->features); } =20 + /* bpb needs kernel support for migration, VSIE and reset */ + if (!kvm_check_extension(kvm_state, KVM_CAP_S390_BPB)) { + clear_bit(S390_FEAT_BPB, model->features); + } + /* We emulate a zPCI bus and AEN, therefore we don't need HW support */ if (pci_available) { set_bit(S390_FEAT_ZPCI, model->features); diff --git a/target/s390x/machine.c b/target/s390x/machine.c index b78f326d3a..84b4928755 100644 --- a/target/s390x/machine.c +++ b/target/s390x/machine.c @@ -194,6 +194,22 @@ const VMStateDescription vmstate_gscb =3D { } }; =20 +static bool bpbc_needed(void *opaque) +{ + return s390_has_feat(S390_FEAT_BPB); +} + +const VMStateDescription vmstate_bpbc =3D { + .name =3D "cpu/bpbc", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D bpbc_needed, + .fields =3D (VMStateField[]) { + VMSTATE_BOOL(env.bpbc, S390CPU), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_s390_cpu =3D { .name =3D "cpu", .post_load =3D cpu_post_load, @@ -228,6 +244,7 @@ const VMStateDescription vmstate_s390_cpu =3D { &vmstate_riccb, &vmstate_exval, &vmstate_gscb, + &vmstate_bpbc, NULL }, }; --=20 2.13.6 From nobody Wed May 1 22:34:28 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 151662277119270.94667311949024; Mon, 22 Jan 2018 04:06:11 -0800 (PST) Received: from localhost ([::1]:38049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edara-0005DF-Dy for importer@patchew.org; Mon, 22 Jan 2018 07:06:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edan5-00020K-PT for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edan4-0006VI-R2 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 07:01:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44634) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edan4-0006Sr-M0; Mon, 22 Jan 2018 07:01:30 -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 B30D183F42; Mon, 22 Jan 2018 12:01:29 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C69638120A; Mon, 22 Jan 2018 12:01:24 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 22 Jan 2018 13:00:45 +0100 Message-Id: <20180122120045.13538-10-cohuck@redhat.com> In-Reply-To: <20180122120045.13538-1-cohuck@redhat.com> References: <20180122120045.13538-1-cohuck@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]); Mon, 22 Jan 2018 12:01:29 +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] [PULL 9/9] s390x/kvm: provide stfle.81 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, qemu-stable@nongnu.org, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Christian Borntraeger stfle.81 (ppa15) is a transparent facility that can be passed to the guest without the need to implement hypervisor support. As this feature can be provided by firmware we add it to all full models. Cc: qemu-stable@nongnu.org Signed-off-by: Christian Borntraeger Message-Id: <20180118085628.40798-4-borntraeger@de.ibm.com> Reviewed-by: Halil Pasic Reviewed-by: David Hildenbrand Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- target/s390x/cpu_features.c | 1 + target/s390x/cpu_features_def.h | 1 + target/s390x/gen-features.c | 1 + 3 files changed, 3 insertions(+) diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index b45ef09f93..85d10b5710 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -89,6 +89,7 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("msa4-base", S390_FEAT_TYPE_STFL, 77, "Message-security-assi= st-extension-4 facility (excluding subfunctions)"), FEAT_INIT("edat2", S390_FEAT_TYPE_STFL, 78, "Enhanced-DAT facility 2"), FEAT_INIT("dfppc", S390_FEAT_TYPE_STFL, 80, "Decimal-floating-point pa= cked-conversion facility"), + FEAT_INIT("ppa15", S390_FEAT_TYPE_STFL, 81, "PPA15 is installed"), FEAT_INIT("bpb", S390_FEAT_TYPE_STFL, 82, "Branch prediction blocking"= ), FEAT_INIT("vx", S390_FEAT_TYPE_STFL, 129, "Vector facility"), FEAT_INIT("iep", S390_FEAT_TYPE_STFL, 130, "Instruction-execution-prot= ection facility"), diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_de= f.h index 4487cfd53b..4d930871b4 100644 --- a/target/s390x/cpu_features_def.h +++ b/target/s390x/cpu_features_def.h @@ -80,6 +80,7 @@ typedef enum { S390_FEAT_MSA_EXT_4, S390_FEAT_EDAT_2, S390_FEAT_DFP_PACKED_CONVERSION, + S390_FEAT_PPA15, S390_FEAT_BPB, S390_FEAT_VECTOR, S390_FEAT_INSTRUCTION_EXEC_PROT, diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 563aced35e..0570f597ec 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -352,6 +352,7 @@ static uint16_t base_GEN14_GA1[] =3D { * support these features yet. */ static uint16_t full_GEN7_GA1[] =3D { + S390_FEAT_PPA15, S390_FEAT_BPB, S390_FEAT_SIE_F2, S390_FEAT_SIE_SKEY, --=20 2.13.6