From patchwork Thu Sep 26 16:26:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174490 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2300252ill; Thu, 26 Sep 2019 09:43:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzN9gLcmT/isgZ5zR+jTIx2zqyO4rG61HZ4ho4S7+9IlzcQDJZF1c1ZOkxu0hw0EebBdOH3 X-Received: by 2002:a0c:8ad0:: with SMTP id 16mr3477408qvw.237.1569516237795; Thu, 26 Sep 2019 09:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569516237; cv=none; d=google.com; s=arc-20160816; b=f/HmeIpsoJGU1cf0Y5oYwL4Ujd4UIsbO+e6+pK4YJpw1JR/peVefK5KIgSsBUAfV8r cNk8MNxLCWQbW5tB7JMVmQYokoge4uuPUgT3hizOnjQOxOUtAsSVPMfgAvMcS5X2YBlY WmzwYJf1SdK0rL09qJBaQPJVQcR21VA6mm1jjVXKUc8YVeYuTiKIvuFN5EDq+sYjcTPB HdOXhoCndUnqgzFGjdnZtaRMh/g2JPhUhx8G6GkWaGl7xSXDjy4gBVSH5zRAWdcG5VfO cHo9x2y1pWv7bxj6A45P1tTFUPDdFT/WUIacKRrOPLSwkmlPD/ntYxIXx02UZe7bHpjH Dbow== 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=BgDvG9Al3WPKQz7RdZ0r1UKiV65zPVQZj9u9agDKhUI=; b=l1DfalYFaD57cgtRx/WnIULgB8+FdsPb7rAcYL7asM34pskQ4W0FpIjczOSWLepKtr AaAPdT/aBf4JK45N8RRqGmhA5onJSohJoW8VzXXz5EKvhu0pLYu1tG7gTihBHQbnXoSC H9tkpXRkTPFRun06NpZw4oFJVddQABWPxeUeoue1poOwlBSKo/x7RvlL++rSEbRoM3m7 ban160Df0pivEWJPGAbWn5/y0j9qNbn+YPToCyRTWRhEPq56IVG+uXOxcrIaP6VT/Hkq UmQZ37K3A5yfMEQGG4Txr7kF09uz7IZsHPN90XEWuGq8QsrEew0MWblYnfkrawMs+kIy 9a9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=drGvDfZb; 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 16si2107623qkm.284.2019.09.26.09.43.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 09:43:57 -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=drGvDfZb; 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]:40916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWs0-000283-TG for patch@linaro.org; Thu, 26 Sep 2019 12:43:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41426) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDWcH-0002kQ-S2 for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDWcF-0004q3-4X for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:41 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:32858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDWcE-0004oq-Tu for qemu-devel@nongnu.org; Thu, 26 Sep 2019 12:27:39 -0400 Received: by mail-pg1-f193.google.com with SMTP id i30so1868896pgl.0 for ; Thu, 26 Sep 2019 09:27:38 -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=BgDvG9Al3WPKQz7RdZ0r1UKiV65zPVQZj9u9agDKhUI=; b=drGvDfZb6YF/SSjGyBem6M9wPyEtLuKKsTfnqEZW829cy7+5yUob548Xe+a7ASM3Rf ttTJQcpBtqNrUBFj4KDGXBzTsF+o3ANLHINy49AGl88Gy1W0H3UOuDyIciME6fkCLAv/ aRQ8/r7wGef2Bv49+bxlfCnwRrRG6GhwIopXx2aMzd/F41jBDV3ap0cvsJbDbqitYRMb yGZhuplPQl8h7Z0BNJZ66Pqn0pEuVMuhXzxdzXQmiEdAXII2HkXuCERa+CBbnW/JeWBQ Jp1x1B2JA2s7Xq0y4ZeXgKXfgS6UKsuDYdRrac7pfh+xTdFFiTKVg9nS6QlvBKR3M3F0 yLAw== 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=BgDvG9Al3WPKQz7RdZ0r1UKiV65zPVQZj9u9agDKhUI=; b=enTWbEAV/oIDxdB+usAEibI1qkl092g9wH2nRIBzVeoPeGt3dGZdi2WwN4Pxp4Mnrs 4AXEsJrd+TOL7TwNQd1d8GkLN/KACKQ3V6XVN37WN/c83ahG76JVnABFS5JzAHghXAmQ tD/W1XyYmBX4bHr0/hzcEgHJLQLmqf4OOh8g86RLKgrK1ltVqLZa7qGmeN4PDU9LJy0O ckE9fCniDFYRf77YGhzqNgQjGKpP3ZYxMxOJgAaY8LkZ/CO3SMQK/TqQLdhPNSzLJ0f/ kXRcov42AUrckuH2qmkK+MaQbvL/kEhCm7gn1q8m8HeviBeWgMTuSbvqpnKbsWIX+N7Y R3zQ== X-Gm-Message-State: APjAAAVXJn6Bey9F+fDAxgaIHjMd7LeLT3v+3/PLgRQPYnJ/FLx2DWTT lBJ57uSQ57G/L5CidzKCK+HKSRUx8iY= X-Received: by 2002:a62:e917:: with SMTP id j23mr4667444pfh.50.1569515197306; Thu, 26 Sep 2019 09:26:37 -0700 (PDT) Received: from localhost.localdomain ([12.157.10.114]) by smtp.gmail.com with ESMTPSA id 64sm4453169pfx.31.2019.09.26.09.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 09:26:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/18] target/s390x: Rely on unwinding in s390_cpu_tlb_fill Date: Thu, 26 Sep 2019 09:26:11 -0700 Message-Id: <20190926162615.31168-15-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.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" We currently set ilen to AUTO, then overwrite that during unwinding, then overwrite that for the code access case. This can be simplified to setting ilen to our arbitrary value for the (undefined) code access case, then rely on unwinding to overwrite that with the correct value for the data access case. Signed-off-by: Richard Henderson --- target/s390x/excp_helper.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 98a1ee8317..8ce992e639 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -96,7 +96,7 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, { S390CPU *cpu = S390_CPU(cs); - trigger_pgm_exception(&cpu->env, PGM_ADDRESSING, ILEN_AUTO); + trigger_pgm_exception(&cpu->env, PGM_ADDRESSING, ILEN_UNWIND); /* On real machines this value is dropped into LowMem. Since this is userland, simply put this someplace that cpu_loop can find it. */ cpu->env.__excp_addr = address; @@ -179,24 +179,15 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, stq_phys(env_cpu(env)->as, env->psa + offsetof(LowCore, trans_exc_code), tec); } - trigger_pgm_exception(env, excp, ILEN_AUTO); - cpu_restore_state(cs, retaddr, true); /* - * The ILC value for code accesses is undefined. The important - * thing here is to *not* leave env->int_pgm_ilen set to ILEN_AUTO, - * which would cause do_program_interrupt to attempt to read from - * env->psw.addr again. C.f. the condition in trigger_page_fault, - * but is not universally applied. - * - * ??? If we remove ILEN_AUTO, by moving the computation of ILEN - * into cpu_restore_state, then we may remove this entirely. + * For data accesses, ILEN will be filled in from the unwind info, + * within cpu_loop_exit_restore. For code accesses, retaddr == 0, + * and so unwinding will not occur. However, ILEN is also undefined + * for that case -- we choose to set ILEN = 2. */ - if (access_type == MMU_INST_FETCH) { - env->int_pgm_ilen = 2; - } - - cpu_loop_exit(cs); + trigger_pgm_exception(env, excp, 2); + cpu_loop_exit_restore(cs, retaddr); } static void do_program_interrupt(CPUS390XState *env)