From nobody Sat Apr 27 11:56: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 1506450918329503.57203457671994; Tue, 26 Sep 2017 11:35:18 -0700 (PDT) Received: from localhost ([::1]:50671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwuhG-0005RP-IZ for importer@patchew.org; Tue, 26 Sep 2017 14:35:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwuff-0004Ng-2G for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwufe-0003SA-BG for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47778) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwufe-0003Rf-5O for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4029AC0587C1; Tue, 26 Sep 2017 18:33:25 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-152.ams2.redhat.com [10.36.117.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id B342460841; Tue, 26 Sep 2017 18:33:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4029AC0587C1 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 20:33:13 +0200 Message-Id: <20170926183318.12995-2-david@redhat.com> In-Reply-To: <20170926183318.12995-1-david@redhat.com> References: <20170926183318.12995-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 26 Sep 2017 18:33:25 +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 1/6] s390x/tcg: fix checking for invalid memory check 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 Hildenbrand , cohuck@redhat.com, Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It should have been a >=3D, but let's directly perform a proper access check to also be able to deal with hotplugged memory later. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- target/s390x/excp_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 470cf8f5bc..308605d9ed 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -26,6 +26,7 @@ #include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "hw/s390x/ioinst.h" +#include "exec/address-spaces.h" #ifndef CONFIG_USER_ONLY #include "sysemu/sysemu.h" #endif @@ -108,7 +109,8 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_= vaddr, } =20 /* check out of RAM access */ - if (raddr > ram_size) { + if (!address_space_access_valid(&address_space_memory, raddr, + TARGET_PAGE_SIZE, rw)) { DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__, (uint64_t)raddr, (uint64_t)ram_size); trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO); --=20 2.13.5 From nobody Sat Apr 27 11:56: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 1506451057626406.67349380820883; Tue, 26 Sep 2017 11:37:37 -0700 (PDT) Received: from localhost ([::1]:50683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwujU-0007BD-3x for importer@patchew.org; Tue, 26 Sep 2017 14:37:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwufh-0004PK-Jm for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwufg-0003Sw-K8 for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45312) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwufg-0003Sf-BF for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FA7A85550; Tue, 26 Sep 2017 18:33:27 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-152.ams2.redhat.com [10.36.117.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AC6D60841; Tue, 26 Sep 2017 18:33:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5FA7A85550 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 20:33:14 +0200 Message-Id: <20170926183318.12995-3-david@redhat.com> In-Reply-To: <20170926183318.12995-1-david@redhat.com> References: <20170926183318.12995-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 26 Sep 2017 18:33:27 +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 2/6] s390x/tcg: add MMU for real addresses 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 Hildenbrand , cohuck@redhat.com, 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" This makes it easy to access real addresses (prefix) and in addition checks for valid memory addresses, which is missing when using e.g. stl_phys(). We can later reuse it to implement low address protection checks (then we might even decide to introduce yet another MMU for absolute addresses, just for handling storage keys and low address protection). Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- target/s390x/cpu.h | 4 +++- target/s390x/excp_helper.c | 25 ++++++++++++++++--------- target/s390x/internal.h | 2 ++ target/s390x/mmu_helper.c | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 9b549dc491..42b4e813e4 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -43,12 +43,13 @@ =20 #include "fpu/softfloat.h" =20 -#define NB_MMU_MODES 3 +#define NB_MMU_MODES 4 #define TARGET_INSN_START_EXTRA_WORDS 1 =20 #define MMU_MODE0_SUFFIX _primary #define MMU_MODE1_SUFFIX _secondary #define MMU_MODE2_SUFFIX _home +#define MMU_MODE3_SUFFIX _real =20 #define MMU_USER_IDX 0 =20 @@ -349,6 +350,7 @@ extern const struct VMStateDescription vmstate_s390_cpu; #define MMU_PRIMARY_IDX 0 #define MMU_SECONDARY_IDX 1 #define MMU_HOME_IDX 2 +#define MMU_REAL_IDX 3 =20 static inline int cpu_mmu_index(CPUS390XState *env, bool ifetch) { diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 308605d9ed..3e4349d00b 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -88,8 +88,8 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_va= ddr, { S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; - uint64_t asc =3D cpu_mmu_idx_to_asc(mmu_idx); target_ulong vaddr, raddr; + uint64_t asc; int prot; =20 DPRINTF("%s: address 0x%" VADDR_PRIx " rw %d mmu_idx %d\n", @@ -98,14 +98,21 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_= vaddr, orig_vaddr &=3D TARGET_PAGE_MASK; vaddr =3D orig_vaddr; =20 - /* 31-Bit mode */ - if (!(env->psw.mask & PSW_MASK_64)) { - vaddr &=3D 0x7fffffff; - } - - if (mmu_translate(env, vaddr, rw, asc, &raddr, &prot, true)) { - /* Translation ended in exception */ - return 1; + if (mmu_idx < MMU_REAL_IDX) { + asc =3D cpu_mmu_idx_to_asc(mmu_idx); + /* 31-Bit mode */ + if (!(env->psw.mask & PSW_MASK_64)) { + vaddr &=3D 0x7fffffff; + } + if (mmu_translate(env, vaddr, rw, asc, &raddr, &prot, true)) { + return 1; + } + } else if (mmu_idx =3D=3D MMU_REAL_IDX) { + if (mmu_translate_real(env, vaddr, rw, &raddr, &prot)) { + return 1; + } + } else { + abort(); } =20 /* check out of RAM access */ diff --git a/target/s390x/internal.h b/target/s390x/internal.h index bc8f83129a..1a83e559e3 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -375,6 +375,8 @@ target_ulong mmu_real2abs(CPUS390XState *env, target_ul= ong raddr); /* mmu_helper.c */ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t= asc, target_ulong *raddr, int *flags, bool exc); +int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw, + target_ulong *addr, int *flags); =20 =20 /* misc_helper.c */ diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index b528c5921d..98c58fc7c9 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -497,3 +497,22 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, ui= nt8_t ar, void *hostbuf, g_free(pages); return ret; } + +/** + * Translate a real address into a physical (absolute) address. + * @param raddr the real address + * @param rw 0 =3D read, 1 =3D write, 2 =3D code fetch + * @param addr the translated address is stored to this pointer + * @param flags the PAGE_READ/WRITE/EXEC flags are stored to this pointer + * @return 0 if the translation was successful, < 0 if a fault occur= red + */ +int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw, + target_ulong *addr, int *flags) +{ + /* TODO: low address protection once we flush the tlb on cr changes */ + *flags =3D PAGE_READ | PAGE_WRITE; + *addr =3D mmu_real2abs(env, raddr); + + /* TODO: storage key handling */ + return 0; +} --=20 2.13.5 From nobody Sat Apr 27 11:56: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 1506450986208903.3825940395639; Tue, 26 Sep 2017 11:36:26 -0700 (PDT) Received: from localhost ([::1]:50682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwuiR-0006N2-Ev for importer@patchew.org; Tue, 26 Sep 2017 14:36:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwufj-0004Pf-Ec for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwufi-0003TY-Ks for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47914) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwufi-0003TN-FD for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A21AC0587E6; Tue, 26 Sep 2017 18:33:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-152.ams2.redhat.com [10.36.117.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5E6960841; Tue, 26 Sep 2017 18:33:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7A21AC0587E6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 20:33:15 +0200 Message-Id: <20170926183318.12995-4-david@redhat.com> In-Reply-To: <20170926183318.12995-1-david@redhat.com> References: <20170926183318.12995-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 26 Sep 2017 18:33: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] [PATCH v1 3/6] s390x/tcg: make lura(g) use the new _real mmu. 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 Hildenbrand , cohuck@redhat.com, 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" Looks like, lurag was not loading 64bit but only 32bit. As we properly handle the return address now, we can drop potential_page_fault(). Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- target/s390x/mem_helper.c | 7 ++----- target/s390x/translate.c | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index ec4760e390..f8525e05b3 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1973,16 +1973,13 @@ void HELPER(purge)(CPUS390XState *env) /* load using real address */ uint64_t HELPER(lura)(CPUS390XState *env, uint64_t addr) { - CPUState *cs =3D CPU(s390_env_get_cpu(env)); =20 - return (uint32_t)ldl_phys(cs->as, wrap_address(env, addr)); + return cpu_ldl_real_ra(env, wrap_address(env, addr), GETPC()); } =20 uint64_t HELPER(lurag)(CPUS390XState *env, uint64_t addr) { - CPUState *cs =3D CPU(s390_env_get_cpu(env)); - - return ldq_phys(cs->as, wrap_address(env, addr)); + return cpu_ldq_real_ra(env, wrap_address(env, addr), GETPC()); } =20 /* store using real address */ diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 5abd34fb34..d0ce14d120 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2915,7 +2915,6 @@ static ExitStatus op_lpq(DisasContext *s, DisasOps *o) static ExitStatus op_lura(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_lura(o->out, cpu_env, o->in2); return NO_EXIT; } @@ -2923,7 +2922,6 @@ static ExitStatus op_lura(DisasContext *s, DisasOps *= o) static ExitStatus op_lurag(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_lurag(o->out, cpu_env, o->in2); return NO_EXIT; } --=20 2.13.5 From nobody Sat Apr 27 11:56: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 150645106653129.15064516858763; Tue, 26 Sep 2017 11:37:46 -0700 (PDT) Received: from localhost ([::1]:50684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwujZ-0007EB-Ki for importer@patchew.org; Tue, 26 Sep 2017 14:37:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwufo-0004T4-BQ for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwufn-0003US-D3 for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58002) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwufn-0003UJ-6U for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43D2115552; Tue, 26 Sep 2017 18:33:34 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-152.ams2.redhat.com [10.36.117.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF62760841; Tue, 26 Sep 2017 18:33:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 43D2115552 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 20:33:16 +0200 Message-Id: <20170926183318.12995-5-david@redhat.com> In-Reply-To: <20170926183318.12995-1-david@redhat.com> References: <20170926183318.12995-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 26 Sep 2017 18:33:34 +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 4/6] s390x/tcg: make stora(g) use the new _real mmu 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 Hildenbrand , cohuck@redhat.com, Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As we properly handle the return address now, we can drop potential_page_fault(). Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- target/s390x/mem_helper.c | 8 ++------ target/s390x/translate.c | 2 -- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index f8525e05b3..34ffc282bf 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1985,9 +1985,7 @@ uint64_t HELPER(lurag)(CPUS390XState *env, uint64_t a= ddr) /* store using real address */ void HELPER(stura)(CPUS390XState *env, uint64_t addr, uint64_t v1) { - CPUState *cs =3D CPU(s390_env_get_cpu(env)); - - stl_phys(cs->as, wrap_address(env, addr), (uint32_t)v1); + cpu_stl_real_ra(env, wrap_address(env, addr), (uint32_t)v1, GETPC()); =20 if ((env->psw.mask & PSW_MASK_PER) && (env->cregs[9] & PER_CR9_EVENT_STORE) && @@ -2000,9 +1998,7 @@ void HELPER(stura)(CPUS390XState *env, uint64_t addr,= uint64_t v1) =20 void HELPER(sturg)(CPUS390XState *env, uint64_t addr, uint64_t v1) { - CPUState *cs =3D CPU(s390_env_get_cpu(env)); - - stq_phys(cs->as, wrap_address(env, addr), v1); + cpu_stq_real_ra(env, wrap_address(env, addr), v1, GETPC()); =20 if ((env->psw.mask & PSW_MASK_PER) && (env->cregs[9] & PER_CR9_EVENT_STORE) && diff --git a/target/s390x/translate.c b/target/s390x/translate.c index d0ce14d120..ee93fce482 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4063,7 +4063,6 @@ static ExitStatus op_stnosm(DisasContext *s, DisasOps= *o) static ExitStatus op_stura(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_stura(cpu_env, o->in2, o->in1); return NO_EXIT; } @@ -4071,7 +4070,6 @@ static ExitStatus op_stura(DisasContext *s, DisasOps = *o) static ExitStatus op_sturg(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_sturg(cpu_env, o->in2, o->in1); return NO_EXIT; } --=20 2.13.5 From nobody Sat Apr 27 11:56:58 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506451128490438.9170807175208; Tue, 26 Sep 2017 11:38:48 -0700 (PDT) Received: from localhost ([::1]:50690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwuke-000846-V7 for importer@patchew.org; Tue, 26 Sep 2017 14:38:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwufq-0004Uf-7c for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwufp-0003V0-Fv for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42424) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwufp-0003Ul-AO for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C30D81DFC; Tue, 26 Sep 2017 18:33:36 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-152.ams2.redhat.com [10.36.117.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A6D360841; Tue, 26 Sep 2017 18:33:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5C30D81DFC Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 20:33:17 +0200 Message-Id: <20170926183318.12995-6-david@redhat.com> In-Reply-To: <20170926183318.12995-1-david@redhat.com> References: <20170926183318.12995-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 26 Sep 2017 18:33:36 +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 5/6] s390x/tcg: make testblock use the new _real mmu 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 Hildenbrand , cohuck@redhat.com, Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Low address protection checks will be moved into the mmu later. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- target/s390x/mem_helper.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 34ffc282bf..4cf4f29171 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1702,17 +1702,9 @@ uint32_t HELPER(testblock)(CPUS390XState *env, uint6= 4_t real_addr) { uintptr_t ra =3D GETPC(); CPUState *cs =3D CPU(s390_env_get_cpu(env)); - uint64_t abs_addr; int i; =20 - real_addr =3D wrap_address(env, real_addr); - abs_addr =3D mmu_real2abs(env, real_addr) & TARGET_PAGE_MASK; - if (!address_space_access_valid(&address_space_memory, abs_addr, - TARGET_PAGE_SIZE, true)) { - cpu_restore_state(cs, ra); - program_interrupt(env, PGM_ADDRESSING, 4); - return 1; - } + real_addr =3D wrap_address(env, real_addr) & TARGET_PAGE_MASK; =20 /* Check low-address protection */ if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) { @@ -1722,7 +1714,7 @@ uint32_t HELPER(testblock)(CPUS390XState *env, uint64= _t real_addr) } =20 for (i =3D 0; i < TARGET_PAGE_SIZE; i +=3D 8) { - stq_phys(cs->as, abs_addr + i, 0); + cpu_stq_real_ra(env, real_addr + i, 0, ra); } =20 return 0; --=20 2.13.5 From nobody Sat Apr 27 11:56: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 1506451236690482.3362390455684; Tue, 26 Sep 2017 11:40:36 -0700 (PDT) Received: from localhost ([::1]:50699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwumJ-0000jZ-TU for importer@patchew.org; Tue, 26 Sep 2017 14:40:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwufs-0004Wm-BN for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwufr-0003Vj-Je for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwufr-0003VH-E1 for qemu-devel@nongnu.org; Tue, 26 Sep 2017 14:33:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 734375AFED; Tue, 26 Sep 2017 18:33:38 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-152.ams2.redhat.com [10.36.117.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id B25CD17F29; Tue, 26 Sep 2017 18:33:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 734375AFED 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, 26 Sep 2017 20:33:18 +0200 Message-Id: <20170926183318.12995-7-david@redhat.com> In-Reply-To: <20170926183318.12995-1-david@redhat.com> References: <20170926183318.12995-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 26 Sep 2017 18:33:38 +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 6/6] s390x/tcg: make idte/ipte use the new _real mmu 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 Hildenbrand , cohuck@redhat.com, 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 don't wrap addresses in the mmu for the _real case, therefore the behavior should be unchanged. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- target/s390x/mem_helper.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4cf4f29171..010f509ac5 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1889,11 +1889,11 @@ void HELPER(idte)(CPUS390XState *env, uint64_t r1, = uint64_t r2, uint32_t m4) for (i =3D 0; i < entries; i++) { /* addresses are not wrapped in 24/31bit mode but table index = is */ raddr =3D table + ((index + i) & 0x7ff) * sizeof(entry); - entry =3D ldq_phys(cs->as, raddr); + entry =3D cpu_ldq_real_ra(env, raddr, ra); if (!(entry & _REGION_ENTRY_INV)) { /* we are allowed to not store if already invalid */ entry |=3D _REGION_ENTRY_INV; - stq_phys(cs->as, raddr, entry); + cpu_stq_real_ra(env, raddr, entry, ra); } } } @@ -1911,6 +1911,7 @@ void HELPER(ipte)(CPUS390XState *env, uint64_t pto, u= int64_t vaddr, uint32_t m4) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); + const uintptr_t ra =3D GETPC(); uint64_t page =3D vaddr & TARGET_PAGE_MASK; uint64_t pte_addr, pte; =20 @@ -1919,9 +1920,9 @@ void HELPER(ipte)(CPUS390XState *env, uint64_t pto, u= int64_t vaddr, pte_addr +=3D (vaddr & VADDR_PX) >> 9; =20 /* Mark the page table entry as invalid */ - pte =3D ldq_phys(cs->as, pte_addr); + pte =3D cpu_ldq_real_ra(env, pte_addr, ra); pte |=3D _PAGE_INVALID; - stq_phys(cs->as, pte_addr, pte); + cpu_stq_real_ra(env, pte_addr, pte, ra); =20 /* XXX we exploit the fact that Linux passes the exact virtual address here - it's not obliged to! */ --=20 2.13.5