From patchwork Fri Mar 29 22:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784099 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3429316wrt; Fri, 29 Mar 2024 15:33:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZCFbkbef9nJehgH8z4077TWndsMohmuUle6s7VCbljJ/1JLiwFVxi/1UMYw/HrIwGrieY42fBxkPHtoYiNBBI X-Google-Smtp-Source: AGHT+IEKNllwPUpR7ZRlxb9JAfYZAQqaEc+LVHGvoByoCFctW5Rd/YDt95qh7hjz+FzRo3XUtqjp X-Received: by 2002:a0c:fac2:0:b0:691:82ed:396f with SMTP id p2-20020a0cfac2000000b0069182ed396fmr3228215qvo.42.1711751614396; Fri, 29 Mar 2024 15:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711751614; cv=none; d=google.com; s=arc-20160816; b=QYKRxCMsBUXeNweIkRQkPqcMo7o+fsoWCoD+jmSWyVpehgBAXqB/bWCjTlCmOsTCyj HpUthUfx7h9vo8lxE/09n0xORiiF8s4BOK54X6V3TL7F7xuzq4C5jOA/2GwDwfg9zssA goFc6WvZJyL7QZBDwH+vvMpJUdxK7E2HrQG0MNujkS0rhY7Lnft2C1KfzS6uNPAWc/E3 WauoANDijZPCB0SvKaaoK3VUmy7VFAt56C3Hofgk9/cSglO4xInlHlmN88RjgTckohHa /WzI2rJOhoXIzSqNAjfPOkTJPwp9uQ7VZ5heimtMiB18j8I1p4kjRNadRlIUI/6pFnTR JGhg== 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=+aKcsx9JEOh52ndAdHyeqzgetKk3eTEnbQJ4vqbujCg=; fh=wDljmxUHXfz9MGj2//jPHYRc53BMWF157v8rVKELrf4=; b=nEZ8klb59iR2blGnDvo/Qv1m13Z2slEu+gvrrmvlcil2Fc/PG/TFo3zFen+9fvwYkb 55eRgHISy+c3SGALaLEpkU96Pa8ZJadFHpg+rLFIOwDl+vI3l3aeu0d5TLz5pSVBZWpH Nn/QYxoU6TZJ8+TZgrpflNjVdKLPuzFGFnBYWjDSAE/6gqRubIRPQvdKQ+HuaM92lTyC ZTI91YWleOkf0E8oaD8IBymUsAlPg6/T7jswbRZ4OGmjHbCDBG9chg/8vOtPZGQeetZR K5881oozm+YyiwtdfYmNwUYbkl84wal72dK0WB2vP8ZTgsfyH50Gx26unVpkdrXpGybp nv9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wMA0iGpu; 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 h22-20020a0cab16000000b00696a943fd8bsi4619301qvb.265.2024.03.29.15.33.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:33:34 -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=wMA0iGpu; 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 1rqKl7-0002Zv-Qp; Fri, 29 Mar 2024 18:31:37 -0400 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 1rqKkx-0002XK-Kg for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:31:28 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKkv-0003Vr-L8 for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:31:27 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e0bfc42783so20766435ad.0 for ; Fri, 29 Mar 2024 15:31:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711751484; x=1712356284; darn=nongnu.org; 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=+aKcsx9JEOh52ndAdHyeqzgetKk3eTEnbQJ4vqbujCg=; b=wMA0iGpu2cLOuysjP68A9Al3LryRGIua/rbMTOTHgdtw+vwMd1SdFbIywEUAV1PfJ0 qoPFd0HPb+2FOrwliPKv3g+tM6bxWh9jrfamh2Y/GjXtfFaCRso6bATzaSxhwdzG71TQ A8dGHn44WaOAm9g1PV5I/wwsFvbLsZ8b+cZ3vwnAa+fmMxiHobYhgsKsFIkKNGpCTqHq SWO+A4ZiyNJRW6kCecgI5Rw0kEoVlgHeoB9qP+d0EKCLlQ9+Bd/AWcbImespMJMe1Q6a u5p6rP88pxKczzvh36leQ5FlLk6/b27rrb7ge3HO7QveUwAxzqo5pk/RQgJ+3c3uxiNl qqNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711751484; x=1712356284; 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=+aKcsx9JEOh52ndAdHyeqzgetKk3eTEnbQJ4vqbujCg=; b=p4yJ8/XXIi8OeFrNbFpJaZ9hRiPaunHQpll2UTDmwD2F55JIU0Pi69CFfnIG7HGhF6 rNXOFdShs1EeWXRHLBgTKirKiIPfz2msqK0w3MT0Nc1ch7KT/MIE/3uaHQ9vZpgjCFSS eG4BXwVWZyLyjlF214qrfqntMqi/cQVnOefm2IePTE++wRW/1pETBlS34NcUXIMMXR// p4gDs/R8BBOztzgzgWvlJ0HVVn72DA7Zq3gU3xTTzC9NdOvMPHOxDhhIGtLYTeixsYAu DQtxbRsniFVvPAEZ5hNMsNCbfeymWtn0zVuzkbl3l2Gn55qsBAMa5MkVlmn+7qofYLlf bAWg== X-Gm-Message-State: AOJu0Yyi4fALZReB+YBkzVze6jCARQfzT3bFDoXzy38O70PXIlMArGAn 8vIIdFro83ppprwqyFIq1Yg6MyKjQsVd1geJRDGMjgJzcvHEpu0SlagV6o5Ek+JipExRQvPmfRx j X-Received: by 2002:a17:902:d2cf:b0:1dd:5f85:1191 with SMTP id n15-20020a170902d2cf00b001dd5f851191mr4433009plc.53.1711751484466; Fri, 29 Mar 2024 15:31:24 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f8-20020a170902684800b001e09b636cafsm4000955pln.287.2024.03.29.15.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:31:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 07/18] target/hppa: Fix EIRR, EIEM versus icount Date: Fri, 29 Mar 2024 12:31:00 -1000 Message-Id: <20240329223111.1735826-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329223111.1735826-1-richard.henderson@linaro.org> References: <20240329223111.1735826-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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.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 Call translator_io_start before write to EIRR. Move evaluation of EIRR vs EIEM to hppa_cpu_exec_interrupt. Exit TB after write to EIEM, but otherwise use a straight store. Reviewed-by: Helge Deller Tested-by: Helge Deller Signed-off-by: Richard Henderson --- target/hppa/helper.h | 1 - target/hppa/int_helper.c | 14 ++++---------- target/hppa/translate.c | 10 +++++++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/target/hppa/helper.h b/target/hppa/helper.h index 1bdbcd8f98..8fd7ba65d8 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -91,7 +91,6 @@ DEF_HELPER_1(rfi, void, env) DEF_HELPER_1(rfi_r, void, env) DEF_HELPER_FLAGS_2(write_interval_timer, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(write_eirr, TCG_CALL_NO_RWG, void, env, tl) -DEF_HELPER_FLAGS_2(write_eiem, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(swap_system_mask, TCG_CALL_NO_RWG, tl, env, tl) DEF_HELPER_FLAGS_3(itlba_pa11, TCG_CALL_NO_RWG, void, env, tl, tl) DEF_HELPER_FLAGS_3(itlbp_pa11, TCG_CALL_NO_RWG, void, env, tl, tl) diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index efe638b36e..90437a92cd 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -28,7 +28,7 @@ static void eval_interrupt(HPPACPU *cpu) { CPUState *cs = CPU(cpu); - if (cpu->env.cr[CR_EIRR] & cpu->env.cr[CR_EIEM]) { + if (cpu->env.cr[CR_EIRR]) { cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -89,14 +89,6 @@ void HELPER(write_eirr)(CPUHPPAState *env, target_ulong val) bql_unlock(); } -void HELPER(write_eiem)(CPUHPPAState *env, target_ulong val) -{ - env->cr[CR_EIEM] = val; - bql_lock(); - eval_interrupt(env_archcpu(env)); - bql_unlock(); -} - void hppa_cpu_do_interrupt(CPUState *cs) { HPPACPU *cpu = HPPA_CPU(cs); @@ -280,7 +272,9 @@ bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } /* If interrupts are requested and enabled, raise them. */ - if ((env->psw & PSW_I) && (interrupt_request & CPU_INTERRUPT_HARD)) { + if ((interrupt_request & CPU_INTERRUPT_HARD) + && (env->psw & PSW_I) + && (env->cr[CR_EIRR] & env->cr[CR_EIEM])) { cs->exception_index = EXCP_EXT_INTERRUPT; hppa_cpu_do_interrupt(cs); return true; diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 5b8c1b06c3..46b2d6508d 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2166,10 +2166,10 @@ static bool trans_mtctl(DisasContext *ctx, arg_mtctl *a) gen_helper_write_interval_timer(tcg_env, reg); break; case CR_EIRR: + /* Helper modifies interrupt lines and is therefore IO. */ + translator_io_start(&ctx->base); gen_helper_write_eirr(tcg_env, reg); - break; - case CR_EIEM: - gen_helper_write_eiem(tcg_env, reg); + /* Exit to re-evaluate interrupts in the main loop. */ ctx->base.is_jmp = DISAS_IAQ_N_STALE_EXIT; break; @@ -2195,6 +2195,10 @@ static bool trans_mtctl(DisasContext *ctx, arg_mtctl *a) #endif break; + case CR_EIEM: + /* Exit to re-evaluate interrupts in the main loop. */ + ctx->base.is_jmp = DISAS_IAQ_N_STALE_EXIT; + /* FALLTHRU */ default: tcg_gen_st_i64(reg, tcg_env, offsetof(CPUHPPAState, cr[ctl])); break;