From patchwork Mon Aug 23 19:55:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501567 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2499580jab; Mon, 23 Aug 2021 13:08:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLEKiRYOeawKHL68NrkZ03Y3MGVRa97E7hVNys1AZ9fg6EFNH2c2TrxH6FDd/35AsecF0A X-Received: by 2002:a17:906:2c14:: with SMTP id e20mr7672392ejh.46.1629749335745; Mon, 23 Aug 2021 13:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629749335; cv=none; d=google.com; s=arc-20160816; b=KNLQzGbVtlSSNoZHjg7YrxBHZzbmg4yso5SG8d9nbSiS6mmlH0p7/neJduzLiMGfQP nTrac4CqA3eCoQiPGiETXScw3FMfA+P15GkrCBSxXu2yIaFox3xEMlBiTDf33SxE3LRB StkMsRuaNOkC7EgTqaBusshCuFPCouJpP4lcZvaSdEkEcwbVILXosE9+ezOqiKgr3njG me81tvwpRPgnZA2jg0rqFRZ+7GFNMpED5DkO9J/zMyzGJxVUeujEFZzeObE34Xk/u+g5 ILfBwWdeVwP8IL6eLRziX1+zEqtmKLKpmBNs4Ui186th+Hxb0k+meNvJ5MjUX/XpIDXe nKRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=WVOEEziwaA11+l/Bdh2nU5ExXt0sCnB+f2iQ2wYW5GA=; b=E4ySCXpTlCpu90aZLa/GUkpXMNqYb1tqOtgfQIr4lvQG8hnXfvPbQ+vQ7d4+ucqfI2 E+ck8m1RdPuXfqH47vRPDS5/NkqNtsrELrA5V8iaHYpH34d8XVOZNoE2rAbOFQdK8icO GJIZ3dg/Hi1PGNz7qARVAFCtGeUSaUNcZSiFimKAQosPi9j6wzPIU1rsHXIBgtVUK6On 5U2xDmCSZsyogGaxRTgTtx8LAa6d0kz1dSPNBDl/qAj/z+OqDkocBoar+derAS6V6u3v 4OhzvBe4AIw2mPPdoDPlMeriOMrvmaYxs4gxMIwB42U97N6adUYzKD3xqvPx4Jxxaz6x kQIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=noPYm+Dc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q2si15033256edw.520.2021.08.23.13.08.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Aug 2021 13:08:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=noPYm+Dc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIGFa-000455-PL for patch@linaro.org; Mon, 23 Aug 2021 16:08:54 -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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/riscv/csr.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) -- 2.25.1 Reviewed-by: Bin Meng Reviewed-by: Alistair Francis 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(CPURISCVState *env, int csrno, return RISCV_EXCP_NONE; } -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; } @@ -1165,17 +1160,12 @@ static RISCVException write_htinst(CPURISCVState *env, int csrno, return RISCV_EXCP_NONE; } -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; } @@ -1599,10 +1589,10 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { [CSR_HIP] = { "hip", hmode, NULL, NULL, rmw_hip }, [CSR_HIE] = { "hie", hmode, read_hie, write_hie }, [CSR_HCOUNTEREN] = { "hcounteren", hmode, read_hcounteren, write_hcounteren }, - [CSR_HGEIE] = { "hgeie", hmode, read_hgeie, write_hgeie }, + [CSR_HGEIE] = { "hgeie", hmode, read_zero, write_hgeie }, [CSR_HTVAL] = { "htval", hmode, read_htval, write_htval }, [CSR_HTINST] = { "htinst", hmode, read_htinst, write_htinst }, - [CSR_HGEIP] = { "hgeip", hmode, read_hgeip, write_hgeip }, + [CSR_HGEIP] = { "hgeip", hmode, read_zero, write_hgeip }, [CSR_HGATP] = { "hgatp", hmode, read_hgatp, write_hgatp }, [CSR_HTIMEDELTA] = { "htimedelta", hmode, read_htimedelta, write_htimedelta }, [CSR_HTIMEDELTAH] = { "htimedeltah", hmode32, read_htimedeltah, write_htimedeltah },