From patchwork Thu Sep 26 16:26:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174491 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2300521ill; Thu, 26 Sep 2019 09:44:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyieyfzODtNXcpTIeIu3QAW5Rn9WB2kieUi+nnwuRuTTiKU6SjyDevXjaUgFMWPJIau3mkS X-Received: by 2002:ac8:5147:: with SMTP id h7mr4964623qtn.117.1569516253563; Thu, 26 Sep 2019 09:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569516253; cv=none; d=google.com; s=arc-20160816; b=gUd0jOcG45+AfZehVBczQWZERCN806CrvCVLp+2ycnlveoa/bzpKXJcgOfw6UnXW3u szjaW373LoZWhBOMXp3XnOCsrHwW7OLIG9qJL6MPuvBUUQOL+LzuMT//u7oFhFaDrBCi o/XDT8g0ogALZslFkwX0qEVhHOUt4NSoEVSvC0vW2CHHDbA0XQ19g/g+mYiHf6qIh2b7 oGasdBMXBtGxPviKlyvb9L3/8JFjYr6cEagwHiaAsCg6WWCCxFsOtOGEc+VMKGpJxi/7 XfWhcFy2HU4ipcivLf+dWm+IC8KmlMuPhBvh8589hViKjum6BjAbCOMp7mGTXH8BF3C5 IQug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=Lvd4eeuinUqzweCiCcYtM7YlQdV39v/YpVBNYDRC1E4=; b=xY0q/JTKjhLMEeVduyuUQKsJvZsGXRj5Ic3QFAqKJHxn4Q/rMr40Wk7iRSMIl5zuvp qHAJv1NsLvBpLeuh6n+GZEVF2o9eHvAXe2ss9VuDnnItzyTdp2qbnQ5kFQFWbnYGeH5M 896P4CEechoB1tP0GQHVyR8ycNSvN0jg/DPgdc4afIe+kUfOny9UzMS1pre6PPYfFW5q sJr0tFVi7pbkkUBJhphLpvPITIZt0Vxd1J4bpKt62ebXNF6vSTC3X1b279gyzFdT5Zac 8hml6TwC8+jkdT3y3NFMGrDmrnMDLLmwffIy198aZhtBToYd3TEgNE6U9UYhJY3oUclY O6nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UFLDkUpT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o20si1997308qtc.33.2019.09.26.09.44.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 09:44:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UFLDkUpT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWsG-0002Z0-L5 for patch@linaro.org; Thu, 26 Sep 2019 12:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41243) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWcE-0002fX-Q3 for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDWc9-0004ki-1J for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:36 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDWc8-0004ht-Md for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:32 -0400 Received: by mail-pg1-f194.google.com with SMTP id z12so1826259pgp.9 for ; Thu, 26 Sep 2019 09:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Lvd4eeuinUqzweCiCcYtM7YlQdV39v/YpVBNYDRC1E4=; b=UFLDkUpThBi+7GVzuQ58gcWc/uCuf/Vn1gf14ukOsguCx7F2/eeuxQC4k6GVOPrH/d ClB+F52WO9OK9Zaho8MGS86h0KxQe4jVdzItOrwusIU/H+m10/CA6IKQpV5MANonvKQk AlBnMsfsizO9CcU6440GQ4/wxd8SDE58YmMIJDYbK+mLzTVw8u6EdIS/CNBwYxC5zNcc vndbQeui10MYagqXkbaSzK05kwL8YtEjjtTIY+KdvE7ktAPfYDMwNIrrGji3xTFj4uk4 lbnCQRlPRKdYG9npLjei9T9LQCw9pp4upu/ctPY5Heso2s5sHqxVUMBJmZEMnc3NIqCB KNJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Lvd4eeuinUqzweCiCcYtM7YlQdV39v/YpVBNYDRC1E4=; b=nD6f8HbqHwRB0lmXFAGtybwV2WLReUZiFY10Z3wwKx+fVrzuZp4v18+Q5+bp56QduN exDbOTND6norH+ZGCq+dsWZoyNeU39UoSi9EWEtRAxA4dsVL8O4sHsTG7jImxTygKkyz XMP4G4qoqUcOyKSfBBw+g/fwiZbpX/YRKx6ttGrq6j13jmMPa4HO69i3IP2P9w+X53GK V2261h0NV6Cj1B0xkuYIqsvK/JQjsVt1NI0c4OjUA/oywYT9gPilEWda6wvUKmzDEGeu q2igrXxqt/+VBjt94JoGnb0K2DvF3TfdpjlN0wiuf1wC/5injthUPDWVKgoe9Ue5EfqX ZnCA== X-Gm-Message-State: APjAAAXwX8th/82pf2aVM0v5C90rDMj4Jw9em6zn6J87ERoxPygvtXrn 6oX0tRZMd8xxndFgMIvt8N+WmSVVw1Y= X-Received: by 2002:a65:62cd:: with SMTP id m13mr4186640pgv.437.1569515189399; Thu, 26 Sep 2019 09:26:29 -0700 (PDT) Received: from localhost.localdomain ([12.157.10.114]) by smtp.gmail.com with ESMTPSA id 64sm4453169pfx.31.2019.09.26.09.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 09:26:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 08/18] target/s390: Return exception from mmu_translate_real Date: Thu, 26 Sep 2019 09:26:05 -0700 Message-Id: <20190926162615.31168-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190926162615.31168-1-richard.henderson@linaro.org> References: <20190926162615.31168-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.194 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: qemu-s390x@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Do not raise the exception directly within mmu_translate_real, but pass it back so that caller may do so. Signed-off-by: Richard Henderson --- target/s390x/internal.h | 2 +- target/s390x/excp_helper.c | 4 ++-- target/s390x/mmu_helper.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 Reviewed-by: David Hildenbrand diff --git a/target/s390x/internal.h b/target/s390x/internal.h index c243fa725b..c4388aaf23 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -362,7 +362,7 @@ void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, 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); + target_ulong *addr, int *flags, uint64_t *tec); /* misc_helper.c */ diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index ab2ed47fef..906b87c071 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -147,8 +147,8 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, if (!(env->psw.mask & PSW_MASK_64)) { vaddr &= 0x7fffffff; } - fail = mmu_translate_real(env, vaddr, access_type, &raddr, &prot); - excp = 0; /* exception already raised */ + excp = mmu_translate_real(env, vaddr, access_type, &raddr, &prot, &tec); + fail = excp; } else { g_assert_not_reached(); } diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 3ef40a37a7..b783c62bd7 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -523,10 +523,10 @@ void s390_cpu_virt_mem_handle_exc(S390CPU *cpu, uintptr_t ra) * @param rw 0 = read, 1 = write, 2 = 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 occurred + * @return 0 = success, != 0, the exception to raise */ int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw, - target_ulong *addr, int *flags) + target_ulong *addr, int *flags, uint64_t *tec) { const bool lowprot_enabled = env->cregs[0] & CR0_LOWPROT; @@ -535,8 +535,8 @@ int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw, /* see comment in mmu_translate() how this works */ *flags |= PAGE_WRITE_INV; if (is_low_address(raddr) && rw == MMU_DATA_STORE) { - trigger_access_exception(env, PGM_PROTECTION, ILEN_AUTO, 0); - return -EACCES; + *tec = 0; + return PGM_PROTECTION; } }