From nobody Sun May 12 20:03:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1602601923; cv=none; d=zohomail.com; s=zohoarc; b=TKJ4/ahmt3CtQNJRoOa+U2tolLKjRV/rphONagZaH6W25K4JfMBhJy7cr++oJbSSH8gmmNRBVosgGXdx1g0BnKiOxTrmtj94Mr4NkCW5mWvoJ1VLQ9sbTx4OxjvXUyD9DXush6dL+rYlhpLiKBtV4ITSIZUZMGgf6dAS4W7zUoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602601923; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=KcGT9vxmphtX7T8dcaUSr8GbGUv1hFrTugtPjJ7Wzgw=; b=GriPYQBbOsdzelyTFl/uXJKTfInsnzPPo0BLrZqWnfjVr0aLT0WYqaH47+6LHjDpfdLwVDmiZ3h+M5cxwjvLH5Ma3UC3Q1WkNR+7SBNvcLpUrwpNrA6OB7gqt1RlmVxn7rRvYpIce5Q29g9Q1a8Mysi32ikfAUU/SgXaplb/wSU= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602601922936772.7896268394896; Tue, 13 Oct 2020 08:12:02 -0700 (PDT) Received: from localhost ([::1]:38252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSLy4-0003Lp-Tl for importer@patchew.org; Tue, 13 Oct 2020 11:12:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSLxJ-0002hU-Hk; Tue, 13 Oct 2020 11:11:13 -0400 Received: from serv1.kernkonzept.com ([2a01:4f8:1c1c:b490::2]:60959 helo=mx.kernkonzept.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSLxH-0007wy-SU; Tue, 13 Oct 2020 11:11:13 -0400 Received: from [86.56.119.37] (helo=george-laptop.lan) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) id 1kSLxD-0007x6-9D; Tue, 13 Oct 2020 17:11:07 +0200 From: Georg Kotheimer To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH] target/riscv: Fix update of hstatus.SPVP Date: Tue, 13 Oct 2020 17:10:54 +0200 Message-Id: <20201013151054.396481-1-georg.kotheimer@kernkonzept.com> X-Mailer: git-send-email 2.25.1 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: softfail client-ip=2a01:4f8:1c1c:b490::2; envelope-from=georg.kotheimer@kernkonzept.com; helo=mx.kernkonzept.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.4, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Georg Kotheimer Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" When trapping from virt into HS mode, hstatus.SPVP was set to the value of sstatus.SPP, as according to the specification both flags should be set to the same value. However, the assignment of SPVP takes place before SPP itself is updated, which results in SPVP having an outdated value. Signed-off-by: Georg Kotheimer Reviewed-by: Alistair Francis --- target/riscv/cpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 904899054d..1d7d10377d 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -932,7 +932,7 @@ void riscv_cpu_do_interrupt(CPUState *cs) /* Trap into HS mode, from virt */ riscv_cpu_swap_hypervisor_regs(env); env->hstatus =3D set_field(env->hstatus, HSTATUS_SPVP, - get_field(env->mstatus, SSTATUS_S= PP)); + env->priv); env->hstatus =3D set_field(env->hstatus, HSTATUS_SPV, riscv_cpu_virt_enabled(env)); =20 --=20 2.25.1