From nobody Sat Sep 27 11:35:40 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629749357730888.3037918620456; Mon, 23 Aug 2021 13:09:17 -0700 (PDT) Received: from localhost ([::1]:37268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIGFw-000685-Q9 for importer@patchew.org; Mon, 23 Aug 2021 16:09:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIG31-0006bv-2x for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:55 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:42730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIG2q-0003Be-LT for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:54 -0400 Received: by mail-pg1-x532.google.com with SMTP id q68so547209pga.9 for ; Mon, 23 Aug 2021 12:55:44 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id v15sm16685078pff.105.2021.08.23.12.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 12:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WVOEEziwaA11+l/Bdh2nU5ExXt0sCnB+f2iQ2wYW5GA=; b=noPYm+DcRJHwfDvf72IWWkXUoQ0B08S+h7O7K4pMuNu0rxGjTmhMi6HBTYK8wL7OO4 Q4KJXrqcSlXm9kjSKrAby3Te+GA7jjORRUMX+MiLUMNxrr/pR6flgCwazP8V033u+Kzm M66kjfu2dwjLKljHBmhUjWD+kcizbvLcrFyxmrGxkFf6q1vt5sY9ENlcetYNnmhXni2Z Jw4aCXCiM3VVXjj1jvPQGMEqw5yKTSMxmWz8fOjHf35i0SFqClvVhkNh1dCIqBFYrYoK okBqOTTItgdBOsrf4CWHZXwlqWgRQRJwHaN2nIyAvx0pFlsj3CAljqDFdWDR5i3xrrPz liSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WVOEEziwaA11+l/Bdh2nU5ExXt0sCnB+f2iQ2wYW5GA=; b=qiVZa36Dp4pmauk60/LRmVRO++bsuLvsKYgF1QBraQtQP+P5Dn41MlcNsH7bN5Nq/D vvMmTJXKvf/E4+d6jKd7ZDOaDHApf/lAH6YRajkEl7KH1tScO54UUAjwaZkxO//VpmXZ Ask7KVLtHP4fz73kvr3ZhX8X6PvDCEmzGIuWDuPgQPV8cT+9SJAxheG254vBfP2h3RJu XjciCZ8kw0wTknhmv72GJrc99233Oob6bTnbLMwWTdCj73XCuFVvhQwqJ0i6tz/N8q8w AkEOjCFDt7IGaQZAF/XMCWkvQECRWYIUYqrcFVBvVcl4qHiulMhKtPWVBDYjHNGms377 4rAg== X-Gm-Message-State: AOAM533SV+8uWvtSDUE9jHimbjfZVfhSSORgB6E638dvMp6RPlZEky33 iwkZkjJszyuJLri8JUJ+gStlmRSW25e85w== X-Google-Smtp-Source: ABdhPJw/sNXbarxAlbSq3Yj4DgjjRBWewHGysUpqLDDuq2if4hNf3E56PwX4cqcvCYOckzfoUKPdfQ== X-Received: by 2002:a62:778e:0:b0:3ea:e8fe:d0c7 with SMTP id s136-20020a62778e000000b003eae8fed0c7mr19944657pfc.21.1629748543121; Mon, 23 Aug 2021 12:55:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 17/24] target/riscv: Fix hgeie, hgeip Date: Mon, 23 Aug 2021 12:55:22 -0700 Message-Id: <20210823195529.560295-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210823195529.560295-1-richard.henderson@linaro.org> References: <20210823195529.560295-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com, bin.meng@windriver.com, qemu-riscv@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1629749359236100001 Content-Type: text/plain; charset="utf-8" We failed to write into *val for these read functions; replace them with read_zero. Only warn about unsupported non-zero value when writing a non-zero value. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Reviewed-by: Bin Meng --- target/riscv/csr.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index d900f96dc1..905860dbb2 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1124,17 +1124,12 @@ static RISCVException write_hcounteren(CPURISCVStat= e *env, int csrno, return RISCV_EXCP_NONE; } =20 -static RISCVException read_hgeie(CPURISCVState *env, int csrno, - target_ulong *val) -{ - qemu_log_mask(LOG_UNIMP, "No support for a non-zero GEILEN."); - return RISCV_EXCP_NONE; -} - static RISCVException write_hgeie(CPURISCVState *env, int csrno, target_ulong val) { - qemu_log_mask(LOG_UNIMP, "No support for a non-zero GEILEN."); + if (val) { + qemu_log_mask(LOG_UNIMP, "No support for a non-zero GEILEN."); + } return RISCV_EXCP_NONE; } =20 @@ -1165,17 +1160,12 @@ static RISCVException write_htinst(CPURISCVState *e= nv, int csrno, return RISCV_EXCP_NONE; } =20 -static RISCVException read_hgeip(CPURISCVState *env, int csrno, - target_ulong *val) -{ - qemu_log_mask(LOG_UNIMP, "No support for a non-zero GEILEN."); - return RISCV_EXCP_NONE; -} - static RISCVException write_hgeip(CPURISCVState *env, int csrno, target_ulong val) { - qemu_log_mask(LOG_UNIMP, "No support for a non-zero GEILEN."); + if (val) { + qemu_log_mask(LOG_UNIMP, "No support for a non-zero GEILEN."); + } return RISCV_EXCP_NONE; } =20 @@ -1599,10 +1589,10 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] =3D { [CSR_HIP] =3D { "hip", hmode, NULL, NULL, rmw_= hip }, [CSR_HIE] =3D { "hie", hmode, read_hie, writ= e_hie }, [CSR_HCOUNTEREN] =3D { "hcounteren", hmode, read_hcounteren, writ= e_hcounteren }, - [CSR_HGEIE] =3D { "hgeie", hmode, read_hgeie, writ= e_hgeie }, + [CSR_HGEIE] =3D { "hgeie", hmode, read_zero, writ= e_hgeie }, [CSR_HTVAL] =3D { "htval", hmode, read_htval, writ= e_htval }, [CSR_HTINST] =3D { "htinst", hmode, read_htinst, writ= e_htinst }, - [CSR_HGEIP] =3D { "hgeip", hmode, read_hgeip, writ= e_hgeip }, + [CSR_HGEIP] =3D { "hgeip", hmode, read_zero, writ= e_hgeip }, [CSR_HGATP] =3D { "hgatp", hmode, read_hgatp, writ= e_hgatp }, [CSR_HTIMEDELTA] =3D { "htimedelta", hmode, read_htimedelta, writ= e_htimedelta }, [CSR_HTIMEDELTAH] =3D { "htimedeltah", hmode32, read_htimedeltah, writ= e_htimedeltah }, --=20 2.25.1