From patchwork Fri Sep 27 19:39:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174643 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3966429ill; Fri, 27 Sep 2019 12:40:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK21/tl8RkZ7G8W0QpLTYWb300tveeCWr5dJQk8xL4kII6sw1WnqrXVlD0aXeFWdYRBtHu X-Received: by 2002:a05:620a:753:: with SMTP id i19mr2109094qki.192.1569613228713; Fri, 27 Sep 2019 12:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569613228; cv=none; d=google.com; s=arc-20160816; b=nICWKf9a7qX+1D5TWC06qPCEa+Y2oAUOdHbQ6W9JWUXa6qpL6hS6Vb6QCwh+oidiYZ iXlbTHLxxPcchZV3HSWVAhhwXfLNwvV3lIWtdbTIBnAD9ExwwKvwuPjGsqy10zTTE54D FtKuxYynKcpz4flA6q8cJEDf/YDSiwUBdl7MZBZTzcptqqSL0HJdT0ahzHZFfIUnlcJe b1/i40jlRqmjT0ZvblwUzNrdZLyOmHqCZWpnOsB9AXYGwttaFMfxP3IFsXPYZdRmWIfa RW3Abxln6aZbLzRLfhxr3f4FAKDhfvBUMLIbl8cs4D/CTIiKHgZgLMg4LKGTnlQx0u1B Xphw== 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=/oqnU8JxcWk92yTF6oHqZ+/jW9Yk0vbg0OCD6IUFg00=; b=jUViPGTEm9pVfglfjrBxrUiboy7BneNFM2R2EotPJlHEuim1JNvTwG8Aor8i1V9ack ezy4dGQOWo/IUZoZ2LaZ38/tVYW1vPFcITyXgIYJfJP8bnCxphdGV/hgu8CLjbKSGxeR U2lTGEPOS+9k0brUJIXwXRRLm5otC0UsaiWQzkyhYkqe9+v60OjRyCA0m7lrQhkJdlbb PT3QD1oM7Tal3ftGezEc3PF8c6CXhaj/QHJm2iPz9IjCeDJi3+RFMIm3/FWCKvJtoqZw h8WOEwesveLKb5RuhuSWVHwbzcOj9M7vubLUju+T+PImXB8k1ScwdoTrYlkVfct66Zly RwyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HDp+bEsD; 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 h32si5552152qvc.36.2019.09.27.12.40.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Sep 2019 12:40:28 -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=HDp+bEsD; 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]:56604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDw6N-0003La-B8 for patch@linaro.org; Fri, 27 Sep 2019 15:40:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46489) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDw5g-0003IP-ID for qemu-devel@nongnu.org; Fri, 27 Sep 2019 15:39:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDw5d-0006JS-Gz for qemu-devel@nongnu.org; Fri, 27 Sep 2019 15:39:44 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:40518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDw5c-0006I8-TK for qemu-devel@nongnu.org; Fri, 27 Sep 2019 15:39:41 -0400 Received: by mail-pf1-x443.google.com with SMTP id x127so2133175pfb.7 for ; Fri, 27 Sep 2019 12:39:40 -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=/oqnU8JxcWk92yTF6oHqZ+/jW9Yk0vbg0OCD6IUFg00=; b=HDp+bEsDpl3Iwi+Cr90KoX4UN5uuGIkjbqsmAT++WG0QGM2kyzO0v18CeYwBNLRiI0 A3nwh0MXL6o0YF0SJEX0SPem8DbTsIEsfRd0ynyCS9WtY4Myxr4ldi4tfkbemhc380Yr lwagiwhuxLILs4zNVByPe/TBEjLoeuRsvUN+B/vkdmFAT3SZRGu8V8UT2Cn3P0nXwGyX dcaESLsXzR0mm7d5R3+jDkbsghY4M0Fs1IZI4GPY9hEP53egIcQ+JdtiAVVNueGnHQXQ K8tf7U5a2tgxmIoWdhfaFjkOf4FC4+3VBHt0q5rcjYiVvBAwskaCJSCRyDpWijFjYocy NnvA== 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=/oqnU8JxcWk92yTF6oHqZ+/jW9Yk0vbg0OCD6IUFg00=; b=tMW010k8Ji9XR65xWWsA2XyCCYMCp7mSPyA32Adv89VYG07QTrHzn+PqN04u9R9fan R3TWAl4n5hirhobQM0X8UhomfDbLbrnlFDQFIKgeNOPFkiJk5iVDDZi3m2miHC2ENswj RfmNrCCm3YccWCnCbaAM4OnFNL6yWN6+OKCwdz5e4eylf2bYkzke8klYXIcAubpmZKsf hBgLI5Ps8kbrA2a2VlLIDGA1Ow4c3hoUT2/Ff9xI4kzV1h0ndIlOs6boGwOi9vH8wwtt vm4fmGGAOC6K6z7vd1wYtzI8BaD0cxCYRTRaIFZVCiCbpTMk8mWBXOQuLUwrDWPBR5+x HybA== X-Gm-Message-State: APjAAAV1IqRzn4s0gsmbWwtE204PzfbKPhpGE5Ogjl8+XqR+tR7hGzeF FJM+5d+R08uqWPXJUZzMGj5IvlOKjT8= X-Received: by 2002:a63:cb07:: with SMTP id p7mr11056760pgg.232.1569613179317; Fri, 27 Sep 2019 12:39:39 -0700 (PDT) Received: from localhost.localdomain ([12.206.46.62]) by smtp.gmail.com with ESMTPSA id 192sm3676403pfb.110.2019.09.27.12.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 12:39:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 05/18] target/s390x: Push trigger_pgm_exception lower in s390_cpu_tlb_fill Date: Fri, 27 Sep 2019 12:39:12 -0700 Message-Id: <20190927193925.23567-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190927193925.23567-1-richard.henderson@linaro.org> References: <20190927193925.23567-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 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" Delay triggering an exception until the end, after we have determined ultimate success or failure, and also taken into account whether this is a non-faulting probe. Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- target/s390x/excp_helper.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index dbff772d34..552098be5f 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -127,7 +127,7 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, CPUS390XState *env = &cpu->env; target_ulong vaddr, raddr; uint64_t asc; - int prot, fail; + int prot, fail, excp; qemu_log_mask(CPU_LOG_MMU, "%s: addr 0x%" VADDR_PRIx " rw %d mmu_idx %d\n", __func__, address, access_type, mmu_idx); @@ -141,12 +141,14 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, vaddr &= 0x7fffffff; } fail = mmu_translate(env, vaddr, access_type, asc, &raddr, &prot, true); + excp = 0; /* exception already raised */ } else if (mmu_idx == MMU_REAL_IDX) { /* 31-Bit mode */ if (!(env->psw.mask & PSW_MASK_64)) { vaddr &= 0x7fffffff; } fail = mmu_translate_real(env, vaddr, access_type, &raddr, &prot); + excp = 0; /* exception already raised */ } else { g_assert_not_reached(); } @@ -159,7 +161,7 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, qemu_log_mask(CPU_LOG_MMU, "%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__, (uint64_t)raddr, (uint64_t)ram_size); - trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO); + excp = PGM_ADDRESSING; fail = 1; } @@ -175,6 +177,9 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, return false; } + if (excp) { + trigger_pgm_exception(env, excp, ILEN_AUTO); + } cpu_restore_state(cs, retaddr, true); /*