From patchwork Tue Jun 28 04:53:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 585516 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp464855mab; Mon, 27 Jun 2022 23:14:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vT+9vUEC4jLEtFcslMC0kT1X17JYx7jcEDV3UnT66eMDACisGFrZceVVeOYF7+22FFymKo X-Received: by 2002:ad4:594f:0:b0:470:5b16:808 with SMTP id eo15-20020ad4594f000000b004705b160808mr2365394qvb.51.1656396878006; Mon, 27 Jun 2022 23:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656396878; cv=none; d=google.com; s=arc-20160816; b=UYB/iHNDeBZZtV4Pp1sBzn7kNeStZ6CB+XELyzdOfxhgprlOoaI2eHFfwzoTvkD6LY +Ukzq4tGFSHvZw77c1loP00in19xbk3z0lfKvOQNUHZ69U96NTrjGGM1xTL9/3Nk4tv0 Hpo5pASIwMsmb0GqkJ7cWuYsTDJgLaZXdTZoZ2mdxo63KcIPLJGopr3G0+gXxvSbMCG6 HaXqtIDnjPiEDQKFmWeeprncYLBbHN9in+eyAYmEx4hvxUYQevZ1E3BxuDPCtUudbZhW CTNg1rtLy2p9Ci0Th91dAy91vNml2iLaXOXaYrbQAEYrN5O4WV3iFLelvw5js6jh7cgM xLJQ== 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=Lkal5KDK4537KjIiM5DwOIkXPoQZ/flNccQ9lkg/eXQ=; b=u/Fe6azSe461S8d5AVyIvMXu+yB5uLCrkP1mBZ0wXBurU/s/o6TMt5OfWqgPVPDgPR L8w9Vt7kmVmhwp94hHb86YVw1wNIxsxl9nxBA7wt5trZex8Zh+kUizGd3byeEb+M+0FB LpVVj4FJHS3OS7Gv3rB6W7k3k/fdGDB67BEDEChY0kyum0TCSHbD5CcW3UzTsIUChFMT HX/FCSp1P3UQS5jI/d9bz2u2jR4P60piS7FSXwFytLMZd/nxDl4fXX9FZ+GSOx9wtJfn 1MjM8Sf6jA2z5maYNnr5dmJwVOvr1d1KW8tbCY5R9kE0QIapxsxOk/iR9a4ajh2fA26q 9Hew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9DoaUCi; 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 l11-20020a05622a050b00b003050a104479si7856540qtx.268.2022.06.27.23.14.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 23:14:38 -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=N9DoaUCi; 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]:37874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o64Uf-0000IQ-HO for patch@linaro.org; Tue, 28 Jun 2022 02:14:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o63Fk-0003IS-7e for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:55:08 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:41844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o63Fh-0008MN-7B for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:55:07 -0400 Received: by mail-pf1-x433.google.com with SMTP id i64so10930283pfc.8 for ; Mon, 27 Jun 2022 21:55:04 -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 :mime-version:content-transfer-encoding; bh=Lkal5KDK4537KjIiM5DwOIkXPoQZ/flNccQ9lkg/eXQ=; b=N9DoaUCiXErs7MF3E7SpMzgtl2eyhVKm5dFsrkV+kACpDJ+lXFXFWs1dX0wlF3/kKu mYY+bJDGyVeGhpy5APu/J7iHPPyO2ply8VWqu7PI+al/kTEbnrJMLlK7KOeyAJiZY1aG c2Izsxj+OxnLt56m+EiJllTAzmfWBoP4j3YhyodELyW227C7g1p0EqI07VPMExKxBeOl VMEMSy0oTyA6O5qRAdcV//+eSPyOv16h4xVaV5iqUD9VAGUW4tIGdOTDIwFEFbdXqjgs mXu2bgBeuZkAy5009qPw/emWTU3AfdpuBGbWrnSzBFC0xelU0zT31xdyA6Tscd0Hsi7y e8wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lkal5KDK4537KjIiM5DwOIkXPoQZ/flNccQ9lkg/eXQ=; b=fGwGJ2W4qOOV5YPwY5QBfAZkgPO9DgbsarQGWryWy/3q5jcxk71Dsn/kXD3TTujRk1 uU4IXV5v9j3D2PQqgezgzJly30Sxq5wXSln06EihHM1zyXMJ/4dycCZqeeZ6f0Ymxwm6 Z7K2zhZqKxr4y5SMIkBzY8xbelYkGPkupwKVFdCojGSRmfP0iRZ5APSxT5Iustt/kqvG M9Tz0rbYtKqVYtf8RX2slfZkRovKY/r81Usa77WazmYzF7bxBIoYTgkBuwHKP6CDvsVu PAWr+i75J+uJFps2gNblsNWRjFzt/ir7rjkmL+89tXqrLmZv8DUmFxPZxSvLvwyOOfju TvoA== X-Gm-Message-State: AJIora/rm8eRg4QkP0be2haIN1mEF6APv+utdARb/rIrFKpkvufQv9cV EPI52N2Y7Ot/utuTKqxJmAL5IfNakMPWBA== X-Received: by 2002:a63:1613:0:b0:411:51f0:eaf8 with SMTP id w19-20020a631613000000b0041151f0eaf8mr3186813pgl.62.1656392103637; Mon, 27 Jun 2022 21:55:03 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id w8-20020a1709026f0800b00168c523032fsm8073735plk.269.2022.06.27.21.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:55:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Alistair Francis Subject: [PULL 23/60] semihosting: Split out common_semi_has_synccache Date: Tue, 28 Jun 2022 10:23:26 +0530 Message-Id: <20220628045403.508716-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628045403.508716-1-richard.henderson@linaro.org> References: <20220628045403.508716-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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" We already have some larger ifdef blocks for ARM and RISCV; split out a boolean test for SYS_SYNCCACHE. Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- semihosting/arm-compat-semi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 7550dce622..50f40a2a1a 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -224,6 +224,12 @@ static inline target_ulong common_semi_stack_bottom(CPUState *cs) CPUARMState *env = &cpu->env; return is_a64(env) ? env->xregs[31] : env->regs[13]; } + +static inline bool common_semi_has_synccache(CPUArchState *env) +{ + /* Ok for A64, invalid for A32/T32. */ + return is_a64(env); +} #endif /* TARGET_ARM */ #ifdef TARGET_RISCV @@ -260,6 +266,11 @@ static inline target_ulong common_semi_stack_bottom(CPUState *cs) CPURISCVState *env = &cpu->env; return env->gpr[xSP]; } + +static inline bool common_semi_has_synccache(CPUArchState *env) +{ + return true; +} #endif /* @@ -1102,16 +1113,11 @@ void do_common_semihosting(CPUState *cs) * virtual address range. This is a nop for us since we don't * implement caches. This is only present on A64. */ -#ifdef TARGET_ARM - if (is_a64(cs->env_ptr)) { + if (common_semi_has_synccache(env)) { common_semi_set_ret(cs, 0); break; } -#endif -#ifdef TARGET_RISCV - common_semi_set_ret(cs, 0); -#endif - /* fall through -- invalid for A32/T32 */ + /* fall through */ default: fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); cpu_dump_state(cs, stderr, 0);