From nobody Thu Nov 14 07:01:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1704877608; cv=none; d=zohomail.com; s=zohoarc; b=e+lO3KsCrtE+MncZpqx7NU8e7do6hPBpnFnc/cBcJebHx0daC8DiHYANlR4hRjtBaB+3sP89tteDAZcE1y8HMqqEqa9OLNTrTNsJSPdkt7QhY16YSn8Ftrz8R+Rdz2GqEUETNM86wMUzvugRQoZlORlWNhr6iB6AzlORtYmGMeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704877608; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kqx6DK/WndzvPi6CVWSwKepXM0C4841Pf/bOwcgRzj8=; b=Db0gxAGBLeDCFxygQ5q6UUNSJUDhOMyx3/vCKm3OVIqxMTFN8TMOBZh96e2GIgXOpNac9Eduv1XrAoZweMOrqy+DM7JctHVT3qyz18ZmIhEBJK6Os/f5p7/3MX2atCrTF4eyDy1KdycRegXNzgDYWYdNW4zJftsodc5GAcOVrnc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704877608731599.9414056567355; Wed, 10 Jan 2024 01:06:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNUUI-0005Bx-MO; Wed, 10 Jan 2024 04:03: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 1rNUTB-0003ZQ-I1 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 04:02:00 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0: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 1rNUT9-0005jz-OR for qemu-devel@nongnu.org; Wed, 10 Jan 2024 04:01:53 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6d9bc8939d0so2102358b3a.0 for ; Wed, 10 Jan 2024 01:01:50 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id t65-20020a628144000000b006d9879ba6besm3223814pfd.170.2024.01.10.01.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 01:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704877309; x=1705482109; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kqx6DK/WndzvPi6CVWSwKepXM0C4841Pf/bOwcgRzj8=; b=KfBhoPgGkcqW9JnjsEqgbkJRDV4UlVqHklCOMH/vG7+3KPurRRgPwahFaJ9HVNQS1T NQvRpCAx+9C12n9llJCBut9IOwXQIwj+00z6bF7vnnNukNATvIPArCtfAq+HGbEOQ+g1 dG2KLCTm5YH4UQ6JsVaX1ryBcTC+2hwxTWeS2gwoWetjZSmf7hOwZHj2dAn+SstFjPwH CpOQh6rmBfLHc1F4I3SwmwhVuxY+WaT6tl4bmKs4XqIIqoc/9Poae1UpWXaupCJfkyZi /BHByqQZpzX9RtkyOa7c04GuCVGC16Y7tr7Mr5KHR9tcLXCTDib9xZv2vPLbPuz+SU/+ jmFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704877309; x=1705482109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kqx6DK/WndzvPi6CVWSwKepXM0C4841Pf/bOwcgRzj8=; b=Dn8sE3czkj2Lnu/f3GNxYnDJSEhVDgruu8z3AfN/t+F5LTAy9CV5rPId7acNn1AT0f BBg0UFLgixovtLBlh553FnhP/PehPha/dcjspIfveSzMNdVcEKkRdMc+r3g2J8W7btel stYvwCThxyGman7Eb4xtiS8vCVWFsdOdBWX9sGEHUVJB5Gxj9ZABKMOcq1sjtc3wIO7v 5Wo0MNVfYNL3qCkCgecKyCoBgF08kSb5Np3NkFqJA6x3DLQ9D9Ol44cBC6MrYZoDJQdp H/Wa3HWA9yxYiIL15KyILSUdTqYnFAcg2i+DYMwC2yJV1D8HeFDsWqSQBEvu4jyjEvM+ jheQ== X-Gm-Message-State: AOJu0YwmLOIQuFI5Is6BUo7IFxyspwyPLP0/Yc74Z6iYGJmgsR8YrG+m XBbx4VZLKnLQMcwcxNDbN/Jjol1DSvHHIBGF X-Google-Smtp-Source: AGHT+IEnsjjixUo/s9t68XNcXMfbv+qecilj0jio6WeipWVNHtqwf2q7AqwgXP7Exmr/HhqvcgPulg== X-Received: by 2002:a05:6a20:3c8b:b0:19a:13:ba4d with SMTP id b11-20020a056a203c8b00b0019a0013ba4dmr435692pzj.82.1704877309104; Wed, 10 Jan 2024 01:01:49 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Alistair Francis , Daniel Henrique Barboza Subject: [PULL 65/65] target/riscv: Ensure mideleg is set correctly on reset Date: Wed, 10 Jan 2024 18:57:33 +1000 Message-ID: <20240110085733.1607526-66-alistair.francis@wdc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240110085733.1607526-1-alistair.francis@wdc.com> References: <20240110085733.1607526-1-alistair.francis@wdc.com> 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::42b; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1704877610768100007 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Bits 10, 6, 2 and 12 of mideleg are read only 1 when the Hypervisor is enabled. We currently only set them on accesses to mideleg, but they aren't correctly set on reset. Let's ensure they are always the correct value. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1617 Signed-off-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza Message-ID: <20240108001328.280222-4-alistair.francis@wdc.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index b32681f7f3..8cbfc7e781 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -931,6 +931,14 @@ static void riscv_cpu_reset_hold(Object *obj) /* mmte is supposed to have pm.current hardwired to 1 */ env->mmte |=3D (EXT_STATUS_INITIAL | MMTE_M_PM_CURRENT); =20 + /* + * Bits 10, 6, 2 and 12 of mideleg are read only 1 when the Hypervisor + * extension is enabled. + */ + if (riscv_has_ext(env, RVH)) { + env->mideleg |=3D HS_MODE_INTERRUPTS; + } + /* * Clear mseccfg and unlock all the PMP entries upon reset. * This is allowed as per the priv and smepmp specifications --=20 2.43.0