From patchwork Thu Sep 26 16:26:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174500 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2325422ill; Thu, 26 Sep 2019 10:05:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqybDXsf0e1oQIiYLxDZ0Q+h/Wrq9Ipk/BMdVY2atPiin5kD1HvVXigOCtHfJchF2HiusrAI X-Received: by 2002:a37:691:: with SMTP id 139mr4380728qkg.476.1569517550239; Thu, 26 Sep 2019 10:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569517550; cv=none; d=google.com; s=arc-20160816; b=ZCMZw5LcihfoPRqUyS4ubMSwnXxXKYqa+bigHXPKEBFKwcs4drNrXlWDQ/oEkRSaYA mH+YUmpLXSb2XtLRzJ4XUNFfQz23A+UYRhN50KG/pcQ3wC5xrZvss387rLvxZfa0ZGZ8 1cAtc3atTa3IsT9bCvZuqoYiPu6vi9tmPYUHTOfDsW/SAh72ys7dZBPgqEf1Vm6JiEew oqIElIPWPtdT8FrCYLQT86g56ZgF5WcSUli+8cA4xgLpFqfbwlZaIQpkNp85JUA4jUD7 9AvS6im/QKvL6cGeC9yYRoigBWoCO5JeJ+pE5lX5XMHRwKek/g1wPgjuFO6IbUasIWYk JEIg== 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=r2Kkjv0LcYhAT4t2h/Z2Rtb/YRP8Pw5ksCfAIsS74Ko=; b=jUciwjTpkhBFi4qbsrhUUb0inytA+lRIapMhJjfCo5dVrvy3vFPvAYQydrwpFC2x7+ PhsHiobTxo2lmmqAtAK5W7Gb8fECRnwIhag1q8jpx7SGXSsCO+/v6jNKo9yb3r7Mx8cz ba8DTBtUdBzZAf0pyMsBxSqo3+aR99zYoNdWdXOghZwTm2VMI+z6WUyIeXtDpkzODdoo JQEgPYddWzqwMINwixroRFE+U8gUUiHc1uzCzctasIf7IWtryY7jb3rWC5P3J1VAu/jP u9dzPfB9lGbrlyU+wqJiXP7AE2F28VpuKLlw7R37OACFjFHaEiDwQACifkEbgb3MKtKo cM6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B2xcwfPx; 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 w6si2271327qvf.7.2019.09.26.10.05.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 10:05:50 -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=B2xcwfPx; 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]:41236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDXDB-0008Bf-J9 for patch@linaro.org; Thu, 26 Sep 2019 13:05:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41418) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWcH-0002k9-EF for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDWcE-0004p0-As for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:41 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34218) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDWcE-0004lO-1l for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:38 -0400 Received: by mail-pl1-f193.google.com with SMTP id k7so1539549pll.1 for ; Thu, 26 Sep 2019 09:27:34 -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=r2Kkjv0LcYhAT4t2h/Z2Rtb/YRP8Pw5ksCfAIsS74Ko=; b=B2xcwfPxOi1uavUy8QNEQvUavc03RxaCR7JwEVGDVqh6tGMY3l5kqJqWF5EYwaIA+5 PXlswRAZfRuWNOsYuOjUL78n2WbEo23hYDEtcsqURgY6TZDrbcPMOZ2s526SGJgJgaqh sGgXcdPZu8oo5hCI9mSDcJVbNGQT/E70CrgFka4Yj2wS3XMpuJKMsLba2Ufxway6rnpW Vj2XhR5/oZpK4adFJ0Sr5uJDRX1seYpUJ9d+rmY9JUwQI4HMmHDVTy4Q/PXc/yQaADfJ FbSH0Ca2hrgKY5dgl3sodACxGDrLAtz8fJ2XR7bWeUc9tu6p3e7tmTO8BK4kyoANbk4/ Vk5A== 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=r2Kkjv0LcYhAT4t2h/Z2Rtb/YRP8Pw5ksCfAIsS74Ko=; b=H49RO/r2EbvEa0A34RYxHSeWIV+0oc2crc/RwIXiRAuIZ+DeH25T8yKmR+2o+K6RGi xPMDDPiO9+rZ4zA6sTNLoCVaVv6zhjTyNBkQkvvfvLJbNGBEgvv5MCALfS+mXhx+tCvQ pWHJGZBh+TresG2IFuWEzwcqMk8sZquncioAmk3xbsewzmf+iAlwQU+9fN2ldXqPzXnW Shn5D0codxg6YgmM4004L6UMZcsshLjZ0mEtX0N3vJlXJaLjE+TaE+N4/kkpL134vrcP 3DgiqTsaVOkhJBin2Qbxj8T66jYJMGrXLuQYzMTirKWBAm13P8jc76NpvqPWQEZQMjj+ PIOw== X-Gm-Message-State: APjAAAVBkrcUYTEVYzh7Fvb1KpqkmHOSWlVwTnO/dfiPQM/fNtMxJ006 LeNXyE+LIUJSxuTwnImFKNHZKjkf/q0= X-Received: by 2002:a17:902:7d92:: with SMTP id a18mr4747728plm.243.1569515193401; Thu, 26 Sep 2019 09:26:33 -0700 (PDT) Received: from localhost.localdomain ([12.157.10.114]) by smtp.gmail.com with ESMTPSA id 64sm4453169pfx.31.2019.09.26.09.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 09:26:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/18] target/s390: Return exception from translate_pages Date: Thu, 26 Sep 2019 09:26:08 -0700 Message-Id: <20190926162615.31168-12-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.193 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 translate_pages, but pass it back so that caller may do so. Signed-off-by: Richard Henderson --- target/s390x/mmu_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.17.1 Reviewed-by: David Hildenbrand diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index a9219942b1..5ecd9ee87e 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -423,25 +423,22 @@ nodat: * the MEMOP interface. */ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, - target_ulong *pages, bool is_write) + target_ulong *pages, bool is_write, uint64_t *tec) { uint64_t asc = cpu->env.psw.mask & PSW_MASK_ASC; CPUS390XState *env = &cpu->env; int ret, i, pflags; for (i = 0; i < nr_pages; i++) { - uint64_t tec; - - ret = mmu_translate(env, addr, is_write, asc, &pages[i], &pflags, &tec); + ret = mmu_translate(env, addr, is_write, asc, &pages[i], &pflags, tec); if (ret) { - trigger_access_exception(env, ret, ILEN_AUTO, tec); - return -EFAULT; + return ret; } if (!address_space_access_valid(&address_space_memory, pages[i], TARGET_PAGE_SIZE, is_write, MEMTXATTRS_UNSPECIFIED)) { - trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0); - return -EFAULT; + *tec = 0; /* unused */ + return PGM_ADDRESSING; } addr += TARGET_PAGE_SIZE; } @@ -469,6 +466,7 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf, { int currlen, nr_pages, i; target_ulong *pages; + uint64_t tec; int ret; if (kvm_enabled()) { @@ -482,8 +480,10 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf, + 1; pages = g_malloc(nr_pages * sizeof(*pages)); - ret = translate_pages(cpu, laddr, nr_pages, pages, is_write); - if (ret == 0 && hostbuf != NULL) { + ret = translate_pages(cpu, laddr, nr_pages, pages, is_write, &tec); + if (ret) { + trigger_access_exception(&cpu->env, ret, ILEN_AUTO, tec); + } else if (hostbuf != NULL) { /* Copy data by stepping through the area page by page */ for (i = 0; i < nr_pages; i++) { currlen = MIN(len, TARGET_PAGE_SIZE - (laddr % TARGET_PAGE_SIZE));