From nobody Tue May 14 09:45:46 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=is.currently.online ARC-Seal: i=1; a=rsa-sha256; t=1693351020; cv=none; d=zohomail.com; s=zohoarc; b=AEJcg6mu6KpTQv3aCSZ2Uok8IUXpW6Kjvorj83NhVQLGwcySsBMpP7EY+3qs5dXqMdsZICIp6aEs5KcQFdbCJXycgDqfhanHX1G5N5zIP3g4r8LaH81aKrEkX8mjfSRRaMMVAj2+7kHXQGB3jXjSxYVtbLEurKbmEHfiUKg17fs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693351020; 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=kYJy9Ny9RaidyT2nj/IfjvKp4Ax6Qf5vQ+djwvC2yac=; b=OSMfxTZUVLKMV0x8K79c4hF1PMzIe4PGbW3pIeVdwvZvyqAA+/lzoiejoySI8jS/cnyaTlQV9KX5w1LKMVIS1qB+Wdm9QVV6d6uZMKA9cJ7cNlKWTMxmdGAMPhyeTnHcnSB1+pHBcieCuLJogdsKmAqyByvl/JQHW7RTgRXn6Vc= 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 1693351019503148.11584703062442; Tue, 29 Aug 2023 16:16:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qb7nx-0001tu-5h; Tue, 29 Aug 2023 19:07:25 -0400 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 1qb6cI-0007gZ-4K; Tue, 29 Aug 2023 17:51:18 -0400 Received: from netc0.host.rs.currently.online ([202.61.195.116]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qb6cD-0002GK-9E; Tue, 29 Aug 2023 17:51:17 -0400 Received: from carbon.srv.schuermann.io (unknown [IPv6:2001:7c7:2112::1c]) by netc0.host.rs.currently.online (Postfix) with ESMTPS id 1403318CA0; Tue, 29 Aug 2023 21:50:53 +0000 (UTC) From: leon@is.currently.online DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=is.currently.online; s=carbon; t=1693345850; bh=kYJy9Ny9RaidyT2nj/IfjvKp4Ax6Qf5vQ+djwvC2yac=; h=From:To:Cc:Subject:Date; b=ovt53bteiW/t0BYFfk9A7dKmlhFLtT1fgfgYYeT0zrmwW0TycxDOHwY3QOwkFI9Tx ED1bb8xmPzclrDc68PuBeDvT71Alv92ICd++YeQOjMn5rbOC0S4oPrpMfZSZL8H7dS EA7tMxNJpJ5I8ocAOkbSFw2M+XZpqPCG/s7z6ptA= To: qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: Alistair Francis , Leon Schuermann Subject: [PATCH] target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes Date: Tue, 29 Aug 2023 17:50:46 -0400 Message-Id: <20230829215046.1430463-1-leon@is.currently.online> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam: Yes 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=202.61.195.116; envelope-from=leon@is.currently.online; helo=netc0.host.rs.currently.online X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FROM_SUSPICIOUS_NTLD=0.001, FROM_SUSPICIOUS_NTLD_FP=1.999, PDS_OTHER_BAD_TLD=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @is.currently.online) X-ZM-MESSAGEID: 1693351022013100002 Content-Type: text/plain; charset="utf-8" From: Leon Schuermann When the rule-lock bypass (RLB) bit is set in the mseccfg CSR, the PMP configuration lock bits must not apply. While this behavior is implemented for the pmpcfgX CSRs, this bit is not respected for changes to the pmpaddrX CSRs. This patch ensures that pmpaddrX CSR writes work even on locked regions when the global rule-lock bypass is enabled. Signed-off-by: Leon Schuermann Reviewed-by: Alistair Francis Reviewed-by: Mayuresh Chitale --- target/riscv/pmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 9d8db493e6..5e60c26031 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -44,6 +44,10 @@ static inline uint8_t pmp_get_a_field(uint8_t cfg) */ static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index) { + /* mseccfg.RLB is set */ + if (MSECCFG_RLB_ISSET(env)) { + return 0; + } =20 if (env->pmp_state.pmp[pmp_index].cfg_reg & PMP_LOCK) { return 1; base-commit: a8fc5165aab02f328ccd148aafec1e59fd1426eb --=20 2.34.1