From patchwork Thu Sep 26 16:26:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174488 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2294908ill; Thu, 26 Sep 2019 09:39:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHJGsE4E5nj2ihmMq7GHaBkebwVjSr4M20e7/0mfZbFlLqsJaU72Rui/1NnN5aUVIIDv7D X-Received: by 2002:ae9:eb93:: with SMTP id b141mr4316204qkg.36.1569515945779; Thu, 26 Sep 2019 09:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569515945; cv=none; d=google.com; s=arc-20160816; b=lBljbeXoQriVUWFJIvM9J9NNUtRdcd7DYt3DYL8pB6Nakp8K2Etv1x5mqK1K8fd/DK R94cBl47OCVZPyj55v3EsNXZKM9L0MaoO+Yv2JvD1JkH5wWvTGGJhqdgRknNO25sRTDg RfWQY/Q13aZuET1PIH4+0JoSpyZc5Lv1h/uM86LtvY1Lp/AQX4biMrHo9RgpHHjKAN4C cYonlh0ytUZ9I9D5Ux38k27ylqM4W/1OctHzsaC2NGLcqEQ3C3/vpQrDwMDEPiGKD935 ikDI3nwhWNbSeGkK+NdHkjXGkaKnCIn1/JkdOKU4zax964/z9O3nEgjGkyM5qy7vm/ln HF3Q== 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=nOk3WYhtYahGat7iYj1GhM9dpB7AkH9Zaoypf0AhgeE=; b=nAepO7tfogHqrMGqfbMG+Fv8c7snMyKkNYbhf90oC84uX3zyduXhplw19nnwdHwXHa pFExH1w/L2oV3W1VwuengkZrcU94oi3EmKC8wsJXCirN2f+34JVw3QZh+C0QsDl6512p AJIQCgTdRoiTavNnz4L2DuFLwAA/nFj+OU51eIQntvZnLxiJItanPfcwbcGy3Oe/dXnK bPbeqsBiUXs/ONv4MGWaFAZ4JRD++EhSG22b4gr2sfIBA9LUDfPDhkO3k3XXvPD+gnUS HF4Hf84vCfOCeTqciV8v3Br+D6Ru/bGDCEqK15EPmm6UlknOl1ex4G4qxzJL7GuNN0/Y Nw6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RPLYePRB; 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 u25si2422783qke.59.2019.09.26.09.39.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 09:39:05 -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=RPLYePRB; 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]:40844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWnI-0005TV-J2 for patch@linaro.org; Thu, 26 Sep 2019 12:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41239) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWcC-0002fO-Si for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDWc8-0004jz-Sh for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:34 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33024) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDWc6-0004ff-LM for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:32 -0400 Received: by mail-pl1-f196.google.com with SMTP id d22so1550151pls.0 for ; Thu, 26 Sep 2019 09:27:27 -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=nOk3WYhtYahGat7iYj1GhM9dpB7AkH9Zaoypf0AhgeE=; b=RPLYePRBWAV6fWtJDMS7+OuMNADukAUIoZC2HprOk8qRgmmK5Wpy9uZHwuU34ixnwZ 4WDUhNAzAm+laD7sekfwLDKHhqH4gqAuzWsx5wHmqeTTMdr5NJ22JAq0ofBqFOOfb3Bd D1nOYIyx5Y9H7QSjNQp3qsGmSnyT3woRyId0+IjxPlIYn21wu8RnTkbzt580r0/0TOZo x/r8yKskobDhK1G4MVAfDUeLogxRmMxgQPtFROWH/QtRFZYcm5JQjKO3tiiUxuyocTgi xF5ZwV5bYyGzL1rz7neLrtFSGxddov2MZ9uRxFKMmXS0mlbsTYt7AWc8IyI4nj1ebSiv vAtw== 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=nOk3WYhtYahGat7iYj1GhM9dpB7AkH9Zaoypf0AhgeE=; b=XSPjhgrsP76NRUNdeQt5yvLCy8K3xSSboTSQ+NBVCEMsNgTv3jvSIap+PTaqPrXf/g UnkLQAwBHuuZ+1iAJ9Afn+kSxZrLuO8OVUXOYN4dY2Dui0hw9eP9rNX42K194apGsq3G L9+cS4NQcHEBA2f6g5FbcJfWlXei5B+Yasd3O0UbSR3Dj3slTl6BaMQgRsiRlzaR+2Vp LW+nl+7FRdHtOHvq62ayV9yxAQVgz07vimMTZLvKJSbN3aaBbyvVxhwta5aEG3e0x2/L hIER0kZ3ntjZpF/9sy6y+v8DI6LdftRpsX6kzrGw/hHtunzWoY5RtlT3QCobtHqA54Dj sY1g== X-Gm-Message-State: APjAAAXeK5JxWHUHcXT0Tu0zJukNSL2zAVl17tdSXtC+SZ3/jdOcUn91 IqtIuDO8HzOLRSX6acQKez1eU43z3tE= X-Received: by 2002:a17:902:7611:: with SMTP id k17mr4594355pll.314.1569515186521; Thu, 26 Sep 2019 09:26:26 -0700 (PDT) Received: from localhost.localdomain ([12.157.10.114]) by smtp.gmail.com with ESMTPSA id 64sm4453169pfx.31.2019.09.26.09.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 09:26:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/18] target/s390x: Push trigger_pgm_exception lower in s390_cpu_tlb_fill Date: Thu, 26 Sep 2019 09:26:03 -0700 Message-Id: <20190926162615.31168-7-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.214.196 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. Signed-off-by: Richard Henderson --- target/s390x/excp_helper.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: David Hildenbrand 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); /*