From patchwork Tue Oct 1 17:16:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174912 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp8859576ill; Tue, 1 Oct 2019 10:35:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4v2HUjAAirAYQ6tYBlgQK0AJAlUOuMXGMz0NqT2GLrQRV7KTE8xJvkMeSoU3y5Bot774y X-Received: by 2002:aed:2f42:: with SMTP id l60mr31160986qtd.315.1569951333237; Tue, 01 Oct 2019 10:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569951333; cv=none; d=google.com; s=arc-20160816; b=U4LEpUsXN+gBPz/TEE+tFbZoLegeO4q2BGlfNihasl1N8AZiclzQP1IZo3M43uUKZt RmddESkRrT9z40oGk0qF+SsjyZpCnYIiUE69Ci5if+pjrmiBjYTxdGw4fityctrDbf3e 3cjOzjEel9WTZkYSmoPWb8ApNT2+XUV6loPnVSdjk7st7RLaXx83t9xKvPI0vA+2FVWZ yV+bdifGY8vWF7CeyxDoPidNDXs0O0v9X4uZyaXe9CUCEDV500/xonf+c+IkFrjRfbzS NQe+qrvZCayO57kMyhCSeEeyaHwmzQ/zSzeOD5zLKlPQRIfkhRCyMpWNXdK3kgugZ3n6 FzQQ== 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=YmgjdpU+fhpGbq3pcaJ7TiewVsfEgoiw4fXZVWlfHixfkJAGe/bWAJot1F5Ry57DBu vEHTtrpe27V28dS7ers8azijOR+xFMAhXkWfT0yZbuae+eJWNTUhdj8WOUcn10FwIe/q MKDO2brJNMeBNGRJZnwmtSki6N/E/96ZyQYfvSLDPFZ34OO5aVMqaMxGOGRhX0ZbXEhv H7q0CJLGe5O01+0y2DM4UAooAneQ+KoZmkJcBLz3IMqMSR1DKqwv/4EZBjVLE7byQtUg LuwcfDehxjLfn44M4VefXdp9Id22oguKwMmWgDfCaxvRLnIhuhSHY/GU3i5FjO2m5ZS1 bh3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AOYp1zg7; 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=pass (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 x34si16003060qth.119.2019.10.01.10.35.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Oct 2019 10:35:33 -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=pass header.i=@linaro.org header.s=google header.b=AOYp1zg7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFM3g-0002d3-Lx for patch@linaro.org; Tue, 01 Oct 2019 13:35:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32934) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFLlM-0001hO-2k for qemu-devel@nongnu.org; Tue, 01 Oct 2019 13:16:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFLlK-0005ag-Vh for qemu-devel@nongnu.org; Tue, 01 Oct 2019 13:16:35 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:36738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFLlK-0005aB-Qi for qemu-devel@nongnu.org; Tue, 01 Oct 2019 13:16:34 -0400 Received: by mail-pg1-x544.google.com with SMTP id 23so1581006pgk.3 for ; Tue, 01 Oct 2019 10:16: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=8sg4rb5KuIBYRa5veNL+5ohAGWn4FiKab4HtkGWajes=; b=AOYp1zg77cPRcPif9SMkLZAwAdK0Aph7iPlFFqUIYy1d3Il+kSG65LK2QSOZVHwSnP fgu3aiurBne1CoecJ4aTcK0n5r8FigcpaSpXZRIzKtyZx0O3s1esRbA0EXP7MjEpoCx4 4L2IftCilatqVELDoAsEo43NlHORU+yXA1A6fOEa4ATjUISkyNYajO6NKaWJsHKcAwrF w1iQwjJJFIhC/FZxKdymclCEwscMGfDxmH9Hlb5qBfdUrVNzc7PRc3zkXxNcYoJmv9JZ oD/RTN14QtQFKBLdGtUr+LmOgMq1rypQ02skfv4UfXK1WpTjj3mZrG3EvDR6LklJzLzP HVzQ== 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=UHThDNoRPpHfQTcOMa32w59gS6MBjp3HjiULofaF+Oxbf3pv5lMYvp/LplQM8tdKRC RWWzrTr+KLmoMi8Jo/NszeqRrvbKJRNBs7nuOYa1qEW0USHuNCLIHwOfZEghmh5i7rpU cje949wMtUVAOIUlFYXTBu5kCmoMhjQDmU7orLrY5nMIRetzfa57zMAx/o3LtdZy7SHO bj58XO2jTxWdFs0xd4dGMRPMuZ0DbQHs2sGNqVa0CavfJ1wTYrSLs+C3G+YlyicE/JTo bEGfKE4mlL48KPENf1I6v7Fs3WakiF4YLO3bQrmfBUeZqulMMqodGeQBVsprP0NbPsdw g9TA== X-Gm-Message-State: APjAAAX8eUtgMbfPhPSGW1rve89l5yXfj5iu1I6lpzoiAzdp32H2ud6C uA6/l3SommCfQ8oVA8Nj9wRd+8RXvWU= X-Received: by 2002:a63:ed08:: with SMTP id d8mr32188280pgi.239.1569950193356; Tue, 01 Oct 2019 10:16:33 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id w7sm2863568pjn.1.2019.10.01.10.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 10:16:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/18] target/s390x: Rely on unwinding in s390_cpu_tlb_fill Date: Tue, 1 Oct 2019 10:16:09 -0700 Message-Id: <20191001171614.8405-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001171614.8405-1-richard.henderson@linaro.org> References: <20191001171614.8405-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::544 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: 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)