From patchwork Wed Feb 10 22:10:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380259 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1570515jah; Wed, 10 Feb 2021 14:40:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNJowUknrdKmeE2Rm3nXKkbdasm/5xidnfIHMV2m5zGh68UzeENSR/d4NuP6klwzh10QwB X-Received: by 2002:a25:b988:: with SMTP id r8mr6991932ybg.268.1612996842025; Wed, 10 Feb 2021 14:40:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996842; cv=none; d=google.com; s=arc-20160816; b=VK0jQLFzp0luthEHvp9U/N6uKBV+HZre7/QQIsEp6qoKs1Kc+a0/xIjGa+pC3LQXDe S3P7bML8wqd3zmRZjXaKXSTPt2gzCsDN61ITDRhoF+JSvxEbQZNlWHGPGJF1joIImAk1 CzMWHb/u0sAkn3l14flYnNop2QYy8CBnOZhwSPvXfGq2NiPLdve51kI2xnjaGM51xRh3 /S5J0AmsDYmDx85lUjJkl3hrturc64C/Uum/xUskm/OpIxGtXLYEVl0mzkbgHo0A09/c fGbI66cjE2yMVArbF4fAx2NvhuMLnm0t/xMaxC7N5jHpZirg+etPWseHNEo7MpKYyQgd 38Sg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=KuHBdM59uja3N5mGLsXzZEOPtsEfioiAaJj0K+4evANoCWTRvlrYuMNi478Dn6vWma K6CjDkuVlcS7W5BAMbpa252ckb2XfLN+deVv4foHFnTPwhIzI1z1+6aq8PH9s+P+p0Ua 6ivewLYZtJ4itB3QQR5GCeveHFRd8tf+oYxx7o4Kwk6n/H8Ax8haDnBQJxhd0GC4YKIZ EvvVvsZA36LfftJeGe7MhhBJw2mDlfhgNsB0ix/yV5Fvex+BaVqIbA0gXZLvXTOhaMR3 BHGBEhZOKyZCnzdXYT9q5rSEpbbvvie5m6nyGQo7CPgYjf6T5Y9GcINMCTtDNFR/EgiS WniQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rcl0EaxV; 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 y126si2953224yba.489.2021.02.10.14.40.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:40:42 -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=fail header.i=@linaro.org header.s=google header.b=rcl0EaxV; 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]:50960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yA5-0007P1-FT for patch@linaro.org; Wed, 10 Feb 2021 17:40:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhq-0006MZ-Vx for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:32 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:37469) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhk-0003Ln-Fc for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:28 -0500 Received: by mail-wm1-x32e.google.com with SMTP id m1so3299517wml.2 for ; Wed, 10 Feb 2021 14:11:23 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=rcl0EaxV/R0yqpKO0l1CQpHyWAzbi0k7XsPOnGO9M+bMLWx/4hU7noUOPg+OVShvlh zU8Q3b5xUCLKeb3SUzlp5zR/+UkhfwI09duyevVlQsvc+B559FfYY9rLoFY/yGcdtnsp 5WOVWTEHMf2U9W0/RXQQFI7qjdMmxtjbEMnLkU9IoKPbDC2PgparevAgNk0WgGH7qMFi HTxTqWiKpLRcczaNdZJbqQFuPzRFSga7hUARPKTCn0T87e1q3sIDb7sN7L1t8Gpi3pHo EgMM3qNWc0NCmCG7/21zxRo0upULMQRvXyG90mQ2slqWIMjeCR14rC9FhjWp4omCyufW 7uZA== 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:mime-version:content-transfer-encoding; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=RM9fnoliq0HSK1cdPlcKAgVyXYFpawDwTkik3SRjGu+4uUCygNV3Zg5jEqeMLnUiHW bGO4Buz2R7ug6ggFDk/M8qby032q77Px0nSzOOYob1aIPhjapYQTrHpeEx4VVLGmCJth iL2eb3ANjww5pehmM7gZVCt8mfVw1aAO/+iLuDvQCIyDzssrutusUQK6xxeFSI0lznQK NXrC2I8pio8Br+QQiTLwpoDH4uplTFa43BT0PPpUxZUZ9QNgJucQZ5SezHB6HZk69q01 ti/pPgEmXXjj7niNvcqA7UDbz4+ID71yFHVRIWeWUEdvNJ/m/f9EdXChOsl1/hZAYDLj jmGw== X-Gm-Message-State: AOAM532FfuL+QkThD4TEbWFtd6kPvVO66aOMARKASPQaLPn5QvgAHf/0 lgktpAz/3YHHl52VyX19Xjf9pQ== X-Received: by 2002:a1c:6289:: with SMTP id w131mr1273386wmb.0.1612995082212; Wed, 10 Feb 2021 14:11:22 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w4sm4502230wmc.13.2021.02.10.14.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D420D1FF9C; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 13/21] target/sh4: Create superh_io_recompile_replay_branch Date: Wed, 10 Feb 2021 22:10:45 +0000 Message-Id: <20210210221053.18050-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.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=ham autolearn_force=no X-Spam_action: no action 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: Yoshinori Sato , Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Move the code from accel/tcg/translate-all.c to target/sh4/cpu.c. Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée Reviewed-by: Alex Bennée Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-5-alex.bennee@linaro.org> --- accel/tcg/translate-all.c | 12 ------------ target/sh4/cpu.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 470657b02a..b8ad95aa1b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2417,9 +2417,6 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_SH4) - CPUArchState *env = cpu->env_ptr; -#endif TranslationBlock *tb; CPUClass *cc; uint32_t n; @@ -2443,15 +2440,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_neg(cpu)->icount_decr.u16.low++; n = 2; } -#if defined(TARGET_SH4) - if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 - && env->pc != tb->pc) { - env->pc -= 2; - cpu_neg(cpu)->icount_decr.u16.low++; - env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); - n = 2; - } -#endif /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb = curr_cflags() | CF_LAST_IO | n; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index a78d283bc8..ac65c88f1f 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -43,6 +43,23 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, cpu->env.flags = tb->flags & TB_FLAG_ENVFLAGS_MASK; } +#ifndef CONFIG_USER_ONLY +static bool superh_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + SuperHCPU *cpu = SUPERH_CPU(cs); + CPUSH4State *env = &cpu->env; + + if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 + && env->pc != tb->pc) { + env->pc -= 2; + env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); + return true; + } + return false; +} +#endif + static bool superh_cpu_has_work(CPUState *cs) { return cs->interrupt_request & CPU_INTERRUPT_HARD; @@ -217,6 +234,7 @@ static struct TCGCPUOps superh_tcg_ops = { #ifndef CONFIG_USER_ONLY .do_interrupt = superh_cpu_do_interrupt, .do_unaligned_access = superh_cpu_do_unaligned_access, + .io_recompile_replay_branch = superh_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ };