From patchwork Fri Sep 27 19:39:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174657 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3986733ill; Fri, 27 Sep 2019 13:01:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzilaCX35W1GzlFiTq7YKQwp+6ucLsnDEQjyuCaVUhyl5cHAbEPKu6/l+WD4YDP5NgJLxYA X-Received: by 2002:ac8:554a:: with SMTP id o10mr12488147qtr.0.1569614461903; Fri, 27 Sep 2019 13:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569614461; cv=none; d=google.com; s=arc-20160816; b=zkz7SxCOZI4WW0gVGoXMVDMkgqqVjRyxZuxhESNOhM2xVtljzYJGDSYELbTl9UVrJK tdNXOqF7lJu0ynBPnhtyKA7le03QUU54Vi3v9jOTItYVk/gLuKPguIcLxtz/rQN2fScY HXF7Jj+Vmc9c7K78VDhoILKz7qBI1Ib3iGYNMqLghrmdSZEBoqlY1l7qdiBjQuYzjTmA X7UYX/wRdktAJidc6GTaYhXrf4lbPgHiZ2tiehsrBbcpuqhBG9AgdqOaz+BK0ihQnYVW PYInwRyJlOX3kYa+9Bxbu7B93TUd8a0BzrMMxOepb3KBdTon0eHPsb9sRKcTDUG12CcJ SArw== 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=8sg4rb5KuIBYRa5veNL+5ohAGWn4FiKab4HtkGWajes=; b=SdrlSHip7c2ATrrScA22RhDmMEx3n24unI9GpdbiivmIcyruolRQZMphG3joyHuBOV BQ3P3CCc6zsK31zPKjDpRW5Uigt6lFDgvLcLHl/cOC+JNiH28fbyYzt3y933l32YC9r+ ZDcQHjs0+eRMt3Drv+Zvq1KSF+ip2Lh8+8VkrvaZ94z1xWsyW5KERYuc9Ukb/Gb6IJgQ 6kPRDJ59B/nHaelztWrBthFfXHGpDwyOuQI2oXnB8wroCMLgdoZYqq57UT6xkVI7mg9E 0lSv20lLnpaGMzH7rlz1+ekKGBwt7VDuPg+nUXaf7hX6Upi2rxrUZ+wYmTxQhN6zMcqz 5EeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lVlsN7Iy; 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 j68si3225406qkc.379.2019.09.27.13.01.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Sep 2019 13:01:01 -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=lVlsN7Iy; 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]:57126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDwQG-0000EL-Oc for patch@linaro.org; Fri, 27 Sep 2019 16:01:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46709) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDw5t-0003RY-9O for qemu-devel@nongnu.org; Fri, 27 Sep 2019 15:39:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDw5q-0006Yi-Lm for qemu-devel@nongnu.org; Fri, 27 Sep 2019 15:39:56 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:45531) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDw5q-0006XM-3I for qemu-devel@nongnu.org; Fri, 27 Sep 2019 15:39:54 -0400 Received: by mail-pf1-x444.google.com with SMTP id y72so2118490pfb.12 for ; Fri, 27 Sep 2019 12:39:53 -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=8sg4rb5KuIBYRa5veNL+5ohAGWn4FiKab4HtkGWajes=; b=lVlsN7IyLeO7dpem0HVwA10RkE/I9azz8CMvlxTsCjCZpiJdPRmS8yfLh4sxtQm7vZ UyRE81WvAMq6uwm2ucaG18vHSxUXVgOWSCtNfQPJdusuvDJymdM+QSpB9QkncwHxBwHg iaKkpFblXh2OABGcPkA5Zytv2a5lFz69Na0qjWWUD/3nCy3psCoZk8i2mwXL5JYiZ2Jn ac/fjUx7Lj4mcRC+Hq1XT0ws9N3CU9nHOEfApeUk67bum9KVbMAt/bEO5Xf3yFWFQklh kLuYwByvDGMnYmC3ADDYlNrq0DQ3dw5cSIhXT4HNPSXkTWkeoRj5bcISRrYojFBIvlFA yYkA== 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=8sg4rb5KuIBYRa5veNL+5ohAGWn4FiKab4HtkGWajes=; b=b1ysLO2sdg4sBx3oCVYWLcl5oxhm0t6x+ep0teQSS39A/Zk4CdpQxAVHQBKwSZOUQE EEZlQXlvltc3Xijjm0fgcLeWFrhBAGvEOtFq0SH1HX2+xI+GGCTY2Mc8dry4teHnw5Of Kj/BVjBS+z6mKiWgAAcKxNcfBVjbg0N6x8arFKKbjbQ4jcf68+ANdRWDi6pISHI1IF1u u+8uvh6LCIWMgdGSEqjmWthLINgB39Cc8FFNjmV3Hd0zbbT/UkrJw5YiNVHo4ZJ0IohQ fZA1Q/ad7rTulvVtyMZQc+BAdBoSN9RPkywK0u/83tJoYMpTMm2bOjyrwxgwxZQeVRFw tbGQ== X-Gm-Message-State: APjAAAVqjMdKoCME31YwP1HaKOg1I/KcqHBCUV+HDCzGvTYD7MCWNXsK 2/+ovIziIPYNH3Z1OapeIZcM7Bu9V28= X-Received: by 2002:a65:6111:: with SMTP id z17mr10959743pgu.415.1569613192341; Fri, 27 Sep 2019 12:39:52 -0700 (PDT) Received: from localhost.localdomain ([12.206.46.62]) by smtp.gmail.com with ESMTPSA id 192sm3676403pfb.110.2019.09.27.12.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 12:39:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 13/18] target/s390x: Rely on unwinding in s390_cpu_tlb_fill Date: Fri, 27 Sep 2019 12:39:20 -0700 Message-Id: <20190927193925.23567-14-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::444 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. Reviewed-by: David Hildenbrand 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)