From nobody Fri Apr 19 22:25:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565609336; cv=none; d=zoho.com; s=zohoarc; b=ZIVkyVGtqxeXE5oiiaqGdJkBzy1TwjNb8iFlF/Aw0PlndlTc6L9iH1LXKmBpD9BO0E1dp8Qhp7QPsJqwJcWZYMFZ475f0UDImoM2QUE52id/5mlZPkLuj3vE2DHQeoWkHkHWyOrw40ECkgZH0nnwiV3J//ktRZSjqm5BRlN4auk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565609336; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=R0n8qt2GA4kAreCJKGIh9obT6xw/ooYOntD9mlcOwqg=; b=ZRWZv6oWdFQ7FLr2g1JHr+z4K3q668GX9ZadbJkXdEqHVuqPr7VgYNbBLAeWfz3vtIyfipsL7qNvrYC5uJbcBl9tkwwdtC8AAJ98j+tiUqAKeI3PCik6hgvHYgHZs7el8wpO53YKv0vYnc0WUAzAHKinDEnAn3OBgHLKYx7Dzt4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565609336365115.79568724934325; Mon, 12 Aug 2019 04:28:56 -0700 (PDT) Received: from localhost ([::1]:44422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8VO-0005xt-En for importer@patchew.org; Mon, 12 Aug 2019 07:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34573) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8UT-0004DO-5C for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx8US-0002VF-6m for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54500) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hx8US-0002Uj-1p; Mon, 12 Aug 2019 07:27:52 -0400 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 5915919CF92; Mon, 12 Aug 2019 11:27:51 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-110.ams2.redhat.com [10.36.117.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17B4C600C4; Mon, 12 Aug 2019 11:27:47 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 13:27:32 +0200 Message-Id: <20190812112737.6652-2-david@redhat.com> In-Reply-To: <20190812112737.6652-1-david@redhat.com> References: <20190812112737.6652-1-david@redhat.com> MIME-Version: 1.0 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.29]); Mon, 12 Aug 2019 11:27:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH-for-4.2 v1 1/6] s390x/mmu: ASC selection in s390_cpu_get_phys_page_debug() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Let's select the ASC before calling the function. This is a prepararion to remove the ASC magic depending on the access mode from mmu_translate. There is currently no way to distinguish if we have code or data access. For now, we were using code access, because especially when debugging with the gdbstub, we want to read and disassemble what we single-step. Signed-off-by: David Hildenbrand Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth --- target/s390x/helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 13ae9909ad..c5fb8966b6 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -58,6 +58,11 @@ hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr = vaddr) vaddr &=3D 0x7fffffff; } =20 + /* We want to read the code (e.g., see what we are single-stepping).*/ + if (asc !=3D PSW_ASC_HOME) { + asc =3D PSW_ASC_PRIMARY; + } + if (mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, fals= e)) { return -1; } --=20 2.21.0 From nobody Fri Apr 19 22:25:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565609335; cv=none; d=zoho.com; s=zohoarc; b=QQMOviJHRC5mlV9ADbYFmaxmkjkmvUwYFZxq4iYXPuTrEFZE/QUSMEOPkuyd8L+mCgblrwIgvCKr4vUWlNS/78eiH8VjA7DbcAfeH+NiAKbdQTs13e6AdM1yz4TFqo3VfSYVuO12z6mukkP1kDZSoxTQzLWpy72IiDLzTBd/+Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565609335; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VMZVlOJXtFCPhyAyUBs3meDlsIjuJJ2tXBgmMCUSSWo=; b=FwAidE6L4EAX2gEtfHUctRK/woAw2GiC6XsV20vCDcOrGT1w6MphbT2sOdw28/yoSR+w3kamotyx7baXwUGZbTpoQS3Ftrx/QHORHANG9kXdmY4bqFT2MswpcDpqNY8QZJ4pxrhS5OpkwAkXiot2jqHB2hLzeBryxHQ8otEbPww= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565609335054184.6052923625292; Mon, 12 Aug 2019 04:28:55 -0700 (PDT) Received: from localhost ([::1]:44424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8VS-00069m-2s for importer@patchew.org; Mon, 12 Aug 2019 07:28:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34596) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8UV-0004JC-ME for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx8UU-0002WM-G3 for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hx8UU-0002Vr-8m; Mon, 12 Aug 2019 07:27:54 -0400 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 74D86EC534; Mon, 12 Aug 2019 11:27:53 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-110.ams2.redhat.com [10.36.117.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id A21EB600C4; Mon, 12 Aug 2019 11:27:51 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 13:27:33 +0200 Message-Id: <20190812112737.6652-3-david@redhat.com> In-Reply-To: <20190812112737.6652-1-david@redhat.com> References: <20190812112737.6652-1-david@redhat.com> MIME-Version: 1.0 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, 12 Aug 2019 11:27:53 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH-for-4.2 v1 2/6] s390x/tcg: Rework MMU selection for instruction fetches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instructions are always fetched from primary address space, except when in home address mode. Perform the selection directly in cpu_mmu_index(). get_mem_index() is only used to perform data access, instructions are fetched via cpu_lduw_code(), which translates to cpu_mmu_index(env, true). We don't care about restricting the access permissions of the TLB entries anymore, as we no longer enter PRIMARY entries into the SECONDARY MMU. Cleanup related code a bit. Signed-off-by: David Hildenbrand --- target/s390x/cpu.h | 7 +++++++ target/s390x/mmu_helper.c | 35 ++++++++++++++--------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index a606547b4d..c34992bb2e 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -332,6 +332,13 @@ static inline int cpu_mmu_index(CPUS390XState *env, bo= ol ifetch) return MMU_REAL_IDX; } =20 + if (ifetch) { + if ((env->psw.mask & PSW_MASK_ASC) =3D=3D PSW_ASC_HOME) { + return MMU_HOME_IDX; + } + return MMU_PRIMARY_IDX; + } + switch (env->psw.mask & PSW_MASK_ASC) { case PSW_ASC_PRIMARY: return MMU_PRIMARY_IDX; diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 6e9c4d6151..2c9bb3acc0 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -349,6 +349,7 @@ int mmu_translate(CPUS390XState *env, target_ulong vadd= r, int rw, uint64_t asc, { static S390SKeysState *ss; static S390SKeysClass *skeyclass; + uint64_t asce; int r =3D -1; uint8_t key; =20 @@ -381,35 +382,21 @@ int mmu_translate(CPUS390XState *env, target_ulong va= ddr, int rw, uint64_t asc, if (!(env->psw.mask & PSW_MASK_DAT)) { *raddr =3D vaddr; r =3D 0; - goto out; + goto nodat; } =20 switch (asc) { case PSW_ASC_PRIMARY: PTE_DPRINTF("%s: asc=3Dprimary\n", __func__); - r =3D mmu_translate_asce(env, vaddr, asc, env->cregs[1], raddr, fl= ags, - rw, exc); + asce =3D env->cregs[1]; break; case PSW_ASC_HOME: PTE_DPRINTF("%s: asc=3Dhome\n", __func__); - r =3D mmu_translate_asce(env, vaddr, asc, env->cregs[13], raddr, f= lags, - rw, exc); + asce =3D env->cregs[13]; break; case PSW_ASC_SECONDARY: PTE_DPRINTF("%s: asc=3Dsecondary\n", __func__); - /* - * Instruction: Primary - * Data: Secondary - */ - if (rw =3D=3D MMU_INST_FETCH) { - r =3D mmu_translate_asce(env, vaddr, PSW_ASC_PRIMARY, env->cre= gs[1], - raddr, flags, rw, exc); - *flags &=3D ~(PAGE_READ | PAGE_WRITE); - } else { - r =3D mmu_translate_asce(env, vaddr, PSW_ASC_SECONDARY, env->c= regs[7], - raddr, flags, rw, exc); - *flags &=3D ~(PAGE_EXEC); - } + asce =3D env->cregs[7]; break; case PSW_ASC_ACCREG: default: @@ -417,11 +404,17 @@ int mmu_translate(CPUS390XState *env, target_ulong va= ddr, int rw, uint64_t asc, break; } =20 - out: + /* perform the DAT translation */ + r =3D mmu_translate_asce(env, vaddr, asc, asce, raddr, flags, rw, exc); + if (r) { + return r; + } + +nodat: /* Convert real address -> absolute address */ *raddr =3D mmu_real2abs(env, *raddr); =20 - if (r =3D=3D 0 && *raddr < ram_size) { + if (*raddr < ram_size) { if (skeyclass->get_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key)) { trace_get_skeys_nonzero(r); return 0; @@ -441,7 +434,7 @@ int mmu_translate(CPUS390XState *env, target_ulong vadd= r, int rw, uint64_t asc, } } =20 - return r; + return 0; } =20 /** --=20 2.21.0 From nobody Fri Apr 19 22:25:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565609389; cv=none; d=zoho.com; s=zohoarc; b=K47aKQSIsdMXixxqebfIOxZmxpx+wlk87oDd+SXxJ6lL2Tm6MOfAuL6x3DvFuyW1/w1DAcpOeIooQ7o7hUUC2LAcx+eSpNmjjCAbYK7UHiVJEP00ToWtCsdc4/d7AdTm3KsM8P/ZT8AFIJIwdsV80QE2EWRo1xuP9i6VePDRGyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565609389; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=X69sduAySRJvBOCn5jArWO0v+wXAIh78xBlgn0UeYNA=; b=NN9fRgnFyXY/124EnV58ijALC1wCOYR5mfa7y7fl96akiXGJmEPlD3W73y8i3i98eQJHI74YaAiI1Nt/chCE5I+Da6U5EQ4/k5Ff0QGNaXI0xlFTkojOF8IWa6AfqcQwOf5JnudpUHh1T91Jwz0uO1Dvbu0mcfbYQLbQiWbemU0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565609389126393.2100339748265; Mon, 12 Aug 2019 04:29:49 -0700 (PDT) Received: from localhost ([::1]:44452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8WK-0000H9-7c for importer@patchew.org; Mon, 12 Aug 2019 07:29:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34616) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8UX-0004PZ-Dl for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx8UW-0002XZ-Fb for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51876) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hx8UW-0002XB-AO; Mon, 12 Aug 2019 07:27:56 -0400 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 93360C059758; Mon, 12 Aug 2019 11:27:55 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-110.ams2.redhat.com [10.36.117.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE8BD600C4; Mon, 12 Aug 2019 11:27:53 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 13:27:34 +0200 Message-Id: <20190812112737.6652-4-david@redhat.com> In-Reply-To: <20190812112737.6652-1-david@redhat.com> References: <20190812112737.6652-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 12 Aug 2019 11:27:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH-for-4.2 v1 3/6] s390x/tcg: Flush the TLB of all CPUs on SSKE and RRBE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Whenever we modify a storage key, we shuld flush the TLBs of all CPUs, so the MMU fault handling code can properly consider the changed storage key (to e.g., properly set the reference and change bit on the next accesses). These functions are barely used in modern Linux guests, so the performance implications are neglectable for now. This is a preparation for better reference and change bit handling for TCG, which will require more MMU changes. Signed-off-by: David Hildenbrand Reviewed-by: Cornelia Huck --- target/s390x/mem_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 29d9eaa5b7..ed54265e03 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1815,6 +1815,8 @@ void HELPER(sske)(CPUS390XState *env, uint64_t r1, ui= nt64_t r2) =20 key =3D (uint8_t) r1; skeyclass->set_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + /* TODO: Flush only entries with this target address */ + tlb_flush_all_cpus_synced(env_cpu(env)); } =20 /* reset reference bit extended */ @@ -1843,6 +1845,8 @@ uint32_t HELPER(rrbe)(CPUS390XState *env, uint64_t r2) if (skeyclass->set_skeys(ss, r2 / TARGET_PAGE_SIZE, 1, &key)) { return 0; } + /* TODO: Flush only entries with this target address */ + tlb_flush_all_cpus_synced(env_cpu(env)); =20 /* * cc --=20 2.21.0 From nobody Fri Apr 19 22:25:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565609337; cv=none; d=zoho.com; s=zohoarc; b=NA2fxyq4U9RzmHj5JhmwgWqKC56+mzpsaF1SiR/rGDR+4j5l2P1pfdGhqxsXGiVFk0/UQ2TKpdMtmcemzfNHrXEfidwaGYryiqoCHRFAYGGNc6GzLDTq2ns6KsBHYVofucILrLZ3YPZpwlWoYFEWfSwaIoiJpGEbv8E9S9prqi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565609337; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Iybi1SNNJUwrh4Yw3uF/XbbX32BATJSoy71PsW+O7mM=; b=LPQTRJW7sbZKKYGPmLWuCDf3Eko/YX2s2UgoXHZ5ggMzb6dFrEgFT8McfyjskNawsCAXXkiyQX7quHMRh/cvQqlXuubXTYVRrw24uW4a74gL8N6e/gGO6pahqwoFMOaoI4+wuXd5g1kZG5luLuAkjdXKGwS1mFH+pqdtYk2d89U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156560933747134.201168403324345; Mon, 12 Aug 2019 04:28:57 -0700 (PDT) Received: from localhost ([::1]:44426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8VU-0006Hk-Jn for importer@patchew.org; Mon, 12 Aug 2019 07:28:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34651) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8UZ-0004XQ-Gd for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:28:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx8UY-0002aG-Jk for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:27:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hx8UY-0002ZB-Ed; Mon, 12 Aug 2019 07:27:58 -0400 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 AF0FABCD24; Mon, 12 Aug 2019 11:27:57 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-110.ams2.redhat.com [10.36.117.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA58163B89; Mon, 12 Aug 2019 11:27:55 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 13:27:35 +0200 Message-Id: <20190812112737.6652-5-david@redhat.com> In-Reply-To: <20190812112737.6652-1-david@redhat.com> References: <20190812112737.6652-1-david@redhat.com> MIME-Version: 1.0 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, 12 Aug 2019 11:27:57 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH-for-4.2 v1 4/6] s390x/mmu: Trace the right value if setting/getting the storage key fails X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We want to trace the actual return value, not "0". Signed-off-by: David Hildenbrand Reviewed-by: Cornelia Huck --- target/s390x/mmu_helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 2c9bb3acc0..227a822e42 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -415,7 +415,8 @@ nodat: *raddr =3D mmu_real2abs(env, *raddr); =20 if (*raddr < ram_size) { - if (skeyclass->get_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key)) { + r =3D skeyclass->get_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key); + if (r) { trace_get_skeys_nonzero(r); return 0; } @@ -428,7 +429,8 @@ nodat: key |=3D SK_C; } =20 - if (skeyclass->set_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key)) { + r =3D skeyclass->set_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key); + if (r) { trace_set_skeys_nonzero(r); return 0; } --=20 2.21.0 From nobody Fri Apr 19 22:25:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565609386; cv=none; d=zoho.com; s=zohoarc; b=AhlLIp05O+GNnzd9/tJSZKneO+NF0PIEmQr9h3Q6c+OvVyfjo2L0m7ah83wnlx6E3XGtU0nwMpHQM1gpa7teAiNIiXpVZoIgLpzfcQM/qIvFqHYl1yGWNo9A5aYnQIXz7S9WLvanBhTP/znxahB+ddlZd8O2gx73c0EtJYMPu5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565609386; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qgsZQgY4pXJTfnRE9x4Nn7CZ8u6NKG8QElN3CKdTZuo=; b=kRJgSU1/0qYicdd/RpMtfFgF4X9Z1O4I2WAVS6E7KwzirVsUEXOw1k2EdwkviY4p1u5SWN713KelfGSfwC8ZMP1UmSkiI3nXnEIAbqoIsN1s5cEVuIuE/jVyIraMU+RNCWpTjUFWGwetjdHW3LGEo2q9Rrtu2GA15NIccbh3NaM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565609386411415.94503923049285; Mon, 12 Aug 2019 04:29:46 -0700 (PDT) Received: from localhost ([::1]:44450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8WH-0000AY-Il for importer@patchew.org; Mon, 12 Aug 2019 07:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34681) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8Ub-0004e2-OY for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx8Ua-0002c5-Ma for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:28:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58368) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hx8Ua-0002bV-Hg; Mon, 12 Aug 2019 07:28:00 -0400 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 CC630182D; Mon, 12 Aug 2019 11:27:59 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-110.ams2.redhat.com [10.36.117.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0361B600C4; Mon, 12 Aug 2019 11:27:57 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 13:27:36 +0200 Message-Id: <20190812112737.6652-6-david@redhat.com> In-Reply-To: <20190812112737.6652-1-david@redhat.com> References: <20190812112737.6652-1-david@redhat.com> MIME-Version: 1.0 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, 12 Aug 2019 11:27:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH-for-4.2 v1 5/6] s390x/mmu: Better storage key reference and change bit handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Any access sets the reference bit. In case we have a read-fault, we should not allow writes to the TLB entry if the change bit was not already set. This is a preparation for proper storage-key reference/change bit handling in TCG and a fix for KVM whereby read accesses would set the change bit (old KVM versions without the ioctl to carry out the translation). Signed-off-by: David Hildenbrand Reviewed-by: Cornelia Huck --- target/s390x/mmu_helper.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 227a822e42..ba4b460ac6 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -421,14 +421,28 @@ nodat: return 0; } =20 - if (*flags & PAGE_READ) { - key |=3D SK_R; - } - - if (*flags & PAGE_WRITE) { + switch (rw) { + case MMU_DATA_LOAD: + case MMU_INST_FETCH: + /* + * The TLB entry has to remain write-protected on read-faults = if + * the storage key does not indicate a change already. Otherwi= se + * we might miss setting the change bit on write accesses. + */ + if (!(key & SK_C)) { + *flags &=3D ~PAGE_WRITE; + } + break; + case MMU_DATA_STORE: key |=3D SK_C; + break; + default: + g_assert_not_reached(); } =20 + /* Any store/fetch sets the reference bit */ + key |=3D SK_R; + r =3D skeyclass->set_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key); if (r) { trace_set_skeys_nonzero(r); --=20 2.21.0 From nobody Fri Apr 19 22:25:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565609440; cv=none; d=zoho.com; s=zohoarc; b=Oj9DLBRyvSwUe0XgrlWxH3siuM4INxI/tln2904+bAWuk720oVMDfF4SWyDfIT6PFqQbKcnCNJ6d6C1OcL7hEs79vE6zJjjxlTbi8PxwiHgFNJUyQtmaWwJey9oN3ejhjS4fi58UmzPFHDlQxIkMpyxUcbCjgzEnxw8LdRD9nzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565609440; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=MTh0wL46nt9aeMF1PFfWqg+bThWZaldmD0XwAL5wFaI=; b=djMNGnQAntsk8VC82oU+z4AWyZ2Uam7iX/CW29piaAuIW5fBVUhSG5/l18EpmrVQGHFjdb5sr8yTXmkfOBikvJU8mHQMFnrn9aX41AHUHzxu6MUfoZERYZpYdg+2qlD29PkjpjzwFxQ3JV8iTfzrDFcnheh4aHVo2+eXXSgexCg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565609440610518.3131200437969; Mon, 12 Aug 2019 04:30:40 -0700 (PDT) Received: from localhost ([::1]:44468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8X9-0001cj-Pm for importer@patchew.org; Mon, 12 Aug 2019 07:30:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34717) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hx8Uh-0004gg-5p for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hx8Uf-0002hE-Kr for qemu-devel@nongnu.org; Mon, 12 Aug 2019 07:28:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hx8Ud-0002eY-Pd; Mon, 12 Aug 2019 07:28:05 -0400 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 EDF76C015C30; Mon, 12 Aug 2019 11:28:01 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-110.ams2.redhat.com [10.36.117.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21F40600C4; Mon, 12 Aug 2019 11:27:59 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 12 Aug 2019 13:27:37 +0200 Message-Id: <20190812112737.6652-7-david@redhat.com> In-Reply-To: <20190812112737.6652-1-david@redhat.com> References: <20190812112737.6652-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 12 Aug 2019 11:28:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH-for-4.2 v1 6/6] s390x/mmu: Factor out storage key handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Factor it out, add a comment how it all works, and also use it in the REAL MMU. Signed-off-by: David Hildenbrand Reviewed-by: Cornelia Huck --- target/s390x/mmu_helper.c | 114 +++++++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index ba4b460ac6..d2c9285d0a 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -334,6 +334,73 @@ static int mmu_translate_asce(CPUS390XState *env, targ= et_ulong vaddr, return r; } =20 +static void mmu_handle_skey(target_ulong addr, int rw, int *flags) +{ + static S390SKeysClass *skeyclass; + static S390SKeysState *ss; + uint8_t key; + int rc; + + if (unlikely(!ss)) { + ss =3D s390_get_skeys_device(); + skeyclass =3D S390_SKEYS_GET_CLASS(ss); + } + + /* + * Whenever we create a new TLB entry, we set the storage key reference + * bit. In case we allow write accesses, we set the storage key change + * bit. Whenever the guest changes the storage key, we have to flush t= he + * TLBs of all CPUs (the whole TLB or all affected entries), so that t= he + * next reference/change will result in an MMU fault and make us prope= rly + * update the storage key here. + * + * Note 1: "record of references ... is not necessarily accurate", + * "change bit may be set in case no storing has occurred". + * -> We can set reference/change bits even on exceptions. + * Note 2: certain accesses seem to ignore storage keys. For example, + * DAT translation does not set reference bits for table acces= ses. + * + * TODO: key-controlled protection. Only CPU accesses make use of the + * PSW key. CSS accesses are different - we have to pass in the = key. + * + * TODO: we have races between getting and setting the key. + */ + if (addr < ram_size) { + rc =3D skeyclass->get_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + if (rc) { + trace_get_skeys_nonzero(rc); + return; + } + + switch (rw) { + case MMU_DATA_LOAD: + case MMU_INST_FETCH: + /* + * The TLB entry has to remain write-protected on read-faults = if + * the storage key does not indicate a change already. Otherwi= se + * we might miss setting the change bit on write accesses. + */ + if (!(key & SK_C)) { + *flags &=3D ~PAGE_WRITE; + } + break; + case MMU_DATA_STORE: + key |=3D SK_C; + break; + default: + g_assert_not_reached(); + } + + /* Any store/fetch sets the reference bit */ + key |=3D SK_R; + + rc =3D skeyclass->set_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + if (rc) { + trace_set_skeys_nonzero(rc); + } + } +} + /** * Translate a virtual (logical) address into a physical (absolute) addres= s. * @param vaddr the virtual address @@ -347,16 +414,8 @@ static int mmu_translate_asce(CPUS390XState *env, targ= et_ulong vaddr, int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t= asc, target_ulong *raddr, int *flags, bool exc) { - static S390SKeysState *ss; - static S390SKeysClass *skeyclass; uint64_t asce; int r =3D -1; - uint8_t key; - - if (unlikely(!ss)) { - ss =3D s390_get_skeys_device(); - skeyclass =3D S390_SKEYS_GET_CLASS(ss); - } =20 *flags =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; if (is_low_address(vaddr & TARGET_PAGE_MASK) && lowprot_enabled(env, a= sc)) { @@ -414,42 +473,7 @@ nodat: /* Convert real address -> absolute address */ *raddr =3D mmu_real2abs(env, *raddr); =20 - if (*raddr < ram_size) { - r =3D skeyclass->get_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key); - if (r) { - trace_get_skeys_nonzero(r); - return 0; - } - - switch (rw) { - case MMU_DATA_LOAD: - case MMU_INST_FETCH: - /* - * The TLB entry has to remain write-protected on read-faults = if - * the storage key does not indicate a change already. Otherwi= se - * we might miss setting the change bit on write accesses. - */ - if (!(key & SK_C)) { - *flags &=3D ~PAGE_WRITE; - } - break; - case MMU_DATA_STORE: - key |=3D SK_C; - break; - default: - g_assert_not_reached(); - } - - /* Any store/fetch sets the reference bit */ - key |=3D SK_R; - - r =3D skeyclass->set_skeys(ss, *raddr / TARGET_PAGE_SIZE, 1, &key); - if (r) { - trace_set_skeys_nonzero(r); - return 0; - } - } - + mmu_handle_skey(*raddr, rw, flags); return 0; } =20 @@ -567,6 +591,6 @@ int mmu_translate_real(CPUS390XState *env, target_ulong= raddr, int rw, =20 *addr =3D mmu_real2abs(env, raddr & TARGET_PAGE_MASK); =20 - /* TODO: storage key handling */ + mmu_handle_skey(*addr, rw, flags); return 0; } --=20 2.21.0