From patchwork Mon Feb 20 18:40:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 655109 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1551815wrc; Mon, 20 Feb 2023 10:43:48 -0800 (PST) X-Google-Smtp-Source: AK7set8C0xco8K1ogRQioTmCM9alWfJajy35qGZGyP0QM6KP6DmM/hhQbmVtIy8096SEVkhxl41U X-Received: by 2002:a05:6214:248c:b0:56e:b1d2:9c2a with SMTP id gi12-20020a056214248c00b0056eb1d29c2amr6228544qvb.28.1676918628701; Mon, 20 Feb 2023 10:43:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676918628; cv=none; d=google.com; s=arc-20160816; b=Ql0GKqQzzjpIgi/ttwVYMkiFPPE3xMqRuQrpgzRCSnc94TCTxhEjwrWjeCAKeA04HF lW3YMgKCNf35JqIGLcVcPyapB4G+0NlOi+7zJWHwEAxLU3IKnpm5Ns6JwoksC7i4xuR5 0mKFGGzBOuH8afGuZ9G5RLh1lJVmC2qMrWUQecg32sN35sqJmmQj40Q5p09HTriR9mOI fLleVYZEnJqyGiMA/Zags+yYOtkw8wEp5wdpCZTC+Bvivsvz1KT0hkQHij6xPcTm599Z 1pVfMZEVHEMg0Dxh6EIJqJ1NNVd51ZUk04loar4NdOb0iqTdLCJ4JEkBs1iddtO2+M8+ 8bkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hVAOE5bYdVyLdxBG7UtWUVaMQMKRna4hS5x0eRllW54=; b=TmhN9UMdTAvza/izTOvtrL2eonz6M/MWxBTEe8pcRk9uJOsy9HvEIkbN6ymGbM2OSO J5AQJIFYiWcBbfk19WgUXRmX66tfzsTwrR5BZ2sDlEtMZcfTwdYx/c8+aJnvaCFrrDmI wSM9WKrMx9wpqCxNSqoD0swexdXGgQl8oaejudtXej8WCxxjRc4R9ySUOnepZjBIgDUn 72gJr2sUh8eRqttRhfJ96f8Cd9snz2wxvuLTyBy/yodMDZ61wZAHe/y+FMwRYyhigD4d weQJv8nEyP7jzp6OA4NeGPFKigTuJxwJhI2Xab6XMikphdnC1dWssq7PwYsl+wiU4S0y XsKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GnAhD7GX; 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 f11-20020a05620a280b00b006ff0a81ae8csi10610338qkp.65.2023.02.20.10.43.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 10:43:48 -0800 (PST) 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=GnAhD7GX; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUB8C-0006Rb-Pn; Mon, 20 Feb 2023 13:43:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUB6a-0004aF-GJ for qemu-devel@nongnu.org; Mon, 20 Feb 2023 13:41:47 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUB6P-00049U-Ij for qemu-devel@nongnu.org; Mon, 20 Feb 2023 13:41:37 -0500 Received: by mail-pj1-x1035.google.com with SMTP id qi12-20020a17090b274c00b002341621377cso2189141pjb.2 for ; Mon, 20 Feb 2023 10:41:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hVAOE5bYdVyLdxBG7UtWUVaMQMKRna4hS5x0eRllW54=; b=GnAhD7GXydMvaC3vTO71Fxt3hkdATyKEStLYnS1eY2zKuPQvE7dIYMh1vxgDBcpNlu K8sVfRjly7lSdPBhRVcXsuYSc9IMtn7d3HTHfj3w576T0LVuv2rc1zBx3zPJTg2cwKZc oLgGIfZoFQ5z/8YdMk73hb+pCRKKHOoxXsWmv+V7cWdIIBxOdLw32KMYQtTK98JgE6yb fhayb+gCWbTMRdREwVEFL8ACLm7xCFBjqEnY3DpfysZ4mBEVIxhokq9/C57bhZn3b9ea auu4L/5IgftpPD9QrD4GCRTKPqLnE3msTu0V8DVGiAvho8AOdxrI8FpXkdLQTWn9QbMC clkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hVAOE5bYdVyLdxBG7UtWUVaMQMKRna4hS5x0eRllW54=; b=N+UrA5gg7f8j144nzJjjGLv6KWoGFTPakEBdGLZ7Apt2QPMdplAEao/CyMQjApw6P/ vM5wZjpytkk7JD6RLM1WUF83onxdf1hKrc7N106P1TOzm5S6rcOL62yu7KWjQV4zgvCc b2GcXoPpuzP434gdxtC/i6vaS9BWR7HPbNi719Nt0+BQnRFa/ZMwZ0lHyRAS3LYhdQLt ACQeRUCy52/kfqnVKi/CoRmgB6duSlzXIfNqbPHZC4rIB66qqBT4tnL+mmV4fAX6p1Y5 NwlIHHeMz9rLLk/P50xE63pdyamtc4lndnwPzcfuwTsn1C0etJOmnbg8Y8OTn5p0T89C o4YA== X-Gm-Message-State: AO0yUKWxHSa58Dkh+GwhnAGpRcrJXaM1rEzCtDu6AFYXrO5Rj0nPhQ/N 10PJDihlfkQKW1y9/bx5AD9Ln1Qz+/poSY4zl3o= X-Received: by 2002:a17:902:d488:b0:196:5f75:66f9 with SMTP id c8-20020a170902d48800b001965f7566f9mr5228172plg.63.1676918487037; Mon, 20 Feb 2023 10:41:27 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id jk20-20020a170903331400b0019258bcf3ffsm1911676plb.56.2023.02.20.10.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 10:41:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH v4 17/27] target/s390x: Introduce per_enabled Date: Mon, 20 Feb 2023 08:40:42 -1000 Message-Id: <20230220184052.163465-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230220184052.163465-1-richard.henderson@linaro.org> References: <20230220184052.163465-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Hoist the test of FLAG_MASK_PER to a helper. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index d8dad71814..433703b4c9 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -353,12 +353,21 @@ static void update_psw_addr_disp(DisasContext *s, int64_t disp) gen_psw_addr_disp(s, psw_addr, disp); } +static inline bool per_enabled(DisasContext *s) +{ +#ifdef CONFIG_USER_ONLY + return false; +#else + return unlikely(s->base.tb->flags & FLAG_MASK_PER); +#endif +} + static void per_branch(DisasContext *s, bool to_next) { #ifndef CONFIG_USER_ONLY gen_psw_addr_disp(s, gbea, 0); - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { if (to_next) { TCGv_i64 next_pc = tcg_temp_new_i64(); @@ -376,7 +385,7 @@ static void per_branch_cond(DisasContext *s, TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2) { #ifndef CONFIG_USER_ONLY - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { TCGLabel *lab = gen_new_label(); tcg_gen_brcond_i64(tcg_invert_cond(cond), arg1, arg2, lab); @@ -680,7 +689,7 @@ static void gen_op_calc_cc(DisasContext *s) static bool use_goto_tb(DisasContext *s, uint64_t dest) { - if (unlikely(s->base.tb->flags & FLAG_MASK_PER)) { + if (per_enabled(s)) { return false; } return translator_use_goto_tb(&s->base, dest); @@ -4506,7 +4515,7 @@ static DisasJumpType op_stura(DisasContext *s, DisasOps *o) { tcg_gen_qemu_st_tl(o->in1, o->in2, MMU_REAL_IDX, s->insn->data); - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { update_psw_addr_disp(s, 0); gen_helper_per_store_real(cpu_env); } @@ -6413,7 +6422,7 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s) } #ifndef CONFIG_USER_ONLY - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { TCGv_i64 addr = tcg_temp_new_i64(); gen_psw_addr_disp(s, addr, 0); @@ -6544,7 +6553,7 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s) } #ifndef CONFIG_USER_ONLY - if (s->base.tb->flags & FLAG_MASK_PER) { + if (per_enabled(s)) { /* An exception might be triggered, save PSW if not already done. */ if (ret == DISAS_NEXT || ret == DISAS_TOO_MANY) { update_psw_addr_disp(s, s->ilen); @@ -6569,7 +6578,7 @@ static void s390x_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->cc_op = CC_OP_DYNAMIC; dc->ex_value = dc->base.tb->cs_base; - dc->exit_to_mainloop = (dc->base.tb->flags & FLAG_MASK_PER) || dc->ex_value; + dc->exit_to_mainloop = per_enabled(dc) || dc->ex_value; } static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs)