From patchwork Tue Nov 5 11:19:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840762 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285112wry; Tue, 5 Nov 2024 03:20:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWmgbARCeG0eF+S3vowQZjVso03Vt0CX2+UBnT0pWZDrfBEBcNJ6V6XJRMiWjkogetQWmcSVA==@linaro.org X-Google-Smtp-Source: AGHT+IFE2dWlVhOluC9DP4P9km9LlU4llL/+YD5iUN8oRMHE0aFtnF5b4fnsqZbGJETyfFw61vSJ X-Received: by 2002:a05:622a:50a:b0:460:96b6:3b56 with SMTP id d75a77b69052e-462b876db1emr279672511cf.55.1730805639706; Tue, 05 Nov 2024 03:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805639; cv=none; d=google.com; s=arc-20240605; b=g1Cn6Us5HAmrN+KfSC1AQ75VY/IC27eSXUXLC8kN/L61kzP51vNVEUeW9Hfwx3u63P 445pCSLMz62F12MBeSzDVNmmSHerQMT/mKDYirvuHXvM94EROydrTk4CKmz1ZE5nKFye IPz0tbKq/iViJdKRGk2dWIq9Q0N6HxMFiI+hGthBwpghTfdoediA43dFJWMCYYrfpdON sk9tmWvbGLCfjXaU+94HYM/BpPl/yyvW/oDV8C7w8OTHLoYWl/lMAZ4x9C1pilk3Pj/E 42WfeGliIRjcEaRLJ5NQewObT9LDdAYLmFDdJekl8zHgPitQxsQN0rmUUSxkmVs4Cvyj WFNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=4pM4g7JscXIH8rzoftCOwYPedLpbaxY4XzpLuJz9zUQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=AV/6AH1lwIunsmt2YZt3u6rv2kasldhzjIqi2y0nVqgtA8gVmN3LAv8GlxgRfpTtIn D+fPIeI6LIjFOG8neCp/WawStEpnDkP8pT3dvHAPwcUWZyUZtWugwivnvQmQ8ICL/IGk O0DxEJdlstIbz37NGhl1AaxsC13j6+J2p3F42FEZ62R2/LarUJw/3xiVSADsoucT2nsZ 2adBWzxZgo/5c/ilmpOq8AVW5pOmvorobrEJlBVAIrrxhbKUS2/+5uwecXor3I2XCcYq n+CNfXK6iQyTkz6LymEgKSspO+iUhup2wucK1Vgjk2b/Zlt1HAtlFApQSNjxONf8HLu7 wE5Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rZpniMaV; 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-462ad0d21c4si126555131cf.172.2024.11.05.03.20.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:20:39 -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=rZpniMaV; 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 1t8HbF-0004Tb-Rb; Tue, 05 Nov 2024 06:19:53 -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 1t8HbD-0004Sn-Ov for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:51 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb8-000750-4t for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:51 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43161c0068bso45027365e9.1 for ; Tue, 05 Nov 2024 03:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805578; x=1731410378; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4pM4g7JscXIH8rzoftCOwYPedLpbaxY4XzpLuJz9zUQ=; b=rZpniMaVMxDFcZ4Ecp4jisDddbMff+jjX02kuSUlbhn5GrivBzrwa0DukNAdciwO4q lJfq4HNmTwFqE6P4CB2hqL4qWi6jiOKwUkqDek4khwpuEwscM6ukpl8sYGwn32OpaCRL lfKuYXTDcn5l3pKzSykHtE1TIsssyu6lhBcpsLhFStKL8zOQdn7RqAN9wkp5wNePLE5u sBgxMRg0GiKQIoWH92MDfbW53xDYgjFtUvcMeDcR4fFMlxRnhcP/UC4EOyn1d5wonrPM 0f7cZO2hXUzIXPjHiRbSBqoQa/ElGIUQB7zPQOkN2XTnWmVE5yQkT6ugbneoVwBXIUiD UHRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805578; x=1731410378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4pM4g7JscXIH8rzoftCOwYPedLpbaxY4XzpLuJz9zUQ=; b=UYa6jKpQv24LU/PDaKtdH6OmBdDNX1jxnveklegUTjbQP7OPS4ge2S1Cjnlxyv5RE7 thLWOfc7tJPej3sqQQ6gEP4+0CqVxpPvwXGS+sKpK8WTFfx7AakEZh9CfgTwGI1B5Bi5 abhLkCd+Bnn7JUAFq/ueLs8ke6DMzdRoR7UVr/fBHGAUmJkMU4k+64wSV7ivWvfdMDYH usLtWik8w7qPXP52psi+8fO8Nlw1iSq2owbpC2NR3ryCV5aATdinb2urs1tQD61aqCaf FcZM5zOoeZl95W9lvQhm7OkVD1ZoEFyihAu44veVIDCHkizTfu3fjUjrhz8fSwG3bERa iw0A== X-Gm-Message-State: AOJu0YyEDFEs8Hxoot4XAfQv9A27W/+eK4Mrp7xUmELgNvKAXZXpim6k SLiy1z/yYyRhdOiHUDezLAQn3DV8dAJBtHAeNSwK/0mSQEFwnPk0vOQe5JO8jMjXoWq+TYm//zN g X-Received: by 2002:a05:600c:16ca:b0:431:5847:f63f with SMTP id 5b1f17b1804b1-43283246cb4mr132750125e9.13.1730805578363; Tue, 05 Nov 2024 03:19:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/31] softfloat: Allow 2-operand NaN propagation rule to be set at runtime Date: Tue, 5 Nov 2024 11:19:05 +0000 Message-Id: <20241105111935.2747034-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 IEEE 758 does not define a fixed rule for which NaN to pick as the result if both operands of a 2-operand operation are NaNs. As a result different architectures have ended up with different rules for propagating NaNs. QEMU currently hardcodes the NaN propagation logic into the binary because pickNaN() has an ifdef ladder for different targets. We want to make the propagation rule instead be selectable at runtime, because: * this will let us have multiple targets in one QEMU binary * the Arm FEAT_AFP architectural feature includes letting the guest select a NaN propagation rule at runtime * x86 specifies different propagation rules for x87 FPU ops and for SSE ops, and specifying the rule in the float_status would let us emulate this, instead of wrongly using the x87 rules everywhere In this commit we add an enum for the propagation rule, the field in float_status, and the corresponding getters and setters. We change pickNaN to honour this, but because all targets still leave this field at its default 0 value, the fallback logic will pick the rule type with the old ifdef ladder. It's valid not to set a propagation rule if default_nan_mode is enabled, because in that case there's no need to pick a NaN; all the callers of pickNaN() catch this case and skip calling it. So we can already assert that we don't get into the "no rule defined" codepath for our four targets which always set default_nan_mode: Hexagon, RiscV, SH4 and Tricore, and for the one target which does not have FP at all: avr. These targets will not need to be updated to call set_float_2nan_prop_rule(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-2-peter.maydell@linaro.org --- include/fpu/softfloat-helpers.h | 11 ++ include/fpu/softfloat-types.h | 42 ++++++ fpu/softfloat-specialize.c.inc | 229 ++++++++++++++++++-------------- 3 files changed, 185 insertions(+), 97 deletions(-) diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h index 94cbe073ec5..453188de70b 100644 --- a/include/fpu/softfloat-helpers.h +++ b/include/fpu/softfloat-helpers.h @@ -75,6 +75,12 @@ static inline void set_floatx80_rounding_precision(FloatX80RoundPrec val, status->floatx80_rounding_precision = val; } +static inline void set_float_2nan_prop_rule(Float2NaNPropRule rule, + float_status *status) +{ + status->float_2nan_prop_rule = rule; +} + static inline void set_flush_to_zero(bool val, float_status *status) { status->flush_to_zero = val; @@ -126,6 +132,11 @@ get_floatx80_rounding_precision(float_status *status) return status->floatx80_rounding_precision; } +static inline Float2NaNPropRule get_float_2nan_prop_rule(float_status *status) +{ + return status->float_2nan_prop_rule; +} + static inline bool get_flush_to_zero(float_status *status) { return status->flush_to_zero; diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 0884ec4ef7a..5cd5a0d0ae1 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -170,6 +170,47 @@ typedef enum __attribute__((__packed__)) { floatx80_precision_s, } FloatX80RoundPrec; +/* + * 2-input NaN propagation rule. Individual architectures have + * different rules for which input NaN is propagated to the output + * when there is more than one NaN on the input. + * + * If default_nan_mode is enabled then it is valid not to set a + * NaN propagation rule, because the softfloat code guarantees + * not to try to pick a NaN to propagate in default NaN mode. + * + * For transition, currently the 'none' rule will cause us to + * fall back to picking the propagation rule based on the existing + * ifdef ladder. When all targets are converted it will be an error + * not to set the rule in float_status unless in default_nan_mode, + * and we will assert if we need to handle an input NaN and no + * rule was selected. + */ +typedef enum __attribute__((__packed__)) { + /* No propagation rule specified */ + float_2nan_prop_none = 0, + /* Prefer SNaN over QNaN, then operand A over B */ + float_2nan_prop_s_ab, + /* Prefer SNaN over QNaN, then operand B over A */ + float_2nan_prop_s_ba, + /* Prefer A over B regardless of SNaN vs QNaN */ + float_2nan_prop_ab, + /* Prefer B over A regardless of SNaN vs QNaN */ + float_2nan_prop_ba, + /* + * This implements x87 NaN propagation rules: + * SNaN + QNaN => return the QNaN + * two SNaNs => return the one with the larger significand, silenced + * two QNaNs => return the one with the larger significand + * SNaN and a non-NaN => return the SNaN, silenced + * QNaN and a non-NaN => return the QNaN + * + * If we get down to comparing significands and they are the same, + * return the NaN with the positive sign bit (if any). + */ + float_2nan_prop_x87, +} Float2NaNPropRule; + /* * Floating Point Status. Individual architectures may maintain * several versions of float_status for different functions. The @@ -181,6 +222,7 @@ typedef struct float_status { uint16_t float_exception_flags; FloatRoundMode float_rounding_mode; FloatX80RoundPrec floatx80_rounding_precision; + Float2NaNPropRule float_2nan_prop_rule; bool tininess_before_rounding; /* should denormalised results go to zero and set the inexact flag? */ bool flush_to_zero; diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 4e279b9bc40..fae6794a152 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -390,118 +390,153 @@ bool float32_is_signaling_nan(float32 a_, float_status *status) static int pickNaN(FloatClass a_cls, FloatClass b_cls, bool aIsLargerSignificand, float_status *status) { -#if defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_HPPA) || \ - defined(TARGET_LOONGARCH64) || defined(TARGET_S390X) - /* ARM mandated NaN propagation rules (see FPProcessNaNs()), take - * the first of: - * 1. A if it is signaling - * 2. B if it is signaling - * 3. A (quiet) - * 4. B (quiet) - * A signaling NaN is always quietened before returning it. - */ - /* According to MIPS specifications, if one of the two operands is - * a sNaN, a new qNaN has to be generated. This is done in - * floatXX_silence_nan(). For qNaN inputs the specifications - * says: "When possible, this QNaN result is one of the operand QNaN - * values." In practice it seems that most implementations choose - * the first operand if both operands are qNaN. In short this gives - * the following rules: - * 1. A if it is signaling - * 2. B if it is signaling - * 3. A (quiet) - * 4. B (quiet) - * A signaling NaN is always silenced before returning it. - */ - if (is_snan(a_cls)) { - return 0; - } else if (is_snan(b_cls)) { - return 1; - } else if (is_qnan(a_cls)) { - return 0; - } else { - return 1; - } -#elif defined(TARGET_PPC) || defined(TARGET_M68K) - /* PowerPC propagation rules: - * 1. A if it sNaN or qNaN - * 2. B if it sNaN or qNaN - * A signaling NaN is always silenced before returning it. - */ - /* M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL - * 3.4 FLOATING-POINT INSTRUCTION DETAILS - * If either operand, but not both operands, of an operation is a - * nonsignaling NaN, then that NaN is returned as the result. If both - * operands are nonsignaling NaNs, then the destination operand - * nonsignaling NaN is returned as the result. - * If either operand to an operation is a signaling NaN (SNaN), then the - * SNaN bit is set in the FPSR EXC byte. If the SNaN exception enable bit - * is set in the FPCR ENABLE byte, then the exception is taken and the - * destination is not modified. If the SNaN exception enable bit is not - * set, setting the SNaN bit in the operand to a one converts the SNaN to - * a nonsignaling NaN. The operation then continues as described in the - * preceding paragraph for nonsignaling NaNs. - */ - if (is_nan(a_cls)) { - return 0; - } else { - return 1; - } -#elif defined(TARGET_SPARC) - /* Prefer SNaN over QNaN, order B then A. */ - if (is_snan(b_cls)) { - return 1; - } else if (is_snan(a_cls)) { - return 0; - } else if (is_qnan(b_cls)) { - return 1; - } else { - return 0; - } -#elif defined(TARGET_XTENSA) + Float2NaNPropRule rule = status->float_2nan_prop_rule; + /* - * Xtensa has two NaN propagation modes. - * Which one is active is controlled by float_status::use_first_nan. + * We guarantee not to require the target to tell us how to + * pick a NaN if we're always returning the default NaN. */ - if (status->use_first_nan) { + assert(!status->default_nan_mode); + + if (rule == float_2nan_prop_none) { + /* target didn't set the rule: fall back to old ifdef choices */ +#if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ + || defined(TARGET_RISCV) || defined(TARGET_SH4) \ + || defined(TARGET_TRICORE) + g_assert_not_reached(); +#elif defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_HPPA) || \ + defined(TARGET_LOONGARCH64) || defined(TARGET_S390X) + /* + * ARM mandated NaN propagation rules (see FPProcessNaNs()), take + * the first of: + * 1. A if it is signaling + * 2. B if it is signaling + * 3. A (quiet) + * 4. B (quiet) + * A signaling NaN is always quietened before returning it. + */ + /* + * According to MIPS specifications, if one of the two operands is + * a sNaN, a new qNaN has to be generated. This is done in + * floatXX_silence_nan(). For qNaN inputs the specifications + * says: "When possible, this QNaN result is one of the operand QNaN + * values." In practice it seems that most implementations choose + * the first operand if both operands are qNaN. In short this gives + * the following rules: + * 1. A if it is signaling + * 2. B if it is signaling + * 3. A (quiet) + * 4. B (quiet) + * A signaling NaN is always silenced before returning it. + */ + rule = float_2nan_prop_s_ab; +#elif defined(TARGET_PPC) || defined(TARGET_M68K) + /* + * PowerPC propagation rules: + * 1. A if it sNaN or qNaN + * 2. B if it sNaN or qNaN + * A signaling NaN is always silenced before returning it. + */ + /* + * M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL + * 3.4 FLOATING-POINT INSTRUCTION DETAILS + * If either operand, but not both operands, of an operation is a + * nonsignaling NaN, then that NaN is returned as the result. If both + * operands are nonsignaling NaNs, then the destination operand + * nonsignaling NaN is returned as the result. + * If either operand to an operation is a signaling NaN (SNaN), then the + * SNaN bit is set in the FPSR EXC byte. If the SNaN exception enable bit + * is set in the FPCR ENABLE byte, then the exception is taken and the + * destination is not modified. If the SNaN exception enable bit is not + * set, setting the SNaN bit in the operand to a one converts the SNaN to + * a nonsignaling NaN. The operation then continues as described in the + * preceding paragraph for nonsignaling NaNs. + */ + rule = float_2nan_prop_ab; +#elif defined(TARGET_SPARC) + /* Prefer SNaN over QNaN, order B then A. */ + rule = float_2nan_prop_s_ba; +#elif defined(TARGET_XTENSA) + /* + * Xtensa has two NaN propagation modes. + * Which one is active is controlled by float_status::use_first_nan. + */ + if (status->use_first_nan) { + rule = float_2nan_prop_ab; + } else { + rule = float_2nan_prop_ba; + } +#else + rule = float_2nan_prop_x87; +#endif + } + + switch (rule) { + case float_2nan_prop_s_ab: + if (is_snan(a_cls)) { + return 0; + } else if (is_snan(b_cls)) { + return 1; + } else if (is_qnan(a_cls)) { + return 0; + } else { + return 1; + } + break; + case float_2nan_prop_s_ba: + if (is_snan(b_cls)) { + return 1; + } else if (is_snan(a_cls)) { + return 0; + } else if (is_qnan(b_cls)) { + return 1; + } else { + return 0; + } + break; + case float_2nan_prop_ab: if (is_nan(a_cls)) { return 0; } else { return 1; } - } else { + break; + case float_2nan_prop_ba: if (is_nan(b_cls)) { return 1; } else { return 0; } - } -#else - /* This implements x87 NaN propagation rules: - * SNaN + QNaN => return the QNaN - * two SNaNs => return the one with the larger significand, silenced - * two QNaNs => return the one with the larger significand - * SNaN and a non-NaN => return the SNaN, silenced - * QNaN and a non-NaN => return the QNaN - * - * If we get down to comparing significands and they are the same, - * return the NaN with the positive sign bit (if any). - */ - if (is_snan(a_cls)) { - if (is_snan(b_cls)) { - return aIsLargerSignificand ? 0 : 1; - } - return is_qnan(b_cls) ? 1 : 0; - } else if (is_qnan(a_cls)) { - if (is_snan(b_cls) || !is_qnan(b_cls)) { - return 0; + break; + case float_2nan_prop_x87: + /* + * This implements x87 NaN propagation rules: + * SNaN + QNaN => return the QNaN + * two SNaNs => return the one with the larger significand, silenced + * two QNaNs => return the one with the larger significand + * SNaN and a non-NaN => return the SNaN, silenced + * QNaN and a non-NaN => return the QNaN + * + * If we get down to comparing significands and they are the same, + * return the NaN with the positive sign bit (if any). + */ + if (is_snan(a_cls)) { + if (is_snan(b_cls)) { + return aIsLargerSignificand ? 0 : 1; + } + return is_qnan(b_cls) ? 1 : 0; + } else if (is_qnan(a_cls)) { + if (is_snan(b_cls) || !is_qnan(b_cls)) { + return 0; + } else { + return aIsLargerSignificand ? 0 : 1; + } } else { - return aIsLargerSignificand ? 0 : 1; + return 1; } - } else { - return 1; + default: + g_assert_not_reached(); } -#endif } /*---------------------------------------------------------------------------- From patchwork Tue Nov 5 11:19:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840770 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285495wry; Tue, 5 Nov 2024 03:21:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8kUTKUAgclSiSPg4wOastW0VeEmDrGGks5vg0e7T8HVMCfae4AAQrw+jMO/fyB5IEU8v6sg==@linaro.org X-Google-Smtp-Source: AGHT+IGbKpQ0W26Lhc+i+IZ50eEPmSPT8OxcVjD5MMs1lVfOnk2lHKuJ6d7mWHWcqPMW1VSLmGQF X-Received: by 2002:a05:620a:1786:b0:79f:15ca:b782 with SMTP id af79cd13be357-7b2f24eff07mr2460373085a.35.1730805697166; Tue, 05 Nov 2024 03:21:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805697; cv=none; d=google.com; s=arc-20240605; b=KxHh9JMRhbKtQQxQ7eIp5SCOdcofN+lnkGSoNnv+jQqWpIWouwKeoD0Bu8/0xsmWLL YDGCvT+ym4U+ngEr95uAe3xrtcmv6z2/ReKObR7SgcJm3QL8tEUnP7Z97DIqMgSrPWrH ya47R8BbZKH4tNpFzMuxMBMsvR8K+bZ7uDmdwpsCk9oMc62oz/g4LJR4GFVQSrL+phaL rR5CmxMD0ihpB7aIzJnbj5mudgwf58h5pT7kDWz9uaYc8yqrMenCn3OSIQn74nTQeNtT 8DKm0HzvJ3KhsVJeR4mOmMaCkIvPvYskLNBfr9quwNzQV4ti4o7Nq8M9fJhMmdwdbatN z/Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=PpqwR/1H2EcJ1oj53HzNbcXsnQdNGMTHaKQ/8EPL8YI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XYp0hpD+yL3tMMcTIEJnoilaWyJ8NKNPLA7tk1H0GVOM00iyBTbNgtccJBuZqGV+FP 2FgT7EtnGlcmVg+HMVGpz/NeJHPa/LksWEeXlGOClG76cKP4PPuv4rIH0RRpj3k6Zpq6 9gxju9nywMIXEmGUAKl9fzlDmrsdV/XBxXMpR1YI5oqYOuIzu2GbSZhMfNqKFi8cT4UK RInX2h4ooJ9EdmaM5X8MqhFM88KPKFVGukNfPMIhllbnFv/C+QKM796nwS3FldmHP899 NkcEcuoVLfDfZLOjYdIHF6n3upORBnCqphgd+40x9gDUj9Fgflqze5lmwlUas6Krh1a9 1jIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SYUVtkAF; 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 af79cd13be357-7b2f3a04827si1330769585a.204.2024.11.05.03.21.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:37 -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=SYUVtkAF; 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 1t8HbA-0004RJ-1t; Tue, 05 Nov 2024 06:19:48 -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 1t8Hb7-0004QQ-JH for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:46 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb3-00074y-UK for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:45 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4315e62afe0so45657845e9.1 for ; Tue, 05 Nov 2024 03:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805579; x=1731410379; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PpqwR/1H2EcJ1oj53HzNbcXsnQdNGMTHaKQ/8EPL8YI=; b=SYUVtkAFtVW4ohN/yw6g3Afya/m+D3uSFKpHRmrQH2MjALQgigYJKNHIHPd95i8WZC yna82juLOWpWaGpRIC+vhYk+QjF8pY5cAYLmNbXnTi1KJe6+1ajBNEuUnUmLixxIyPGM 3w8Me6wvnvIzC7MKjD3UqFcNH8tsTlboOq3lCPhCVO7jpTsmZpj3jRj1g3gUC9F6KVdI X22OoGE/PbqW13yLO7srFP1hPDtgrPsQb5AidzBrYOQ4KoLTpw0LDRW47rQmeeoKePck MFM17eVJ1ozKifQMr1wIqU9Eft3UsnftZQW/0ycbrmbyMsP1IY0rzw+8tlW/Z5xo8ydi vi8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805579; x=1731410379; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PpqwR/1H2EcJ1oj53HzNbcXsnQdNGMTHaKQ/8EPL8YI=; b=bRVfAdXruOokAaSaFod1/X7PJg77IL0OObc8RNDJ04P5w+DkCUuvWjmLqj1Q5dcMiq tx3DAw5zu5vL/8rnXH+SwViZQWS8c6L6fzE5I5HUdoWEMoGzsGgippcJ6emquytJ4hRm yvnAf4cZqb7Xaw5PcgQRs1JlWNp+u5XV6OJ+DeC3DJ4AKCQGVuZiBnQEkmJnVVVOSSwm /kX8GR3+87q9xWiQfW/WZwHnfhZv9z4lnat6QqY2mFs2HMCI5yQEoQXBtmG+vlLpDeIV 3gdqLAE0mv6y3oPyJx1ILQjsdhRDEVnB2+X8fL/2oRKVT+xnqFI52Q5h5hFyTEreSRxd BU/A== X-Gm-Message-State: AOJu0Ywc97dOjdpOOe1Qgye3SQZNGXDgPGDHK1Qk7X5ybmaJpPv9+MEx 2x9ZlBnFSBKxpGQZ6ckcAkKnmBb36aXYCleATNEiJtWw3OMucy1QVE6fFZODVUNllHMOdpoHCS1 n X-Received: by 2002:a05:600c:44c7:b0:432:7c30:abe6 with SMTP id 5b1f17b1804b1-4327c30aceemr168130635e9.21.1730805578931; Tue, 05 Nov 2024 03:19:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/31] tests/fp: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:06 +0000 Message-Id: <20241105111935.2747034-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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 Explicitly set a 2-NaN propagation rule in the softfloat tests. In meson.build we put -DTARGET_ARM in fpcflags, and so we should select here the Arm propagation rule of float_2nan_prop_s_ab. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-3-peter.maydell@linaro.org --- tests/fp/fp-bench.c | 2 ++ tests/fp/fp-test-log2.c | 1 + tests/fp/fp-test.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c index 8ce0ca1545d..75c07d5d1f1 100644 --- a/tests/fp/fp-bench.c +++ b/tests/fp/fp-bench.c @@ -488,6 +488,8 @@ static void run_bench(void) { bench_func_t f; + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &soft_status); + f = bench_funcs[operation][precision]; g_assert(f); f(); diff --git a/tests/fp/fp-test-log2.c b/tests/fp/fp-test-log2.c index 4eae93eb7cc..de702c4c80d 100644 --- a/tests/fp/fp-test-log2.c +++ b/tests/fp/fp-test-log2.c @@ -70,6 +70,7 @@ int main(int ac, char **av) float_status qsf = {0}; int i; + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf); set_float_rounding_mode(float_round_nearest_even, &qsf); test.d = 0.0; diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c index 36b5712cda0..5f6f25c8821 100644 --- a/tests/fp/fp-test.c +++ b/tests/fp/fp-test.c @@ -935,6 +935,8 @@ void run_test(void) { unsigned int i; + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf); + genCases_setLevel(test_level); verCases_maxErrorCount = n_max_errors; From patchwork Tue Nov 5 11:19:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840767 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285347wry; Tue, 5 Nov 2024 03:21:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV4KmoJ5zS2asNl1vCnYdyul7oRqGyW4/sYrsHzvSj6KyHAwJGQwckE/p/UgbsZLfBeZjdbWg==@linaro.org X-Google-Smtp-Source: AGHT+IFHxa6aRRe6mWwYUPFajJPXk59Oj552PZ8KqP1EJILCIl6VbVSr9RVL7h4FRn2S4ZqARrjS X-Received: by 2002:ac8:5a8d:0:b0:460:a9ec:b50e with SMTP id d75a77b69052e-462b8755cf9mr221369561cf.38.1730805673882; Tue, 05 Nov 2024 03:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805673; cv=none; d=google.com; s=arc-20240605; b=jYz6limG8HVubOzjYIq1p25oMjefbzZl2jtqjJfHsSGjuILDphUqY1tzprkjlM+D6P AQf8EmZJX9f7BfEawcjpT8K6YyGYaa2zsQdqjsnGV784aTRSDqKzDz+IiT3PUIWFmuxc 4dcIujNCt9Vo9Q7o/+8gCKBLEvJZ/1b+Lfa7oZ62RVa1P7WZ/BsA3FpPshTW1cNRUFLm grnyjy3OP5UVhr0HIm25NGuekG10eBHvwsR1rNELaF8WJCwkeoz2W8I6mg0vanUt29lo 4aRMde7JcvGC8saKHk1SOmOujANLxZHFBbjEhZ5p0rBpAVDnOv3jFk2ABK0CW0Go7jUj arew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=SsKJm0cgG3cclmW2jQ7Wow6omeKg5AA44umCDXD6jSQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=biYr0/YDnNTkpU6fF6wj+cW0YUL89IkTtJ0ZLvqrOCTLY2zwA5jwvjo4UM1nCWTyOB i4altvt8bs3PfsgXTyLJ0iqCa3HornqON87y6jDYGwgDBJwD2GZLVfMpEvcbL/0Hhjze 64uVICpRzP80vbd+QH0yKAo2PmJs+CsECLkwIhrdOsMfthNKZ8vb9XXWA5amov3HbsB5 /OOGyh60NIfU0C8z6dFLaxxIfjZ0UjWFKrnzfVZHYnntpJ2U86cAjRjAvU33XVHnT9mp DvnjcxZNmb080e/SMd8Ambt2ki5fGo3I3vuUEiUbLqSuRrUid4M7d6OOied/sT9KKtdL pwhw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aw6w2Cpo; 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-462be13affesi106016261cf.392.2024.11.05.03.21.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:13 -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=aw6w2Cpo; 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 1t8HbD-0004SX-Lj; Tue, 05 Nov 2024 06:19:51 -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 1t8HbB-0004RY-1G for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:49 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb6-000751-FC for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:48 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so41098995e9.3 for ; Tue, 05 Nov 2024 03:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805579; x=1731410379; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SsKJm0cgG3cclmW2jQ7Wow6omeKg5AA44umCDXD6jSQ=; b=aw6w2CpoQUXCprwSkO9uo51gCWBdIQjF6yduYqQIAgqQ6MFqmsg1wJk1R99LNWkfgv H5KDPIoyR0NbZGMuEVsVYbb1E/b5/KpkVa509fCKP0suGZO+DonySA6ox5Wp4pV4aRKE EgUlEsGRyfrfmsOUJE36CIKjqm1O0gaJnUaP2qvo11ijo+tIZjAjffRuYhKRF45LL5w6 Eh4n53Tat9A6r/+OLec+2OLnMmkOuzy/TGfJPjG4KUiycGDanqxbui65LXUm/v2Pq0HR SuABph4yk9cRH8yATz5oLLvWD1PLQrNCx26wQyJGs6wHzXGyBhM2uKhU45/8x8h4jayg p+0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805579; x=1731410379; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SsKJm0cgG3cclmW2jQ7Wow6omeKg5AA44umCDXD6jSQ=; b=B+VsdU46D9lg/sKZoLPfVvj70l4GJxjcoTWGOmVEK1GSbCd+GQIghywOMNESH18bOn rnSml089dUFT0HK6fa0LszqeqOdC/NS8HT0MgpLS57hy+ktDGdoC2GoWzCqrgcCOyuep YKQVXVqEIgDxIWhyXxU+X06LvK2bED+c4gKtFi706smGZG5+UG7RgY1h2vUZHnRyEWRm M7dlrqAGHa1wEZSn8MYd6uxqG5A8l+vQbdXIJTwKpO9fys5uRbXik7QzS9QIeVtFRzIg sqAanZHRIvByDxCmRsMCayn5DvaM50wzarMCpsHY+GYRgy15l0OWeqWLMbzCfpqKxwgB Tj0A== X-Gm-Message-State: AOJu0YyuJHdhPd564toNymmJzOgSRA3VFpkscbZw/pOMUJ/m8o0ax4+z w2zfnAwVTeVNThrxPPbyAobRECTmck+tKIzoSZfCyp1hRZ5oCLA4UIkXzO81+NaEJwtpFL1s6dD g X-Received: by 2002:a05:600c:1f82:b0:430:57f2:bae2 with SMTP id 5b1f17b1804b1-431bb9d14afmr189910775e9.23.1730805579447; Tue, 05 Nov 2024 03:19:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/31] target/arm: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:07 +0000 Message-Id: <20241105111935.2747034-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 Set the 2-NaN propagation rule explicitly in the float_status words we use. We wrap this plus the pre-existing setting of the tininess-before-rounding flag in a new function arm_set_default_fp_behaviours() to avoid repetition, since we have a lot of float_status words at this point. The situation with FPA11 emulation in linux-user is a little odd, and arguably "correct" behaviour there would be to exactly match a real Linux kernel's FPA11 emulation. However FPA11 emulation is essentially dead at this point and so it seems better to continue with QEMU's current behaviour and leave a comment describing the situation. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-4-peter.maydell@linaro.org --- linux-user/arm/nwfpe/fpa11.c | 18 ++++++++++++++++++ target/arm/cpu.c | 25 +++++++++++++++++-------- fpu/softfloat-specialize.c.inc | 13 ++----------- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c index 9a93610d245..8356beb52c6 100644 --- a/linux-user/arm/nwfpe/fpa11.c +++ b/linux-user/arm/nwfpe/fpa11.c @@ -51,6 +51,24 @@ void resetFPA11(void) #ifdef MAINTAIN_FPCR fpa11->fpcr = MASK_RESET; #endif + + /* + * Real FPA11 hardware does not handle NaNs, but always takes an + * exception for them to be software-emulated (ARM7500FE datasheet + * section 10.4). There is no documented architectural requirement + * for NaN propagation rules and it will depend on how the OS + * level software emulation opted to do it. We here use prop_s_ab + * which matches the later VFP hardware choice and how QEMU's + * fpa11 emulation has worked in the past. The real Linux kernel + * does something slightly different: arch/arm/nwfpe/softfloat-specialize + * propagateFloat64NaN() has the curious behaviour that it prefers + * the QNaN over the SNaN, but if both are QNaN it picks A and + * if both are SNaN it picks B. In theory we could add this as + * a NaN propagation rule, but in practice FPA11 emulation is so + * close to totally dead that it's not worth trying to match it at + * this late date. + */ + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &fpa11->fp_status); } void SetRoundingMode(const unsigned int opcode) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5b751439bdc..6938161b954 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -168,6 +168,18 @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, QLIST_INSERT_HEAD(&cpu->el_change_hooks, entry, node); } +/* + * Set the float_status behaviour to match the Arm defaults: + * * tininess-before-rounding + * * 2-input NaN propagation prefers SNaN over QNaN, and then + * operand A over operand B (see FPProcessNaNs() pseudocode) + */ +static void arm_set_default_fp_behaviours(float_status *s) +{ + set_float_detect_tininess(float_tininess_before_rounding, s); + set_float_2nan_prop_rule(float_2nan_prop_s_ab, s); +} + static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque) { /* Reset a single ARMCPRegInfo register */ @@ -549,14 +561,11 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status); set_default_nan_mode(1, &env->vfp.standard_fp_status); set_default_nan_mode(1, &env->vfp.standard_fp_status_f16); - set_float_detect_tininess(float_tininess_before_rounding, - &env->vfp.fp_status); - set_float_detect_tininess(float_tininess_before_rounding, - &env->vfp.standard_fp_status); - set_float_detect_tininess(float_tininess_before_rounding, - &env->vfp.fp_status_f16); - set_float_detect_tininess(float_tininess_before_rounding, - &env->vfp.standard_fp_status_f16); + arm_set_default_fp_behaviours(&env->vfp.fp_status); + arm_set_default_fp_behaviours(&env->vfp.standard_fp_status); + arm_set_default_fp_behaviours(&env->vfp.fp_status_f16); + arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16); + #ifndef CONFIG_USER_ONLY if (kvm_enabled()) { kvm_arm_reset_vcpu(cpu); diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index fae6794a152..70cd3628b54 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -402,19 +402,10 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, /* target didn't set the rule: fall back to old ifdef choices */ #if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ || defined(TARGET_RISCV) || defined(TARGET_SH4) \ - || defined(TARGET_TRICORE) + || defined(TARGET_TRICORE) || defined(TARGET_ARM) g_assert_not_reached(); -#elif defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_HPPA) || \ +#elif defined(TARGET_MIPS) || defined(TARGET_HPPA) || \ defined(TARGET_LOONGARCH64) || defined(TARGET_S390X) - /* - * ARM mandated NaN propagation rules (see FPProcessNaNs()), take - * the first of: - * 1. A if it is signaling - * 2. B if it is signaling - * 3. A (quiet) - * 4. B (quiet) - * A signaling NaN is always quietened before returning it. - */ /* * According to MIPS specifications, if one of the two operands is * a sNaN, a new qNaN has to be generated. This is done in From patchwork Tue Nov 5 11:19:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840772 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285670wry; Tue, 5 Nov 2024 03:22:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUSJ2QzzWK37oPrPJIofIf4CM8wl4vS3pKK5IgDFNu8j60I0T9THnlJCcU/vuB3Pa86DGgoCA==@linaro.org X-Google-Smtp-Source: AGHT+IEYi0ArVteU4Bep0yNi3Y7bwpTxprAnd+jg2OLuGhnnJY2Nviaor8mf2GkQLVm5eKTtQJAT X-Received: by 2002:a05:6102:32c2:b0:4a4:886e:e1ea with SMTP id ada2fe7eead31-4a9542eb129mr17445146137.9.1730805724767; Tue, 05 Nov 2024 03:22:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805724; cv=none; d=google.com; s=arc-20240605; b=TZDKmJLBYirUVs4BN4jEyMUsaN17RUfjBPYMY9/Ym2zKIy6ImqbZ7mS01Y3EY599iA Ii3z6fa3jbxE8kcik2DZbMwTP1dPHX/krZ48N5J+QF9G0chfwnOOtBG+rth19dLbWLWE hbgXNDXrM+DTb8JIuGmRDZ0n9r2F7Hl1Kh174c6mJ7AJ4cKjw8eV9HRdbKIx6kVX8Y/q Kp8QcNG4BnikImMPENbt7Ob0dlwKiuxDoGSzx5t1m6Es4Ah82sJFU08g5Qh1teY9dSKl T3Q6kv1MguxK0C2S/dEYIflRL7wubLNpEHeYcDeiLHZ6E+iI/4u8Zf6IEgdweMpSAF8J zK1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=Xz2c4FWC4m4OfIHVNBzr5/hraJmE26SETciSZUO8ixw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=OshOgH596LRK2hBbznXjMywtHVUwIyN+I9NL233Syae3I/ujpD+jnzWhZnhBajFK4Y qdYg0+5xpkk2ggyDt1j8oVwmDMHb5HCcVUah6UAPKeBQRSCqyPaFh/Fk8irFHlmU645E ywTwE9hIvAwBLs7aBc1OJa9ffUSkp6ZgaTGVKK4F5yC6VtQfep0D6CE+Iw8oZkpn1F/Y +1LkRjxd7hFSx3OWV9vVU5LPRymUucT1sOjub358cUuonZcv7NzVI2laFce4QB9FrWAo I+WV0LFVWa4ZG1sJqCZlvj4E5NUb9PNMJP8qzm1QzwjvclSWJBfABl4BeDS6Q0tGrGkH TAsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Usod8Tze; 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 af79cd13be357-7b2f3ab12fdsi1446596285a.567.2024.11.05.03.22.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:22:04 -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=Usod8Tze; 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 1t8HbA-0004RV-Kl; Tue, 05 Nov 2024 06:19:48 -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 1t8Hb8-0004Qo-HM for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:46 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb5-000754-AH for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:46 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-539fe76e802so6123558e87.1 for ; Tue, 05 Nov 2024 03:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805580; x=1731410380; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Xz2c4FWC4m4OfIHVNBzr5/hraJmE26SETciSZUO8ixw=; b=Usod8TzeFkKfK+aRAsfSVlW2Npskf6cNUQdOpU5/eFkhoWfClPtIEtrE1u9zSXzLpT TutL2nGv26mAatEZHeE026H7S+yrd4YKU86vDC2S+dUaUOV5i8+YTAP+bpcmgaHlJE/4 3kvh8ERFjE83voM9RF02p7n6XiW1OLloxpsey1rtWPeB+EPrmaLbbqLBgrqvB1uF4TS/ dquHfsVYMi9VAPOlLXt/nphJS+2iTUdM0SvEO/X3xm2zP+3r5uVkitedgbW/AmRdmM/X I06/2CusmXPwk71+B7fZY0KTfVomSLDITenuk0wnx9n9H8ub5FrBoLi5tBaeuPdrSz2/ rR+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805580; x=1731410380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xz2c4FWC4m4OfIHVNBzr5/hraJmE26SETciSZUO8ixw=; b=t1IbQdximgOCxQt041mTLyHci/7DEZSYGW8eQkc/IuF3FM9q6C8KoUtiAWFyxDLwde AyA18l2ihWnD8f+h+GkhHr9NJBY+RONlAp7AxEAGxqaJ3GAq6LuPfCj0floWRYlzrhZZ YkBa0DrOpRy/q+Qp6+M3pdeebnWBbMbmpttHyC1FxUYRSRQqPL7GOSy/i+2MhBYHFzhp Gxcd7dJIh22w6zsoaVO6fykxdpWaqNqFsFHJvvcD3uGPreZ/B+7JgDcDOpK0WNqGqf7y XjBBJ/9X17CZ+//Xafytjd2g/YHOKW1FrM5bWcG87IdWRoDPPe/A1BmkHNkA2oRa0Ola nf4w== X-Gm-Message-State: AOJu0YyhYQshjvrfjSUTY9xOebjabV9WUVR0pN+JCwnlIpC0EWtQf8gS oSZ38YOMxCRifD1FbHB19JamQLafdjwwQr30qH9Pxs/ByWn+7nQLTLuWOISEulcMmmx4wlU4E+C 4 X-Received: by 2002:a05:6512:b11:b0:535:d4e9:28bf with SMTP id 2adb3069b0e04-53d65e12357mr7811286e87.46.1730805580065; Tue, 05 Nov 2024 03:19:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/31] target/mips: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:08 +0000 Message-Id: <20241105111935.2747034-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x136.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 Set the 2-NaN propagation rule explicitly in the float_status words we use. For active_fpu.fp_status, we do this in a new fp_reset() function which mirrors the existing msa_reset() function in doing "first call restore to set the fp status parts that depend on CPU state, then set the fp status parts that are constant". Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20241025141254.2141506-5-peter.maydell@linaro.org --- target/mips/fpu_helper.h | 22 ++++++++++++++++++++++ target/mips/cpu.c | 2 +- target/mips/msa.c | 17 +++++++++++++++++ fpu/softfloat-specialize.c.inc | 18 ++---------------- 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h index ad1116e8c10..7c3c7897b45 100644 --- a/target/mips/fpu_helper.h +++ b/target/mips/fpu_helper.h @@ -44,6 +44,28 @@ static inline void restore_fp_status(CPUMIPSState *env) restore_snan_bit_mode(env); } +static inline void fp_reset(CPUMIPSState *env) +{ + restore_fp_status(env); + + /* + * According to MIPS specifications, if one of the two operands is + * a sNaN, a new qNaN has to be generated. This is done in + * floatXX_silence_nan(). For qNaN inputs the specifications + * says: "When possible, this QNaN result is one of the operand QNaN + * values." In practice it seems that most implementations choose + * the first operand if both operands are qNaN. In short this gives + * the following rules: + * 1. A if it is signaling + * 2. B if it is signaling + * 3. A (quiet) + * 4. B (quiet) + * A signaling NaN is always silenced before returning it. + */ + set_float_2nan_prop_rule(float_2nan_prop_s_ab, + &env->active_fpu.fp_status); +} + /* MSA */ enum CPUMIPSMSADataFormat { diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 9724e71a5e0..d0a43b6d5c7 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -407,9 +407,9 @@ static void mips_cpu_reset_hold(Object *obj, ResetType type) } msa_reset(env); + fp_reset(env); compute_hflags(env); - restore_fp_status(env); restore_pamask(env); cs->exception_index = EXCP_NONE; diff --git a/target/mips/msa.c b/target/mips/msa.c index 61f1a9a5936..9dffc428f5c 100644 --- a/target/mips/msa.c +++ b/target/mips/msa.c @@ -49,6 +49,23 @@ void msa_reset(CPUMIPSState *env) set_float_detect_tininess(float_tininess_after_rounding, &env->active_tc.msa_fp_status); + /* + * According to MIPS specifications, if one of the two operands is + * a sNaN, a new qNaN has to be generated. This is done in + * floatXX_silence_nan(). For qNaN inputs the specifications + * says: "When possible, this QNaN result is one of the operand QNaN + * values." In practice it seems that most implementations choose + * the first operand if both operands are qNaN. In short this gives + * the following rules: + * 1. A if it is signaling + * 2. B if it is signaling + * 3. A (quiet) + * 4. B (quiet) + * A signaling NaN is always silenced before returning it. + */ + set_float_2nan_prop_rule(float_2nan_prop_s_ab, + &env->active_tc.msa_fp_status); + /* clear float_status exception flags */ set_float_exception_flags(0, &env->active_tc.msa_fp_status); diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 70cd3628b54..c60b999aa3d 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -402,24 +402,10 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, /* target didn't set the rule: fall back to old ifdef choices */ #if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ || defined(TARGET_RISCV) || defined(TARGET_SH4) \ - || defined(TARGET_TRICORE) || defined(TARGET_ARM) + || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) g_assert_not_reached(); -#elif defined(TARGET_MIPS) || defined(TARGET_HPPA) || \ +#elif defined(TARGET_HPPA) || \ defined(TARGET_LOONGARCH64) || defined(TARGET_S390X) - /* - * According to MIPS specifications, if one of the two operands is - * a sNaN, a new qNaN has to be generated. This is done in - * floatXX_silence_nan(). For qNaN inputs the specifications - * says: "When possible, this QNaN result is one of the operand QNaN - * values." In practice it seems that most implementations choose - * the first operand if both operands are qNaN. In short this gives - * the following rules: - * 1. A if it is signaling - * 2. B if it is signaling - * 3. A (quiet) - * 4. B (quiet) - * A signaling NaN is always silenced before returning it. - */ rule = float_2nan_prop_s_ab; #elif defined(TARGET_PPC) || defined(TARGET_M68K) /* From patchwork Tue Nov 5 11:19:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840787 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286342wry; Tue, 5 Nov 2024 03:23:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVH4/ED9u/agovzYrRjTtO6n3aK4FL+QEVD+Zf1ewLiWoLvYdaQ/f+hMv1p+gsYSLlRGavZrw==@linaro.org X-Google-Smtp-Source: AGHT+IGhLZ5Xn/GmI0PDJ9GV3yQosns7uGIteOq6vvDQgDnVY2mtBqOWzBFfoYVG70UnTIcZhW0s X-Received: by 2002:a05:690c:2906:b0:6dd:bba1:b86d with SMTP id 00721157ae682-6e9d8939dbbmr247785847b3.10.1730805837759; Tue, 05 Nov 2024 03:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805837; cv=none; d=google.com; s=arc-20240605; b=C7DJggk67etUZcGXKEediegRezg4NfIrb5pE5tJDCr7HyZgsFedZz7GwsBT7fFApBe 6m1gmn1nd1d1m08JYNWsGwgadK3luIDs7b2vF6DJlEU5pcP7nx2QjdrmYE5mbNf+Be1H 7q2WIabxoXTzFNNVL9tIX5rBzEc3ZKSrricc7b6n/1TDLBnIUSfk61PTfiwWPqmRa56r VaQZ0ash1P5RuwROGxqhI+GkqjEcoZYiL/fPTyZRqqie2Gw8zdBtI/30DDIGn4Wfm8xk oaO76vVcnaLKK9AVXuWeZca1fYattvjMw5UEZihsbGF35dwqppynAmCo4oScEHYeeujn z7Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=PnNrin2zutii5G605GsXXECDkzBjAbg43NyhdUJVqpQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=BdK0j4gWi7z/NIfZBHJwoDHWvofm2j/kddgGXP0je3gHcFBgDxWRixpkuc9A4qksd7 Xo15pwmlq4KC3HXFMjRT4+AC7m1gMnT71xy3z1wqaTLAya3VGBzReZ8y9IO4Bu9gZtUS XVD3nVWl8TwQ6eTUl12JDV99XSFovVzjocuv122aSh4z1Y6LAQODcibK4FDqhxzzKW4n M6jJcCA5MweI/neC2jHMtT7akR7MLTRMlAAduNi94WBQRAt3visn1ZkzNZQoplHHFX2i c9IB2aapG5uEGzUX0hZYkmcxrh/BHr7m+4jR6m8yf6UQnpiqLas8wCse5vrY/MeD7rw9 e5QA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XAbjdke6; 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 6a1803df08f44-6d353fa834fsi137297026d6.94.2024.11.05.03.23.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:57 -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=XAbjdke6; 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 1t8HbG-0004Te-Fq; Tue, 05 Nov 2024 06:19:54 -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 1t8HbD-0004SZ-Gu for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:51 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb7-000759-Kj for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:51 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so47251965e9.1 for ; Tue, 05 Nov 2024 03:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805581; x=1731410381; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PnNrin2zutii5G605GsXXECDkzBjAbg43NyhdUJVqpQ=; b=XAbjdke6kd1zmQT8+fvcuF3dLAIrSBw9XCpotNbN97JLwg2wWsspix9QuAPkS5m7f3 mkzmITX0tTCA5DhJP8cPXQje47fSu967HfRR3xEbJtYZXivco13IP9OFNYYCwfXCtK39 OfIiRntEJd3uPWyHbbrH+H5VS0SzOH6WNqXHpBThDf+9HmaU01Kr71/x+20k1addmYY0 QbqioYOclQj6VaKCqWaHK8DiPxhQyM1tr405W4LjpJF3CRiwifdRsMUUZiukmWmmnlEy Sol+3ld54r/d2UrsHaxXMcj2AG1Ax26/cK0OJWorNowBkGCTGK38klv+bQ+RRtZU3fqX rmKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805581; x=1731410381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PnNrin2zutii5G605GsXXECDkzBjAbg43NyhdUJVqpQ=; b=elbIyzxHokx3rCLn0RRibdUXeIHgfFeuJhkpd1wDFrepqe9Ng4cV1RE8QU1aLzCn+U japc6GcT73vqGHgrBubAHhiDuNSKeFl/K8FYkU6znExlHmukWJUQVR3LdrMhY93JCg3z xmm9qB9mSNADNLAsUL0t3eEOC5rah7WM7sxf965ngXgS+trhuhKEkwyntfQ9IDEcW0xC CHu1shp2bJI8RgmFMNx4bE+p3GRvxqFcq8eQ60beiI4SLaAYdR56zy+vdQQl1CFxUsYi tNTDlOQVoLUKbH/3OBitUoraXeRWIJAzWj3+xhlA0eDzUL4XH2UZ2Lkb8ILhBh3Vx6Oy MRyQ== X-Gm-Message-State: AOJu0Yy8mvfb1CUN6OZCwUWFu9S1tQ/hmy0r4FsYyIL9M1wrDKkPGu4s jogunaSwI58kIHfDV86444Uyw155AkqvgYZ/Ql1H6/OSkeIrSgnzwjcILqkhkZRT2g9f9FmuDWg T X-Received: by 2002:a05:600c:3b14:b0:42c:de34:34c1 with SMTP id 5b1f17b1804b1-4327b6f9590mr164576825e9.2.1730805580619; Tue, 05 Nov 2024 03:19:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/31] target/loongarch: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:09 +0000 Message-Id: <20241105111935.2747034-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 Set the 2-NaN propagation rule explicitly in the float_status word we use. (There are a couple of places in fpu_helper.c where we create a dummy float_status word with "float_status *s = { };", but these are only used for calling float*_is_quiet_nan() so it doesn't matter that we don't set a 2-NaN propagation rule there.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-6-peter.maydell@linaro.org --- target/loongarch/tcg/fpu_helper.c | 1 + fpu/softfloat-specialize.c.inc | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/target/loongarch/tcg/fpu_helper.c b/target/loongarch/tcg/fpu_helper.c index f6753c5875b..21bc3b04a96 100644 --- a/target/loongarch/tcg/fpu_helper.c +++ b/target/loongarch/tcg/fpu_helper.c @@ -31,6 +31,7 @@ void restore_fp_status(CPULoongArchState *env) set_float_rounding_mode(ieee_rm[(env->fcsr0 >> FCSR0_RM) & 0x3], &env->fp_status); set_flush_to_zero(0, &env->fp_status); + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status); } int ieee_ex_to_loongarch(int xcpt) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index c60b999aa3d..bbc3b70fa9d 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -402,10 +402,10 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, /* target didn't set the rule: fall back to old ifdef choices */ #if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ || defined(TARGET_RISCV) || defined(TARGET_SH4) \ - || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) + || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ + || defined(TARGET_LOONGARCH64) g_assert_not_reached(); -#elif defined(TARGET_HPPA) || \ - defined(TARGET_LOONGARCH64) || defined(TARGET_S390X) +#elif defined(TARGET_HPPA) || defined(TARGET_S390X) rule = float_2nan_prop_s_ab; #elif defined(TARGET_PPC) || defined(TARGET_M68K) /* From patchwork Tue Nov 5 11:19:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840765 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285318wry; Tue, 5 Nov 2024 03:21:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhx6jnxt9eElVfuoyyOVsRflElgRat9ImkFwhm2fsiQ/bJvf63uWaD0jFK/uq2JmJ7fmzVOQ==@linaro.org X-Google-Smtp-Source: AGHT+IFVCCJ/ofPirQeSFW8WVSOy8w5mOoBX+p9tCsZ+ULjOSL9Xpcw8s5m1C3JTFCt2Vt4YxwYv X-Received: by 2002:a05:6902:1409:b0:e30:d6eb:fd16 with SMTP id 3f1490d57ef6-e30d6ebff7emr18664509276.25.1730805669958; Tue, 05 Nov 2024 03:21:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805669; cv=none; d=google.com; s=arc-20240605; b=Gg8nKcqR8BZxX6Fuocf3I9AE/q1BOQrDVxczNREGwn1ZSmKc4/j1E+qfaEN2w6pdEl pcx5Iy2lauk6rbszSHeMn0E65hs1JfXncXqo4DrDO22zwsNT5qU2jhr2IGo3sg1juUiU LSLbTKjfb0/d2Id+RthKYhR27y7knCT4C+MA06MrLkrfdFLfOM4T+1zsWIvfS++OgMri Ns0OKPPfAbKnU81qNEl9mjoeRBTCm3FAcR3Rzk2lKpxwAetn+OwaAAx92nGbJJyPZGgR id2UnEMqkchsnTw2zlHhRfP9e4dG+3xD79AWVWUeG63wtQzG5UJEWW63lf6I/70Fs+F2 ht1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=1ITym5U3J9cuAVSZN3O87UN4hyjdbTQKA+1cJNNI3AY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=OLZR8XKJL3Efws9CPJ8t8I+oHU7uZCkVf2uD7cpJ7jmjXaQ16N8lcKJdt5S/BXJ6jc kkgiAP3J/tZg8YB1YzpMpBxbv/TqAI9e0JwwBqhpfW5bdZ2zhkFYpC072iCiBU+OCYqf IV0gRrqsX6T358GWAEZDoNVePnI3bQWoqNmMH+Z5IN4lk21a7bBy6XK8yMkieQD7dTnr ouKp4uJdp9quOKPSynDUgJ6G98Km7fJELKet9zOKNeDTPhEx7MtU9dCMVS6EVKO4MH1a AwD8tBTQOVuN7lQ8H2yENoLBQ9UgKnNsN5kOqAc/Ab8PAGEnGcQdMM4ngx04QHWv+GSh Cf0A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jG1AbU13; 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-462ad0d20e9si141446521cf.222.2024.11.05.03.21.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:09 -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=jG1AbU13; 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 1t8HbB-0004Rf-KG; Tue, 05 Nov 2024 06:19:49 -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 1t8Hb9-0004RM-U1 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:48 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb7-00075H-1p for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:47 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43162cf1eaaso63303525e9.0 for ; Tue, 05 Nov 2024 03:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805581; x=1731410381; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1ITym5U3J9cuAVSZN3O87UN4hyjdbTQKA+1cJNNI3AY=; b=jG1AbU135apmnC9jNo7x6hgjx4jHgOryrRhYZZU8J3JY44+PV5x7799mCSILrrH3Bx +pjiyLZVAaG5I5XFsYfh3FK/3QHER25MLfFbPUuBOXKES3ScWzkNOP06pBpbGuoALK3C /XqX3WCafrS4uxSigiXkJJjrKmg2qESZ46PgeE2Q/8JkC8v6clpMzUXoU0WBAXA6Svlx xyHVzDms6Lg8ouwc2PgU4PfgQcnlS0hS9VIm3z86s2BvdJLDcgY5HNMt3RhtAjtm5YGM Ys7hJvOXoi8AicYvDIUuJfJZKw8oFheXb/p/AwJiM/+z1mVpE1RoTJ8T6tYBGbE+WSQ6 OOSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805581; x=1731410381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ITym5U3J9cuAVSZN3O87UN4hyjdbTQKA+1cJNNI3AY=; b=nj21cBtpw0HTIpDiLXGAkEcMTvWFPwkFAH02zeOd5tJPp4bMRUTx5m5dPM0HEh8VZy tGGe0WQixX6n0Sx7mlDsw31Ec8NGVzd933yDr7pDPgUBwIIKX7F6epFf4Amg04S2qh0o 5bidHio0FAHwuypjrzAhV1/4d4keyFjPmNMV0TNa2TSXTpEffqJlt3Zk6mijzQDIpnbg ISrYbz/rY6jeFVA9g8IfKMKSf1RE+T3nXzyxOeyPYmBXEGfMM8BLiJa270s82hGHjSX3 kOjg95KTxsQG+SfYsag9cdIZwDR+oB6gjnM6zSfexcCiOfkcKm+0SPIvtbsM4uhtSwJC Cxmg== X-Gm-Message-State: AOJu0YxeHdqAho5RG+T92hQFmbTKf+IX0J6PmEi0hpsL3iTxe1oq/kpp QuRKg4koGL2MJR9jaEa6zYyUcEiYU4EcBaehnfuUpzFAGMn6Grk2LR5ij9XJcbpmW09SRMvZdwB T X-Received: by 2002:a05:600c:5486:b0:431:52cc:877a with SMTP id 5b1f17b1804b1-43283296066mr165633785e9.34.1730805581139; Tue, 05 Nov 2024 03:19:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/31] target/hppa: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:10 +0000 Message-Id: <20241105111935.2747034-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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 Set the 2-NaN propagation rule explicitly in env->fp_status. Really we only need to do this at CPU reset (after reset has zeroed out most of the CPU state struct, which typically includes fp_status fields). However target/hppa does not currently implement CPU reset at all, so leave a TODO comment to note that this could be moved if we ever do implement reset. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-7-peter.maydell@linaro.org --- target/hppa/fpu_helper.c | 6 ++++++ fpu/softfloat-specialize.c.inc | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c index deaed2b65d1..0e44074ba82 100644 --- a/target/hppa/fpu_helper.c +++ b/target/hppa/fpu_helper.c @@ -49,6 +49,12 @@ void HELPER(loaded_fr0)(CPUHPPAState *env) d = FIELD_EX32(shadow, FPSR, D); set_flush_to_zero(d, &env->fp_status); set_flush_inputs_to_zero(d, &env->fp_status); + + /* + * TODO: we only need to do this at CPU reset, but currently + * HPPA does note implement a CPU reset method at all... + */ + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status); } void cpu_hppa_loaded_fr0(CPUHPPAState *env) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index bbc3b70fa9d..4e51cf8d083 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -403,9 +403,9 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, #if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ || defined(TARGET_RISCV) || defined(TARGET_SH4) \ || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ - || defined(TARGET_LOONGARCH64) + || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) g_assert_not_reached(); -#elif defined(TARGET_HPPA) || defined(TARGET_S390X) +#elif defined(TARGET_S390X) rule = float_2nan_prop_s_ab; #elif defined(TARGET_PPC) || defined(TARGET_M68K) /* From patchwork Tue Nov 5 11:19:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840780 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286212wry; Tue, 5 Nov 2024 03:23:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXKq5mmKM4Wky++WuydxbdZoOj4k5+xZoYlHxxws4P/VFccafVHVY93iiH5B52BR1eSFx5jVA==@linaro.org X-Google-Smtp-Source: AGHT+IGkRmKMpnU7cViQqZHHqZ+EFw5cGG8iBjVMQEelOkULzdQ2YhydyWBmMt4q+9DRhjAVK/3v X-Received: by 2002:a05:620a:1a9f:b0:7b1:48e0:de3 with SMTP id af79cd13be357-7b1aee52673mr3086201885a.58.1730805813667; Tue, 05 Nov 2024 03:23:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805813; cv=none; d=google.com; s=arc-20240605; b=lk9wkIzyVIdeCoh31TNKxIhH3//9ulER5SG28Ax3aJq+kPwNpaNfLeD2/7U8sGd9yo hTCZSlSMEcn0QIYH6hv/aKE/zQ2TPCtOqTmeXT3dvnwDT7bmlSFLpkdY1zNwuxbGJ3S5 L/kLCpCtrqRq3i0W6T0JTC8uQAKohYDi4jMOwxZQH6rWEHqEVUvnmxSXOVqtkmj793wy VjhRTLxkjsuntipKDrqYQUjqiafck2teFujHVHr9i54Yta1b4j+Buu73CgKuuLFqiHzt ZYLc9Gv5Lk4EVT2mwCtmbAys7L2HSPjfIdLG6QhTbXFM7nS6xidnIUtAIxEHl8AiHYra ZiYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=fPC7kSUfAWbQOqemhG63/yTJ4GpbFp+SBxN/5tQNobY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VMANjRhek5TWUgDJOkslUzFDKFAq5oUI+gQvo4AoyDyNrPv7jL857N4iHdj2tRZBZW mh9LZO1hDIfOwGvrKoUevk7jq3gh7mX5x52eKyJsf6cCscAXfRpY37iwJ8N0uFOo8/uk CV0VaFrQZRiXVEO0XO5g7/rJ15p4xP8xCQ1YcdJb0chSXsKsV6yfjxsX9qArbmjr3mDJ /uxnOut+sjNypu+F2ezdW3cmNdJRwv0XVQ5IW525GoZGGKlCeKWkWo+AezW2NU2Ce2kL TVnioUmP+Eks9OXuyWtgXcXcgfgUD+aKFqBMQD7oafE50TLXFdzDCbawcEVzMvgaQsxG hNdw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dzOgXCcg; 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 af79cd13be357-7b2f3ad117fsi1346984285a.702.2024.11.05.03.23.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:33 -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=dzOgXCcg; 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 1t8HbH-0004UB-LX; Tue, 05 Nov 2024 06:19:55 -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 1t8HbC-0004SH-L8 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:50 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb7-00075O-0N for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:50 -0500 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-539f4d8ef84so6731376e87.0 for ; Tue, 05 Nov 2024 03:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805582; x=1731410382; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=fPC7kSUfAWbQOqemhG63/yTJ4GpbFp+SBxN/5tQNobY=; b=dzOgXCcgHEW+8rxmzgs0Vzjz0pkcTioDTpRNs0AYS+572n16EII4kp5sCtGl4VucKY 769TfT3xddNPOAqu9WqSDdr9w66nwXRvDVVR0+QmuHMriiD9O+vIk3Lu+WBnzzVEkQt7 cMipmIxLp2YesQZpKCSPhDiHHY/D2tWGeqG5WqjLVMRfD+PEUb48uX3gUhfdeM1u1Cvn xHtwemrRBK53XkcP07bH2McoEv38QpOzasO0ioKnqzUvG260dU4I+AvmP2uP2ci1MJtc Z9WvcSnnojB5ka+MGZWPLZfg66EEHrXVIPTYuGGrGrmzj7hjwAChSbGuH29cAi7F622D lyZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805582; x=1731410382; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fPC7kSUfAWbQOqemhG63/yTJ4GpbFp+SBxN/5tQNobY=; b=WvM7bNXVH9j1TKOV3kyixAvOf6KX/yEeMWRYviWmVUbKpXdUKJlolYpjHOMv1WMGTK hvNaXqvzbtSOO7ajHsCyffHQpe7VHgdh4O+cqxI6K7Qf1F5kS/FGlaw6WTIsDxqKo5Jw 7KMh+1av/mbzPkAFVl3d1JTFQUlGK7K8wvwJAEfemvRksRndnD+M+FzFYTpMXltvBVkm tNRLAasB7TAenmQJpkZqR8HxjvXbNf8rDm9e7Q/JjQkP6G8zqAitiwWZUnWOlx8v67Ku krVhx+APogOo9NN9P6jh1pk6xFwKETESpa4ROv/JwaIKeZZ8/9oRU3YanmWFBTxB9uo2 Gmlg== X-Gm-Message-State: AOJu0YyU9tU0Irm8hRK4MbbEJVUrJFezJZ/EqCr8vpwiy3iYZB5uWnU3 u+nihVaUQUvY+dDWCXsVP+i2turLszqyqZYbNns7xw82ExzKHbkUZZyrJbmUJGf8bFBGij5yPTo 5 X-Received: by 2002:a05:6512:2398:b0:53c:74a7:43e1 with SMTP id 2adb3069b0e04-53c79e2f714mr9855513e87.13.1730805581677; Tue, 05 Nov 2024 03:19:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/31] target/s390x: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:11 +0000 Message-Id: <20241105111935.2747034-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12c.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 Set the 2-NaN propagation rule explicitly in env->fpu_status. Signed-off-by: Peter Maydell Reviewed-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-8-peter.maydell@linaro.org --- target/s390x/cpu.c | 1 + fpu/softfloat-specialize.c.inc | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 4e41a3dff59..514c70f3010 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -205,6 +205,7 @@ static void s390_cpu_reset_hold(Object *obj, ResetType type) /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, &env->fpu_status); + set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fpu_status); /* fall through */ case RESET_TYPE_S390_CPU_NORMAL: env->psw.mask &= ~PSW_MASK_RI; diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 4e51cf8d083..a0c740e544d 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -403,10 +403,9 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, #if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ || defined(TARGET_RISCV) || defined(TARGET_SH4) \ || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ - || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) + || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ + || defined(TARGET_S390X) g_assert_not_reached(); -#elif defined(TARGET_S390X) - rule = float_2nan_prop_s_ab; #elif defined(TARGET_PPC) || defined(TARGET_M68K) /* * PowerPC propagation rules: From patchwork Tue Nov 5 11:19:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840771 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285542wry; Tue, 5 Nov 2024 03:21:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV9ZLYx4YgSI5yPcwxEZ+EZThxw/BXZi86wIz5709wrPWuOkYivafGKhCoEM51goynuTIUcAA==@linaro.org X-Google-Smtp-Source: AGHT+IH9uHx9OyDTAxO9A+DRrIIDp0IGmNVeK3v+OzR7utHoCy9Fn6N8xpM1naMDp9iy/QAi7+AY X-Received: by 2002:ac8:5d47:0:b0:460:ab1b:a16d with SMTP id d75a77b69052e-461717000bbmr384396851cf.27.1730805704562; Tue, 05 Nov 2024 03:21:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805704; cv=none; d=google.com; s=arc-20240605; b=K6BetHvMhdsY8U+gxBUMvGw7RxXq0cepRwBjjPDipuxlrIKv7muvj86MhpoajtvyJ7 6CvycCfZW4Fw9AA8pyrqlmXBxy7D6NgAlKIVZiUnNAUi64bF5tqiVSKgjjP8FBFX09yD 0AyRZODvrgWe7EXiYit/uZaJVMGEtqa9XH5QNQhwEyUKOUSKXxbeRJTPjwK53/eolQQM NFgIUTwrdnIUjecFkoIHpvwm16wxHFkzIXjwrLgSMmYooRxY9IOTI799v2BoU9XCe8Ez ihwUNQp7PNOqb7W6yGOHK51iACnukSQrnaHfxEFf7ELEvpMRrlKE/qSIkegrIpc1vtrk OWlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=gAa7nG8JV8MJXxE6NvLX8mZwE6oSHiLMecKFbVo5vN8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=kXJBWpROQJAPd1v/bfEb7wjjoBFBf1ugz1inflqqvX1ucRzFRzgwjz7q0ekecjQ37v ltGwwHwypG2brP3XvMfXbwRgQl1ddcQjs96z2FkdLv+7kHgsNN83yBTusNBo36dITF21 wG8T4e7Y+N4E7ip5aysEl+XdiM1b+uYy4f+OVm8wlBccrveFxiExr9LutSpenZchx3Ck b84jpq1dKfeCY1jokbfjT8Y2CPluRCSoZSAk9YSKTlSEqZkVbNYzOC56N+YUwVj3Gyak 4PA0BTUo9sP9ISw3tjfElucFEb3TinBQscIwL69CFdX57XBHSA4WMMItx/A58s99VEpW sy/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mDfpy8dq; 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-462ad0b4705si130511621cf.22.2024.11.05.03.21.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:44 -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=mDfpy8dq; 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 1t8HbK-0004Va-4N; Tue, 05 Nov 2024 06:19:58 -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 1t8HbH-0004UA-Dj for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:55 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb7-00075V-1o for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:55 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so47252225e9.1 for ; Tue, 05 Nov 2024 03:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805582; x=1731410382; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gAa7nG8JV8MJXxE6NvLX8mZwE6oSHiLMecKFbVo5vN8=; b=mDfpy8dqOX5pF47aDLTTstM4YdSQ3aNKJ0V1Ybe8oZ7yciAW7eC9KkCiWTDJZ20h6o mmZ/q5lGkiwkXIn+keq/0lZcbt1FKYTPADdJP5cjG5n5VkC/ow7brjRZJ6gUe5CziZ1B /5zjtWdmHJodEAVCx5LNv341pq0jWBG+gaU2MZU4JEN5Ur9mm+RyHzVSUIhBj+haEHnX 42myPRqBOKv4gOgGkf63BWdhWy5OP5px9D77OkcHuQD8Dn1pzZtNmLJTwfoApU6Sp9BX VHn9asWPBN/LVYheZabpQ5hemKeRJpJaMQYh1VIO6NBF00Ii/8oJYW7fTeWnx5NAPSoq 0i8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805582; x=1731410382; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gAa7nG8JV8MJXxE6NvLX8mZwE6oSHiLMecKFbVo5vN8=; b=P2b60Xd7GzI/E3S2M4v4JGgLmA8SUgEh+yfjZDugOSGJqYDzH+owwAIXzWJlbhRwrP MvSc5g7LDQFynY3ZLKEcfdHuQ51CWEt1GzecEANBOgluQDJc5RX2hl1m6luSZPqy6gVt FNw3/VsdFhI/mQah0rubafSS/bBjCYss8VB+4Yfg2R3SAGJ8rgLuN/6I/2Sx+J/wZMov HF1dfts1KZRobMeTR35QRYkNDJacuNEwatAZIvF61PyFD+/4fRldwgrEhWmz0C8Nd/Fj jvZqhrf1/im90MqtbOeaSyto6Kjq5POU0MxnRjCvsbUSApgPIodA0MWIgex7nTbbHS1r j8tQ== X-Gm-Message-State: AOJu0YwkiqxMjJtNsM7hP2jkTmVIEmBJnlYe5XQPA1vt+jXuOBvnz7F/ DggOQuo0T63XhQ8mds/Io7R979YB8onDzhzEvSbVCOi67od5lvM2IBkTbbrm7PgYdxhE1yxAAxL v X-Received: by 2002:a05:600c:190f:b0:431:6153:a246 with SMTP id 5b1f17b1804b1-4327b6fd999mr166925635e9.13.1730805582193; Tue, 05 Nov 2024 03:19:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/31] target/ppc: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:12 +0000 Message-Id: <20241105111935.2747034-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 Set the 2-NaN propagation rule explicitly in env->fp_status and env->vec_status. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-9-peter.maydell@linaro.org --- target/ppc/cpu_init.c | 8 ++++++++ fpu/softfloat-specialize.c.inc | 10 ++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23881d09e9f..5c9dcd1f857 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7326,6 +7326,14 @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type) /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); + /* + * PowerPC propagation rules: + * 1. A if it sNaN or qNaN + * 2. B if it sNaN or qNaN + * A signaling NaN is always silenced before returning it. + */ + set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status); + set_float_2nan_prop_rule(float_2nan_prop_ab, &env->vec_status); for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { ppc_spr_t *spr = &env->spr_cb[i]; diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index a0c740e544d..8e3124c11a6 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -404,15 +404,9 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_RISCV) || defined(TARGET_SH4) \ || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ - || defined(TARGET_S390X) + || defined(TARGET_S390X) || defined(TARGET_PPC) g_assert_not_reached(); -#elif defined(TARGET_PPC) || defined(TARGET_M68K) - /* - * PowerPC propagation rules: - * 1. A if it sNaN or qNaN - * 2. B if it sNaN or qNaN - * A signaling NaN is always silenced before returning it. - */ +#elif defined(TARGET_M68K) /* * M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL * 3.4 FLOATING-POINT INSTRUCTION DETAILS From patchwork Tue Nov 5 11:19:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840782 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286235wry; Tue, 5 Nov 2024 03:23:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUi+K/GG/AeCeh+rxtmAdyP8HMJNojylmUFL6FkDn53wDTyJhdpdkGrEF5g0Z863ISVr4SZ4Q==@linaro.org X-Google-Smtp-Source: AGHT+IFHY4R76YD/8eqnOT/Q5gd/9LRB/V+k0K5W3QNd6qYlBc+mevt7G0AlyR8SM9sNOnVAmvk/ X-Received: by 2002:a05:6214:5705:b0:6cc:58c:8f39 with SMTP id 6a1803df08f44-6d351b2f4dbmr266961056d6.44.1730805818403; Tue, 05 Nov 2024 03:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805818; cv=none; d=google.com; s=arc-20240605; b=FlmcLdHyybwWkfzS+FMPe4jGyT/Hsn1rzVYVHGc/OtBbZMHRBKimdwVIb0YGAHQ59P Joe41RKRhVj9LDOe/PUYgNU4E4LEg/8SshL797n965IkVoLQfU5Z0vUfsHT7TTj+AAvq 9BKIQqoNUEjAfSjx16EDxfjpX1JGpuf8uayOKdszRveArJ3Y7nuIlEvDG02PjC8Ps4u+ NmCZQndkc0QMo0+PRqoDStvPOsB4Pqo9OZ0REZ5vxi/EpKUQpH40j2leXzxBwlMeHbYE sJPtB084Pbh4QTmLh7eFJpUl6QWZoYSU+kpyB8HyFRwh/vO19prTsIxLkew5unyU+RlZ Pzsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=T+YjZ1qgd1ODXhl25u0D0zFyemAxEawOWnnVFrkVnTc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=KIKmvR+SQpbbwAWLLDGyRqXgLQ4MiVjMu0aRFaksKARcypjRjoE06OGM4Hr82l57di JgnqcO+gi+iqfbkWuBdvLh6Tjr7iEIcbbB5n7pfKtm75NRGGkOemabtKd0T6JW2URCQz a3WNIDpSSNs/l8NMBmpRZHqmleiGmtx2+nI7+w2pfN0JptjeruTFCMsrwAk1l5KpSMt0 Ar4yUuj5SewAtRe3xdVWp+dDcTNyj4NYsZkf4XiKrFYxj08Immv51BNG5r/hBhgBQ6Xa kFzpV462WCjW1Kq/3evJ0Bz4dj8OY5j4OksDXdcC/h4rGWdrjfGFLwXg0DR0Z+/Gv0I8 /U2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v9C/Xmfw"; 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 af79cd13be357-7b31d2c2785si51230285a.145.2024.11.05.03.23.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:38 -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="v9C/Xmfw"; 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 1t8HbE-0004T5-IR; Tue, 05 Nov 2024 06:19:53 -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 1t8HbC-0004Rl-8X for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:50 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb7-00075a-TD for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:49 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so47350065e9.0 for ; Tue, 05 Nov 2024 03:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805583; x=1731410383; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=T+YjZ1qgd1ODXhl25u0D0zFyemAxEawOWnnVFrkVnTc=; b=v9C/XmfwYWZrPP3vQGqCAN5kIW66xGsiAJjZvG4hAmd27yXveoM/slkdRYVj1pPKg1 TY7nfD9JtBnNbZlYR1b+ED1TYdKHbcrL9VCd2mUYr5SdtmtIxwe43wLcf3cBfGOeKFCn rG2GpCe6Jg7howRTLm0VUkgtxA5yohSTRYH8BovM+malQiRKSjxpBNZrji2OA0GIwqxI d5Kp2gjXv8O4hBIxkkpq6FbuFlR8/rmBPI5yS+pDnRLPMBmQOtqz9AzBfs6f3GBtH/jd 0Fn71ecE3zHngo6la/qFEYqt1c0Wk3AZ2MaEcFRvASAk2AC6WgI4q/khipw+K1hf7B1I bkYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805583; x=1731410383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T+YjZ1qgd1ODXhl25u0D0zFyemAxEawOWnnVFrkVnTc=; b=c/cyc0ovJNsnwFVzpOXifu8hIoWyN2M6bPxUdt/UZV1rUfRvco3p4aoF2O4Ya3aoFR 0diTiTxGN+h/U+CGdWqnFmRZnxLvyZQfUmAPkb7azLcySDo5wqtVW1ZU8xUHL22soWUB jtE4aibR0KhabKgK5AoTiiICEoV8DF/8qdXVux92dDZWRaasS3P5fz32uZjySPTL8nOv tde5S8jjKpeHEG6um8JI9Fo7UiqgE70GkdA4AHdZSve0xnSU+0UXnQyproONQCnn4CbD lrFlAXhJyeUTr6ROWjcg9CUFZ9ADHwdkXkUtH+bmh85D52gUHDYX3i1/UF8avu7i3hc4 MAXA== X-Gm-Message-State: AOJu0YxjI9RLfaW35Zv3XOU0iTS978zVdXbAbJqTB/gWeIXLZvOnQRhO tlmALqZi346AtNd9yPqhGzMb344STqQ/qsQSMvKCDomykUlaF7PdjZxSM5cJzO89ZEGhAhuBLRV 3 X-Received: by 2002:a05:600c:4f8a:b0:431:51e5:2316 with SMTP id 5b1f17b1804b1-4327b822402mr163588725e9.34.1730805582733; Tue, 05 Nov 2024 03:19:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/31] target/m68k: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:13 +0000 Message-Id: <20241105111935.2747034-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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 Explicitly set the 2-NaN propagation rule on env->fp_status and on the temporary fp_status that we use in frem (since we pass that to a division operation function). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/m68k/cpu.c | 16 ++++++++++++++++ target/m68k/fpu_helper.c | 1 + fpu/softfloat-specialize.c.inc | 19 +------------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 1d49f4cb238..5fe335558aa 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -93,6 +93,22 @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type) env->fregs[i].d = nan; } cpu_m68k_set_fpcr(env, 0); + /* + * M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL + * 3.4 FLOATING-POINT INSTRUCTION DETAILS + * If either operand, but not both operands, of an operation is a + * nonsignaling NaN, then that NaN is returned as the result. If both + * operands are nonsignaling NaNs, then the destination operand + * nonsignaling NaN is returned as the result. + * If either operand to an operation is a signaling NaN (SNaN), then the + * SNaN bit is set in the FPSR EXC byte. If the SNaN exception enable bit + * is set in the FPCR ENABLE byte, then the exception is taken and the + * destination is not modified. If the SNaN exception enable bit is not + * set, setting the SNaN bit in the operand to a one converts the SNaN to + * a nonsignaling NaN. The operation then continues as described in the + * preceding paragraph for nonsignaling NaNs. + */ + set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status); env->fpsr = 0; /* TODO: We should set PC from the interrupt vector. */ diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 8314791f504..a605162b71f 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -620,6 +620,7 @@ void HELPER(frem)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1) int sign; /* Calculate quotient directly using round to nearest mode */ + set_float_2nan_prop_rule(float_2nan_prop_ab, &fp_status); set_float_rounding_mode(float_round_nearest_even, &fp_status); set_floatx80_rounding_precision( get_floatx80_rounding_precision(&env->fp_status), &fp_status); diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 8e3124c11a6..226632a4d10 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -404,25 +404,8 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_RISCV) || defined(TARGET_SH4) \ || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ - || defined(TARGET_S390X) || defined(TARGET_PPC) + || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) g_assert_not_reached(); -#elif defined(TARGET_M68K) - /* - * M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL - * 3.4 FLOATING-POINT INSTRUCTION DETAILS - * If either operand, but not both operands, of an operation is a - * nonsignaling NaN, then that NaN is returned as the result. If both - * operands are nonsignaling NaNs, then the destination operand - * nonsignaling NaN is returned as the result. - * If either operand to an operation is a signaling NaN (SNaN), then the - * SNaN bit is set in the FPSR EXC byte. If the SNaN exception enable bit - * is set in the FPCR ENABLE byte, then the exception is taken and the - * destination is not modified. If the SNaN exception enable bit is not - * set, setting the SNaN bit in the operand to a one converts the SNaN to - * a nonsignaling NaN. The operation then continues as described in the - * preceding paragraph for nonsignaling NaNs. - */ - rule = float_2nan_prop_ab; #elif defined(TARGET_SPARC) /* Prefer SNaN over QNaN, order B then A. */ rule = float_2nan_prop_s_ba; From patchwork Tue Nov 5 11:19:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840791 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp287022wry; Tue, 5 Nov 2024 03:25:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU7TQWqrh4NPheSNhfEU3HgIyKNzhk0d6wMDAZkWW8q3HXpuslbs1CrgUP+WDbkhqOV2u3GLA==@linaro.org X-Google-Smtp-Source: AGHT+IFhfwCEEOva7sllKwOJoxjHmQ+8Sd7aLQjSMvA9rXmeaYitK5aaDZrU0sOHL3mkHNV0T7ss X-Received: by 2002:ac8:58ca:0:b0:461:db6:b939 with SMTP id d75a77b69052e-461716a1133mr282610441cf.12.1730805956743; Tue, 05 Nov 2024 03:25:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805956; cv=none; d=google.com; s=arc-20240605; b=YQ0G9TytHf1H8OPIm1MTAt5wujNy2r4UylEnflFjaPpqSvs9Xc1GAEguG1FNjZQrXv RyglPSKY+MON14oL8C9LaH/7dcPOuZEjWQFAIe2EBCB84VM6jrm4jlSmu3u2yyj5jO8r WLVKFWYcSKqYGK+nomGYBVL4pyLd1Tu4u3+G4Xmy967Dll9zBCkcgviGUZmdZKLj7wk1 LGrt7EBU+x5TZnGVxuSqB5HLq6uqBKnB87O0SwWDjkbF4dqFl3xs+CzozEbKxINDEqnA drMM32NPqMwdCMp8s45JGCZgV5YK8HgSimYCEPDCp/7YyWsfp01eGOYm6G2sk2JnZX65 IPSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=4CpB0XbZQLncselzyyj8L+Ydlxu2Z7NIO+QmbjnCCQ4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=E6yMrCo6sqHw/AXKxL8nF9lyLLjh3BnFUdpljLE3zvmhnzx+EqGDmUYgm8oNW++Gea eZ24UK7TUs58FPJ4WIO7BHybex7aKk0LVqRiQ50jj2AuafNj/ucsJ0TRlP8Pu5wlMZfw bN0Ns+2L7PPf2UjPzW4SfHEnBjuY8Ar79Fh+/5Gf4yRoerjzqYmAeiwVdvNMbStePSVP Z7n84AA3bL9QU1bHBLJqQBnks4oSGcyrNGDQK8LXSdCkU5Ey+VFpCOduDOd73iUqefyL eo+/Il7lPBriJUwi0PVOove6pm2QiQJZUqOup1u5B718bAwPs8XjXC1H8+jJGPxfYSMQ 7tmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z7RuK1bV; 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-462ad0d0768si148415911cf.189.2024.11.05.03.25.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:25:56 -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=z7RuK1bV; 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 1t8HbI-0004UZ-N2; Tue, 05 Nov 2024 06:19:56 -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 1t8HbE-0004TS-Qd for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:53 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb9-00075j-7Y for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:52 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-431ac30d379so43593975e9.1 for ; Tue, 05 Nov 2024 03:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805583; x=1731410383; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4CpB0XbZQLncselzyyj8L+Ydlxu2Z7NIO+QmbjnCCQ4=; b=z7RuK1bVXxL3OF5gUx4lemw9FYwALvtg55ON7sr19qhjaYnOk6tnCU2qCSIhoyi7aP 0c4A21Jg1jv78KPC205McRz1NlvBBhg0mPZDa4Y289dbmZp7J0+sCnD4QA5ObCrteMxA 2q0hM4ZTXz/CSov1jQh2UhZVukOUHrvVENGAXmzEDOIl9e/T8kF3OlgiIrStCuBEVPHT AmoxtbEIQJ1K3rmEMDZTBUbB7tdKz5ROlWP3mHt9j6xOdWMBVs8bw3LjS455HAEmHFpC I4kvgZe09lhBla3C4AX1mLg3Kg4WG3o4Ag2Y6rF3mQshPnSusuhQmswNNBJ00p3xcer2 pMPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805583; x=1731410383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4CpB0XbZQLncselzyyj8L+Ydlxu2Z7NIO+QmbjnCCQ4=; b=JBUrHt7p1WyQN28L6s8MXOrEcxTqCDlGBdxSPrRIYJ2CZFShiOYXGbejV/fbeWsktS O88qY6Ld/rAVi7yZjoUOiguC1llwH8zBDzEYft2nMbuSoJxOih38HMXvFIhSQXOOvQAw elJCxqRkWB8WUOraVlhecY9EPM/UpVmkb9CQYFZqSOgMDfXAKqKCa9EBirtOqRTPqhr3 ExKyx+eooREZxMfji0/sIudTEbhJV723ki+YxA0i4YrK7KX1oytTAgaWvj3/7vZmojWF daZJ3FqNFrouoDjq7IoVIbxN7q5r2N9J602ZJyppS23RGLhzd/NEsxvmwUpp/vmDrfi5 vROw== X-Gm-Message-State: AOJu0YzhYE3649NELdsfGOlk80eA2uPfXsDYMiqGwxzbU+akZBj4q7Zz FDY0Qn5aJrefBD8//w8BmipxYos4ekAPaZkUizwEiFYRtoeTLbR4uBEIWSYe8fWvOZxvaKKsY8z D X-Received: by 2002:a05:600c:34cd:b0:431:157a:986e with SMTP id 5b1f17b1804b1-4319acb8d3amr283664825e9.20.1730805583224; Tue, 05 Nov 2024 03:19:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/31] target/m68k: Initialize float_status fields in gdb set/get functions Date: Tue, 5 Nov 2024 11:19:14 +0000 Message-Id: <20241105111935.2747034-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@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.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 In cf_fpu_gdb_get_reg() and cf_fpu_gdb_set_reg() we use a temporary float_status variable to pass to floatx80_to_float64() and float64_to_floatx80(), but we don't initialize it, meaning that those functions could access uninitialized data. Zero-init the structs. (We don't need to set a NaN-propagation rule here because we don't use these with a 2-argument fpu operation.) Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-11-peter.maydell@linaro.org --- target/m68k/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 9d3db8419de..9bfc6ae97c0 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -36,7 +36,7 @@ static int cf_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n) CPUM68KState *env = &cpu->env; if (n < 8) { - float_status s; + float_status s = {}; return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s)); } switch (n) { @@ -56,7 +56,7 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n) CPUM68KState *env = &cpu->env; if (n < 8) { - float_status s; + float_status s = {}; env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s); return 8; } From patchwork Tue Nov 5 11:19:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840781 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286226wry; Tue, 5 Nov 2024 03:23:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX52AgIn0sJZciOe5UQlROjem0ICP74Q0y9qsNXuIc3xm/Zsvcv9NVDGyQ/HTYWj4932k1Ykw==@linaro.org X-Google-Smtp-Source: AGHT+IGgljqp2vUQT6J/IkItCbMkk55VYJS/6oaYWrK7LBLJyPzeo0auyXIBiBDXzKvbxKysAfkD X-Received: by 2002:a05:622a:18a1:b0:460:ae0f:4708 with SMTP id d75a77b69052e-462b86579fcmr234117781cf.1.1730805817548; Tue, 05 Nov 2024 03:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805817; cv=none; d=google.com; s=arc-20240605; b=RU+DeFuKhutGosTovUe5aeOdIZoPGdx0VCUxY0cbteZzUKf4dnhokwsvoxVceWJ5Wr P2bIaltJUCc/xTvrxE8TWxwkuBu6Fj/qc/ZQ5n3lgdkGMBdp6ZE7LflXD9NFX3YgXAcd EyK026uGr+AOg9i3MTZ9YBoJCNILUx2SAZurZ+XYTBSIpVG5+pKQM/6GY3O96+WSPrJa xJJN16RkEML5u8BFnuV634ECHP+QBVT9KvHNU4HwQgIsI/24zGcJ+fdRUojNKSMhmMDV ewxO6N5/7pvi8FRQuUEaUci1LF78P+JvQ3bL+JnEnmcDHdyO9/YltLq2054Z7EdADJ16 GK8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=nlatDknV/aBfEnJ/+F3868r6flWSi/PVuWVtl184IcQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=BRMpY/tpk6BgbN3Jljw6LL3NhgmjICz3pxoNdoDaLCiR6JFgO43Hhg32SqE9sFvtDL vkLYRyIHOQTz1uzEM4WJvoZ74yfgpLeGOeiAcInY3SXYbTC8CnTRYRJtW9yhU1arUXHw qPKK32GvqQR/9mPSO5LsCvwybmgBxT7Nwtiglgp0Kr/Nn1gRXY8VO9KliPy6GHUDh+Xm tW4dJPX8nyWazv8h+OVt6SWI/vUWacH2y5pvjr+ZlrMB5hwz42yClW7VyWgMrxFuNdLQ /5L1TlO4eGg4RDrLmnMu7uRMVeFF4hoqsDF6VFE/lcG12wl6sTjg2TAVTY+Vg7Cdh68o 50jw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="B/i+lgDj"; 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-462ad27aed9si129028361cf.726.2024.11.05.03.23.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:37 -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="B/i+lgDj"; 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 1t8HbG-0004To-Q5; Tue, 05 Nov 2024 06:19:54 -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 1t8HbE-0004T1-7T for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:52 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb9-00075v-Pu for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:51 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4315e62afe0so45658365e9.1 for ; Tue, 05 Nov 2024 03:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805584; x=1731410384; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=nlatDknV/aBfEnJ/+F3868r6flWSi/PVuWVtl184IcQ=; b=B/i+lgDjbNc2cmEJ78MGIAZA81rNsG+EwUq4Q8nSDOMdFgmwAH/CW9nTsl9SeBxDhH uZYN5CWWYwwW/XqpnOtLsZZGHmVxtj6BEnV++CPdO/LlyStqs+9H0R6AYHIJWGDbbUgJ tZqpRCIRi3FkQzIdiOHapJxjxJHhnkgcIyzBwX/O3rc6ldsj0Xu9HNLKabs36Srb42uD bxr5UOnxw40peZ0ANgm61Pp4RzcXY45u4zP+PykzMJJrLcAvFWo2oOYfKaKRvMhlDn1N a4WafbSZSGy/5enSlkgIsnX6ZByMY1QzaZvf0Na7hMvJ6BMbPuYSRSf9eAgRV+4AkFZw XYhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805584; x=1731410384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nlatDknV/aBfEnJ/+F3868r6flWSi/PVuWVtl184IcQ=; b=dUgPHArDaDoeHxx5pq76kGumKYUxH1wgpfkLWDI0/CwZ9AgrF60j2fG4DSWG4jODTa deFqjzv45FuLX5H9LXDj1/oonfclG9wpEdqhPeZWV6A7V2Ztuk/QOxXeTBo+uh9Ej9hA IF8Rk/oVVR6bZHJs1DoksIK7VgLCTO53Dzawg9IDly0+VyyP2gcmknyxBSkNrnzEpZkh v3tVBFcQ5hP8A+qtwc1+whd7s2uRmyucsyUcBvfXFXD70ASFMdmxspbzrLn5bK/DAO34 WuCtQTtmPcShLXdd+Hb2CTul37miOubzy7tL4k0R9nspR3bvtJrqqllCIJih03eCo8Op wNeA== X-Gm-Message-State: AOJu0YyDsluXQze2ec27NcfGZwQBbe4Zyie00fkRF2+cEMpp7KvIPUhn kPGtrDVkGD3PRwZNppPtADljEOEUAQzVAjK7mpI+tFOxAhyV2QewnUH3UlFpUuMRF3f3e1FVjMP h X-Received: by 2002:a05:600c:cc5:b0:432:a36b:d896 with SMTP id 5b1f17b1804b1-432a36bd911mr16015845e9.26.1730805583796; Tue, 05 Nov 2024 03:19:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/31] target/sparc: Move cpu_put_fsr(env, 0) call to reset Date: Tue, 5 Nov 2024 11:19:15 +0000 Message-Id: <20241105111935.2747034-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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 Currently we call cpu_put_fsr(0) in sparc_cpu_realizefn(), which initializes various fields in the CPU struct: * fsr_cexc_ftt * fcc[] * fsr_qne * fsr It also sets the rounding mode in env->fp_status. This is largely pointless, because when we later reset the CPU this will zero out all the fields up until the "end_reset_fields" label, which includes all of these (but not fp_status!) Move the cpu_put_fsr(env, 0) call to reset, because that expresses the logical requirement: we want to reset FSR to 0 on every reset. This isn't a behaviour change because the fields are all zero anyway. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-12-peter.maydell@linaro.org --- target/sparc/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 54cb269e0af..e7f4068a162 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -76,6 +76,7 @@ static void sparc_cpu_reset_hold(Object *obj, ResetType type) env->npc = env->pc + 4; #endif env->cache_control = 0; + cpu_put_fsr(env, 0); } #ifndef CONFIG_USER_ONLY @@ -805,7 +806,6 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) env->version |= env->def.maxtl << 8; env->version |= env->def.nwindows - 1; #endif - cpu_put_fsr(env, 0); cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { From patchwork Tue Nov 5 11:19:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840778 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286188wry; Tue, 5 Nov 2024 03:23:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX9gnqFApYdlj2o8+Oqgce8EgV1OqGn4KGDDXyzHYXot9ka2IfMf6NDjHl9J7UE6K3ja/vJ9A==@linaro.org X-Google-Smtp-Source: AGHT+IEnD1XV8oW+bC37wd5XrT80uH8vRYaGtOItqJbGXmcBLVNJZ1n9+2dP/OWBIxRolbBk09aG X-Received: by 2002:a05:6214:5b02:b0:6cb:ef09:9d7d with SMTP id 6a1803df08f44-6d35c1aec1cmr207908226d6.51.1730805809768; Tue, 05 Nov 2024 03:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805809; cv=none; d=google.com; s=arc-20240605; b=RaGzjLPC0R8IqgCqleCHhqoWObVc1Absjs3ctoeBWWWSlD0CGNPpRapP0+8LyaWJqA Deaq0HJf3ZGVxx8JOMwMbMDzCvUZ127FNSJjyF8Pgy0fYylnuQUw0/jXutCEwFhHuNig B8VvPXCVXZysB2FSSgqTBJxdwbY+JVkUBj6zjsCr51tuFd3khUS/S1AV3UMUyklk5A0K X+i6RYnVjsZmp+/OAonKcxwC9Ay/8WjnsMp5RA7Qcrsyw1XqEgQEsSFA4VkIpNRPT9P+ HZ8w7Q5+4fAibW0U+x4dtU6rIH3o8qtfX3WaEsrLyHwomC/4mBo4Ri1+GcXpHiRZh6/1 Sclw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=rw5y8B7P/l3rqEDHkilLI0k4OLMoKZwY9v6CZQNZn3k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=gUiC8OtEiRqXPYdBe/FBFgtnKgtXLrEi045OicYrPuT3+DPPtxIS2SA7IQnRgUyk2S g/N5EghL4LowFhizaF3KiMX9zVvFfyMLb1GGINllm8HcopN6/Ajsk+0VgcqGfyNNQlLp mZFCQZ1rXGjHPZO/IjRL3Y2uENSlwAWJfg0TZAeCA5DW1ZzQaAP0d2tGELhmFfnyjpdY CB+SWQEfQVIFIz+S2vBO8vh60uvrCwhrWQJKwRj00i8xo/kCcpBpqKkJ5lnUprsvseme Kvfwe7kQXfV9MYMwVWON1YivbWCom7cl6+N5P+P8WoK3H8Wt5aIJ2PMhPm4AcWRA15tU C1/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xcagPw9Z; 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 6a1803df08f44-6d353fadf98si134727236d6.27.2024.11.05.03.23.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:29 -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=xcagPw9Z; 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 1t8HbP-0004Ye-42; Tue, 05 Nov 2024 06:20:03 -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 1t8HbK-0004Vh-A3 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:58 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbA-000763-Ei for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:57 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso47185795e9.0 for ; Tue, 05 Nov 2024 03:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805584; x=1731410384; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rw5y8B7P/l3rqEDHkilLI0k4OLMoKZwY9v6CZQNZn3k=; b=xcagPw9ZwkwcCLWHYTk9ps1UZASuNwBR/XsbyFjSHS6CmxuF/PqqLmFBqGZchlNZyE ebnyHPZCRL++F7TcXow6delDrL0lagVFKnOzzATn1KqxSEMwhkovWwObH80M6cOejgUa KGcF+C0YLbaOLuyXbgNu42U0taXcauS3ORhqDbu5h2X6K+5+3OZpYV3Y7T2xGNz+Jsfp 0jLL8QSi5aT237jBIkbOFe6cMQooo1kwJFGr/oaeeukdeX2JJOjVZMrVFIKEBG4E+oc4 unBp0iH10R7ZdLeSv7bMp/Y1206tjVzdePTtdh2+iUkUeus3DcK2Kgtmyr1YQSzgX062 r2Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805584; x=1731410384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rw5y8B7P/l3rqEDHkilLI0k4OLMoKZwY9v6CZQNZn3k=; b=wbLyj7irjhXOGVXPKiuQZGc3YpI3xwA8kl6yklK2+Qi0J2R1yfBxbjCKB5Y1xEFtF7 JXM+6lIHn1a7rlsg+NXHkSX2Ril9N0XmivZhAkKedNzII8hRrkry/Dk3aTMPJlWYp87m 8kH91lnw5i6dnHfMNDCuGsU2sHdznRSnKqA7xqzacqHqww4Qfp7im89OaAVOaH8IctE/ y/D1h4leMwjkn80wxTUFy1YoH7b+021qAgEQeAmZnlXEVnNmYs+Tyo8Wggy+Bt/jAhGY 8BBGNzPZWmDObK8UKhBzPx1WDaJ7HUqjauSUz8p+tFtKM0TKyzQCfNa5jo4nb6keGDiX 7dlg== X-Gm-Message-State: AOJu0Ywdn6fFLvD011uKbg1AYMl4K5zAyzp/Co4QrFZ61MRMe+EEAvw7 FxVsz0Tr3yzD5yP22nFWiZzgBKskPHPo+BiTTzeFxbKjwmmF9tA9+s0f3dYTL/FaOUR+k65z/H+ o X-Received: by 2002:a05:600c:4e8a:b0:42b:af5a:109 with SMTP id 5b1f17b1804b1-43283284867mr114312475e9.24.1730805584293; Tue, 05 Nov 2024 03:19:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/31] target/sparc: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:16 +0000 Message-Id: <20241105111935.2747034-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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 Set the NaN propagation rule explicitly in the float_status words we use. Signed-off-by: Peter Maydell Acked-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-13-peter.maydell@linaro.org --- target/sparc/cpu.c | 8 ++++++++ target/sparc/fop_helper.c | 10 ++++++++-- fpu/softfloat-specialize.c.inc | 6 ++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index e7f4068a162..dd7af86de73 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -26,6 +26,7 @@ #include "hw/qdev-properties.h" #include "qapi/visitor.h" #include "tcg/tcg.h" +#include "fpu/softfloat.h" //#define DEBUG_FEATURES @@ -807,6 +808,13 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) env->version |= env->def.nwindows - 1; #endif + /* + * Prefer SNaN over QNaN, order B then A. It's OK to do this in realize + * rather than reset, because fp_status is after 'end_reset_fields' in + * the CPU state struct so it won't get zeroed on reset. + */ + set_float_2nan_prop_rule(float_2nan_prop_s_ba, &env->fp_status); + cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c index b6692382b3b..6f9ccc008a0 100644 --- a/target/sparc/fop_helper.c +++ b/target/sparc/fop_helper.c @@ -497,7 +497,10 @@ uint32_t helper_flcmps(float32 src1, float32 src2) * Perform the comparison with a dummy fp environment. */ float_status discard = { }; - FloatRelation r = float32_compare_quiet(src1, src2, &discard); + FloatRelation r; + + set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard); + r = float32_compare_quiet(src1, src2, &discard); switch (r) { case float_relation_equal: @@ -518,7 +521,10 @@ uint32_t helper_flcmps(float32 src1, float32 src2) uint32_t helper_flcmpd(float64 src1, float64 src2) { float_status discard = { }; - FloatRelation r = float64_compare_quiet(src1, src2, &discard); + FloatRelation r; + + set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard); + r = float64_compare_quiet(src1, src2, &discard); switch (r) { case float_relation_equal: diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 226632a4d10..8bc95187178 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -404,11 +404,9 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_RISCV) || defined(TARGET_SH4) \ || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ - || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) + || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ + || defined(TARGET_SPARC) g_assert_not_reached(); -#elif defined(TARGET_SPARC) - /* Prefer SNaN over QNaN, order B then A. */ - rule = float_2nan_prop_s_ba; #elif defined(TARGET_XTENSA) /* * Xtensa has two NaN propagation modes. From patchwork Tue Nov 5 11:19:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840783 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286283wry; Tue, 5 Nov 2024 03:23:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUIRdcZWO0jL5cpFnpyYVlqWVhK3M0GAvxyOkj/ozhHXw196o2HyNCgjJF7L8XeeGzmASsZAw==@linaro.org X-Google-Smtp-Source: AGHT+IGQy9RLnOG9/Yrbr7ONul18X2iPro+PX/bwYikCfvobjm4tNurf52sliQBVY7D7q33Olc0B X-Received: by 2002:a05:620a:2488:b0:7b1:5311:468a with SMTP id af79cd13be357-7b193eeae7bmr4968055685a.19.1730805828476; Tue, 05 Nov 2024 03:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805828; cv=none; d=google.com; s=arc-20240605; b=WNoOgxqer3wWGOIZ74snI+1aJ7jghG8+h4ikpSJ5QckkPQ/PYqfIbyBHhWvLLCcQnE neYRySAO8yxkq5nFNp7qAj6Kh8Rk/q4u6N+SdLaGRQ/1Fvtba0Fmj+oaiNZBU2rQHP+4 pTwl5H+ln645AtjakcZQ/bYyvpdn+r+Zd8zhc89ekz5OzRvWfw3gFwCYzctCjyPM07aa qeMxw21mXvq76HOvgOq9V2oKLJC37h8NrrQ2rzFu4vXGAWBZtiKjNIxVlUhDZsRq616I BjxUqNoG3bnKCn08/PfoJWg8mVzgwuDbgspqflT0Ex1neW7FKGQXsr57S5ZKBSStfZC1 v4OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=OblJVNrVRdiqCsRdbj7zFz9kFn0JIzHW6PAymqxC+rA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=kbrCMwybqYTBdlwDlvxvRiCtfdENNpDOSaJEIM2EWk7tzCeXgw1rSv0Xt0GZn7y4LC bqNAWbUHQ0YY2I+TuBpQuXiJfX7hiowj14VjH40StL3zqQZg4LpzQGnlsa81y8hkhzAE 5vC1LrnY1kAMyEskzpIMDpVSvLOid+4nJ9pE8EOvhUJwDX8JJa8IdbkB/yEgY3izIRvr bg4s0E7MgrW+CqYudVOHlBhjZ0GpwDLJ20v5N1E1F4cmmEwdT6qPSQm3mh47GPvU2K+d bZHalrG8WeOc1SAa6iVLKq/A84EY1UVQfMd4XiulorrS5hOkz36ZZPZ80bJKwS4qyifZ OadA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SSxRxscL; 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 af79cd13be357-7b2f3a81881si1294713885a.259.2024.11.05.03.23.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23: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=SSxRxscL; 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 1t8HbM-0004X7-VB; Tue, 05 Nov 2024 06:20:01 -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 1t8HbJ-0004V7-7u for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:57 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hb9-00076C-KB for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:56 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4315df7b43fso43681035e9.0 for ; Tue, 05 Nov 2024 03:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805585; x=1731410385; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=OblJVNrVRdiqCsRdbj7zFz9kFn0JIzHW6PAymqxC+rA=; b=SSxRxscLSli4bZwkW4fQr4ak5TXcF8Wu3ZtXxuKynLCYecD9QrFgXeZr3tZxLe3qZU dqfTmjGDZ+R8b9EAvN8coKMc0spR7qg77SBLlW9VHAawVOz/YI8OLbK5fDlC0hZDebNi TGZAAiVoATCO+Tm+hTG+Eq/F+1XcWzFVd8CS8Dw3TcnvUDgneKRRjQfKs/72zIICVDVh REmeV3qkMLwt3jwWOIpHmvU+Nl4K7uMoLoObY87+2oiss43TyyXbyI4MkItWup87CfcB ejXkD50l/eMCxrtC6hRYrSbI3yVuS36Bi2Qv39eo0q55OPi7WXmaAUvQVBNcjw2yuKGY MStw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805585; x=1731410385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OblJVNrVRdiqCsRdbj7zFz9kFn0JIzHW6PAymqxC+rA=; b=p12qhTtN8yjPEgbZvlK97TDfzwxIkG2D1V5Klb7HLPAYe0b3dipkNtxUHTYswxh6SP m5tQE3APBIh5ASzk0tnn9G4Utlg8k6JiBCs4roWZHGqOQvcgIgqpfFGpyqAYaR1SuHU/ n6lJemQtzMK+lNXUWb2NRJ18VYV/sjX5pSmVS8IT9D9HuqjJiCaNCU6YESKWKabm5RLp LWb7xRqU1eupqLwP1xeoGNigdB4tX0RgpDxAcOKYQBjni1PVgi1eSxwt69cXudX/r0x5 4ycrE5pm8cWeU+ZAG24UmWFwhZtGUsZufNKnoxVPaM6NFqv+WbCut7mBHkwEZjVkW6Wd Fr+g== X-Gm-Message-State: AOJu0Yw1RM5Aw+b5wW3DFGsT5tuR+7JRZnyFprfnni61brlzmT0yPL+6 fK+082NYunLWUKj6EhieRHWLaMwN5ZdJ2uKlgzgRj+IMC8RCXD55RQdjGUMWlbcR9eYg+Vy44KZ 2 X-Received: by 2002:a05:600c:46c8:b0:42c:b905:2bf9 with SMTP id 5b1f17b1804b1-4319acb17a9mr329516995e9.16.1730805584815; Tue, 05 Nov 2024 03:19:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/31] target/xtensa: Factor out calls to set_use_first_nan() Date: Tue, 5 Nov 2024 11:19:17 +0000 Message-Id: <20241105111935.2747034-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 In xtensa we currently call set_use_first_nan() in a lot of places where we want to switch the NaN-propagation handling. We're about to change the softfloat API we use to do that, so start by factoring all the calls out into a single xtensa_use_first_nan() function. The bulk of this change was done with sed -i -e 's/set_use_first_nan(\([^,]*\),[^)]*)/xtensa_use_first_nan(env, \1)/' target/xtensa/fpu_helper.c Signed-off-by: Peter Maydell Reviewed-by: Max Filippov Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-14-peter.maydell@linaro.org --- target/xtensa/cpu.h | 6 ++++++ target/xtensa/cpu.c | 2 +- target/xtensa/fpu_helper.c | 33 +++++++++++++++++++-------------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 9f2341d8563..77e48eef19c 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -802,4 +802,10 @@ static inline void cpu_get_tb_cpu_state(CPUXtensaState *env, vaddr *pc, XtensaCPU *xtensa_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk); +/* + * Set the NaN propagation rule for future FPU operations: + * use_first is true to pick the first NaN as the result if both + * inputs are NaNs, false to pick the second. + */ +void xtensa_use_first_nan(CPUXtensaState *env, bool use_first); #endif diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index a08c7a0b1f2..6f9039abaee 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -134,7 +134,7 @@ static void xtensa_cpu_reset_hold(Object *obj, ResetType type) cs->halted = env->runstall; #endif set_no_signaling_nans(!dfpu, &env->fp_status); - set_use_first_nan(!dfpu, &env->fp_status); + xtensa_use_first_nan(env, !dfpu); } static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model) diff --git a/target/xtensa/fpu_helper.c b/target/xtensa/fpu_helper.c index 381e83ded83..50a5efa65e2 100644 --- a/target/xtensa/fpu_helper.c +++ b/target/xtensa/fpu_helper.c @@ -57,6 +57,11 @@ static const struct { { XTENSA_FP_V, float_flag_invalid, }, }; +void xtensa_use_first_nan(CPUXtensaState *env, bool use_first) +{ + set_use_first_nan(use_first, &env->fp_status); +} + void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v) { static const int rounding_mode[] = { @@ -171,87 +176,87 @@ float32 HELPER(fpu2k_msub_s)(CPUXtensaState *env, float64 HELPER(add_d)(CPUXtensaState *env, float64 a, float64 b) { - set_use_first_nan(true, &env->fp_status); + xtensa_use_first_nan(env, true); return float64_add(a, b, &env->fp_status); } float32 HELPER(add_s)(CPUXtensaState *env, float32 a, float32 b) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_add(a, b, &env->fp_status); } float64 HELPER(sub_d)(CPUXtensaState *env, float64 a, float64 b) { - set_use_first_nan(true, &env->fp_status); + xtensa_use_first_nan(env, true); return float64_sub(a, b, &env->fp_status); } float32 HELPER(sub_s)(CPUXtensaState *env, float32 a, float32 b) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_sub(a, b, &env->fp_status); } float64 HELPER(mul_d)(CPUXtensaState *env, float64 a, float64 b) { - set_use_first_nan(true, &env->fp_status); + xtensa_use_first_nan(env, true); return float64_mul(a, b, &env->fp_status); } float32 HELPER(mul_s)(CPUXtensaState *env, float32 a, float32 b) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_mul(a, b, &env->fp_status); } float64 HELPER(madd_d)(CPUXtensaState *env, float64 a, float64 b, float64 c) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float64_muladd(b, c, a, 0, &env->fp_status); } float32 HELPER(madd_s)(CPUXtensaState *env, float32 a, float32 b, float32 c) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_muladd(b, c, a, 0, &env->fp_status); } float64 HELPER(msub_d)(CPUXtensaState *env, float64 a, float64 b, float64 c) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float64_muladd(b, c, a, float_muladd_negate_product, &env->fp_status); } float32 HELPER(msub_s)(CPUXtensaState *env, float32 a, float32 b, float32 c) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_muladd(b, c, a, float_muladd_negate_product, &env->fp_status); } float64 HELPER(mkdadj_d)(CPUXtensaState *env, float64 a, float64 b) { - set_use_first_nan(true, &env->fp_status); + xtensa_use_first_nan(env, true); return float64_div(b, a, &env->fp_status); } float32 HELPER(mkdadj_s)(CPUXtensaState *env, float32 a, float32 b) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_div(b, a, &env->fp_status); } float64 HELPER(mksadj_d)(CPUXtensaState *env, float64 v) { - set_use_first_nan(true, &env->fp_status); + xtensa_use_first_nan(env, true); return float64_sqrt(v, &env->fp_status); } float32 HELPER(mksadj_s)(CPUXtensaState *env, float32 v) { - set_use_first_nan(env->config->use_first_nan, &env->fp_status); + xtensa_use_first_nan(env, env->config->use_first_nan); return float32_sqrt(v, &env->fp_status); } From patchwork Tue Nov 5 11:19:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840774 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285709wry; Tue, 5 Nov 2024 03:22:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUUHHqcOgG+Ua/Sw+YqFNWLbQlkbSCdiOWWSBJ2KXdrv1dVv+YYv7/UATM2Q7Bfuh3eJao5ew==@linaro.org X-Google-Smtp-Source: AGHT+IFr6qPVbv5yOEMaAZVZsalCQlEZjlrPQlrb0o117oTyO2wzTw84XiX5viK3s+OIgTB8g2Cb X-Received: by 2002:ac8:7fd0:0:b0:460:af80:ceb9 with SMTP id d75a77b69052e-462ab23ec4dmr272303231cf.4.1730805729567; Tue, 05 Nov 2024 03:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805729; cv=none; d=google.com; s=arc-20240605; b=V/zZd8+R6zF8cW9SWyBag0U9SS3al+nUBiNATI3mRyfVLuc0s0zGNgY845cWWJiKLB KPR6juuDk75Mnj1rjiR4M1MgWutG8+Q2RBmRVLuKqt6zqEAKOv/my8K6NcEXmlThMINy Z4lQByPerQO3VKv9yauUtkafKMUhq5aUQuMAP4cJi0iPMvuQJ2BlmvKws+eMkGgKVGrp 6KSKiBe8m6sn1s7EfiQVG5P7FXxI9GBGvvTa582xuahLGbziTUtdqUnZZNQrxlu5Wca4 Sxs3csgV5CacVc5RQ96KRKYw1VTbUVnCENxAcsgUTAtue4u/7cIDTxg5d0xNzjRuvitg KTmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=G3DkeEcruqixMHeVvkc/55DZL7+DSMMcCtNLajeMDec=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=j8u4nmnztQSn0WZ7Zy3z4NoF4B9GcsvigFYVyUushhVbdXgMXxXnTlHf5bJht+XLg0 kgJu02P34naeZolGLInOS3XSJ+rrN+H+aR3dbU09QvMXdQ4kYsB4QA33FA3OBFNFX1Ir GI7J2UfG1vM26JOMTVXXPW4zAAhNNBFQGI6kSbBtW3jZTecDmJnVRuitsI9blktf9Yya aR3IByLpSgBm6XqZhHhikVneg2aoa93VLEpAP/9ACs2AwE6ugPn88VWgro09KxAto3hk jMkl29UKahDRxHq0pismx2C7CYdUmQnvQIg7h1Io8X+hZZtuHrJsHoe+0Ixvhvve1dSz CYiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cn7tNfaB; 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-462ad241af8si139809781cf.569.2024.11.05.03.22.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:22:09 -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=cn7tNfaB; 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 1t8HbH-0004UC-Pj; Tue, 05 Nov 2024 06:19:55 -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 1t8HbG-0004Td-62 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:54 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbA-00076M-A2 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:53 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-539fe76e802so6123715e87.1 for ; Tue, 05 Nov 2024 03:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805585; x=1731410385; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=G3DkeEcruqixMHeVvkc/55DZL7+DSMMcCtNLajeMDec=; b=cn7tNfaB+GSUNWVy2JFVvlVp3JZRB4Rd/2UKoI4NaFD8yiQSaCwyg5fn6Kszk5kjDX fVuzG52F1qoAMyFwqyZjcsXE+m+3vZEit4gANqCyvjbNkW3y6xv+sEOm+ZeDBy6YbnkA 5gPic+LwL3/0UK9NzeW37uAZRu2pIiEBbpya3Oh4RPLMYDnexpXMVxbw6h6U/qkVAGmA HC5uuAMTcinabL6VKtFMcxA3awXG0SBouZ9EY8MRo5Rw6HYpGP4NGYMEpeXwOtzBcVHN thFPEtEk52DY68Uj9PryIbFxA8ygDxYW9QiW6evZEtsWye6P4QrolEIXu2ayTqrf0YR8 HK+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805585; x=1731410385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G3DkeEcruqixMHeVvkc/55DZL7+DSMMcCtNLajeMDec=; b=C7vdLfAKSzmlqeiSM4QsL9N4wwC41xGdRSSvRJp4TdS6Hu5msbvVJatU/sXtJUeAQs AAMajbxu5/m72bt7JgaIl+fNipmdYoNKqtfYj8gvPMky4NxnoOWQvEE//7Bl84eWgyf8 UIjyCRxkV16omcauWw3fssrr1wd/PxfrJSGEZ/QdyApfEG90tHIbz6Yhvi+WnP7Fzyby WwJoARw7guaxO40ztxvlr6G/9z/Ezvq+HwUS5D+Ugcjw8u+N9JxEIyRGcDwt5qPiafoh zFg6y/ECbFI4kJmUMgw3w1qoNPDyx0fDollQbWQiI1c5qkdZ1sAUs3QYPvwv2cK1G41B 0yJg== X-Gm-Message-State: AOJu0YwccsjGqFud7MXenEhOZ9dhiq7BvVxit4Rm6eWxKw3u07Bafzva ahM+MoZaXZ6K20LJceQ0DIOCKMLn3/QkxYIui8xCODSRT5Z6xiqS8pDvCoo2JPTyuOArMZl1+7b l X-Received: by 2002:a05:6512:1150:b0:539:de0d:1e35 with SMTP id 2adb3069b0e04-53d65dd0926mr7255780e87.1.1730805585337; Tue, 05 Nov 2024 03:19:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/31] target/xtensa: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:18 +0000 Message-Id: <20241105111935.2747034-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x131.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 Set the NaN propagation rule explicitly in xtensa_use_first_nan(). (When we convert the softfloat pickNaNMulAdd routine to also select a NaN propagation rule at runtime, we will be able to remove the use_first_nan flag because the propagation rules will handle everything.) Signed-off-by: Peter Maydell Reviewed-by: Max Filippov Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-15-peter.maydell@linaro.org --- target/xtensa/fpu_helper.c | 2 ++ fpu/softfloat-specialize.c.inc | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/target/xtensa/fpu_helper.c b/target/xtensa/fpu_helper.c index 50a5efa65e2..f2d212d05df 100644 --- a/target/xtensa/fpu_helper.c +++ b/target/xtensa/fpu_helper.c @@ -60,6 +60,8 @@ static const struct { void xtensa_use_first_nan(CPUXtensaState *env, bool use_first) { set_use_first_nan(use_first, &env->fp_status); + set_float_2nan_prop_rule(use_first ? float_2nan_prop_ab : float_2nan_prop_ba, + &env->fp_status); } void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 8bc95187178..b050c5eb04a 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -405,18 +405,8 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ - || defined(TARGET_SPARC) + || defined(TARGET_SPARC) || defined(TARGET_XTENSA) g_assert_not_reached(); -#elif defined(TARGET_XTENSA) - /* - * Xtensa has two NaN propagation modes. - * Which one is active is controlled by float_status::use_first_nan. - */ - if (status->use_first_nan) { - rule = float_2nan_prop_ab; - } else { - rule = float_2nan_prop_ba; - } #else rule = float_2nan_prop_x87; #endif From patchwork Tue Nov 5 11:19:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840790 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp287018wry; Tue, 5 Nov 2024 03:25:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVUAyfk1yfW/aYA7Zt469ONgnTSym/tFuj6Hr0A9KD4s/HKZugttFzKKGTkzjR9gQAs4aEpdQ==@linaro.org X-Google-Smtp-Source: AGHT+IGZey6y0OYkz2TGx1vVbzx786w8k0BSo0Kt7sAo+bFoJNeBRF8dsRcxvISBNrfUWk+Qs14Y X-Received: by 2002:a05:6122:1da0:b0:50d:53ab:3d0c with SMTP id 71dfb90a1353d-51014ff8a1bmr32846314e0c.2.1730805956260; Tue, 05 Nov 2024 03:25:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805956; cv=none; d=google.com; s=arc-20240605; b=RjYQpu3NNjQK9oj/RC3aV9qIAEf2wH9O5UT5I6LW8XvC7/lRVaqWK2hwkz0e9a9C58 dR+NOozrSaVQ2SbWYJSpOrHy/wIDW0GzWpAPKNF9Zl3szfW769ovdyjOmILT/QOlQXZI FJ7qrqJz/7k0oaUrhp7qsIoqdChasqun53D1NvDt/MKe7x7y1MIcC73lGNa2us6hp39c XLXUPIUaWKfZxfl3uqAbN3ScVGXWSXCqrnxi408lEVNUi4285mo/m48McOKbUSN8wybF tiuDBEpljIFYw4sYvTaUQNlJ2fnMHYCV1Gdn8LM3UrCY/yyi7Igr8AtfgfP0OUhv/563 jbGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=z6Sx5T7z3vX0Od3b8lOlnJtkNCiAtBmuCbivGnTfARs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XOFhrXMGRwms89wlLTphJF2v3HtQT44xB+7vx1ZMIarVzkLj82Go4zk6RmiokgyKdY b8F8HEzEvqq8N+rYHfWcyReMCf+silllBv+MPEEQUP7OFyx8WdAElQuj0GZKk9TAibHL +SMyzXJRi6qYURimG2TOZl8NM0BpXCmHOd1lVgyM0/cl2C8QnIPt/PJ5wIiB2jh1nNgo pTV+Y2ueArYgSaOj4EnPuR8zNvlhqD+8U+oFS+6rsXuhn4zbG50icO+1aJEfN3xPBV7Z YADGTw4bsrja3VvpSIvG54hiWwsHGUkjmrs22FSo+uMh2u1DcroBh9vh9GxuVu89Hges l6RQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HzWhO/oo"; 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 6a1803df08f44-6d35417f7d6si137270086d6.357.2024.11.05.03.25.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:25:56 -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="HzWhO/oo"; 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 1t8HbI-0004US-DM; Tue, 05 Nov 2024 06:19:56 -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 1t8HbG-0004Tr-NB for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:54 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbA-00076Z-Ll for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:54 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4315abed18aso44965805e9.2 for ; Tue, 05 Nov 2024 03:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805586; x=1731410386; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=z6Sx5T7z3vX0Od3b8lOlnJtkNCiAtBmuCbivGnTfARs=; b=HzWhO/oor0StP1zWub0IsqUHL72wIxz0aM+1Qigc2XeZOswirZYo0KfFZB2Dg2NGTX 4w6rErCQqUTZAzEgq+Az37XGSx51aRfXd05pkxpaCXn+1H1RrELOsw7G+N3QJ3mazySr n6jwXX8UGE0/ir2kOibuerSqGekieHO1uMDarjjhCL6a4RQ/xEq9f+qQT8m4qRykxj0u LcnEOzV+zuBsgytqWW5KGjKwWuYCNjXgp82Pj8Dpp7nC7gegm/MAQtw3M9i3zS+ICBCw mJby9Hhn6TNi/UnWzb240YMWklfynrGiFZxGNmolRodSRkWnxmYsaQP0OO1mC+9P8mDl Nu/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805586; x=1731410386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z6Sx5T7z3vX0Od3b8lOlnJtkNCiAtBmuCbivGnTfARs=; b=ny7p4F03EHpnmAvs/8CEToOZSdvvgACu+NATOuv9hISevhmkhtA6Ng9vKYRw5PxH0f k0TrxpcGfuB1O65640aW+FjEQOBEm2Yxp8U2u4H7UFGSckcsEsUkF2B99CHl5D78hu8r clLVeOYJ34qVwZeSci5aslQfrwSQaCKTqqjdZX5wJYcYj+prMspvnZhVww/YNPDIn+Zo maJy29JEkwAiizoCQ6lJmrxT9QOJJS0n5sTSJ6bZfQPcJwzW6ieyCtvw8iLH10xb2N/q jzDbOFVj/0paPXo/US7gL6xLZsd1RtSY1LQNclqEsb3AL23aQZH88KeK4E1a11drW1ZE o57Q== X-Gm-Message-State: AOJu0Yy8USTXK1sC3/4rHy9YKr2AbzGguZoYBnVwVicQqvhrdlmUJQdJ L1VOMxEIR8GC7F9fxghxQhiihkFJhj4gndD98KXLAKFKtqY9vET9f54Yfl9K6kH3Yy7YIMAgwaL h X-Received: by 2002:a05:6000:4911:b0:37d:62ed:b66b with SMTP id ffacd0b85a97d-381c7ac79ccmr14564795f8f.52.1730805585886; Tue, 05 Nov 2024 03:19:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/31] target/i386: Set 2-NaN propagation rule explicitly Date: Tue, 5 Nov 2024 11:19:19 +0000 Message-Id: <20241105111935.2747034-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@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.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 Set the NaN propagation rule explicitly for the float_status words used in the x86 target. This is a no-behaviour-change commit, so we retain the existing behaviour of using the x87-style "prefer QNaN over SNaN, then prefer the NaN with the larger significand" for MMX and SSE. This is however not the documented hardware behaviour, so we leave a TODO note about what we should be doing instead. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-16-peter.maydell@linaro.org --- target/i386/cpu.h | 3 +++ target/i386/cpu.c | 4 ++++ target/i386/tcg/fpu_helper.c | 40 ++++++++++++++++++++++++++++++++++ fpu/softfloat-specialize.c.inc | 3 ++- 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 59959b8b7a4..c24d81bf31d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2614,6 +2614,9 @@ static inline bool cpu_vmx_maybe_enabled(CPUX86State *env) int get_pg_mode(CPUX86State *env); /* fpu_helper.c */ + +/* Set all non-runtime-variable float_status fields to x86 handling */ +void cpu_init_fp_statuses(CPUX86State *env); void update_fp_status(CPUX86State *env); void update_mxcsr_status(CPUX86State *env); void update_mxcsr_from_sse_status(CPUX86State *env); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 3baa95481fb..3d2874cf784 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7200,6 +7200,10 @@ static void x86_cpu_reset_hold(Object *obj, ResetType type) memset(env, 0, offsetof(CPUX86State, end_reset_fields)); + if (tcg_enabled()) { + cpu_init_fp_statuses(env); + } + env->old_exception = -1; /* init to reset state */ diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index e1b850f3fc2..53b49bb2977 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -135,6 +135,46 @@ static void fpu_set_exception(CPUX86State *env, int mask) } } +void cpu_init_fp_statuses(CPUX86State *env) +{ + /* + * Initialise the non-runtime-varying fields of the various + * float_status words to x86 behaviour. This must be called at + * CPU reset because the float_status words are in the + * "zeroed on reset" portion of the CPU state struct. + * Fields in float_status that vary under guest control are set + * via the codepath for setting that register, eg cpu_set_fpuc(). + */ + /* + * Use x87 NaN propagation rules: + * SNaN + QNaN => return the QNaN + * two SNaNs => return the one with the larger significand, silenced + * two QNaNs => return the one with the larger significand + * SNaN and a non-NaN => return the SNaN, silenced + * QNaN and a non-NaN => return the QNaN + * + * If we get down to comparing significands and they are the same, + * return the NaN with the positive sign bit (if any). + */ + set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); + /* + * TODO: These are incorrect: the x86 Software Developer's Manual vol 1 + * section 4.8.3.5 "Operating on SNaNs and QNaNs" says that the + * "larger significand" behaviour is only used for x87 FPU operations. + * For SSE the required behaviour is to always return the first NaN, + * which is float_2nan_prop_ab. + * + * mmx_status is used only for the AMD 3DNow! instructions, which + * are documented in the "3DNow! Technology Manual" as not supporting + * NaNs or infinities as inputs. The result of passing two NaNs is + * documented as "undefined", so we can do what we choose. + * (Strictly there is some behaviour we don't implement correctly + * for these "unsupported" NaN and Inf values, like "NaN * 0 == 0".) + */ + set_float_2nan_prop_rule(float_2nan_prop_x87, &env->mmx_status); + set_float_2nan_prop_rule(float_2nan_prop_x87, &env->sse_status); +} + static inline uint8_t save_exception_flags(CPUX86State *env) { uint8_t old_flags = get_float_exception_flags(&env->fp_status); diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index b050c5eb04a..77ebc8216f6 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -405,7 +405,8 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ - || defined(TARGET_SPARC) || defined(TARGET_XTENSA) + || defined(TARGET_SPARC) || defined(TARGET_XTENSA) \ + || defined(TARGET_I386) g_assert_not_reached(); #else rule = float_2nan_prop_x87; From patchwork Tue Nov 5 11:19:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840784 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286293wry; Tue, 5 Nov 2024 03:23:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXKYKV5IU0rQyxH+18BC5aicL4re26ULImIWiIsIzdCnQfKvPcrcYEGnkKEd82SpOE5GZFh+w==@linaro.org X-Google-Smtp-Source: AGHT+IEnyOcr78/i9aTFBw7nWFc0yM4V2IM9GzUAbq/orQ5v6o5gc11AaqtJI48a+JtBHO3wlYv/ X-Received: by 2002:ac8:7d02:0:b0:461:141b:47a4 with SMTP id d75a77b69052e-462b86a79e8mr239404041cf.36.1730805830531; Tue, 05 Nov 2024 03:23:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805830; cv=none; d=google.com; s=arc-20240605; b=M5aggzZhufvPgy1qbIORZGK/RUKKv7BxoF7vMROJ3kGJn8Nc/7J7ZD1QOMDOGXmGEH rqTExUt4g2PqwbJfUG/cPVEhHa4ubDiiferP1z9xBj07yXAUtMUYc3PXMAR5QzJRytlF 1YQMTH93HdrewhuPKMoq53nleaEpYEhJLBQC9KNRO7u7q5O30RgJOWpKiwbywu+50PJZ vKQVij5i5DFGuylFG2duDZGjRK/Wxe274VjAZVoJKsmezD1jcE/sBvSP6aNDr0Dy0Prr h0FTSAm70BudHsJ9j/lnIDhezUpaRFUwCC2XPfX7UgjwtPEqUBXN+vSPK84/cfIUKo4p Xwpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=TfXkDdm7UXvN9SQ0HEv89qVQFRKDh0IE2sOcAT0PJD8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=JTzirlcqdAIo8AJbIibtb4lgJPj4oQcs+TsS/5eqaXTag4yUdp7cGbetz1e21zAA5K +qU5EgWNcJvYczxwzobabbCxKZbiCmHg2dtW5Dx3qJ5PFYRLv4mLLucbUsgZvTB5sDkJ C8qQ2qLrXE1PILuY8dMJa4XEzNRMhdnASm70nbK6+5gFpcjymRKy5mS3kR9+m/kk4/GT y/ysx6J3MdziUtP8lMVS0qkycMy9k8j0NqEAB2I6Z/2SuN147WRbc3bRAs5iTtf0c5Qq JI6Roole4gnH1x2ZckvO/eVOkFcSUsVQ61jKxuuBNQMuGSccjItx1q9b5vckbqN+NQ/Z 3J0Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1qMw7DM; 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-462ad1f0b9dsi142433281cf.451.2024.11.05.03.23.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:50 -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=N1qMw7DM; 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 1t8HbO-0004YZ-8f; Tue, 05 Nov 2024 06:20:02 -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 1t8HbM-0004X8-20 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:00 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbB-00076l-Q4 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:59 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2fb58980711so49179021fa.0 for ; Tue, 05 Nov 2024 03:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805586; x=1731410386; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TfXkDdm7UXvN9SQ0HEv89qVQFRKDh0IE2sOcAT0PJD8=; b=N1qMw7DMsWOiwKMY031CGaepl7EUNCYPb3HvBM0vQWisgzJR8EIGIXyUjrHWiwXcAn bGIgolw2uyxgpT3afSzmRi5PYSTD3qfDFsxvXSoly+t/9wA0SNFf3Hp44RNmhBYQk/3N ybmIyhEfarKY1JuhKJLUSB6jqbtn9i8swbFp5CoUwzxFhCkkuurHv31qENr+tK+XBxnB omVu2rlB3XL44H7i9CPlCqI7E/IBpBbExCSaqyvz9sQT0P0Tof2tbRUcmnNDg+JtFW7P VopLUwYYnhy2H2qGsPaE7aLf5iPDQbdr43UxMWKKKbl8V96410k0/BTcSo/aXGT9RrIM 4Qsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805586; x=1731410386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TfXkDdm7UXvN9SQ0HEv89qVQFRKDh0IE2sOcAT0PJD8=; b=FV3IDV8A9UcLBWUIzXrOXTTIKnH/iwxR5Ia6+szrnYJORJc+FUeitfH5RKRDhoRMxr hF2eUwGWWK1ekk+r+8PR6RR/giuTxuKug9aYSjaxiicb65rgxN2+H+SkEI28H3EnuxJn aypyYjNpB0rwekY/FOTjxm8u7+1IyKBq0Sy4fNnU7mYX2JEuJLeIcquOr++rD8Eg/Gyo qs7Ig56v8PLFsIlUQtghDSDQsE92ei9BHXpOGvfGdyV9qI2l2AyiM/8Yb/2fE3uDEFoS h1i120iK28W3YjI38V81MHHIeWRW4h6z1QQTU5zx4yq8r+TV/ly9h/diTRv7A/Uwrlek WZsg== X-Gm-Message-State: AOJu0YxYtPIwRpCJa4Yztcqc12uMghKD6Vkiyi9DkXHnXHRDakvK1kPn 51WutooIzMSUwCvXcQtK1P7DTl6WALa++nUimPC8wUGVPZVIV8oqSai60ezaE2nUY4OjqblDlQ1 m X-Received: by 2002:a2e:b895:0:b0:2fa:de52:f03c with SMTP id 38308e7fff4ca-2fcbdf5b818mr161391041fa.5.1730805586475; Tue, 05 Nov 2024 03:19:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/31] target/alpha: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:20 +0000 Message-Id: <20241105111935.2747034-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x233.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_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 Set the NaN propagation rule explicitly for the float_status word used in this target. This is a no-behaviour-change commit, so we retain the existing behaviour of x87-style pick-largest-significand NaN propagation. This is however not the architecturally correct handling, so we leave a TODO note to that effect. We also leave a TODO note pointing out that all this code in the cpu initfn (including the existing setting up of env->flags and the FPCR) should be in a currently non-existent CPU reset function. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-17-peter.maydell@linaro.org --- target/alpha/cpu.c | 11 +++++++++++ fpu/softfloat-specialize.c.inc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 9db1dffc03e..5d75c941f7a 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -24,6 +24,7 @@ #include "qemu/qemu-print.h" #include "cpu.h" #include "exec/exec-all.h" +#include "fpu/softfloat.h" static void alpha_cpu_set_pc(CPUState *cs, vaddr value) @@ -187,7 +188,17 @@ static void alpha_cpu_initfn(Object *obj) { CPUAlphaState *env = cpu_env(CPU(obj)); + /* TODO all this should be done in reset, not init */ + env->lock_addr = -1; + + /* + * TODO: this is incorrect. The Alpha Architecture Handbook version 4 + * describes NaN propagation in section 4.7.10.4. We should prefer + * the operand in Fb (whether it is a QNaN or an SNaN), then the + * operand in Fa. That is float_2nan_prop_ba. + */ + set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); #if defined(CONFIG_USER_ONLY) env->flags = ENV_FLAG_PS_USER | ENV_FLAG_FEN; cpu_alpha_store_fpcr(env, (uint64_t)(FPCR_INVD | FPCR_DZED | FPCR_OVFD diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 77ebc8216f6..a5c3e2b8de5 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -406,7 +406,7 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ || defined(TARGET_SPARC) || defined(TARGET_XTENSA) \ - || defined(TARGET_I386) + || defined(TARGET_I386) || defined(TARGET_ALPHA) g_assert_not_reached(); #else rule = float_2nan_prop_x87; From patchwork Tue Nov 5 11:19:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840761 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285110wry; Tue, 5 Nov 2024 03:20:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWTkhz2d8ZylCyj3x6DaXafs5Xjrx9jiGr+TBaJexDVV/Pp6t6xhHDwFFr/hoNDjGUixjbmMw==@linaro.org X-Google-Smtp-Source: AGHT+IEqJ4foBoL+hKd8v5kZNGBLy17A1fsvSYmDPgiSsPmxM9fCgxTDLdTvyXcNiX+waSCj77fB X-Received: by 2002:a05:620a:284b:b0:7a9:acd0:c8c4 with SMTP id af79cd13be357-7b193f4d8femr4846701185a.52.1730805639537; Tue, 05 Nov 2024 03:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805639; cv=none; d=google.com; s=arc-20240605; b=FxSYfH+n0rTiQs+SwTHMmTRxD4xQJAoEMME5j5vf/aqIAGltM9In6Fiz6K1NOO82Lt wG++hb6zbuaVGgBwi2J1eTbDOlOlMhwHUDFgqLDPSS/6IGyABfSgy9kq4OzXj6OdVOwn AjoAU0DD5c/36hMBzx6Fc/NCiU6c/D0k5C6yc1JVUtL7Y9Aq83KW4XcC4GlLf6q68qSI rzZnrDST4+D0wUcEIpeqODaVHL88KjiKG2BH9ZiQxP0D7FNsqVkikH1QhAu7bQLG1Ipb Xd3oLHGYysRHvIWRNwP687zEVfH89D3+SIp0VYkMa0EIlnvDEZCUMGQkzcHr1FtVrb/t 4kLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=QD6Lc/I6xdPJ52+g1i8fO338zKT4nqacusp7y0oQIcc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=DC5zgGShjFvB5KRA+zkOXW+KK/vhC3/0DALyfd+FYcP+9pbiONGda3SyEL/tAFqCwl JF62/I14PgHiOgjq9Da+Kvkrzw7Ne+OiKhUGDYqz2FakSuYxdtKyhItF7OHHBUqOCA5I rd/FVzvwTeyTjIHxcYAecrn4ziTTq0vYis4WdhUtImpKBauSpdeB5Wxn0hcQfcAHAITZ vyfp1LcL4+tF0lgoIHjswVHEIPwlAtmT181YlAzndFs8RDt3O3zvrd+74t7KpB5pN9H3 aYymJiY9ZcVf9j0qqA0PHLpLIJ+84p1dODvVRcnQ+Tb6HNpYL1CcBirVJ0EHJtjfy06Y OiEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sicNZKRH; 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 af79cd13be357-7b2f3a0377fsi1320172185a.195.2024.11.05.03.20.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:20:39 -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=sicNZKRH; 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 1t8HbK-0004Vn-On; Tue, 05 Nov 2024 06:19:58 -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 1t8HbI-0004UL-30 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:56 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbB-00076o-Nb for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:55 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-431616c23b5so33181505e9.0 for ; Tue, 05 Nov 2024 03:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805587; x=1731410387; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QD6Lc/I6xdPJ52+g1i8fO338zKT4nqacusp7y0oQIcc=; b=sicNZKRHrhkfNYHpLjBwqB9ZQjhKlcUGzHxhNqUKAtsbbYWNa9b3WeApzqjknbGVXG llqjMzkC2VVvcyRivAwaotIp64S9mVbnGXLhTsvSHGWM+ALei0I/XaBlWBDdtdEUtz11 FmJYmGSeZDwKLou1t8Vz4gxMshewtF5VkQz7i5DzPSQ1AJNTJbbsXeEZydKS6uPDS4to HS6ghoeOqfQFR2w7KeiA/1qzJvrpSGVmHoAbMLmc9f3mKbVJyiUs7CbBRVBe5CIDZUIl bgdB72lggi8/0MK/cnTQkGo8gH+LulsUF6LxKq8vrEQdXUqsN8kvZmXK0UXqY07pwdOS blGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805587; x=1731410387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QD6Lc/I6xdPJ52+g1i8fO338zKT4nqacusp7y0oQIcc=; b=V8uKON2o7jA6FgbQzYjDe8XoWm5qsTmljTmSDpAAMk80ScCh1C8F8qg4dgchCiOc/c 7cko+PvWIw5NjMyeD7NYf1eAL7/v9Djp6tkXCXmKiGihIoscbbNanvrCQtuk/uZWmls3 3Tk7hFW3rPuNdvkH0ulkTgp1GwDCWdZlmBEYBY9bUpNX2M0+Sy+jwDVLwijY9IFkWQ1E pQ3NWmvdll9EoUbhrtrfurdpvX37QESkMFhnqsZ8jWAVRjxcJ2iv4bTmhCv4v0Wbs1u7 /QGC4wl8iTAm0ytwWFgBSNlIacP/DBh7vPVix05E1CmwN7gNDBkznY7+HJDBuW4Ah1lo nfJA== X-Gm-Message-State: AOJu0Yx9yIYDLSJPZF0sxwjRa6sIGNDUgMMZVA6A96d8DGKbHVoX7JZ/ EBoAeVWq7/02qRl5w3fBDgifTlLmwEGnfJ737zEeP5QnM8t48xSIzKK100Nb8iNUrIc/yVaGvyu O X-Received: by 2002:a05:600c:a02:b0:431:15f1:421d with SMTP id 5b1f17b1804b1-432830a14b7mr129407135e9.16.1730805586993; Tue, 05 Nov 2024 03:19:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/31] target/microblaze: Move setting of float rounding mode to reset Date: Tue, 5 Nov 2024 11:19:21 +0000 Message-Id: <20241105111935.2747034-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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 Although the floating point rounding mode for Microblaze is always nearest-even, we cannot set it just once in the CPU initfn. This is because env->fp_status is in the part of the CPU state struct that is zeroed on reset. Move the call to set_float_rounding_mode() into the reset fn. (This had no guest-visible effects because it happens that the float_round_nearest_even enum value is 0, so when the struct was zeroed it didn't corrupt the setting.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-18-peter.maydell@linaro.org --- target/microblaze/cpu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 135947ee800..6329a774331 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -201,6 +201,8 @@ static void mb_cpu_reset_hold(Object *obj, ResetType type) env->pc = cpu->cfg.base_vectors; + set_float_rounding_mode(float_round_nearest_even, &env->fp_status); + #if defined(CONFIG_USER_ONLY) /* start in user mode with interrupts enabled. */ mb_cpu_write_msr(env, MSR_EE | MSR_IE | MSR_VM | MSR_UM); @@ -311,15 +313,12 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp) static void mb_cpu_initfn(Object *obj) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj); - CPUMBState *env = &cpu->env; gdb_register_coprocessor(CPU(cpu), mb_cpu_gdb_read_stack_protect, mb_cpu_gdb_write_stack_protect, gdb_find_static_feature("microblaze-stack-protect.xml"), 0); - set_float_rounding_mode(float_round_nearest_even, &env->fp_status); - #ifndef CONFIG_USER_ONLY /* Inbound IRQ and FIR lines */ qdev_init_gpio_in(DEVICE(cpu), microblaze_cpu_set_irq, 2); From patchwork Tue Nov 5 11:19:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840792 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp287727wry; Tue, 5 Nov 2024 03:27:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVSJycWBGTu5pKXfBw8yR63iUxyeaWoUmpN+Vhb71pExV38W3a1wnBdMS4CGh639sPDYjj4bw==@linaro.org X-Google-Smtp-Source: AGHT+IH52G2dLvJn2KmqEPwVAe70/9vng9fImMhaoZqS0W/ZizgKlmcFRO/1oKEaLzb1C4iVtbpq X-Received: by 2002:a05:620a:468a:b0:7b1:53c5:8f42 with SMTP id af79cd13be357-7b2fb979256mr2281743085a.15.1730806071782; Tue, 05 Nov 2024 03:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730806071; cv=none; d=google.com; s=arc-20240605; b=ct/QRPKJe0yZDtV+/d9NCdm9tVyAKUEqCb/gUZE1/L9KITUpykKZz5gW3dPpbaJJth NhtN9WhkUAo+Gp5+kaR4GudD9UsII+Zm0ZKgAD6yCaGDDcFH928gH3IDrK2CGhOErNKi baBrb6yuk98vuHbHV/0wrLDVNlAGpMFx9k5os1motQU++jETw5e7c432s+C60mHARAIm JNFHwtLT55Xh/MMyWVgczsHleigKobKhhahM5UfdTwlpzzyjdf5gc0c+WnsZFWlsNlPV knut4Yg6dQ1SmCsosSFS6KjXyC5wSYDNSgtfrafiKq4PAj1ha4MIKNZiW/NeNwPiRSpZ UeCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=B9iPPGInxZFEJeivG1/w0WhkOP2pUxlITSIJKqo2Kuc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eNmqirPTUYRR4e9uBPTlE1BsZFOKVQ+VPO+xpKTcYdTLYSYULITgazq1ON1aLFqfKT lLv6c+WiA5TbwgnLEfLV8J5RDulNqqnVs3LwvyLASc/1YQHEyHGn1QzXUlcrXv45cqSP GGzXY0dVzmdYv7bSLXtwDFXEA5yq9McnVt+/t0pD5atN/Euq5cXfxWs6OZD1tV7qFWZq z1tT04I8FasYzgoxTs88ssEJ0ll3mq4myTN97Wtdpd0Hki//DV8h0EDiXBmqGgkLirwv UMHuY99RBCcy2ukQH/ssMt1GF/RkZuPtho35lKqEMRdr8yXzC+20N6q61q3I9btr/1Q/ 24/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GK0tnZQn; 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 af79cd13be357-7b2f39f1c93si1300094385a.156.2024.11.05.03.27.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:27:51 -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=GK0tnZQn; 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 1t8Hig-0006zR-Q9; Tue, 05 Nov 2024 06:27:34 -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 1t8Hif-0006zH-FH for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:27:33 -0500 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8Hid-000825-JF for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:27:33 -0500 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a9a0ef5179dso879638366b.1 for ; Tue, 05 Nov 2024 03:27:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730806050; x=1731410850; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=B9iPPGInxZFEJeivG1/w0WhkOP2pUxlITSIJKqo2Kuc=; b=GK0tnZQnTpvnX9vPYj2PH43AIf20eEaqUsfox6UPpfojp9NrSOuKq3M5m/VoZKiLxj na2M1fuPqLe78u6TqQ4t/Wgfloj+Pvzamrz/HT8qvsU0t4zgLelw6ApO02b1vTrhfNxo L804kMPK7VzIlgH7fcyHnVPLf/CQW1LFnDq9VqTYuLDdNCw6hRC8nE0gy5EcvWyAyYAv haO3kAZITXYGrxoDTT/ULhanYE1mcytWMpnqktca0+LWJFky6LsurqjrVNqUrFo5JYYN /ulBoT3wj8nFVeUi6W8RF6RsSXISgK0mlDl72xsrZxVRuRuae0DJyLJ+dH/HEXN/7/5s Ic+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730806050; x=1731410850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B9iPPGInxZFEJeivG1/w0WhkOP2pUxlITSIJKqo2Kuc=; b=pWtR6IaTODbPFuS+2GKbdTmuuW1I+MUXWNWWdUZwtDBvA27OOHaHsdPwAc+n8QPy14 WjfCEOgKUpg7kh1Nu/yBXfABu4ui+fhTpF9YI6gtdEYP6gxLSfluIbn+HMHeISlsZ/UE ocnYM7CiBID9n4hibeShnzEa67tW92BwIEZmfFiXsEZL47TJBOAI7Kq2IIZs6ssl/Mh/ 3ylipe84tWzbKDuVjOo7dtnLk1T2ad9VID2mVlKsOpbeHqxm8yH8PhvAD4Ah1CP9vn3G 2Zp1H5hpXiF0mtsQdJuwkufExQm76DtgvnPJrMWnsSmJ5z7LEpA0ZpVJNr+3QRQn5mv+ b+2g== X-Gm-Message-State: AOJu0YzQNWtZIaXxvbioiNOYZDueY+G04TyoKMDCE4gE+dCj2p8p0rZ4 cFDa37FNbpJAjB7sesOVc966wKdgxl6RcRZqWdqUVbzJ2wTH2npZURGFuvMyc09Nnlp2Z9Hwu3h S X-Received: by 2002:a05:600c:46c8:b0:42c:b905:2bf9 with SMTP id 5b1f17b1804b1-4319acb17a9mr329518575e9.16.1730805587592; Tue, 05 Nov 2024 03:19:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/31] target/microblaze: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:22 +0000 Message-Id: <20241105111935.2747034-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=peter.maydell@linaro.org; helo=mail-ej1-x630.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 Set the NaN propagation rule explicitly for the float_status word used in the microblaze target. This is probably not the architecturally correct behaviour, but since this is a no-behaviour-change patch, we leave a TODO note to that effect. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-19-peter.maydell@linaro.org --- target/microblaze/cpu.c | 5 +++++ fpu/softfloat-specialize.c.inc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 6329a774331..14286deead9 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -202,6 +202,11 @@ static void mb_cpu_reset_hold(Object *obj, ResetType type) env->pc = cpu->cfg.base_vectors; set_float_rounding_mode(float_round_nearest_even, &env->fp_status); + /* + * TODO: this is probably not the correct NaN propagation rule for + * this architecture. + */ + set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); #if defined(CONFIG_USER_ONLY) /* start in user mode with interrupts enabled. */ diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index a5c3e2b8de5..40cbb1ab73b 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -406,7 +406,8 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ || defined(TARGET_SPARC) || defined(TARGET_XTENSA) \ - || defined(TARGET_I386) || defined(TARGET_ALPHA) + || defined(TARGET_I386) || defined(TARGET_ALPHA) \ + || defined(TARGET_MICROBLAZE) g_assert_not_reached(); #else rule = float_2nan_prop_x87; From patchwork Tue Nov 5 11:19:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840764 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285259wry; Tue, 5 Nov 2024 03:21:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhVJ9V4BQRHwF9/d/CzDkkZIg/dG6JZewuyQRkJ1uIS7HeLdo7tArcyOU3AddTl/5KIDcDRw==@linaro.org X-Google-Smtp-Source: AGHT+IFE8rKEEXasHzzyq37nUCV19O7GDPOGTSKK9wTyTM1K+NXURUIUH+sJOawqBDWj+SBpjad6 X-Received: by 2002:a05:6214:4a8c:b0:6ce:26d0:c7cd with SMTP id 6a1803df08f44-6d354249f9fmr283263156d6.2.1730805661298; Tue, 05 Nov 2024 03:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805661; cv=none; d=google.com; s=arc-20240605; b=iZOJg+MOKTTuoc2DopWM2zVk5nMGqyb6kY+qi9mwLANDDYXxEVXyybJc4mrllzvt3p Gbi1oFN8aqz77JYcXiCPmX5FP6AQna5q+wYm2FnhDDdqQTYUc5H33c/EJDjJxO+NMwXL eU//cta2YO6NiyHlvzRJRslUdacj2nVyBEVKJfXzwJLeCa16hbFmmnYvhnfVTRuhkNwf QwkUzr0grO1Vnb0b/kfilF3Mxw+5YsqiVse/bGhwT4psydE2qsYBootQBNal85ioaOwi KmnT++QfsBRX8IC8wwuSIQdHeWNqsGYKV5oS0mAc7RslkXlZ/J114WwL+5g37whkxUen CdOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=ysrDYNahrgAVHDeokOZCJEwZEZgWfdy4TG+aarln+ss=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Y5pwZstIiH7CfUIA8w57R1T3b6EJN8LEG4G5LMbmUV1EeR+yH7w1CKk4PDECx4hoVx qBAFTq6ooqmAOivYowkv7ZP3Ws/CyA2j3BUF1nCNd4zfi5wE4FCN/fdKSpzXxnVbeo71 80qAWLZapAESQi/NqF9WQHQ5+T47xTJXiVfksOxqm1B5OcmmX6fAnXtg/XEPoH+53hod uMqYRJW7oIDcRIPVWYCl7D2P3AuJM/20Qg1X4xEt7DfZ3RddOLn4xudgyYr62GfZpUmn ZShNS0H8LSOw217/GDWc7Rlhxq94lvQ58iZcRJnG8f6uZM+5GIQ/dER5LxMBjsgcuAB/ IaFA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yr25zUmj; 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 6a1803df08f44-6d35416ae35si131210726d6.300.2024.11.05.03.21.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:01 -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=yr25zUmj; 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 1t8HbR-0004ZS-6V; Tue, 05 Nov 2024 06:20:05 -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 1t8HbP-0004Yl-8a for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:03 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbD-000774-6U for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:02 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so41178045e9.1 for ; Tue, 05 Nov 2024 03:19:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805588; x=1731410388; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ysrDYNahrgAVHDeokOZCJEwZEZgWfdy4TG+aarln+ss=; b=yr25zUmjtdcyefnt4wvwLxjeyxZ3kBx2raaFGe45HJws/1d8d0Vv9821ynsA9x720K 3KKQ5wsjvtaI3NNAeTqqbY0S8uClnQhXpV+gvzDfVJuJn9YGqTxmIbu808v1IzklPXur sYnNoejL9tU6zFUmdyY8FkaDmV/WT9L0HcNWaSE7NJdokBEHuB3ArhX/dT0dhZC8nNTP gWWXv3HBntJn6myEcuk7WBiKmpqrFoS5rQE+EAm85Q+v2o0clj+oYJwml8HyYr/8aPio PTdbzGZQO9aHSb+xjINz2+GdVAabKqOZ6bdbzmhLhAdUCn+CWH5glfpKpGRJBnL4y7MP /O2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805588; x=1731410388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ysrDYNahrgAVHDeokOZCJEwZEZgWfdy4TG+aarln+ss=; b=xD4Fnjbq3psBFTDbM61/vMj/Df/IhZEpcDxdvnLXE9VeC+xZvv+7xZilz6pGJe/Dds jBju9jYVAVgBeGqP1b7NCS9dc7ATaJwhn4HgARYHuf0owkgcwkVXpknu/0by3mHlpOoh axOO6wt6JpE7yvELzU+sPYo4zv/J5RCp0hru2KKJx0gq7m1cLdu5/t0W+ZaOOe/s2luW vIrdQZ2jKVoe8gQUxFHOLZpEggZPwPQtLbA5UzJoSfgN1va0HGATjcrSQDtzUb2z2U0W aPUAVMjUkB6t9xWHaSyzzkUiis+0+6V8kzM6VqZxgr0hDLc0zDxVh1fEHjk1kwWhao0x FSGA== X-Gm-Message-State: AOJu0YxwtJB3naufQOD0og391bGbWygazc1BI86o3DFEfKjqTsg9j79S +IKnZO92XekBNX3Y9ahkr7lrgPhAVpsqBD5FOjPIX6seuCp4nF+fhnOhrF+/dM67JJX83EszkcK I X-Received: by 2002:a05:600c:198a:b0:431:6153:a258 with SMTP id 5b1f17b1804b1-431bb9855f6mr212117345e9.13.1730805588212; Tue, 05 Nov 2024 03:19:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/31] target/openrisc: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:23 +0000 Message-Id: <20241105111935.2747034-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 Set the NaN propagation rule explicitly for the float_status word used in the openrisc target. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-20-peter.maydell@linaro.org --- target/openrisc/cpu.c | 6 ++++++ fpu/softfloat-specialize.c.inc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 6ec54ad7a6c..b96561d1f26 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -105,6 +105,12 @@ static void openrisc_cpu_reset_hold(Object *obj, ResetType type) set_float_detect_tininess(float_tininess_before_rounding, &cpu->env.fp_status); + /* + * TODO: this is probably not the correct NaN propagation rule for + * this architecture. + */ + set_float_2nan_prop_rule(float_2nan_prop_x87, &cpu->env.fp_status); + #ifndef CONFIG_USER_ONLY cpu->env.picmr = 0x00000000; diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 40cbb1ab73b..ee5c73cad46 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -407,7 +407,7 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ || defined(TARGET_SPARC) || defined(TARGET_XTENSA) \ || defined(TARGET_I386) || defined(TARGET_ALPHA) \ - || defined(TARGET_MICROBLAZE) + || defined(TARGET_MICROBLAZE) || defined(TARGET_OPENRISC) g_assert_not_reached(); #else rule = float_2nan_prop_x87; From patchwork Tue Nov 5 11:19:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840766 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285319wry; Tue, 5 Nov 2024 03:21:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWlgPEa2wldzOikFNLe/eY12UeXg4kmAvHgz5L2nQe5e2meztt1dKgIESbAF0J4FtTJXWLo2A==@linaro.org X-Google-Smtp-Source: AGHT+IERS+jEzbN6n6TuIQ2WBIbsimXxbyiFNvbNRxa/3FE1snZ2HoLTFoQMVOA3QCxq2e+c3sTJ X-Received: by 2002:a05:690c:6186:b0:6ea:96bf:1706 with SMTP id 00721157ae682-6ea96bf2f0fmr60089157b3.0.1730805670205; Tue, 05 Nov 2024 03:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805670; cv=none; d=google.com; s=arc-20240605; b=EN/WfH2QojxfS5yKLrW6vd0/W78eAV0JnxKakSfW2Ei+L4kpYK9z5P0dwVop4zGkZs 4e6J0KfWwYpTZYnmQIFGDNAJKHN/+/TSd7vY/7zv9vMUDNiLp67grv74TN8Di0IRNRf1 qp4mbaYkuHBLhYs1uYH6Iy1kQo7+xV+bH4DV6pZZEnJploRUY2VfGb/I3R3iCk/Bepso LqhpN2W5M+inqohh+iRI9ekXry88q2gkWvpui2j0DEG+m8JAzAsctU9fdVwB4kaR0kK0 ee3n7qQsp8o+I0o8F8AfItr9BVYJI+mPfs7bKgV1+SdDGD1K1yQdZtBlccNw0HyLY2UG fJMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=c8Sl2WdMeznJ3O6Hl+0ANVSekrp0/KXuiL2fAiYWe7Y=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Jkt9YcmbCG2sC+AqI4+CLeW2LAGhAfNYuVDu+9VZdt9BACsHNaIikmzZrqiPrc6sgN YeaWqt1jm/+GNk5fUGtF/7DwB3jP6AzjTYEf6y4bWHK7zgBCzREOz+wLeT+QBuSojRyt ZEtW0OW8r6+OjKTtUlkxnsXKTqUMi0cB6FYV+u4s0064olutzPB+PEmSzqgWEv3xmdPa CQE4YHNt5UH/8xs7UKZfQT2p9dFv9qTX2AAamVduvftncXJG4zHQBZSVp6qNcDuEJYed hKbHO8s/L6bJyg2ThViZULbUJYklC3FRn8Iu+lGx9txGlrl0jjWBY66rtd6EdLh6/Zo4 X82A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EotC5W3w; 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 6a1803df08f44-6d35416b1b1si129044316d6.216.2024.11.05.03.21.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:10 -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=EotC5W3w; 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 1t8HbO-0004YY-4y; Tue, 05 Nov 2024 06:20:02 -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 1t8HbK-0004VZ-0i for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:58 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbD-00077F-JD for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:19:57 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4314b316495so45502685e9.2 for ; Tue, 05 Nov 2024 03:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805589; x=1731410389; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=c8Sl2WdMeznJ3O6Hl+0ANVSekrp0/KXuiL2fAiYWe7Y=; b=EotC5W3wV5nQVA1Ke8WpTF007lOMb1cWooXAsyiANAhkKjC4umHkDzBMrzgZgRIWHE uBJ5msPmXvQlWzhQhnJ39grrI0UMQ4mn0ApbByFAfIFrtrIehQp9oEfMA5lhiXat5g/0 Ma78ALUfxlWvoz8FgGjVstqHA/arFdBG3XXA5EN8ZSVfaZ3vEMQEmo9MnA8Mr6XPdTas V2Fy+DvROddHLGUOLUTsPejxhMBxH0l4FBJkycYUVyHeIJL9mkVhM6a+GkJOnyLeewYR Pd50XEmL4ngFUQPxlsUqOFleWb0A0VmTSwdhLRG1aBLxiaCLd7M1ubW6xbHMauWEOZEO bnoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805589; x=1731410389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c8Sl2WdMeznJ3O6Hl+0ANVSekrp0/KXuiL2fAiYWe7Y=; b=rHYCHEjGkv1uc2pigdWC4qh1FPO5cEjxiT0i5UXMCQ7eoJVcNxCGhglgjNmV00oa0U m7/182SC4GqmEf1HEw50wUcvFvBxDAfhgeu0r2iH5a7B74cRGT+hFpl6zCNDaBnfaIJS SnOgIKvbjyPRnAcSl2ySBV1917XMskmCjGJ1PC8Ubma+3Cy/6WWiJ7bZJZ7omETAKk2D TOdntrC438aDzZr8TGstDRm87qkDjyPa2S+HAQCp/BiU0M48/fo+jvviJK/PabNipEoK oFQBBn1uinPVbrbnVxf/EedEyPcD0/nHsQdSX4nwk3jzY2gL56zRyCvYlQAsOq1HLBYG 0gRg== X-Gm-Message-State: AOJu0Yxd8YqagAehR4RnOKLPKjUT0BFFFlgkXTAKKvdltw6naW2oR5V7 QukvXcezM0Hoyj4dY6RKK0IkXUInhQwvGXBWKfeYGJFgVT6PPtvnAAkhnti2V+9Wf2PgEoeOzo2 3 X-Received: by 2002:a05:600c:3591:b0:431:680e:95d9 with SMTP id 5b1f17b1804b1-4327b7eac4emr165388775e9.22.1730805588717; Tue, 05 Nov 2024 03:19:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/31] target/rx: Explicitly set 2-NaN propagation rule Date: Tue, 5 Nov 2024 11:19:24 +0000 Message-Id: <20241105111935.2747034-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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 Set the NaN propagation rule explicitly for the float_status word used in the rx target. This not the architecturally correct behaviour, but since this is a no-behaviour-change patch, we leave a TODO note to that effect. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-21-peter.maydell@linaro.org --- target/rx/cpu.c | 7 +++++++ fpu/softfloat-specialize.c.inc | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 36d2a6f1890..65a74ce720f 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -93,6 +93,13 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) env->fpsw = 0; set_flush_to_zero(1, &env->fp_status); set_flush_inputs_to_zero(1, &env->fp_status); + /* + * TODO: this is not the correct NaN propagation rule for this + * architecture. The "RX Family User's Manual: Software" table 1.6 + * defines the propagation rules as "prefer SNaN over QNaN; + * then prefer dest over source", which is float_2nan_prop_s_ab. + */ + set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); } static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index ee5c73cad46..254bbd67168 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -407,7 +407,8 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ || defined(TARGET_SPARC) || defined(TARGET_XTENSA) \ || defined(TARGET_I386) || defined(TARGET_ALPHA) \ - || defined(TARGET_MICROBLAZE) || defined(TARGET_OPENRISC) + || defined(TARGET_MICROBLAZE) || defined(TARGET_OPENRISC) \ + || defined(TARGET_RX) g_assert_not_reached(); #else rule = float_2nan_prop_x87; From patchwork Tue Nov 5 11:19:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840763 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285137wry; Tue, 5 Nov 2024 03:20:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVL03RhIdwH1oPQfZRaAZJos19CBmonwJYFCefd27iL65NI6mUfCyrCkyMUl6yvgiCt9/1k5A==@linaro.org X-Google-Smtp-Source: AGHT+IF8mtvBjBMruzVp5Tgr4LTXVJx8W88gEv/t5a6xaWzqB9j0w8jAYGQbkneTHN6soeVlR8Dj X-Received: by 2002:a05:6122:1ac8:b0:50a:b5a3:e00c with SMTP id 71dfb90a1353d-512270b5ab9mr13001106e0c.1.1730805643135; Tue, 05 Nov 2024 03:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805643; cv=none; d=google.com; s=arc-20240605; b=YcInfi1SYxRxCdG5C2S2Di3e1pq9mKrudPA+1cUQDZ+kizHRv3ZhYcWNw5w5JWs9Uv F0JhdA+Cp+eHdr9phLMVcv9BMxP1fq8Z1XM7nmkirOIq9HX0wEIoZNl1l+IxjblLIudx zWc1BnectZrreDGnFq0AhA3S8EZ4w6GrBJqsvTH+CM00d5pxvitVkUWareG8qBbn/M5M RetGV7xEt6Gh+0+wVpccZsK6kAQyL8UN9Xz2h/gAguqoeFkhXvbanL2Vc7GSLw1dlGyL B+C2mJMl0u/qkuxTIBDjXpai9pyO6Ftogjk4T3x++Bm2rzDh+AgAITtZh+jGRszigXFD zu5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=Cw1psGp48awikydAaL3SY3lKiGJTebHKYQq/ZU+4hUk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=IdV9mvve16GaaY6BRxoiFhdN4WNJz/FOmyk5lF5rrSfqz0KK0O5BFREk2bXfSdum6d 3Ov/ym4htx+kVYKBJzisIbOnhVWV/BDx9aNhJ+AChM3doIyukEOi+ikWsQu8OravB1cX XhZLWsc280k7CwGqDRRrg92w+zshle3kXel6d3BX7T2oZPi9+91/YcZe9in+ytNn4JeD nmgsHnINN13n0RxJDaySx/yUAJ+QwvPYzJVA5aXou6o2T5uE6MIPdaHHSHPppA0VJYX4 7koxu3W2Fn2CQh99OLv2mH+q9+BEmB7KkeFZYKVxnbw4VDXtPDL3cLwVgHSDMy8/tAdz TNPQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tfck9LSn; 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 6a1803df08f44-6d3541ac794si130931876d6.508.2024.11.05.03.20.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:20:43 -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=tfck9LSn; 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 1t8HbS-0004aD-Vn; Tue, 05 Nov 2024 06:20:07 -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 1t8HbQ-0004Yk-8Q for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:04 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbE-00077O-G4 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:02 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-37d41894a32so3063508f8f.1 for ; Tue, 05 Nov 2024 03:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805589; x=1731410389; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Cw1psGp48awikydAaL3SY3lKiGJTebHKYQq/ZU+4hUk=; b=tfck9LSnEOOFfcW0CLZQQUNbB6E/QcXa6qyrBE5bRVro2OnJSyB86k9f1pJTdNOKQC DpG0c1JRRTJTLzXjU5g6uDfCzOs3gX7vVQ6X3qE61KnNJQoEFUApMNpKJptwMEamukY/ BIdewRO7YInMYqTXJsmvSGrAbnRC7lLNw66mc+0P5NE2Kruye3G96kpGZZh6jqlRLGMt zkESnTEVCjKF5NUhWYtA2yQMnuliWgQn31k+90cb+ozH3/x+tpA2UBZmWjIumhR2ddv3 E5QSD2K0U23qMcLgY/ERKEwfUHfb3SyT/k4JFTibDHyvNrw1+tnIMQyL5honzAZMjQ7Z 8XKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805589; x=1731410389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cw1psGp48awikydAaL3SY3lKiGJTebHKYQq/ZU+4hUk=; b=SUyouWQG6jJE0lu1+jKmUS5AciQkixEks4LNcLSXAHN97d8F+h4eIeEqkMCPLliOhk ssWyAcdc4iGOxVlvxKFSdzvmLhpIahLnXJNAvaH9vf2h4VnuX2ra/h8DluIIrpb78e2i nJ613xLG+xmk2wsRtPWC69vbvaE5mh4Cq8rA5H+pbiljLDQ9FgNt7RuPE1tfi2XD71yP mZx8nVSOrqBBN1eyPDtTmYXdYKJl2GvijX1WeIC6Zf8cho51oZo4ONSutVgbhpEmIF2E D9awafGJb1oGN4U5sbmeVHluszufBV2a9v4cBHbp8hESGow0hUDWIOhWfMVV+8ZYAhhS YFmw== X-Gm-Message-State: AOJu0YzJhkxQpIqcbQnTLBvaKTM3cocUfI/tLWmeyCRdnYOQd/MBqOZU JYV+qIj1shfp9jEBXsEhUNgKLIJKGCaYT5Ah/3BfNDUf8+eAfyHadkmZyS6y31Yi4Qe9yzEDOt+ 3 X-Received: by 2002:a5d:47ac:0:b0:37c:fdc8:77ab with SMTP id ffacd0b85a97d-381c7973202mr13345787f8f.7.1730805589398; Tue, 05 Nov 2024 03:19:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/31] softfloat: Remove fallback rule from pickNaN() Date: Tue, 5 Nov 2024 11:19:25 +0000 Message-Id: <20241105111935.2747034-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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 Now that all targets have been converted to explicitly set a NaN propagation rule, we can remove the set of target ifdefs (which now list every target) and clean up the references to fallback behaviour for float_2nan_prop_none. The "default" case in the switch will catch any remaining places where status->float_2nan_prop_rule was not set by the target. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20241025141254.2141506-22-peter.maydell@linaro.org --- include/fpu/softfloat-types.h | 10 +++------- fpu/softfloat-specialize.c.inc | 23 +++-------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 5cd5a0d0ae1..8f39691dfd0 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -178,13 +178,9 @@ typedef enum __attribute__((__packed__)) { * If default_nan_mode is enabled then it is valid not to set a * NaN propagation rule, because the softfloat code guarantees * not to try to pick a NaN to propagate in default NaN mode. - * - * For transition, currently the 'none' rule will cause us to - * fall back to picking the propagation rule based on the existing - * ifdef ladder. When all targets are converted it will be an error - * not to set the rule in float_status unless in default_nan_mode, - * and we will assert if we need to handle an input NaN and no - * rule was selected. + * When not in default-NaN mode, it is an error for the target + * not to set the rule in float_status, and we will assert if + * we need to handle an input NaN and no rule was selected. */ typedef enum __attribute__((__packed__)) { /* No propagation rule specified */ diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 254bbd67168..b5a32080505 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -390,32 +390,15 @@ bool float32_is_signaling_nan(float32 a_, float_status *status) static int pickNaN(FloatClass a_cls, FloatClass b_cls, bool aIsLargerSignificand, float_status *status) { - Float2NaNPropRule rule = status->float_2nan_prop_rule; - /* * We guarantee not to require the target to tell us how to * pick a NaN if we're always returning the default NaN. + * But if we're not in default-NaN mode then the target must + * specify via set_float_2nan_prop_rule(). */ assert(!status->default_nan_mode); - if (rule == float_2nan_prop_none) { - /* target didn't set the rule: fall back to old ifdef choices */ -#if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \ - || defined(TARGET_RISCV) || defined(TARGET_SH4) \ - || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \ - || defined(TARGET_LOONGARCH64) || defined(TARGET_HPPA) \ - || defined(TARGET_S390X) || defined(TARGET_PPC) || defined(TARGET_M68K) \ - || defined(TARGET_SPARC) || defined(TARGET_XTENSA) \ - || defined(TARGET_I386) || defined(TARGET_ALPHA) \ - || defined(TARGET_MICROBLAZE) || defined(TARGET_OPENRISC) \ - || defined(TARGET_RX) - g_assert_not_reached(); -#else - rule = float_2nan_prop_x87; -#endif - } - - switch (rule) { + switch (status->float_2nan_prop_rule) { case float_2nan_prop_s_ab: if (is_snan(a_cls)) { return 0; From patchwork Tue Nov 5 11:19:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840775 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285710wry; Tue, 5 Nov 2024 03:22:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXmtam6K9goFH13+epOvjPTw2PkiF+ca1Uv1aE0mvPfcnBckvJ+S/jiPTeKQXY1ovN1s6bO8w==@linaro.org X-Google-Smtp-Source: AGHT+IHaNtkGXgYbkAAyz9e4YPhB/sQFrlKom9PMdBAPTHPrGHt9N3oVqqVyCA12erD2PGogaNDw X-Received: by 2002:a05:6808:1b12:b0:3e6:2d10:2392 with SMTP id 5614622812f47-3e758bfd94amr14485234b6e.7.1730805729624; Tue, 05 Nov 2024 03:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805729; cv=none; d=google.com; s=arc-20240605; b=SMP168HFEs9lwHM4GZ6cTpIUIoWTl/NmU1A2ugp0rINHm1ZkWKwseWELYOnXoJtZjn cejWpsyyHWWhQ9IbxwJWAL7OTK1FbTnpUnigOHJkZigdfv74kLl3gAAXXbZr0dqz5rgg sCgK2+iLQn6jynuN8Vobd9pRovV9+0E67wpKyDzn9bdxUNstXS7OFZ+eKVOPk38w3Ff4 5gtzRWcay5TDvI4udpQeTSsQ1M75vNzvdKuLZuUF59U3DOdPVX/Xn1xmTr75XTcwDOnK 3QaynzmZLJQxH9k7wFDhfGXrQolMkVglJFdXfQ+bwDUig8GTzPhoe1NCbHm6JU0//Sy3 /ELg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=VjaWzrmGlTbLwLkZAx+1n0T7g0x94qIv6F1YDtyxP20=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=DRmUaa2CsfWZDNtUPB9musW7o/hzI//rkZYONJkpe4LbmlMfFI5wk8tVlSfqvwh4j2 2/wuoo16BNe12Qy32XFJ0OZ8F4h2Xo66n658olh+YSS5qGoYr3678aely+lsdNTUZswf KTPuusib/+Ucg5Hv0TV4wumrB2HxtBcZFrbo50ANOrZuHFsg/1MitmRMtOarhlc/pbVq xX8h6tuaGrQrIdpDoclj4Yh7itGdfRlQenwDRMYH6mO0Z6ZHerh9aPOStoCV9lvel+4u 6nkUY0RhrMVCN/PwiZq+YvGSv1drKc82CtR1KJI9hHk/ufnJbAtWGnVt8UTuSx2LfRC2 OHKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g+Vi5Tkd; 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 6a1803df08f44-6d3541c262esi139908016d6.558.2024.11.05.03.22.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:22:09 -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=g+Vi5Tkd; 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 1t8HbU-0004b3-Gk; Tue, 05 Nov 2024 06:20:08 -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 1t8HbT-0004aU-6A for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:07 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbF-00077g-Ar for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:06 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-431688d5127so42184175e9.0 for ; Tue, 05 Nov 2024 03:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805590; x=1731410390; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VjaWzrmGlTbLwLkZAx+1n0T7g0x94qIv6F1YDtyxP20=; b=g+Vi5TkdpU7lSWl5BobzYgA25Cn0Uq+Fde9dgzjpYBf0Mo39a45xmw20Bzk/blfGCx O+xPKonpZb6DCC4TSevGanwR5N2oWiUk84rOUR3o/HD2svqEiUJOt7l7nE0zhWtW8127 3VemmnF5cvStCWowuOLp+N/w0/Tj8hOkxdA+M3Ppir85azuLzIjLxQbR9wZYxMnIJaRI z/iIBBMUyVY587Q1vz2YhtEkAEd/UPJ2NMeKMKRd2aSRiVG5kAUNHwGKR49x2dFhcbQA eZ7I736ZNDLX1apXMH+PEtxa/ZTKNv0HJsnR68C+wk1XiZ1Hceg5jUgcVY1hX2Q3KN2g leFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805590; x=1731410390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VjaWzrmGlTbLwLkZAx+1n0T7g0x94qIv6F1YDtyxP20=; b=PMzdskG+ZJ4T6vLOP4YARhf11QiGHHrHyzo6sGOAVMjYR22F0GmLWQKpK/4kV9q9Tc xCyNzoG8gckV6xLfvX/YIusUSg6tjfxkMtdURaAHGdPYlLy7/d/6HhJ9IQnRsGIBFYwC F3/Fugoaibj+UF3IADPbPhfIrQP4zLzjZTyQ0juiJ+z1NTgfuCVX7ov+MleaxapIQb2c EAriUkRom76ZtFn9LDJ11XDVupLgMPdCs4Uzn/zJlmZxDwNRII25nW6OV+qay4o/+6v2 hBDwCDZpMucUeGXJ6GSWogux8Dpo5oojQsiepIwooSO5+gOlDM7/XJQFJ1GxRjdfxrGK M9Lg== X-Gm-Message-State: AOJu0YzXM4/kqM4jG8LqwJoddIOXd6vohcSv+k8epnIDcuRQxOcYTHUP phe5Axlzt9/mLEWTgclTIKABlNzTLVnwqPIlGk6iWAKAT3SM0vTO13HxwrjMCQ0H1HxwgosTNNl n X-Received: by 2002:a05:600c:4eca:b0:431:5c1c:71b6 with SMTP id 5b1f17b1804b1-4319acad842mr370546495e9.17.1730805590206; Tue, 05 Nov 2024 03:19:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/31] Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32" Date: Tue, 5 Nov 2024 11:19:26 +0000 Message-Id: <20241105111935.2747034-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@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.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 This reverts commit 4c2c0474693229c1f533239bb983495c5427784d. This commit tried to fix a problem with our usage of MMU indexes when EL3 is AArch32, using what it described as a "more complicated approach" where we share the same MMU index values for Secure PL1&0 and NonSecure PL1&0. In theory this should work, but the change didn't account for (at least) two things: (1) The design change means we need to flush the TLBs at any point where the CPU state flips from one to the other. We already flush the TLB when SCR.NS is changed, but we don't flush the TLB when we take an exception from NS PL1&0 into Mon or when we return from Mon to NS PL1&0, and the commit didn't add any code to do that. (2) The ATS12NS* address translate instructions allow Mon code (which is Secure) to do a stage 1+2 page table walk for NS. I thought this was OK because do_ats_write() does a page table walk which doesn't use the TLBs, so because it can pass both the MMU index and also an ARMSecuritySpace argument we can tell the table walk that we want NS stage1+2, not S. But that means that all the code within the ptw that needs to find e.g. the regime EL cannot do so only with an mmu_idx -- all these functions like regime_sctlr(), regime_el(), etc would need to pass both an mmu_idx and the security_space, so they can tell whether this is a translation regime controlled by EL1 or EL3 (and so whether to look at SCTLR.S or SCTLR.NS, etc). In particular, because regime_el() wasn't updated to look at the ARMSecuritySpace it would return 1 even when the CPU was in Monitor mode (and the controlling EL is 3). This meant that page table walks in Monitor mode would look at the wrong SCTLR, TCR, etc and would generally fault when they should not. Rather than trying to make the complicated changes needed to rescue the design of 4c2c04746932, we revert it in order to instead take the route that that commit describes as "the most straightforward" fix, where we add new MMU indexes EL30_0, EL30_3, EL30_3_PAN to correspond to "Secure PL1&0 at PL0", "Secure PL1&0 at PL1", and "Secure PL1&0 at PL1 with PAN". This revert will re-expose the "spurious alignment faults in Secure PL0" issue #2326; we'll fix it again in the next commit. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Tested-by: Thomas Huth Message-id: 20241101142845.1712482-2-peter.maydell@linaro.org Reviewed-by: Richard Henderson --- target/arm/cpu.h | 31 +++++++++++++------------------ target/arm/internals.h | 27 ++++----------------------- target/arm/tcg/translate.h | 2 -- target/arm/helper.c | 34 +++++++++++----------------------- target/arm/ptw.c | 6 +----- target/arm/tcg/hflags.c | 4 ---- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 9 ++++----- 8 files changed, 34 insertions(+), 81 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 8fc8b6398f7..133a87e39a8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2787,7 +2787,8 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * + NonSecure PL1 & 0 stage 1 * + NonSecure PL1 & 0 stage 2 * + NonSecure PL2 - * + Secure PL1 & 0 + * + Secure PL0 + * + Secure PL1 * (reminder: for 32 bit EL3, Secure PL1 is *EL3*, not EL1.) * * For QEMU, an mmu_idx is not quite the same as a translation regime because: @@ -2805,39 +2806,37 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * The only use of stage 2 translations is either as part of an s1+2 * lookup or when loading the descriptors during a stage 1 page table walk, * and in both those cases we don't use the TLB. - * 4. we want to be able to use the TLB for accesses done as part of a + * 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3" + * translation regimes, because they map reasonably well to each other + * and they can't both be active at the same time. + * 5. we want to be able to use the TLB for accesses done as part of a * stage1 page table walk, rather than having to walk the stage2 page * table over and over. - * 5. we need separate EL1/EL2 mmu_idx for handling the Privileged Access + * 6. we need separate EL1/EL2 mmu_idx for handling the Privileged Access * Never (PAN) bit within PSTATE. - * 6. we fold together most secure and non-secure regimes for A-profile, + * 7. we fold together most secure and non-secure regimes for A-profile, * because there are no banked system registers for aarch64, so the * process of switching between secure and non-secure is * already heavyweight. - * 7. we cannot fold together Stage 2 Secure and Stage 2 NonSecure, + * 8. we cannot fold together Stage 2 Secure and Stage 2 NonSecure, * because both are in use simultaneously for Secure EL2. * * This gives us the following list of cases: * - * EL0 EL1&0 stage 1+2 (or AArch32 PL0 PL1&0 stage 1+2) - * EL1 EL1&0 stage 1+2 (or AArch32 PL1 PL1&0 stage 1+2) - * EL1 EL1&0 stage 1+2 +PAN (or AArch32 PL1 PL1&0 stage 1+2 +PAN) + * EL0 EL1&0 stage 1+2 (aka NS PL0) + * EL1 EL1&0 stage 1+2 (aka NS PL1) + * EL1 EL1&0 stage 1+2 +PAN * EL0 EL2&0 * EL2 EL2&0 * EL2 EL2&0 +PAN * EL2 (aka NS PL2) - * EL3 (not used when EL3 is AArch32) + * EL3 (aka S PL1) * Stage2 Secure * Stage2 NonSecure * plus one TLB per Physical address space: S, NS, Realm, Root * * for a total of 14 different mmu_idx. * - * Note that when EL3 is AArch32, the usage is potentially confusing - * because the MMU indexes are named for their AArch64 use, so code - * using the ARMMMUIdx_E10_1 might be at EL3, not EL1. This is because - * Secure PL1 is always at EL3. - * * R profile CPUs have an MPU, but can use the same set of MMU indexes * as A profile. They only need to distinguish EL0 and EL1 (and * EL2 for cores like the Cortex-R52). @@ -3130,10 +3129,6 @@ FIELD(TBFLAG_A32, NS, 10, 1) * This requires an SME trap from AArch32 mode when using NEON. */ FIELD(TBFLAG_A32, SME_TRAP_NONSTREAMING, 11, 1) -/* - * Indicates whether we are in the Secure PL1&0 translation regime - */ -FIELD(TBFLAG_A32, S_PL1_0, 12, 1) /* * Bit usage when in AArch32 state, for M-profile only. diff --git a/target/arm/internals.h b/target/arm/internals.h index fd8f7c82aa3..f43d97c59a9 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -275,20 +275,6 @@ FIELD(CNTHCTL, CNTPMASK, 19, 1) #define M_FAKE_FSR_NSC_EXEC 0xf /* NS executing in S&NSC memory */ #define M_FAKE_FSR_SFAULT 0xe /* SecureFault INVTRAN, INVEP or AUVIOL */ -/** - * arm_aa32_secure_pl1_0(): Return true if in Secure PL1&0 regime - * - * Return true if the CPU is in the Secure PL1&0 translation regime. - * This requires that EL3 exists and is AArch32 and we are currently - * Secure. If this is the case then the ARMMMUIdx_E10* apply and - * mean we are in EL3, not EL1. - */ -static inline bool arm_aa32_secure_pl1_0(CPUARMState *env) -{ - return arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3) && arm_is_secure(env); -} - /** * raise_exception: Raise the specified exception. * Raise a guest exception with the specified value, syndrome register @@ -841,12 +827,7 @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx) return mmu_idx | ARM_MMU_IDX_A; } -/** - * Return the exception level we're running at if our current MMU index - * is @mmu_idx. @s_pl1_0 should be true if this is the AArch32 - * Secure PL1&0 translation regime. - */ -int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx, bool s_pl1_0); +int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx); /* Return the MMU index for a v7M CPU in the specified security state */ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate); @@ -941,11 +922,11 @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) return 3; case ARMMMUIdx_E10_0: case ARMMMUIdx_Stage1_E0: - case ARMMMUIdx_E10_1: - case ARMMMUIdx_E10_1_PAN: + return arm_el_is_aa64(env, 3) || !arm_is_secure_below_el3(env) ? 1 : 3; case ARMMMUIdx_Stage1_E1: case ARMMMUIdx_Stage1_E1_PAN: - return arm_el_is_aa64(env, 3) || !arm_is_secure_below_el3(env) ? 1 : 3; + case ARMMMUIdx_E10_1: + case ARMMMUIdx_E10_1_PAN: case ARMMMUIdx_MPrivNegPri: case ARMMMUIdx_MUserNegPri: case ARMMMUIdx_MPriv: diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 5a2e10d64d5..20cd0e851c4 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -165,8 +165,6 @@ typedef struct DisasContext { uint8_t gm_blocksize; /* True if the current insn_start has been updated. */ bool insn_start_updated; - /* True if this is the AArch32 Secure PL1&0 translation regime */ - bool s_pl1_0; /* Bottom two bits of XScale c15_cpar coprocessor access control reg */ int c15_cpar; /* Offset from VNCR_EL2 when FEAT_NV2 redirects this reg to memory */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 0a731a38e8f..0900034d42a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3701,7 +3701,7 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, */ format64 = arm_s1_regime_using_lpae_format(env, mmu_idx); - if (arm_feature(env, ARM_FEATURE_EL2) && !arm_aa32_secure_pl1_0(env)) { + if (arm_feature(env, ARM_FEATURE_EL2)) { if (mmu_idx == ARMMMUIdx_E10_0 || mmu_idx == ARMMMUIdx_E10_1 || mmu_idx == ARMMMUIdx_E10_1_PAN) { @@ -3775,11 +3775,13 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) case 0: /* stage 1 current state PL1: ATS1CPR, ATS1CPW, ATS1CPRP, ATS1CPWP */ switch (el) { + case 3: + mmu_idx = ARMMMUIdx_E3; + break; case 2: g_assert(ss != ARMSS_Secure); /* ARMv8.4-SecEL2 is 64-bit only */ /* fall through */ case 1: - case 3: if (ri->crm == 9 && arm_pan_enabled(env)) { mmu_idx = ARMMMUIdx_Stage1_E1_PAN; } else { @@ -11860,11 +11862,8 @@ void arm_cpu_do_interrupt(CPUState *cs) uint64_t arm_sctlr(CPUARMState *env, int el) { - if (arm_aa32_secure_pl1_0(env)) { - /* In Secure PL1&0 SCTLR_S is always controlling */ - el = 3; - } else if (el == 0) { - /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */ + /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */ + if (el == 0) { ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0); el = mmu_idx == ARMMMUIdx_E20_0 ? 2 : 1; } @@ -12524,12 +12523,8 @@ int fp_exception_el(CPUARMState *env, int cur_el) return 0; } -/* - * Return the exception level we're running at if this is our mmu_idx. - * s_pl1_0 should be true if this is the AArch32 Secure PL1&0 translation - * regime. - */ -int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx, bool s_pl1_0) +/* Return the exception level we're running at if this is our mmu_idx */ +int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) { if (mmu_idx & ARM_MMU_IDX_M) { return mmu_idx & ARM_MMU_IDX_M_PRIV; @@ -12541,7 +12536,7 @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx, bool s_pl1_0) return 0; case ARMMMUIdx_E10_1: case ARMMMUIdx_E10_1_PAN: - return s_pl1_0 ? 3 : 1; + return 1; case ARMMMUIdx_E2: case ARMMMUIdx_E20_2: case ARMMMUIdx_E20_2_PAN: @@ -12579,15 +12574,6 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) idx = ARMMMUIdx_E10_0; } break; - case 3: - /* - * AArch64 EL3 has its own translation regime; AArch32 EL3 - * uses the Secure PL1&0 translation regime. - */ - if (arm_el_is_aa64(env, 3)) { - return ARMMMUIdx_E3; - } - /* fall through */ case 1: if (arm_pan_enabled(env)) { idx = ARMMMUIdx_E10_1_PAN; @@ -12607,6 +12593,8 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) idx = ARMMMUIdx_E2; } break; + case 3: + return ARMMMUIdx_E3; default: g_assert_not_reached(); } diff --git a/target/arm/ptw.c b/target/arm/ptw.c index dd402683973..ba3dd38a729 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3607,11 +3607,7 @@ bool get_phys_addr(CPUARMState *env, vaddr address, case ARMMMUIdx_Stage1_E1: case ARMMMUIdx_Stage1_E1_PAN: case ARMMMUIdx_E2: - if (arm_aa32_secure_pl1_0(env)) { - ss = ARMSS_Secure; - } else { - ss = arm_security_space_below_el3(env); - } + ss = arm_security_space_below_el3(env); break; case ARMMMUIdx_Stage2: /* diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c index bab7822ef66..f03977b4b00 100644 --- a/target/arm/tcg/hflags.c +++ b/target/arm/tcg/hflags.c @@ -198,10 +198,6 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, DP_TBFLAG_A32(flags, SME_TRAP_NONSTREAMING, 1); } - if (arm_aa32_secure_pl1_0(env)) { - DP_TBFLAG_A32(flags, S_PL1_0, 1); - } - return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ec0b1ee2523..b2851ea5032 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -11690,7 +11690,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->tbii = EX_TBFLAG_A64(tb_flags, TBII); dc->tbid = EX_TBFLAG_A64(tb_flags, TBID); dc->tcma = EX_TBFLAG_A64(tb_flags, TCMA); - dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx, false); + dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); #if !defined(CONFIG_USER_ONLY) dc->user = (dc->current_el == 0); #endif diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index e2748ff2bb8..c5bc691d92b 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -7546,6 +7546,10 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) core_mmu_idx = EX_TBFLAG_ANY(tb_flags, MMUIDX); dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx); + dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); +#if !defined(CONFIG_USER_ONLY) + dc->user = (dc->current_el == 0); +#endif dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); dc->pstate_il = EX_TBFLAG_ANY(tb_flags, PSTATE__IL); @@ -7576,12 +7580,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) } dc->sme_trap_nonstreaming = EX_TBFLAG_A32(tb_flags, SME_TRAP_NONSTREAMING); - dc->s_pl1_0 = EX_TBFLAG_A32(tb_flags, S_PL1_0); } - dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx, dc->s_pl1_0); -#if !defined(CONFIG_USER_ONLY) - dc->user = (dc->current_el == 0); -#endif dc->lse2 = false; /* applies only to aarch64 */ dc->cp_regs = cpu->cp_regs; dc->features = env->features; From patchwork Tue Nov 5 11:19:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840788 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286420wry; Tue, 5 Nov 2024 03:24:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXfaIm7EDuzRGW482mIPqVQJpNoT0Wt2yBuOYYx9CyKhyS+lnSp5qx5sJMU5g7MkHFf9tJEgQ==@linaro.org X-Google-Smtp-Source: AGHT+IEV75T95/JmzXakKSYZqk67xEgHhmF7I1KkYuMNZq4A4y1vc9vsdOLDg4R2lbBxVKqiTgRy X-Received: by 2002:a05:690c:4809:b0:6de:2ae:8138 with SMTP id 00721157ae682-6ea64a8cc02mr154426467b3.5.1730805849663; Tue, 05 Nov 2024 03:24:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805849; cv=none; d=google.com; s=arc-20240605; b=Mz9oq+Kya+gGLMM2L7PMgpdh36IkdZvVVDlCymxMlZGkqh7RnEcFFUOAmn34T+cKDm t+B97yCrcwj+BkV/caEhrp78O0yfyzWaX9lTRFLVcpd1obvjEHrJu/BUKko+/N4Bv1FH emo3swYEsyCwdfpvw8H3PMvuZtHFJ7TqArGFovBjrQuox4ll76BbYKXA/Af4bbonLz9S GT2kFjT21Z0vQVZgV6sovczm4VnBuoYCKFgr0zdoc7/kl1VB0DSwxtUuIH0cDNAZis5H Y6oRxHiPOaAu2vGwKOD9cqXjF0CJl2xf6l5yLJOc0txTvh7K9vLl5QRzI8w+5ei7EO+h +/Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=ORbo9Z9GZzbmxVY8m4mg1oc4mRVIApeDSyXROSST6Z0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NmXZgF74l/IAT4TfWr5NHY472Ilbv5qd5lQkIL2Nugw8XlBjpWec8Vf8FkJVJ9ZaBG r2ewcJTOzyYWOAuhVQePXf3SfOgj27ZWkLjrNUY3IXCLntQUxLQI+SJAeBg6CJKuTKB6 jdhb+CeyxtNLvHEf9m0/1EUyKjYOCmiRcYpv9fwHrgr3z810Wz3cSx+p74l22URfBnmX yOX2DvMVjTiedWDTk9kHY94sSiTfd7KKe0vpxeMRAHPXaZx9wunrtrp+PBjQF/3D8kAE aFrD0uzL4XlJxzse5akOgb/uziRYdiC/3CRCxweZrbPJY3LmwbThxypvFFceLRYDeocA BGTQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D4Mc0Vi+; 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 6a1803df08f44-6d35416a42csi142125546d6.199.2024.11.05.03.24.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:24:09 -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=D4Mc0Vi+; 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 1t8HbY-0004er-Lg; Tue, 05 Nov 2024 06:20:12 -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 1t8HbT-0004ac-DJ for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:07 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbG-00077v-RZ for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:07 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so47101575e9.1 for ; Tue, 05 Nov 2024 03:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805591; x=1731410391; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ORbo9Z9GZzbmxVY8m4mg1oc4mRVIApeDSyXROSST6Z0=; b=D4Mc0Vi+XFyv+MyufVOcUhbiKNwrKTbeQ6WoQkE06DAfY9Tu24APT7WX52Q6AWjg6v I9SBJcK1bLd9iSBQQmxPKx8J2OSSs+be3WCpnhnM/zE8EGwQc5iT+9a9KcckqZ37tmrx KHJ2gRAg0FFI8zxY1D42TeQgnP6ULOCXhl5BM8EB3xBg5az/aIgFa0iCic8L05gvurwb fnK0ldbsk44Od2tF4NXN2+KM5NfwFfVOLwvCp4LdsXOuIP+fP/B5oakrLfYKewC/N7lc 6NAZ+twCeDPBllF2+ZOFodmFInW+FYrtYKzv5iihZl4R4Lqio6XIfonGj9AUNlqLtst/ QSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805591; x=1731410391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ORbo9Z9GZzbmxVY8m4mg1oc4mRVIApeDSyXROSST6Z0=; b=k/hcLnADG2C3YCiXr1/jQajcJgMycFDZIYqjbEYdg12SFynW6cJ5zejVQ/YLbluRY+ HLFwEDP8iRN1vZIOd93m3/EE5uNp+45NS2QafEn16R5xXDrPZKhO9yRDiGHhfteuxBDr ue+TFRAtrtO+7ekoip3MUiKO9lL+CJmRTnXNmHdHa5oteK+6BO7T9AYL7HRUj16Zfv4i RjhH0PShQBnJiQyuT26fNq3F6IbKXWEzfRtA4yjVYDQkeUZVJkgd4fHvJp2bTAHOlPFR p3iO+JQ3mKY/HQ/Xf61mm4EKw9fu81fAxTGRtIybTfIM+JnNE/HsDDem5t6z0P8vaOmc KK3A== X-Gm-Message-State: AOJu0Yzc4u7/qqm+Sg56sxh1dA6d/jT/NexH9YT9GccZoD5siZOefNUq 0e2z+5QCTvtB9BMXONVgRZy2EXr9VD1vES0pvosDSL+3kC4eYcmjgJyhkR7mcumzWngz3uwFOSS V X-Received: by 2002:a05:600c:3c83:b0:430:5846:7582 with SMTP id 5b1f17b1804b1-43283242ae4mr112161795e9.7.1730805590844; Tue, 05 Nov 2024 03:19:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/31] target/arm: Add new MMU indexes for AArch32 Secure PL1&0 Date: Tue, 5 Nov 2024 11:19:27 +0000 Message-Id: <20241105111935.2747034-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@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.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 Our current usage of MMU indexes when EL3 is AArch32 is confused. Architecturally, when EL3 is AArch32, all Secure code runs under the Secure PL1&0 translation regime: * code at EL3, which might be Mon, or SVC, or any of the other privileged modes (PL1) * code at EL0 (Secure PL0) This is different from when EL3 is AArch64, in which case EL3 is its own translation regime, and EL1 and EL0 (whether AArch32 or AArch64) have their own regime. We claimed to be mapping Secure PL1 to our ARMMMUIdx_EL3, but didn't do anything special about Secure PL0, which meant it used the same ARMMMUIdx_EL10_0 that NonSecure PL0 does. This resulted in a bug where arm_sctlr() incorrectly picked the NonSecure SCTLR as the controlling register when in Secure PL0, which meant we were spuriously generating alignment faults because we were looking at the wrong SCTLR control bits. The use of ARMMMUIdx_EL3 for Secure PL1 also resulted in the bug that we wouldn't honour the PAN bit for Secure PL1, because there's no equivalent _PAN mmu index for it. Fix this by adding two new MMU indexes: * ARMMMUIdx_E30_0 is for Secure PL0 * ARMMMUIdx_E30_3_PAN is for Secure PL1 when PAN is enabled The existing ARMMMUIdx_E3 is used to mean "Secure PL1 without PAN" (and would be named ARMMMUIdx_E30_3 in an AArch32-centric scheme). These extra two indexes bring us up to the maximum of 16 that the core code can currently support. This commit: * adds the new MMU index handling to the various places where we deal in MMU index values * adds assertions that we aren't AArch32 EL3 in a couple of places that currently use the E10 indexes, to document why they don't also need to handle the E30 indexes * documents in a comment why regime_has_2_ranges() doesn't need updating Notes for backporting: this commit depends on the preceding revert of 4c2c04746932; that revert and this commit should probably be backported to everywhere that we originally backported 4c2c04746932. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2326 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2588 Signed-off-by: Peter Maydell Tested-by: Thomas Huth Reviewed-by: Richard Henderson Message-id: 20241101142845.1712482-3-peter.maydell@linaro.org --- target/arm/cpu.h | 31 ++++++++++++++++++------------- target/arm/internals.h | 16 ++++++++++++++-- target/arm/helper.c | 38 ++++++++++++++++++++++++++++++++++---- target/arm/ptw.c | 4 ++++ target/arm/tcg/op_helper.c | 14 +++++++++++++- target/arm/tcg/translate.c | 3 +++ 6 files changed, 86 insertions(+), 20 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 133a87e39a8..fb0f217b196 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2787,8 +2787,7 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * + NonSecure PL1 & 0 stage 1 * + NonSecure PL1 & 0 stage 2 * + NonSecure PL2 - * + Secure PL0 - * + Secure PL1 + * + Secure PL1 & 0 * (reminder: for 32 bit EL3, Secure PL1 is *EL3*, not EL1.) * * For QEMU, an mmu_idx is not quite the same as a translation regime because: @@ -2823,19 +2822,21 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * * This gives us the following list of cases: * - * EL0 EL1&0 stage 1+2 (aka NS PL0) - * EL1 EL1&0 stage 1+2 (aka NS PL1) - * EL1 EL1&0 stage 1+2 +PAN + * EL0 EL1&0 stage 1+2 (aka NS PL0 PL1&0 stage 1+2) + * EL1 EL1&0 stage 1+2 (aka NS PL1 PL1&0 stage 1+2) + * EL1 EL1&0 stage 1+2 +PAN (aka NS PL1 P1&0 stage 1+2 +PAN) * EL0 EL2&0 * EL2 EL2&0 * EL2 EL2&0 +PAN * EL2 (aka NS PL2) - * EL3 (aka S PL1) + * EL3 (aka AArch32 S PL1 PL1&0) + * AArch32 S PL0 PL1&0 (we call this EL30_0) + * AArch32 S PL1 PL1&0 +PAN (we call this EL30_3_PAN) * Stage2 Secure * Stage2 NonSecure * plus one TLB per Physical address space: S, NS, Realm, Root * - * for a total of 14 different mmu_idx. + * for a total of 16 different mmu_idx. * * R profile CPUs have an MPU, but can use the same set of MMU indexes * as A profile. They only need to distinguish EL0 and EL1 (and @@ -2899,6 +2900,8 @@ typedef enum ARMMMUIdx { ARMMMUIdx_E20_2_PAN = 5 | ARM_MMU_IDX_A, ARMMMUIdx_E2 = 6 | ARM_MMU_IDX_A, ARMMMUIdx_E3 = 7 | ARM_MMU_IDX_A, + ARMMMUIdx_E30_0 = 8 | ARM_MMU_IDX_A, + ARMMMUIdx_E30_3_PAN = 9 | ARM_MMU_IDX_A, /* * Used for second stage of an S12 page table walk, or for descriptor @@ -2906,14 +2909,14 @@ typedef enum ARMMMUIdx { * are in use simultaneously for SecureEL2: the security state for * the S2 ptw is selected by the NS bit from the S1 ptw. */ - ARMMMUIdx_Stage2_S = 8 | ARM_MMU_IDX_A, - ARMMMUIdx_Stage2 = 9 | ARM_MMU_IDX_A, + ARMMMUIdx_Stage2_S = 10 | ARM_MMU_IDX_A, + ARMMMUIdx_Stage2 = 11 | ARM_MMU_IDX_A, /* TLBs with 1-1 mapping to the physical address spaces. */ - ARMMMUIdx_Phys_S = 10 | ARM_MMU_IDX_A, - ARMMMUIdx_Phys_NS = 11 | ARM_MMU_IDX_A, - ARMMMUIdx_Phys_Root = 12 | ARM_MMU_IDX_A, - ARMMMUIdx_Phys_Realm = 13 | ARM_MMU_IDX_A, + ARMMMUIdx_Phys_S = 12 | ARM_MMU_IDX_A, + ARMMMUIdx_Phys_NS = 13 | ARM_MMU_IDX_A, + ARMMMUIdx_Phys_Root = 14 | ARM_MMU_IDX_A, + ARMMMUIdx_Phys_Realm = 15 | ARM_MMU_IDX_A, /* * These are not allocated TLBs and are used only for AT system @@ -2952,6 +2955,8 @@ typedef enum ARMMMUIdxBit { TO_CORE_BIT(E20_2), TO_CORE_BIT(E20_2_PAN), TO_CORE_BIT(E3), + TO_CORE_BIT(E30_0), + TO_CORE_BIT(E30_3_PAN), TO_CORE_BIT(Stage2), TO_CORE_BIT(Stage2_S), diff --git a/target/arm/internals.h b/target/arm/internals.h index f43d97c59a9..e37f459af35 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -871,7 +871,16 @@ static inline void arm_call_el_change_hook(ARMCPU *cpu) } } -/* Return true if this address translation regime has two ranges. */ +/* + * Return true if this address translation regime has two ranges. + * Note that this will not return the correct answer for AArch32 + * Secure PL1&0 (i.e. mmu indexes E3, E30_0, E30_3_PAN), but it is + * never called from a context where EL3 can be AArch32. (The + * correct return value for ARMMMUIdx_E3 would be different for + * that case, so we can't just make the function return the + * correct value anyway; we would need an extra "bool e3_is_aarch32" + * argument which all the current callsites would pass as 'false'.) + */ static inline bool regime_has_2_ranges(ARMMMUIdx mmu_idx) { switch (mmu_idx) { @@ -896,6 +905,7 @@ static inline bool regime_is_pan(CPUARMState *env, ARMMMUIdx mmu_idx) case ARMMMUIdx_Stage1_E1_PAN: case ARMMMUIdx_E10_1_PAN: case ARMMMUIdx_E20_2_PAN: + case ARMMMUIdx_E30_3_PAN: return true; default: return false; @@ -919,10 +929,11 @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) case ARMMMUIdx_E2: return 2; case ARMMMUIdx_E3: + case ARMMMUIdx_E30_0: + case ARMMMUIdx_E30_3_PAN: return 3; case ARMMMUIdx_E10_0: case ARMMMUIdx_Stage1_E0: - return arm_el_is_aa64(env, 3) || !arm_is_secure_below_el3(env) ? 1 : 3; case ARMMMUIdx_Stage1_E1: case ARMMMUIdx_Stage1_E1_PAN: case ARMMMUIdx_E10_1: @@ -946,6 +957,7 @@ static inline bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx) switch (mmu_idx) { case ARMMMUIdx_E10_0: case ARMMMUIdx_E20_0: + case ARMMMUIdx_E30_0: case ARMMMUIdx_Stage1_E0: case ARMMMUIdx_MUser: case ARMMMUIdx_MSUser: diff --git a/target/arm/helper.c b/target/arm/helper.c index 0900034d42a..8c4f86f475a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -444,6 +444,9 @@ static int alle1_tlbmask(CPUARMState *env) * Note that the 'ALL' scope must invalidate both stage 1 and * stage 2 translations, whereas most other scopes only invalidate * stage 1 translations. + * + * For AArch32 this is only used for TLBIALLNSNH and VTTBR + * writes, so only needs to apply to NS PL1&0, not S PL1&0. */ return (ARMMMUIdxBit_E10_1 | ARMMMUIdxBit_E10_1_PAN | @@ -3776,7 +3779,11 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) /* stage 1 current state PL1: ATS1CPR, ATS1CPW, ATS1CPRP, ATS1CPWP */ switch (el) { case 3: - mmu_idx = ARMMMUIdx_E3; + if (ri->crm == 9 && arm_pan_enabled(env)) { + mmu_idx = ARMMMUIdx_E30_3_PAN; + } else { + mmu_idx = ARMMMUIdx_E3; + } break; case 2: g_assert(ss != ARMSS_Secure); /* ARMv8.4-SecEL2 is 64-bit only */ @@ -3796,7 +3803,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) /* stage 1 current state PL0: ATS1CUR, ATS1CUW */ switch (el) { case 3: - mmu_idx = ARMMMUIdx_E10_0; + mmu_idx = ARMMMUIdx_E30_0; break; case 2: g_assert(ss != ARMSS_Secure); /* ARMv8.4-SecEL2 is 64-bit only */ @@ -4906,11 +4913,14 @@ static int vae1_tlbmask(CPUARMState *env) uint64_t hcr = arm_hcr_el2_eff(env); uint16_t mask; + assert(arm_feature(env, ARM_FEATURE_AARCH64)); + if ((hcr & (HCR_E2H | HCR_TGE)) == (HCR_E2H | HCR_TGE)) { mask = ARMMMUIdxBit_E20_2 | ARMMMUIdxBit_E20_2_PAN | ARMMMUIdxBit_E20_0; } else { + /* This is AArch64 only, so we don't need to touch the EL30_x TLBs */ mask = ARMMMUIdxBit_E10_1 | ARMMMUIdxBit_E10_1_PAN | ARMMMUIdxBit_E10_0; @@ -4949,6 +4959,8 @@ static int vae1_tlbbits(CPUARMState *env, uint64_t addr) uint64_t hcr = arm_hcr_el2_eff(env); ARMMMUIdx mmu_idx; + assert(arm_feature(env, ARM_FEATURE_AARCH64)); + /* Only the regime of the mmu_idx below is significant. */ if ((hcr & (HCR_E2H | HCR_TGE)) == (HCR_E2H | HCR_TGE)) { mmu_idx = ARMMMUIdx_E20_0; @@ -11862,10 +11874,20 @@ void arm_cpu_do_interrupt(CPUState *cs) uint64_t arm_sctlr(CPUARMState *env, int el) { - /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */ + /* Only EL0 needs to be adjusted for EL1&0 or EL2&0 or EL3&0 */ if (el == 0) { ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0); - el = mmu_idx == ARMMMUIdx_E20_0 ? 2 : 1; + switch (mmu_idx) { + case ARMMMUIdx_E20_0: + el = 2; + break; + case ARMMMUIdx_E30_0: + el = 3; + break; + default: + el = 1; + break; + } } return env->cp15.sctlr_el[el]; } @@ -12533,6 +12555,7 @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) switch (mmu_idx) { case ARMMMUIdx_E10_0: case ARMMMUIdx_E20_0: + case ARMMMUIdx_E30_0: return 0; case ARMMMUIdx_E10_1: case ARMMMUIdx_E10_1_PAN: @@ -12542,6 +12565,7 @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) case ARMMMUIdx_E20_2_PAN: return 2; case ARMMMUIdx_E3: + case ARMMMUIdx_E30_3_PAN: return 3; default: g_assert_not_reached(); @@ -12570,6 +12594,9 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) hcr = arm_hcr_el2_eff(env); if ((hcr & (HCR_E2H | HCR_TGE)) == (HCR_E2H | HCR_TGE)) { idx = ARMMMUIdx_E20_0; + } else if (arm_is_secure_below_el3(env) && + !arm_el_is_aa64(env, 3)) { + idx = ARMMMUIdx_E30_0; } else { idx = ARMMMUIdx_E10_0; } @@ -12594,6 +12621,9 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) } break; case 3: + if (!arm_el_is_aa64(env, 3) && arm_pan_enabled(env)) { + return ARMMMUIdx_E30_3_PAN; + } return ARMMMUIdx_E3; default: g_assert_not_reached(); diff --git a/target/arm/ptw.c b/target/arm/ptw.c index ba3dd38a729..98499495085 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -280,6 +280,8 @@ static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx, case ARMMMUIdx_E20_2_PAN: case ARMMMUIdx_E2: case ARMMMUIdx_E3: + case ARMMMUIdx_E30_0: + case ARMMMUIdx_E30_3_PAN: break; case ARMMMUIdx_Phys_S: @@ -3635,6 +3637,8 @@ bool get_phys_addr(CPUARMState *env, vaddr address, ss = ARMSS_Secure; break; case ARMMMUIdx_E3: + case ARMMMUIdx_E30_0: + case ARMMMUIdx_E30_3_PAN: if (arm_feature(env, ARM_FEATURE_AARCH64) && cpu_isar_feature(aa64_rme, env_archcpu(env))) { ss = ARMSS_Root; diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index c083e5cfb87..1ecb4659889 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -912,7 +912,19 @@ void HELPER(tidcp_el0)(CPUARMState *env, uint32_t syndrome) { /* See arm_sctlr(), but we also need the sctlr el. */ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0); - int target_el = mmu_idx == ARMMMUIdx_E20_0 ? 2 : 1; + int target_el; + + switch (mmu_idx) { + case ARMMMUIdx_E20_0: + target_el = 2; + break; + case ARMMMUIdx_E30_0: + target_el = 3; + break; + default: + target_el = 1; + break; + } /* * The bit is not valid unless the target el is aa64, but since the diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index c5bc691d92b..9ee761fc647 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -228,6 +228,9 @@ static inline int get_a32_user_mem_index(DisasContext *s) */ switch (s->mmu_idx) { case ARMMMUIdx_E3: + case ARMMMUIdx_E30_0: + case ARMMMUIdx_E30_3_PAN: + return arm_to_core_mmu_idx(ARMMMUIdx_E30_0); case ARMMMUIdx_E2: /* this one is UNPREDICTABLE */ case ARMMMUIdx_E10_0: case ARMMMUIdx_E10_1: From patchwork Tue Nov 5 11:19:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840789 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286528wry; Tue, 5 Nov 2024 03:24:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXwiBUGewKMW+xxaxksq5misOS4fHwyLtACx9mFcpJC559+Upx4DTs0egHG7fJ27jO0CrbLYQ==@linaro.org X-Google-Smtp-Source: AGHT+IEZ4i/Um3niRw2jKEbrwfoUpoNT3vzygPBxtxrNiB7o8vn9dM4kfKFXf/w+97gnGelF0i15 X-Received: by 2002:a05:622a:28a:b0:461:15a1:788c with SMTP id d75a77b69052e-4613c026bd5mr493111001cf.26.1730805870511; Tue, 05 Nov 2024 03:24:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805870; cv=none; d=google.com; s=arc-20240605; b=U8dcV+YKqe6SAMs2MR2/FdJJqF0/C38crmJ9Y5V+qep6vBwrShN616hCLhCrP8dIR6 jUL4rwDEsIWfGSlYdkMaz/4ki9jBcp2W/WAS6Ski7X1RON2rvwf3UdT1oy0PTRNLYo1s AV9bGxTJTlFJTQQCxTTdzsKDz0nQPZyx8lDaNXdW8jN48rJNEmbRyrT0vcK1P+ly++M2 Is3Ld4zvrNFWf/JGREhgm6SA5oH0/+FPYhDB28WnQL3fueTwLdYG9p1u+PsiksT/Auy3 YRz6OdTU5ex2n5jGOqUVaJ4BV6VUQ0J8S5+9t6ytqfOP0d1FOLpDqoPghEKIsOCTtRMM KPwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=FBJ7C4+ClTBlCUSOBe+gLo7sz1EnjPStvDm17hGVx2c=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=G3eX4n1+JW7tNBwsEYxhZ/petU/l9P5tOf1brsNq4ap2bj3ZAVi8OoVgB7eusuERhF WqOhWtu89JQ+SqAHwOSEmMlvX0EwbiYH59D7mNljVwBmKiiBVKpvZL0zNPAG4m+vXIzc YjCT/1cQ4KJUDLv3hLuALfAqAbh8I8zbLHDb5tlBl2y7Blz0LuAbpiNTJ/QSH6yXrOYa AwwPe2/DjbXSeUXMlQQdQXVvDbcL4WKsUifFaH+38vpsZKS1MB+hl78nOE+Rn4lzlFfp YK0+IfH6W6deRKzT7Kwqbq3o7QUPR7ANGfo7uBpU3bwrJitmIAoLFfPcWzefMYIXf85b rwHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=izdKyItZ; 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-462ad0b4345si129738071cf.162.2024.11.05.03.24.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:24:30 -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=izdKyItZ; 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 1t8HbY-0004fF-OP; Tue, 05 Nov 2024 06:20:12 -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 1t8HbX-0004dC-64 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:11 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbJ-000784-40 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:10 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-539e3f35268so6499189e87.3 for ; Tue, 05 Nov 2024 03:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805591; x=1731410391; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FBJ7C4+ClTBlCUSOBe+gLo7sz1EnjPStvDm17hGVx2c=; b=izdKyItZepj/PE6PIHB6b5aO6fCmI8Smaa1yxLF2ous9gzF8zWIflmYUmywi/32tW5 0HtU1SCAsNNgoHch39zRquHNdha2Q+ZUdxXKSKSqa44zWqs++7voyQmBXn2MTTjOj9xU U1nHdaZMoZyXE6OgCAN4An2nschVXgjb+DVf/Xb/M0fnszIrKdM4S6xY4N8lGbrIJh0Q viE9OlCw8pQXbB1ifIRx6f4qhEdXA1H5krqsMe0s7gc/ehOPuq2k55llKDbh0FAJQC1J zWE8NMhjkLc/Nvle+WF2QUrLn+Lj6PwTbJ+uumKjTu3MQgetEkvxpsS7DS/+RA/uAM3H LmEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805591; x=1731410391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FBJ7C4+ClTBlCUSOBe+gLo7sz1EnjPStvDm17hGVx2c=; b=ocEq19ErcDRTCn6vHLfgFmO+Sv9zWSCBRw0cxpr9qQRDAbebVG3D+u00YQ9xWtfuzI HmAc+HV/QWeRI4jsNyePaAKgZWsJ8DVfwbzlSBwmnWzQ6E54db9HD6ioNP0jZU8k9WuH M/jYddYzX7ss1Fa2+3Rlr3ZNv3drQsQtmDYR+En7noAHDb9RD29Rae08i5s0/P4d2ini DRer2dPa26/XUqzeFAN/otFX8FjYPEjPx5+jMHxdNWvr+YDsTpxEZl4l9HtRd7FqBBBk 4KcHkyNcivfoySbSMOsGTusfWoUZEo4ju0sm6mEJc1X7y+J7w3/nSaARDbeNHutW6ty3 Wx5A== X-Gm-Message-State: AOJu0YzUWCZZc1tvXMHwDhbQ86EM+kuUph6waQdFllkWIHmeEZaXjTRv HVrqp+S5Qy/iDNj61AzjximQ43fqELy4KE2Yp+M2mm0ekE4LM+Hhhq6zPCSuBLVNqZF6JZLPA4p a X-Received: by 2002:a05:6512:1193:b0:539:e436:f1cc with SMTP id 2adb3069b0e04-53d65e264e8mr7159660e87.52.1730805591459; Tue, 05 Nov 2024 03:19:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/31] target/arm: Fix SVE SDOT/UDOT/USDOT (4-way, indexed) Date: Tue, 5 Nov 2024 11:19:28 +0000 Message-Id: <20241105111935.2747034-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x134.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 Our implementation of the indexed version of SVE SDOT/UDOT/USDOT got the calculation of the inner loop terminator wrong. Although we correctly account for the element size when we calculate the terminator for the first iteration: intptr_t segend = MIN(16 / sizeof(TYPED), opr_sz_n); we don't do that when we move it forward after the first inner loop completes. The intention is that we process the vector in 128-bit segments, which for a 64-bit element size should mean (1, 2), (3, 4), (5, 6), etc. This bug meant that we would iterate (1, 2), (3, 4, 5, 6), (7, 8, 9, 10) etc and apply the wrong indexed element to some of the operations, and also index off the end of the vector. You don't see this bug if the vector length is small enough that we don't need to iterate the outer loop, i.e. if it is only 128 bits, or if it is the 64-bit special case from AA32/AA64 AdvSIMD. If the vector length is 256 bits then we calculate the right results for the elements in the vector but do index off the end of the vector. Vector lengths greater than 256 bits see wrong answers. The instructions that produce 32-bit results behave correctly. Fix the recalculation of 'segend' for subsequent iterations, and restore a version of the comment that was lost in the refactor of commit 7020ffd656a5 that explains why we only need to clamp segend to opr_sz_n for the first iteration, not the later ones. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2595 Fixes: 7020ffd656a5 ("target/arm: Macroize helper_gvec_{s,u}dot_idx_{b,h}") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20241101185544.2130972-1-peter.maydell@linaro.org --- target/arm/tcg/vec_helper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 22ddb968817..e825d501a22 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -836,6 +836,13 @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ { \ intptr_t i = 0, opr_sz = simd_oprsz(desc); \ intptr_t opr_sz_n = opr_sz / sizeof(TYPED); \ + /* \ + * Special case: opr_sz == 8 from AA64/AA32 advsimd means the \ + * first iteration might not be a full 16 byte segment. But \ + * for vector lengths beyond that this must be SVE and we know \ + * opr_sz is a multiple of 16, so we need not clamp segend \ + * to opr_sz_n when we advance it at the end of the loop. \ + */ \ intptr_t segend = MIN(16 / sizeof(TYPED), opr_sz_n); \ intptr_t index = simd_data(desc); \ TYPED *d = vd, *a = va; \ @@ -853,7 +860,7 @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ n[i * 4 + 2] * m2 + \ n[i * 4 + 3] * m3); \ } while (++i < segend); \ - segend = i + 4; \ + segend = i + (16 / sizeof(TYPED)); \ } while (i < opr_sz_n); \ clear_tail(d, opr_sz, simd_maxsz(desc)); \ } From patchwork Tue Nov 5 11:19:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840777 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286011wry; Tue, 5 Nov 2024 03:22:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVWSeBxPqIwxCxkGSFYN5A9Q+7Mj7MryNQnV6xIPfA2LGjAfRbx8sGAkFZK/jGM1wt72FKWNw==@linaro.org X-Google-Smtp-Source: AGHT+IHC3eEA1N5LXbqHdFof6YLmZVo1EEOF8qpVOmDWBcbG5QEed7FGV3uC77IHZDzyQTQ3zSeZ X-Received: by 2002:a05:620a:1793:b0:79f:67b:4fdc with SMTP id af79cd13be357-7b2fb9582cemr2114842785a.2.1730805776094; Tue, 05 Nov 2024 03:22:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805776; cv=none; d=google.com; s=arc-20240605; b=XnNvLQJvQvT7GaTgTkacHmWly04tFB0JcRTwbcY5I0pyD/WgGUE39hPhVqmLUVTpWz OYnWNPaSxwW5DzvStVNZVDRKHAwEEBmcov+bmn2bJlftaWQJE4gvwqpMgkJ9NQ+TuuKc UMGYynKNI944oyPDw0n3jcRjdeiykzV8DQYihu1IvOxB3fOE12qS1C71KkRK1VJ4KKAL ZDAxoqwEheDJxodUdhT8Ns26QbulEZhldKo2guklsK/dmQC7B02EXM1kpMtYpdVNj3We UMq0w3LzkbSndCqoNgWBAATPw6CVin4F02602S3ENgqxSxl3WDgR2vPcC6+Fb8z+TTgj K+eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=9Pvdl2amKi4XsrvVH6yACE3VgtWiyqVuGZb0GDfDjII=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=E7zRQeNdTmk4Clx6m2jaRRfmxBQ/Cw24WlQshTn5btVKU8MfEbYRDOXTcBSxblRBP5 UA9zu8DelKOEAOQS085NLjwmKpdnStEGBgKNkB9NhzrE8pusVFNlL3zpwG22dNzfAlxQ d97uIXB5UxRb0HEkhvCukiQAXMqgEcpTwvy6yvvS2K+aTHAxZ9Q9FsUkzYYLhXu5EVTO XFrPMxG+1iw9NPMFPJQY5hqgFZHKLLckkei6r2sHplWRL0u98QnjrKHB7CaFCcyqbL3Z nwHIsuecbSMAZ6kH7NOUnV3bKNzcNMfNaDKim8O8Eb101pMj5BGw50mSTEYsrh/rWHJf fnYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C96jLdK7; 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 af79cd13be357-7b2f8d88c6esi1198741185a.308.2024.11.05.03.22.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:22:56 -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=C96jLdK7; 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 1t8HbX-0004cz-3s; Tue, 05 Nov 2024 06:20:11 -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 1t8HbS-0004aN-TF for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:06 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbH-00078A-NJ for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:06 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so47101845e9.1 for ; Tue, 05 Nov 2024 03:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805592; x=1731410392; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9Pvdl2amKi4XsrvVH6yACE3VgtWiyqVuGZb0GDfDjII=; b=C96jLdK7ftOa9Wf7c8DBQOYFuIvOmOcUxq3AQmXYtzETrJErI0VPm5bCzYQwirVala uWmdJDCq+YVREQ9OLQ2BG5+FabVhNiGzQ+jkEFlXsX3K1e57K8Z48kRkWf92QKLV3lqg cAF1QKPHkTbaDtxYsg47dSDX6lENMCRVDZP9c0LUSjeHAbOPz0k+Wqn2vHqCWYvefu+s zyrnM2LVOXoeCdx1o7fzqrkPbQ3DMArMgwaNN8q42OP/RCUbf8dBoPS5RsTuGpIujQUB tiW9Ag4zN7djw1MqI7nbzyDosGrOzFkVUCV98jnZgXqsMkAXYz3gtzKA0x/TxJAHy0F9 DRbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805592; x=1731410392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Pvdl2amKi4XsrvVH6yACE3VgtWiyqVuGZb0GDfDjII=; b=rNEAPigebajnaEfs7SdpzglLzoGa78OkLI/1ZuFUvNO94JGx1AL9CVzd8TpBsSD6sT 98vRX/L7a9K8RkIKHP+X+xgUMobc4rbjIjACFcthN2hv+pyKKb9n3yxzbTaWFTXNb+Pv 3PYr10fuXzq2xzR7VT/+OiLjN17AUDWj87wJzcQiPfdZmgCfwW7xtL6RpCze4808xKd5 g1HhpA62oZS9z8u4yAC5YsIFr06ZG4F+ly2Yad4k3iOxnHtUT17DbsfJXUwBeSsMuzYt q5liWwqB51Ch6OcAKeUnVnJByh/UvCpF9raB62Z5QBWAOJ1JvWtzk7tVX3o91ZFG9n6A dOYQ== X-Gm-Message-State: AOJu0YwY5UAya/BpVzRKRn8b2cJ1TAJQ9sw6QfeiIF8ciFDgpas3Gx1j SGJiWIll+5cKWeCmheBT3Fv3tEoDzbm5Zq1oKQ0zLuQws17GYcEKOLZGr4piMEjJlOF5w1Ricy3 u X-Received: by 2002:a05:600c:a41:b0:42a:a6d2:3270 with SMTP id 5b1f17b1804b1-432832562aemr122556715e9.21.1730805591998; Tue, 05 Nov 2024 03:19:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/31] disas: Fix build against Capstone v6 (again) Date: Tue, 5 Nov 2024 11:19:29 +0000 Message-Id: <20241105111935.2747034-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 From: Richard Henderson Like 9971cbac2f3, which set CAPSTONE_AARCH64_COMPAT_HEADER, also set CAPSTONE_SYSTEMZ_COMPAT_HEADER. Fixes the build against capstone v6-alpha. Signed-off-by: Richard Henderson Reviewed-by: Gustavo Romero Message-id: 20241022013047.830273-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/disas/capstone.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/disas/capstone.h b/include/disas/capstone.h index a11985151d3..c43033f7f60 100644 --- a/include/disas/capstone.h +++ b/include/disas/capstone.h @@ -4,6 +4,7 @@ #ifdef CONFIG_CAPSTONE #define CAPSTONE_AARCH64_COMPAT_HEADER +#define CAPSTONE_SYSTEMZ_COMPAT_HEADER #include #else From patchwork Tue Nov 5 11:19:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840785 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286296wry; Tue, 5 Nov 2024 03:23:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUp4dv6vKvXri2ZcRGIGzWmiwCwvRCo5NgU/4bCSiu1XoQlVLrokigmUfI6e4fs7SwL/Zvukw==@linaro.org X-Google-Smtp-Source: AGHT+IHn5yxNw0ETpCXYQxVE+oZd2Fo06DVO73+xbUY+jFea/T7927DHWQrsculHoOoMokCzo9Tn X-Received: by 2002:a05:6214:5343:b0:6cd:e38a:a91e with SMTP id 6a1803df08f44-6d1856e6a44mr440063156d6.18.1730805831009; Tue, 05 Nov 2024 03:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805830; cv=none; d=google.com; s=arc-20240605; b=UIFit0UHZrs34Cft+0aH90KpfldgqLewodererzjD814tiZoneNnHIri8oIxKuBU5E tWLrkSuI+9cHQZMvHNjV/9WFwfehWN5YSYRqz2PSjieNLihY1+H8WRcx29MgzK4ajmUx 6ScIz/utY02Fj4lfrg3XuoteSxmXnc8X3CFfvjTRXW5AzgaXl1bPnT91ls2HKaFx/R95 9jx+BXZtE9cqU1D+H6F2ffVif+QNVXMW3/ZKrr04unvgZ+QS9JSSV2O6vOk0z0Fm+pc0 rOK2BZkuAjq/cU5BR0DuGK1+rAcw6YbcT99WrFYEMF8FsLwUmQ7tXVEG8hf6CTaeRtAE lr6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=ycb+wgMk/1SYEUhSnCxJadXCThlkM3LqVJU9a7bxvrY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=RzdroG0dGUykQ73zpuRklZVGMjWZSk+p+vYTLuGl7KUSMibFRB61VgQ7Hbja1kBlVQ oIw+TYtEn80fgnSwyfUCpTj/wRPWIil84YQgipWxfkqxDxsr+r/MAoxD9Wt1G//wcT+U ZgojG89+jiDGakPhMvyAhOb/syAcqX4XiZnOvNkboEgybNaJp/p8zpkqCyGX/pzQSuoB ZGcMyBX7tBLivuRa6uuWJknpf0OiYUIsHVvP6L3W6KPCkFA2L2E8YwiYXVrts12e57p+ bFWpMMtIz5S3aZbwCnBITO+jo8ng3ZNKMC1PYuLkjGtejVtjNQPIq0fLcJl2aKj804Ya PegA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LuBllXfp; 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 6a1803df08f44-6d353fd1e31si139337006d6.181.2024.11.05.03.23.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:50 -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=LuBllXfp; 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 1t8HbT-0004aP-Bf; Tue, 05 Nov 2024 06:20:07 -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 1t8HbR-0004ZR-1j for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:05 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbI-00078H-Fr for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:04 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43155afca99so38981605e9.1 for ; Tue, 05 Nov 2024 03:19:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805592; x=1731410392; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ycb+wgMk/1SYEUhSnCxJadXCThlkM3LqVJU9a7bxvrY=; b=LuBllXfpqvEC5UrEAo1RDLgSwrgztruJzdXDStSapXoyvOb6vBYU3wCgLncP+qH27w mPn/MSN5Gcs1OUvqWZVD8ZBZdKm1USPQf7qn0NCDo1LV1dptFq1XREhn1mNSgx+0w0Hm BkIU+exa9c5EwtyJTmzJFtu/93bREgNzdmTXxfpadRDUAzK5zwvK9jYndyxAacPpCL2J 5rpRW3i4W7X2Y2skBt7FAgxHFQ05mL/idOtYxxH6DmS/6IhQ9ibNJUCFUbb+ORlYlgHg /PM1iKblhLbNDLiYS47uPg+TXmijb34gpsqovEZitRXYVVnMGUCG4S0U1t6k72xp1PMA qQXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805592; x=1731410392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ycb+wgMk/1SYEUhSnCxJadXCThlkM3LqVJU9a7bxvrY=; b=mBX6/2WzKOdyWLwygAIc4mMwR2534FFzs2elqOLsnt0RJx9hPr+rQb3Eo91gfwsztU R8vY14N8N/04aG3LhT3yRy0A4WvcOsPrL4kpTYNYlafOgTspyd8zcZSvUndhXnzpQMrs rx27j8Jt9a9S2cDXXHpeK2btmrkQddc22BUk7L2czE1unE953jI/snFIKYinRP9U7meJ sdXizq+NfvVh9JWB0hrPrMKk52Uiq5QaVRyBDxyIR7x5UufvfM3j1g+rWSZiWq5m5/4/ 9vg+r3Uiw+5+G7kh7LbeOJNWRzldhWizqxwaP+lfbinjpxv4mCXRzj7gM1Z1VDVqqLRB aKNA== X-Gm-Message-State: AOJu0YxuO+9CUuuIF7rVPZnZ6McBEONAPQNJ0hgTBi+K2JeJYugmMuDj 1pkpCeEp0nAechFzQrab1OxIU0e5YYU8yAJYL5BAJ2Lo+Kbct91teLt6Ux2P989gIR/t9oEGIOQ o X-Received: by 2002:a05:6000:1868:b0:37c:f997:5b94 with SMTP id ffacd0b85a97d-381c7975472mr12664009f8f.12.1730805592551; Tue, 05 Nov 2024 03:19:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/31] hw/rtc/ds1338: Trace send and receive operations Date: Tue, 5 Nov 2024 11:19:30 +0000 Message-Id: <20241105111935.2747034-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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 From: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Bernhard Beschow Message-id: 20241103143330.123596-2-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/rtc/ds1338.c | 6 ++++++ hw/rtc/trace-events | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c index a5fe2214184..929a92f7bda 100644 --- a/hw/rtc/ds1338.c +++ b/hw/rtc/ds1338.c @@ -17,6 +17,7 @@ #include "qemu/module.h" #include "qom/object.h" #include "sysemu/rtc.h" +#include "trace.h" /* Size of NVRAM including both the user-accessible area and the * secondary register area. @@ -126,6 +127,9 @@ static uint8_t ds1338_recv(I2CSlave *i2c) uint8_t res; res = s->nvram[s->ptr]; + + trace_ds1338_recv(s->ptr, res); + inc_regptr(s); return res; } @@ -134,6 +138,8 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data) { DS1338State *s = DS1338(i2c); + trace_ds1338_send(s->ptr, data); + if (s->addr_byte) { s->ptr = data & (NVRAM_SIZE - 1); s->addr_byte = false; diff --git a/hw/rtc/trace-events b/hw/rtc/trace-events index ebb311a5b0e..8012afe1021 100644 --- a/hw/rtc/trace-events +++ b/hw/rtc/trace-events @@ -22,6 +22,10 @@ pl031_set_alarm(uint32_t ticks) "alarm set for %u ticks" aspeed_rtc_read(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64 aspeed_rtc_write(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64 +# ds1338.c +ds1338_recv(uint32_t addr, uint8_t value) "[0x%" PRIx32 "] -> 0x%02" PRIx8 +ds1338_send(uint32_t addr, uint8_t value) "[0x%" PRIx32 "] <- 0x%02" PRIx8 + # m48t59.c m48txx_nvram_io_read(uint64_t addr, uint64_t value) "io read addr:0x%04" PRIx64 " value:0x%02" PRIx64 m48txx_nvram_io_write(uint64_t addr, uint64_t value) "io write addr:0x%04" PRIx64 " value:0x%02" PRIx64 From patchwork Tue Nov 5 11:19:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840776 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285976wry; Tue, 5 Nov 2024 03:22:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUtI1ofGConoQHZP+/a1K7FQb2xgSr94Ogs/SZw6Q3z2RqXvZBfQZFwbbuFXvshBfAGkn3oow==@linaro.org X-Google-Smtp-Source: AGHT+IGp9F6EQqUzuaCJnErHPPKN/podILeo7BjAVJWPu/JTR6CAg/N+y6CnoTO1RhWXOsesyNM6 X-Received: by 2002:ac8:5981:0:b0:460:7c45:2218 with SMTP id d75a77b69052e-4613bff0c1dmr566418051cf.15.1730805771459; Tue, 05 Nov 2024 03:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805771; cv=none; d=google.com; s=arc-20240605; b=PnCXtEiHhzoa1Q8PZaeTHsKCfM5Hx89gT64seay8y6S4II4O6jghaf59iAupwVnJoB hgMW/TyQd51iRA8jSI5nVDnNZ93kM8BfC/K+YVEmSjrt5O5tU4/39HIlG3d5C1uJtdam OExnQP6XQLoJePdLDoiMygkHjvaovcHaVM4yAm/rMDufXT5CLyHx/U70fVnuQa/fLUJ0 vobY/Czc8bl0zqEuwqSpLVVITO8xJ9g5K2Fq7je6sPgBlvJGfXnugwgonDEOvZlhvxKb AT6jl8p+VdKuRd4OkfwoejuYaWxlz/8mjbC5L/ToDwZLbn03L5Wt8EBBl+CzeAQnMOqG HHHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=ciRtNVI6sFcbqWWtUz/mMIIqmwEx3shGcliHftq7lkk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bHLUdQRpSBjmFHWvWk4j4WKkrRvvfYlNegl41HUP5oKnM+dgvR7XcFnB40HDCjUZ94 Iiezr5xroJX3/eWghs3RWF4JIt8gsAfn9EroBs+6BIqhgVKK53ebyZ5+zbKCxncs+1vW W7d0xgLA++HtDb3svZsbSh75eKXFA7PD0GyQcXONVLRqa4F3h7PxwK46CExJbgG1RJmW fcmHIvudaH/UY5irr8znrB+H4xZKMqYO2+7DiXZreYbTkjbUqAny/ROWku3aDIUJ3XWE VB26nNtN2+bD9Z3DH4T4sSqyC5D2a2G3xCP9F+3ksLO009HvLcDK6MaKaoDH5/Z6lPr+ nQ0A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ut0k6Y10; 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-462ad24fb54si133419821cf.634.2024.11.05.03.22.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:22:51 -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=Ut0k6Y10; 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 1t8Hbb-0004hW-Kh; Tue, 05 Nov 2024 06:20:15 -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 1t8HbW-0004bw-1e for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:10 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbI-00078V-E8 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:09 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-539f1292a9bso6096714e87.2 for ; Tue, 05 Nov 2024 03:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805593; x=1731410393; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ciRtNVI6sFcbqWWtUz/mMIIqmwEx3shGcliHftq7lkk=; b=Ut0k6Y10/ymhIpwto6+WUTGTyWxzI8Qc5CqsVefj5t78S9hX1WIAFlxlneQyJcWdlQ qh+9Vu2jG6g1x6Xs5oMzLf1xU1VHLU1624HlGp4qjkJeaEcZGh6NTQ9J+HWHfJZKNpg9 QMhxkq+jxZmxVvHon9JKLqFwqbLo5RWeZuLN5/1ERkJAFCCRm9mO1nfu401sr59zstOe n1oozx8DEa/j5fcPSxxe9Ond66ohcJ8lT4muq3KAbsTOO80DBfiBJqVf1+rYzHpHRoBj R7sPgw5TWNWgpHiNZo4/kDIY0Yv0FTxtGDo9Zq74n9GlOlEmoM8uPGDwAA0pzm08igMA PDxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805593; x=1731410393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ciRtNVI6sFcbqWWtUz/mMIIqmwEx3shGcliHftq7lkk=; b=BlS/Ym+8Dtaxe30imaFhqPb+OVC55CK9MLFjTUXlFEpEGI7oml9UrpyGlG68flIzvK c7zE29db+6we4hOVyUbKUnk5MwjBi13PS93e3X0v+iDGlkz8FnaDTQrvv5gI8JyiOuca i42dbACYnqWMmzs/qu1gF7qn/4ge5Sa/w/ZMxgL/wnpTrEX56or7A93b6iuEbP/Sb2Hz k630rZR0eUosC5q3iup+tGIUw1rucDOg5AaulwM81J2/iNRRH1kdTZ+6kVW0trW01aPZ eaHPV6pgmLpdojbxRsxKvjaJ3//IcqMFHP6BmBGmZJYkbeNuDbS48mqPMxqFuqqpSNqu MLCg== X-Gm-Message-State: AOJu0Yylq/9U3YzQRWMYgpVqVBDLWhF+GoI6WlyCq4CUNQ5K8Pb+FkB/ +b/wwedIXetXf/XrGKDQbdGgYaoNkZzxyAqLoMP+LaC+D9MdzQrbkX9z3pf3Jm9+mlI/JdZau35 Y X-Received: by 2002:a05:6512:2397:b0:539:9746:2d77 with SMTP id 2adb3069b0e04-53b34c35fe0mr14791325e87.61.1730805593156; Tue, 05 Nov 2024 03:19:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/31] hw/timer/imx_gpt: Convert DPRINTF to trace events Date: Tue, 5 Nov 2024 11:19:31 +0000 Message-Id: <20241105111935.2747034-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x133.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 From: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Bernhard Beschow Message-id: 20241103143330.123596-3-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/timer/imx_gpt.c | 18 +++++------------- hw/timer/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c index 23b3d79bdb8..2663a9d9ef4 100644 --- a/hw/timer/imx_gpt.c +++ b/hw/timer/imx_gpt.c @@ -18,19 +18,12 @@ #include "migration/vmstate.h" #include "qemu/module.h" #include "qemu/log.h" +#include "trace.h" #ifndef DEBUG_IMX_GPT #define DEBUG_IMX_GPT 0 #endif -#define DPRINTF(fmt, args...) \ - do { \ - if (DEBUG_IMX_GPT) { \ - fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPT, \ - __func__, ##args); \ - } \ - } while (0) - static const char *imx_gpt_reg_name(uint32_t reg) { switch (reg) { @@ -145,7 +138,7 @@ static void imx_gpt_set_freq(IMXGPTState *s) s->freq = imx_ccm_get_clock_frequency(s->ccm, s->clocks[clksrc]) / (1 + s->pr); - DPRINTF("Setting clksrc %d to frequency %d\n", clksrc, s->freq); + trace_imx_gpt_set_freq(clksrc, s->freq); if (s->freq) { ptimer_set_freq(s->timer, s->freq); @@ -317,7 +310,7 @@ static uint64_t imx_gpt_read(void *opaque, hwaddr offset, unsigned size) break; } - DPRINTF("(%s) = 0x%08x\n", imx_gpt_reg_name(offset >> 2), reg_value); + trace_imx_gpt_read(imx_gpt_reg_name(offset >> 2), reg_value); return reg_value; } @@ -384,8 +377,7 @@ static void imx_gpt_write(void *opaque, hwaddr offset, uint64_t value, IMXGPTState *s = IMX_GPT(opaque); uint32_t oldreg; - DPRINTF("(%s, value = 0x%08x)\n", imx_gpt_reg_name(offset >> 2), - (uint32_t)value); + trace_imx_gpt_write(imx_gpt_reg_name(offset >> 2), (uint32_t)value); switch (offset >> 2) { case 0: @@ -485,7 +477,7 @@ static void imx_gpt_timeout(void *opaque) { IMXGPTState *s = IMX_GPT(opaque); - DPRINTF("\n"); + trace_imx_gpt_timeout(); s->sr |= s->next_int; s->next_int = 0; diff --git a/hw/timer/trace-events b/hw/timer/trace-events index f48a712801e..5cfc369fba4 100644 --- a/hw/timer/trace-events +++ b/hw/timer/trace-events @@ -49,6 +49,12 @@ cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK A cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset" +# imx_gpt.c +imx_gpt_set_freq(uint32_t clksrc, uint32_t freq) "Setting clksrc %u to %u Hz" +imx_gpt_read(const char *name, uint64_t value) "%s -> 0x%08" PRIx64 +imx_gpt_write(const char *name, uint64_t value) "%s <- 0x%08" PRIx64 +imx_gpt_timeout(void) "" + # npcm7xx_timer.c npcm7xx_timer_read(const char *id, uint64_t offset, uint64_t value) " %s offset: 0x%04" PRIx64 " value 0x%08" PRIx64 npcm7xx_timer_write(const char *id, uint64_t offset, uint64_t value) "%s offset: 0x%04" PRIx64 " value 0x%08" PRIx64 From patchwork Tue Nov 5 11:19:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840773 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285677wry; Tue, 5 Nov 2024 03:22:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXVIzSxFcjrfph1/8ZGcleMKaeJCagwjA4oMPAU2AuAKJdOsezz9u/r+TWkSAbyezax2WB4cQ==@linaro.org X-Google-Smtp-Source: AGHT+IGVnbl8P6KefwtbO/3j7Jfxp2obZRcUoHmSAM/dWLTxmFXoYaPyxuLhkIF/vgn7OOinFSKf X-Received: by 2002:ac8:5d02:0:b0:460:3f8a:f9a2 with SMTP id d75a77b69052e-461717c45f6mr346327281cf.56.1730805726215; Tue, 05 Nov 2024 03:22:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805726; cv=none; d=google.com; s=arc-20240605; b=MNhprKpgpsB5ZaVfKX1GHWeJEEm39ucnL4oj5qPGT05mBjveRqF0xN4bRYGjI6RH+E hRphfN4RHCnmwSrguwwCpHacNBjPcaq+74GmXzdihwdV6mLpWX9pT5G4A7TmR7mWgvF2 uYSlauZmpS5nkT/Uo3rb+HxGcpmEV4IF4ZA96GGywalsQN0LNeBnDGrYG1pP1ia4RLVj BQnrL+p/48L9axkwl9oJzPdRTeY8XNpOYPpfhQFWi974M4SrfMgThKZKM+WN/nL/QcI1 oYufVUoVx0T4aam/vUU/fFQy6q/yB2qe7Rvc1yZPz6UTV+ChpBfHOTsth+iuo/5fSo1V BL3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=38EGQ1h0hACahyl0oXRU0siZ/g2UnItojGbOd1JPD7Q=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=X90XvsacjIDIPRYvvsnGqZSNKK3uhEu8oKABZN5Lp72LGHiJxDDH0UPtuvSuhmGI77 9233Hpv2QQte5wmRx0oH8z6VOglMgsdR0OaQbHVoUeK/2MsCPVvcpq4kdWpQovmO80t+ XL6mTSgoryfYdGtX1+Gtpb/vXCLJnRZNjIJX94FtIeHCt2GRuVPzX+NabaZGa8GWrJig Hx3A/u1RfhHqAfVrJnrafWAphIXIFpgPhcq3IB+YJowo9mNU3FqggXcuuEXb7N443LKw 1wAXrsVAR6ee8/GN0HfhKkjjjA4jUjyDJDZs69jkmKQEyaDuY8Biogd9VMGP26O8HZL1 Rs8Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i6e5NReh; 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-462ad1f20a2si129649841cf.453.2024.11.05.03.22.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:22:06 -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=i6e5NReh; 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 1t8HbV-0004bW-Sr; Tue, 05 Nov 2024 06:20:09 -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 1t8HbR-0004Zv-Vh for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:06 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbI-00078b-HF for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:04 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so41103405e9.3 for ; Tue, 05 Nov 2024 03:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805594; x=1731410394; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=38EGQ1h0hACahyl0oXRU0siZ/g2UnItojGbOd1JPD7Q=; b=i6e5NRehCJxmnSjFWwSLXKIJrD4siRw4xkRkhikCByF99GypWIALo1P0Mn+3V0aeSM Ow/Ey/nsS0rjhgFtUJAq+07/xgH2wyAMnWjwv5mflMh1Ow8HOblp5wgem0SvJJh+HIrM 49Zymotv/qeLEGtrzOOpYGoQzyWWa91CpYs1nuxt/lhTbQqz1LT/C0G5q+NJB1h5s46D IQphFIe530Hwgv1Kf0+l5bzGC5ipT0tvnmZoIAdphL8d+WozCPmr273Rm3XPJfuD3nm1 RHZ84kNh+JbV/ghNo0N2wRXGgrUT1wfJufHB2sHc/LpQILnVFKQn+iBHJ86XlsWFul/C VFew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805594; x=1731410394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=38EGQ1h0hACahyl0oXRU0siZ/g2UnItojGbOd1JPD7Q=; b=SVJd/QtjO4Yaou73Sbu6z3H6U7+F7XHF6nb/1pXcq1/I6UI0YgO/zgMg0UgsX8sjvs K5cs/qYhM8MXZy392TPVdyV9a1G2dOxhhVt0iMZ8SfeZUC2ekI3UJmunG7Wwb5K7s4VP A83y7gV9LNNn4Q+ug+k+3OTsl2CjHsaeseDEp4PPJzuFGBalGEW88SNhjaOWjPF0kQqE x2aUeUfsxo7+XV/0mhhCADhGKkjS6xm7L4NxO+/Ou9R614CXkhI8jL0Npzo5smbV7g3b Ly03LDjeBOVkG7te/neJ3REPf8FpPlC/QGJMDc1u9iWc4gYsQT7mGyn0ZbIExKCEfOTT lB5g== X-Gm-Message-State: AOJu0Yy+XP4wD+SZdOXrrFp8PMO5tTbqpL6YOzn7oGt8c4H7CasgC7LL 1N4JcAEKI9UhVXEyr3eipkk/5axhA+q5e3gsDmb/s4Jr453RorbRe+Ex+trtU5GilYCGwgIVq0s c X-Received: by 2002:a05:600c:1385:b0:42c:ae30:fc4d with SMTP id 5b1f17b1804b1-431bb977328mr197556815e9.7.1730805593793; Tue, 05 Nov 2024 03:19:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/31] hw/watchdog/wdt_imx2: Remove redundant assignment Date: Tue, 5 Nov 2024 11:19:32 +0000 Message-Id: <20241105111935.2747034-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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 From: Bernhard Beschow The same statement is executed unconditionally right before the if statement. Cc: Guenter Roeck Reviewed-by: Guenter Roeck Signed-off-by: Bernhard Beschow Reviewed-by: Richard Henderson Message-id: 20241103143330.123596-4-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/watchdog/wdt_imx2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index be63d421da1..8162d58afaf 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -39,7 +39,6 @@ static void imx2_wdt_expired(void *opaque) /* Perform watchdog action if watchdog is enabled */ if (s->wcr & IMX2_WDT_WCR_WDE) { - s->wrsr = IMX2_WDT_WRSR_TOUT; watchdog_perform_action(); } } From patchwork Tue Nov 5 11:19:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840786 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286336wry; Tue, 5 Nov 2024 03:23:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXRD9JvPy58VxliQoV8glojiZ6R4XOIQ4PN0coUmilT0DWYTNgdBuSthtig7py/zxVaq9Cs+w==@linaro.org X-Google-Smtp-Source: AGHT+IEuUb6jtY5etRW0QMLcdNNqtdyLwqRcyOcEOP/Gzw9EYk+rBnQ9PCWJY5Pu0xWdLU8zXglW X-Received: by 2002:a05:6102:b10:b0:4a3:ef1e:8566 with SMTP id ada2fe7eead31-4a954317f2dmr17826558137.17.1730805835582; Tue, 05 Nov 2024 03:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805835; cv=none; d=google.com; s=arc-20240605; b=ce5qrYy6tqu148Tc9zG73DdY6GZl8XX+J6Pf3OLmCrIsdjFXf7yn+XKYhrKni+Z0ej f5V8XzywX24R/uLTq4RQWUzm90+OWkSsyRsMqq5iqnQSLJzJy4IqWor50qi2p1ixQU6b mw73dDn6yH0IWnOE8RdeyJfWsHjXAfLzYpIV1ApZ0h5oy5yM4fDbqO8uOLYQ3J23tgDX gnf2rD/M2h9kNv6oQOA6ovFNGH3xLVJ9Jz1/M9zE2GC1AueRWSPNIYz34rMbRZbvoP9Y qUt6dlvLWzfhPoX2DPgJh72YqqnQNGsvB35L4ktstswItAW1KkyvE87UlI2HE0EBOEY5 OsvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=pRL4mDTjVw9mfjbMMniJd6QkIPpIN0o0sYfT9bqu/h8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=KU7fYvJ6X5a7YevefKQ+Rc75xC+MLNyYBlosVBJg2klYITYXbcpN1XQYWWrMv2a6by M1szJAfTgX/NXtFO3i3eLmm0BhrKnK4mGVwyg0qqRTEqCzEgatCT7X2/oUI9kQgRUKsz uBo9forvT0PqmcbQ2qzT66WEoF5vPMHDea/sEwM7fhHDmTwaeU5LyJvUsA+kjezMMdLH dMZAF3PKySCyvPKYe9xK+wWDkTiBhfcmEnzJc5JDpuedGU1tOUWQGPcL4rhbARQIIGaN BrOcDzs9k/MdWiVNMm1ufWFdGzFlo7ESm5Ie5wq4Cau2ajP+oYIVDA2NQ9AiIHVZane8 cMNg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jbrBQsMz; 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-462ad1a04aasi147251491cf.344.2024.11.05.03.23.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:55 -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=jbrBQsMz; 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 1t8HbZ-0004gX-Py; Tue, 05 Nov 2024 06:20:13 -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 1t8HbU-0004aT-6D for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:08 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbJ-00078j-CF for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:06 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-37d3ecad390so4013025f8f.1 for ; Tue, 05 Nov 2024 03:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805594; x=1731410394; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pRL4mDTjVw9mfjbMMniJd6QkIPpIN0o0sYfT9bqu/h8=; b=jbrBQsMz/bC0OTpKA684iLmiDZ/n3zmiJ+zivdVCA2TRoAZv6/dOQ/UIhaZAAhKOOp 9OnGaJT/EPQKM+utUtmhsTmJFSZHH+BE5OVmPigdw8QJyfglgUjg1u/4Gh5o060tDYAU sujBt7NYPqpa7mzeZ4Cd8edW62e2azkZWamMlaNcXCjFIfsbXrmHciPkFazPEOHSTMMb XM0tgOO8vOicDazORs6JRkcMopQkTo6NoY+1/7jZ5K7534BW71uOzqX1PMoAT8clcULt dOozyHsE3Gw/tyucvGgOvddwqbCz7oqeQZqcScXssD8hAph7Qsv98r/UQDhf5tdghbuz WZMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805594; x=1731410394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pRL4mDTjVw9mfjbMMniJd6QkIPpIN0o0sYfT9bqu/h8=; b=mirSX+ct+YsBxrtf4zl8uQ3Ji05/yjdIvPWVvlPHzRFk3JL7Xx6iYUWJINwJBGH0x7 g1mcA2EJvju3UIo/EF82vpQitV1EumRhU+ciAIfFw+CIdOftDYdeKxw9dcr2hAGn11e8 nqAMEi6j5EWsa+HzYJ5p3bfOTm2lw22Y0POHESoEuVv8+V8AIZJAC99b2MjhfNhgGZ2q 2+V4wOIPdfLMYCnfCnedeletTDnfoZaj3JJ4okLoYOogPs95IKWCT3BD4qbb5GY1XUXY Z4cRVY+FZnbVIZBwzBy8pf9mBxHgI0NZX51zHao8oCqogo9sWZvSUF8EX5MxhQ70N2MN bJWQ== X-Gm-Message-State: AOJu0YyAH4wpNuj1FPrPerXgy8plf2OrUe7pWT+HxQdhp9vRDEiM6+0N kWbt5PY3WFZHtd80utVHujrfFCIr6wvwTgdkGRtOVlePiP77COYbDR/0YhQDEIf0L3ECxZoPgBn L X-Received: by 2002:a5d:6da2:0:b0:374:b6e4:16a7 with SMTP id ffacd0b85a97d-381c7974c6cmr13763013f8f.8.1730805594301; Tue, 05 Nov 2024 03:19:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/31] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access Date: Tue, 5 Nov 2024 11:19:33 +0000 Message-Id: <20241105111935.2747034-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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 From: Bernhard Beschow printf() unconditionally prints to the console which disturbs `-serial stdio`. Fix that by converting into a trace event. While at it, add some tracing for read and write access. Fixes: 7e7c5e4c1ba5 "Nokia N800 machine support (ARM)." Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Message-id: 20241103143330.123596-5-shentey@gmail.com Signed-off-by: Peter Maydell --- meson.build | 1 + hw/sensor/trace.h | 1 + hw/sensor/tmp105.c | 7 ++++++- hw/sensor/trace-events | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 hw/sensor/trace.h create mode 100644 hw/sensor/trace-events diff --git a/meson.build b/meson.build index c386593c527..4262e1e84a9 100644 --- a/meson.build +++ b/meson.build @@ -3484,6 +3484,7 @@ if have_system 'hw/s390x', 'hw/scsi', 'hw/sd', + 'hw/sensor', 'hw/sh4', 'hw/sparc', 'hw/sparc64', diff --git a/hw/sensor/trace.h b/hw/sensor/trace.h new file mode 100644 index 00000000000..e4721560b03 --- /dev/null +++ b/hw/sensor/trace.h @@ -0,0 +1 @@ +#include "trace/trace-hw_sensor.h" diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index 9d7b911f596..ef2824f3e1b 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -27,6 +27,7 @@ #include "qapi/visitor.h" #include "qemu/module.h" #include "hw/registerfields.h" +#include "trace.h" FIELD(CONFIG, SHUTDOWN_MODE, 0, 1) FIELD(CONFIG, THERMOSTAT_MODE, 1, 1) @@ -150,17 +151,21 @@ static void tmp105_read(TMP105State *s) s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 0; break; } + + trace_tmp105_read(s->i2c.address, s->pointer); } static void tmp105_write(TMP105State *s) { + trace_tmp105_write(s->i2c.address, s->pointer); + switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: break; case TMP105_REG_CONFIG: if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) { - printf("%s: TMP105 shutdown\n", __func__); + trace_tmp105_write_shutdown(s->i2c.address); } s->config = FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0); s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; diff --git a/hw/sensor/trace-events b/hw/sensor/trace-events new file mode 100644 index 00000000000..a3fe54fa6dc --- /dev/null +++ b/hw/sensor/trace-events @@ -0,0 +1,6 @@ +# See docs/devel/tracing.rst for syntax documentation. + +# tmp105.c +tmp105_read(uint8_t dev, uint8_t addr) "device: 0x%02x, addr: 0x%02x" +tmp105_write(uint8_t dev, uint8_t addr) "device: 0x%02x, addr 0x%02x" +tmp105_write_shutdown(uint8_t dev) "device: 0x%02x" From patchwork Tue Nov 5 11:19:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840768 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp285401wry; Tue, 5 Nov 2024 03:21:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV47pAqdH+ZOP/D0kL6r6UC+aGdHF+Kz7FJ0YPQiYYohxgzDDgG3yrBuZQvvHAUMDmkWAI/KA==@linaro.org X-Google-Smtp-Source: AGHT+IHj3X3IXcC/XYCMYy59NdEs00eU2yd56CqlAamFB+mZA6lKY8t//uwSnZy7ITIU5TDQLzCc X-Received: by 2002:a05:622a:1b8b:b0:460:8f80:909a with SMTP id d75a77b69052e-4613c030d57mr526430841cf.32.1730805682207; Tue, 05 Nov 2024 03:21:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805682; cv=none; d=google.com; s=arc-20240605; b=h4TuVi8kQb1eaAzKgw600ku2fBKo9WT3u1Z5MsUNEga6QVnynSyHalekGoSlyDYJmD kAND71uH7FtC0hebAk4wuRfoyp9ZXcvLMG0AUrC+xu54FYeILSJKXLjOBkc6wNQUTFVo 4EunTbntcjbTpckx7EFdWuRQaLmqlywT6JdgkKVJ4V8LCiDdiq1jfc3pNyIb4bqs0Xgw 3BrUoserHohZuEwSKaWTn5me8pKR1O321HPEeaw8O258SbgJypspJM36tyII0zOEQAzK FJrQdVLto4g55RdA/71aMnqILSCiOAD5rB1gOYPfEtuQRUXWuhtIcflU9fRVagzEMgRr DA0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=+LP6S0HiqT0UnMi7xLzb+PtlWN4r3AjuiB9iv2CEHDk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=X4S2j1IwxsKxuJNYs3aryB+EBPzK7GeiW4wgkN0MN7AYFUEw8tmiEufyK61R+zaVDy L+Ej0KDNtjhdi7JblfUs2gxXHUOh6wrpiq4GcPcn2N0kW8+Qp9L4jmRWmdaaDUTEa8mw YNhzAAFK9PzbTkDxlZiXEs0WiisEkocWehxy7Y37ZjYKzLo41I2RYh881n7UFmhg6+MG 5bdFNzH7Sz/qOu3iYrLJHUSLGDPVce/6rDzr/dKVEHfiGNEdhGDg/tVaxolmZvMmHo/O u652wkrICKJ2juxwl2LWPQuLqQ1oLFx5yTTnGNDd63EjDa88b7rMtzUHRckNQJmziU8v fyEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d8VbeaQ4; 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-462ea1d1a6fsi6802651cf.387.2024.11.05.03.21.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:21:22 -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=d8VbeaQ4; 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 1t8Hbc-0004iS-Go; Tue, 05 Nov 2024 06:20:16 -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 1t8HbX-0004dP-Il for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:11 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbJ-00078t-W4 for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:11 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-539e8607c2aso5782586e87.3 for ; Tue, 05 Nov 2024 03:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805595; x=1731410395; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+LP6S0HiqT0UnMi7xLzb+PtlWN4r3AjuiB9iv2CEHDk=; b=d8VbeaQ4MT9hGxedcDzrl/vAGU4hHDVtQkPT7x0ifi16jeAKYhxZdt3C+h2ppUTGy0 gldSknjfMETiiglrsPap/js07emz7xg4ZzqC5LYguGBzKvVxrj5Gjlftf8+fZ3Q24/LM Lvm6DaDtEy2zxWd0rH7Dm9fAJzj6WVz+wdklSdtWiuvJ9scPmVL+3lXjouOK5zkVH/AO PRVoqK4JndasdHvI/iTJWXRM5ifpmsFmxnLORMhT1rc1vZ5bQSTBDVHv8qOk34koMXmW PjrwPu4tWHMF9H512XyPsUHA9LAoX4ZBcT67cBjne1To/k00oVJRFjl/bjG8qHsE6Ku5 U2Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805595; x=1731410395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+LP6S0HiqT0UnMi7xLzb+PtlWN4r3AjuiB9iv2CEHDk=; b=iwKeDJ+CJttPBTfnGqGFUVOagNcFJQi5UROtLg2NB1g22VDRHYeqhJpGmmbsOOlGjF PEMtDfU4i9qB2Dfp86c+TR1+l7LQdrI99OfSL/tsJAX9q/ehpqIWzWG9ObWhBhlGxxNr M/7VrmU+nP+ngvn/DKm160zWQI6FfXF42RKeM+GRI8MLKKEIlBrMliSNpKeiRsTcp7f4 dJGc9jjeZcg0DF1Xop68I6NC3YUhU/RBc9dr7jxFHz/WrhfXE6H8xtfpHxFxSsMxZ/hZ gsmXf02UBuWINEeSO4f2pK4YPSa5mebsnODDQW3MwnZ4OV99Iuwrfz8UkrLEalR300OG BJIg== X-Gm-Message-State: AOJu0YzfNKkHcFsxjPtUCin/8LZWgUAzm1FLinehMx1Fq7WnXI6KY1cX sjT83s+OcBIQI/cZO2QnRE7wdRwrqzVeIiTmySUPHQpZtpmc/sT8YeipzXbSYN+8PAuDc8GyLG6 C X-Received: by 2002:ac2:4e06:0:b0:52c:fd46:bf07 with SMTP id 2adb3069b0e04-53b34a2e4d0mr15730991e87.49.1730805594825; Tue, 05 Nov 2024 03:19:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/31] hw/net/npcm_gmac: Change error log to trace event Date: Tue, 5 Nov 2024 11:19:34 +0000 Message-Id: <20241105111935.2747034-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x136.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 From: Nabih Estefan Convert the LOG_GUEST_ERROR for the "tx descriptor is owned by software" to a trace message. This condition is normal when there is there is nothing to transmit, and we would otherwise spam the logs with it in that situation. Signed-off-by: Nabih Estefan Signed-off-by: Roque Arcudia Hernandez Reviewed-by: Philippe Mathieu-Daudé Message-id: 20241014184847.1594056-1-roqueh@google.com [PMM: tweaked commit message] Signed-off-by: Peter Maydell --- hw/net/npcm_gmac.c | 5 ++--- hw/net/trace-events | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index 6fa6bece61f..685905f9e27 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -546,9 +546,8 @@ static void gmac_try_send_next_packet(NPCMGMACState *gmac) /* 1 = DMA Owned, 0 = Software Owned */ if (!(tx_desc.tdes0 & TX_DESC_TDES0_OWN)) { - qemu_log_mask(LOG_GUEST_ERROR, - "TX Descriptor @ 0x%x is owned by software\n", - desc_addr); + trace_npcm_gmac_tx_desc_owner(DEVICE(gmac)->canonical_path, + desc_addr); gmac->regs[R_NPCM_DMA_STATUS] |= NPCM_DMA_STATUS_TU; gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT, NPCM_DMA_STATUS_TX_SUSPENDED_STATE); diff --git a/hw/net/trace-events b/hw/net/trace-events index 91a3d0c0548..d0f1d8c0fbe 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -478,6 +478,7 @@ npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception finishe npcm_gmac_packet_sent(const char* name, uint16_t len) "%s: TX packet sent!, length: 0x%04" PRIX16 npcm_gmac_debug_desc_data(const char* name, void* addr, uint32_t des0, uint32_t des1, uint32_t des2, uint32_t des3)"%s: Address: %p Descriptor 0: 0x%04" PRIX32 " Descriptor 1: 0x%04" PRIX32 "Descriptor 2: 0x%04" PRIX32 " Descriptor 3: 0x%04" PRIX32 npcm_gmac_packet_tx_desc_data(const char* name, uint32_t tdes0, uint32_t tdes1) "%s: Tdes0: 0x%04" PRIX32 " Tdes1: 0x%04" PRIX32 +npcm_gmac_tx_desc_owner(const char* name, uint32_t desc_addr) "%s: TX Descriptor @0x%04" PRIX32 " is owned by software" # npcm_pcs.c npcm_pcs_reg_read(const char *name, uint16_t indirect_access_baes, uint64_t offset, uint16_t value) "%s: IND: 0x%02" PRIx16 " offset: 0x%04" PRIx64 " value: 0x%04" PRIx16 From patchwork Tue Nov 5 11:19:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 840779 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp286191wry; Tue, 5 Nov 2024 03:23:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXAUutZLE4p2XKGhnr7UdYbkd7dxrbllxDrkYMCWGlxOMQ1uxRE+8ilJyKOI8HyzH25IDcTCA==@linaro.org X-Google-Smtp-Source: AGHT+IF+KLBVsV5nKEUCMpnIyKSz76JIvtWH5I7WW2OsGqLuVYezczJYebg6SQXwBl37A6v/F3uW X-Received: by 2002:a05:6122:1786:b0:50d:4285:1409 with SMTP id 71dfb90a1353d-5106b116f15mr17679013e0c.6.1730805809850; Tue, 05 Nov 2024 03:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730805809; cv=none; d=google.com; s=arc-20240605; b=WnNgyVtn+1BTV4s0BV3xvPVfmCk3702SQRSZZ2Kg0RdDrursIxGgYU7dgfn++k5xlO Qp40CdRPqPouyOvZOU7cSWCRc6/5XFp8Yh8zBfAcf8KiGhTN3iDk4P/E2bKA3QwWL2qG 0GMw0SRmIjgGnXTdmTxAPTcWS+k82CWVtEeyd2VoBCpvpCJghr9pAWcCWhmw8W99Bf4E nW0lt/cedNNvfy39Aph/sgVOy0DIqkqlSeoQdvtVTu1vWs+TuWdqvfh51UZG0tJj8HeY tCxMgrkvCNpWgrAQ3Crw6ZoBRYjVnXXPQt8sk96uHkcPGn6QBjhvSaMULoAceZxmoX8Z Iw4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=ig5jYCKBIJw18wNceoQVbcha/Skyw92dmimUEm0U7I4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lzqc6eIVJDoIJUeFZglc5KQnQj/XDApqxxxDJ6nd/17Mp0cuWDytI39TStv/jf9C2k 5RQZ+jzHN+VqVXToHUD5hi8yLW9vsVdj9fWIr/RYCSNg2khR3CfMR/t/KGnPUzwQ/Q+6 bNJriUoiGOvta5ot2mJMSbSdDxYLmEj652lELntcG2UUbggCYYxyf4bArYX4wcCe6WsP Nd+lMXpqC2dTqZIyD186meZrbAno/kXPCe0h2aW1HyTn0P1Kk3Aw/1pd+Cu0IYsrIVOX f3x3sw/hUOlP2H8Yp/79wlUSPMR3GzErKkYfgSGIANvb79hfln2Cbot0H4B9gxzupKok L1Cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Adys6tJZ; 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 af79cd13be357-7b2f39f1e8csi1295738685a.149.2024.11.05.03.23.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 03:23:29 -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=Adys6tJZ; 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 1t8HbX-0004d6-FM; Tue, 05 Nov 2024 06:20:11 -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 1t8HbV-0004bV-DH for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:09 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8HbL-000794-IH for qemu-devel@nongnu.org; Tue, 05 Nov 2024 06:20:09 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-539ebb5a20aso5667352e87.2 for ; Tue, 05 Nov 2024 03:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730805595; x=1731410395; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ig5jYCKBIJw18wNceoQVbcha/Skyw92dmimUEm0U7I4=; b=Adys6tJZaGaEy0d/jZ6yyNvMlmxUme4Y+upNA86KvMDSvuniG4AwnDgbTtLJ9qSclk 4GYFTKKw1nmqIGhap4f8LJEikxxYnvshx434Ln1Wa6OzDX7KLq4zIV4USDlnRKW2hs9i E3p2xMOzq+uhUnV8k0Wo8wioOFK1fXTsA92uqBzdnvhjKOwhT71AcPY/h0TKkz5vAVBY 6sJgSYrJ160CdzouV945aFryzQrW1e8ZtSDd568ikaIJnJH5EuXgDePDPViwzWuPfAd8 2bQ+zOPP8Jcm8d5TuiOjOAKJ60Wp5chHLkqPeR6F+KzwtSSA606BKE/XYZQST/fRlJJK n+9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730805595; x=1731410395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ig5jYCKBIJw18wNceoQVbcha/Skyw92dmimUEm0U7I4=; b=sTOkRTfRJ4rqmR4hR7WAiKeiiIdlbLD6dvkb4CrHtPaBiQ8rLMoN0vxLvcrnQ9wKJR u/fmR4d82QVmQOWXUilA3w+jLRxpUD1YEHLGv9wecubIX7AADC/v7P7ZbKlWSTozS2iu cxRbrwOEQ63LiykswEYZShf/DPDQF6xcnM0CD4EUzkpstIsLEY5AR823neYNCJxcBEIc /GOU7AYZrcMCfb+WrG0ucOYnrrUG2lLl4lw/1h9wGpM3VObIKvmDQAwMr/mt/KVvRFZO wJqQcMLU62JwsMql7a5/5sb2Vq8FFeY5iuVM+gkKYVugYoiSLdCc3rpwTNmTYRObSsVA JnIA== X-Gm-Message-State: AOJu0YzBqjCxffWOkpn4B40LHmfmlZ7zRkBkY/DrklKfllKFIj0g6vKR dsU2Eu0ONrUS7mr5B5I8NzopFymECUv9k9bOcG7EVEptzCvm9JYwSlZSafWDKTnCZnMQe9Wa+La 1 X-Received: by 2002:a05:6512:3403:b0:52e:7448:e137 with SMTP id 2adb3069b0e04-53d65dd0e30mr9080197e87.6.1730805595401; Tue, 05 Nov 2024 03:19:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432a3688813sm16354555e9.1.2024.11.05.03.19.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 03:19:55 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/31] target/arm: Enable FEAT_CMOW for -cpu max Date: Tue, 5 Nov 2024 11:19:35 +0000 Message-Id: <20241105111935.2747034-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105111935.2747034-1-peter.maydell@linaro.org> References: <20241105111935.2747034-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x135.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 From: Gustavo Romero FEAT_CMOW introduces support for controlling cache maintenance instructions executed in EL0/1 and is mandatory from Armv8.8. On real hardware, the main use for this feature is to prevent processes from invalidating or flushing cache lines for addresses they only have read permission, which can impact the performance of other processes. QEMU implements all cache instructions as NOPs, and, according to rule [1], which states that generating any Permission fault when a cache instruction is implemented as a NOP is implementation-defined, no Permission fault is generated for any cache instruction when it lacks read and write permissions. QEMU does not model any cache topology, so the PoU and PoC are before any cache, and rules [2] apply. These rules state that generating any MMU fault for cache instructions in this topology is also implementation-defined. Therefore, for FEAT_CMOW, we do not generate any MMU faults either, instead, we only advertise it in the feature register. [1] Rule R_HGLYG of section D8.14.3, Arm ARM K.a. [2] Rules R_MZTNR and R_DNZYL of section D8.14.3, Arm ARM K.a. Signed-off-by: Gustavo Romero Reviewed-by: Richard Henderson Message-id: 20241104142606.941638-1-gustavo.romero@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/system/arm/emulation.rst | 1 + target/arm/cpu-features.h | 5 +++++ target/arm/cpu.h | 1 + target/arm/helper.c | 5 +++++ target/arm/tcg/cpu64.c | 1 + 5 files changed, 13 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 35f52a54b1c..a2a388f0919 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -26,6 +26,7 @@ the following architecture extensions: - FEAT_BF16 (AArch64 BFloat16 instructions) - FEAT_BTI (Branch Target Identification) - FEAT_CCIDX (Extended cache index) +- FEAT_CMOW (Control for cache maintenance permission) - FEAT_CRC32 (CRC32 instructions) - FEAT_Crypto (Cryptographic Extension) - FEAT_CSV2 (Cache speculation variant 2) diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index 04ce2818263..e806f138b8f 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -802,6 +802,11 @@ static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, TIDCP1) != 0; } +static inline bool isar_feature_aa64_cmow(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, CMOW) != 0; +} + static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index fb0f217b196..d86e641280d 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1367,6 +1367,7 @@ void pmu_init(ARMCPU *cpu); #define SCTLR_EnIB (1U << 30) /* v8.3, AArch64 only */ #define SCTLR_EnIA (1U << 31) /* v8.3, AArch64 only */ #define SCTLR_DSSBS_32 (1U << 31) /* v8.5, AArch32 only */ +#define SCTLR_CMOW (1ULL << 32) /* FEAT_CMOW */ #define SCTLR_MSCEN (1ULL << 33) /* FEAT_MOPS */ #define SCTLR_BT0 (1ULL << 35) /* v8.5-BTI */ #define SCTLR_BT1 (1ULL << 36) /* v8.5-BTI */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 8c4f86f475a..f38eb054c06 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6229,6 +6229,11 @@ static void hcrx_write(CPUARMState *env, const ARMCPRegInfo *ri, if (cpu_isar_feature(aa64_nmi, cpu)) { valid_mask |= HCRX_TALLINT | HCRX_VINMI | HCRX_VFNMI; } + /* FEAT_CMOW adds CMOW */ + + if (cpu_isar_feature(aa64_cmow, cpu)) { + valid_mask |= HCRX_CMOW; + } /* Clear RES0 bits. */ env->cp15.hcrx_el2 = value & valid_mask; diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c index 01689208286..2963d7510f3 100644 --- a/target/arm/tcg/cpu64.c +++ b/target/arm/tcg/cpu64.c @@ -1218,6 +1218,7 @@ void aarch64_max_tcg_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64MMFR1, ETS, 2); /* FEAT_ETS2 */ t = FIELD_DP64(t, ID_AA64MMFR1, HCX, 1); /* FEAT_HCX */ t = FIELD_DP64(t, ID_AA64MMFR1, TIDCP1, 1); /* FEAT_TIDCP1 */ + t = FIELD_DP64(t, ID_AA64MMFR1, CMOW, 1); /* FEAT_CMOW */ cpu->isar.id_aa64mmfr1 = t; t = cpu->isar.id_aa64mmfr2;