From patchwork Fri Aug 16 07:23:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 819731 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c8:0:b0:367:895a:4699 with SMTP id m8csp162101wrb; Fri, 16 Aug 2024 00:25:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWiv5rtPNlFQgNQlCu9NIhnZhdmLtQgzvOajt2jGhwT+Ea0IbhMApfyRVB+Ji+ER6x2qvGvP8gMXozKt85rQcpn X-Google-Smtp-Source: AGHT+IFOW2EJWI3hi16dbflOqNC8EoNBAh5IfTM7/kk4e7eMjBHqA6Qmb1/qGyIksgEQ3TCGFLQO X-Received: by 2002:a05:622a:1b0b:b0:44f:f83d:46a7 with SMTP id d75a77b69052e-453743a9551mr17716091cf.51.1723793107891; Fri, 16 Aug 2024 00:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723793107; cv=none; d=google.com; s=arc-20160816; b=UH+M7SLdDSzzPpjinf3YZDoa5kLWrUfUhZP/ucimPHT1jETgjHjNRw0/xOUcdwyOjs ko7mzwsXlBH9xPDPWDj4/5Hs/JXwf6YKetRZWyMBkX8jxjnG2aaPFCmvLZWbrxtQMV0w mzOfHPF7MFb/QksnOKMpHSxWOFRYiBRvXlcefCKZNa7/JHF/aYgvwosgaergUq0xT06q dC2UhU/IG7E9UqWTXp5mfHozRMUc6PTiuZcRSwizJqSSQhEpOM2+GCFMP8eQ4KzLKv4o Z8HUJjMSEDoq8wsgjdkLJBtabSz3QcAc5NCMTP3JYwKx8ukp+w97UbT6VVv/4AW+bcpy CNaQ== 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=Ek2SH+eIGTE6kXSOvmjvmBjlH+328ULsNPwNMVHdkKo=; fh=p/+L0Odm18RRMlFO3Np611soLgx+p9X23e419/JuZ6o=; b=nSaztphcf5BLKYfVOulPiE1rs/cxD090OoXWfMkjuVYeY6Ju6NBX99wlmK1LRcDgfk IIwTaG5zt/TkvlZ+mxqKsU32diE8Lmo28vy2nluOK0AYHQuf29MHfX7UtSP0Rl3zKauh GAtyJ/cHFDRubFOo84dMENxnpoaSPIf4mhZSSw0KzOcs+Xh1nnmd6J2Q/1MNavH75R9F al7mcpUYFx8CUkjm/tqQr6l37zQNOv0dfz/bwRta9cK0H5I4UPYQfuo75dhRH2QG1VW9 g2g4v1jB6yA1rincOX7QLNYysG0oHpH5KtjaweZuRn5grCU9slwUc/QHAWc0RI2dforT vjCQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="d3d/SGSh"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4536a0c8355si35167081cf.619.2024.08.16.00.25.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Aug 2024 00:25:07 -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="d3d/SGSh"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1serJ5-0007G8-Qk; Fri, 16 Aug 2024 03:23:31 -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 1serJ4-00079J-1h for qemu-devel@nongnu.org; Fri, 16 Aug 2024 03:23:30 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1serJ0-00041o-9y for qemu-devel@nongnu.org; Fri, 16 Aug 2024 03:23:29 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-7c3ebba7fbbso1386581a12.1 for ; Fri, 16 Aug 2024 00:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723793005; x=1724397805; 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=Ek2SH+eIGTE6kXSOvmjvmBjlH+328ULsNPwNMVHdkKo=; b=d3d/SGShkXUefdLSt0+gzNOudjjOguduOiflw0+b4mU8BXXVZ5UY4HPBXN20KtD7FE BVlXyk1SlwlY6vFKtpAGx/lGK3+lWIOmcz2OEQvQowUPeOkklSSODd4vnjL10o7zJ0lr yNsycirNjbLXVVSl2nk8/JeQBlCNE1q+3aBkJvptAUtb1WETQDor8cLzCi8FIt2ubWtq p1K+BJiySDwqp9oAbNQLhqlaTFZJq1xaJWK3FHrn4/uREjBLdavlzyk1vacoyrffkt6P r1XfI2kJKPdSEOxR469kSTQtjudOp0bgXhnR/mbTGJH6E905Yic2seFoNPgb4b6zETCz PHaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723793005; x=1724397805; 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=Ek2SH+eIGTE6kXSOvmjvmBjlH+328ULsNPwNMVHdkKo=; b=CLzgc3yIiBAwOUjFV0YI1HKdBdcRGIVZnUnn58nwoUfz8WIp59/4FaMsLgG8ebXQQJ 45Fbq9FKrpE8ZSoIBE54F2vdq+e2dM69zN5SJ2ug9NhoqWe0FLB5rfprkHTI1xs4kCM0 Er4NWEIHer3XDPon0nfJK6WlyfhEfaddDa35BdsEH6ExlbFR9QZXTpQrtBFl25nHo4t6 LijODobx26rp24PzB+Yw3HDju+oJBQ+O5xioANQCaIDM41hQhOWnhGsaYMWGImYzfdyE Z4Jep8lXbE3E0SqYBOLQdH9bnuOViyZ3kqF4swRk/MAC57Ix8g8TG7r1Gc4aTGVAtxv2 pgsA== X-Gm-Message-State: AOJu0Yz/k5wPPVVRAIilaPwIwgnIokBUEdyACGjQo9ZzMujR313be/Cv o0J9V5xAY+1wui2TSeLSInMGEb4zE4MD1OQNYwMYKeWx2x1e4JmajtPzJGIhyWPbr8jae1QEQ+U ZLyI= X-Received: by 2002:a05:6a21:392:b0:1be:c6f8:c530 with SMTP id adf61e73a8af0-1c904fc9f79mr2892997637.26.1723793004727; Fri, 16 Aug 2024 00:23:24 -0700 (PDT) Received: from stoup.. (2403-580a-f89b-0-1b6b-8c7b-90f9-144f.ip6.aussiebb.net. [2403:580a:f89b:0:1b6b:8c7b:90f9:144f]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201f037588esm20195525ad.171.2024.08.16.00.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 00:23:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: chauser@pullman.com Subject: [PATCH v3 3/6] target/sparc: Populate sparc32 FQ when raising fp exception Date: Fri, 16 Aug 2024 17:23:08 +1000 Message-ID: <20240816072311.353234-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240816072311.353234-1-richard.henderson@linaro.org> References: <20240816072311.353234-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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-bounces+patch=linaro.org@nongnu.org From: Carl Hauser Implement a single instruction floating point queue, populated while delivering an fp exception. Signed-off-by: Carl Hauser [rth: Split from a larger patch] Signed-off-by: Richard Henderson --- target/sparc/int32_helper.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/target/sparc/int32_helper.c b/target/sparc/int32_helper.c index 6b7d65b031..fb6f3799c8 100644 --- a/target/sparc/int32_helper.c +++ b/target/sparc/int32_helper.c @@ -21,10 +21,10 @@ #include "qemu/main-loop.h" #include "cpu.h" #include "trace.h" +#include "exec/cpu_ldst.h" #include "exec/log.h" #include "sysemu/runstate.h" - static const char * const excp_names[0x80] = { [TT_TFAULT] = "Instruction Access Fault", [TT_ILL_INSN] = "Illegal Instruction", @@ -116,22 +116,9 @@ void sparc_cpu_do_interrupt(CPUState *cs) qemu_log("%6d: %s (v=%02x)\n", count, name, intno); log_cpu_state(cs, 0); -#if 0 - { - int i; - uint8_t *ptr; - - qemu_log(" code="); - ptr = (uint8_t *)env->pc; - for (i = 0; i < 16; i++) { - qemu_log(" %02x", ldub(ptr + i)); - } - qemu_log("\n"); - } -#endif count++; } -#if !defined(CONFIG_USER_ONLY) +#ifndef CONFIG_USER_ONLY if (env->psret == 0) { if (cs->exception_index == 0x80 && env->def.features & CPU_FEATURE_TA0_SHUTDOWN) { @@ -143,6 +130,21 @@ void sparc_cpu_do_interrupt(CPUState *cs) } return; } + if (intno == TT_FP_EXCP) { + env->fsr_qne = FSR_QNE; + env->fq.s.addr = env->pc; + env->fq.s.insn = cpu_ldl_code(env, env->pc); + /* + * The sparc32 fpu has three states related to exception handling. + * The FPop that signals an exception transitions from fp_execute + * to fp_exception_pending. A subsequent FPop transitions from + * fp_exception_pending to fp_exception, which forces the trap. + * We do not model the fp_exception_pending state, but we do need + * to advance pc/npc to mimic the delayed trap delivery. + */ + env->pc = env->npc; + env->npc = env->npc + 4; + } #endif env->psret = 0; cwp = cpu_cwp_dec(env, env->cwp - 1);