From nobody Tue Nov 4 06:24:18 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1677092015; cv=none; d=zohomail.com; s=zohoarc; b=LO+glRD4jZbEJ7KG9MlagSr7qeQZ9Im3XrKoJYbnDbSa3+ptHRGMJC2T/L8vS1nEWMf8eJ+VYuyAyoH1Q1Lcu/A/yE6s5U62w2DGdXwCxzRV+vFLJkCDEbnAukxCsvUSDJMhaBOhLTUjPIAebCR/3pbarsCMeYSldOv0/O1+Vvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677092015; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yDeC9W26Tqq62T+IG4dI73GqG8Ah45b+7FjvvmJyEXM=; b=Fzt/7gyft3I0DDFuQbgTimGjB7QBAQ7SV/KlOV8sxz2L5XDmZb97LWA/Qh6l6OWocfJ+Em3dr1R5dcxaw78VfBt1VQF6O0oXXdfrPtXefQ8g5RguUpZqPxzqSQG4mzsTaUjkUy9Gx0g32971nYHgn6hOJE9HePH9UTLmMU1LY68= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167709201527243.186406644628846; Wed, 22 Feb 2023 10:53:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUuEL-0007E4-Vl; Wed, 22 Feb 2023 13:52:41 -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 1pUuEK-0007DG-NM for qemu-devel@nongnu.org; Wed, 22 Feb 2023 13:52:40 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUuEI-0004Nm-U4 for qemu-devel@nongnu.org; Wed, 22 Feb 2023 13:52:40 -0500 Received: by mail-ot1-x331.google.com with SMTP id a14-20020a056830100e00b00690ed91749aso1799411otp.7 for ; Wed, 22 Feb 2023 10:52:38 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.112.117]) by smtp.gmail.com with ESMTPSA id z2-20020a9d71c2000000b0068bcadcad5bsm1781111otj.57.2023.02.22.10.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 10:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=yDeC9W26Tqq62T+IG4dI73GqG8Ah45b+7FjvvmJyEXM=; b=bRKq3z0wtjJsNBnxemXRLAXT/IOGNDDIAS5sFHejMQW13E0UXgk6X8ZB3yxQb+P+cM weIpHdC3+IynSXODGnqMq+0glWvBxzY72ccJsch3Ef2h5snzCjBsnBtzZbdbkgLlTXbQ rOYv9KJpWJPE29OqIUG8lJxcn6QrGrp7pf9IUMANOmhUAqC2IauN8DKwS8X0lCjZLz8K MwhMO2igNPC76Gts4xJ6+Jlu+W08nOgxHUuTPgcx5qMD9fcTOg8Rn+eATVuwkPY9MrVM IcSePMJcMyXOcfgsE059kH6kToo9wCS20TDTBOq3wz1axFR9oh5J3V17sr1t6by7hvUi x14A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=yDeC9W26Tqq62T+IG4dI73GqG8Ah45b+7FjvvmJyEXM=; b=Xh2fOfIo4w4qgvSQvrNhnp/vjpAiDx25Ckd8tz3plg+UebNs5av1RBMsdf27jiBI5k JPR5EiYRL+h0oPvZ1zelORppZdHrVcpFKz3x1Gk9/+rutKFrknD5YtRVpeE0n9PaKT7d f0yxFEokhgULUoDxUry05iucA8NPX9b2YQGeLGSNB7aAzajaI0lKMiHp2b2g39zTZ2e6 f399qYqdOCfsAYRiTrlWZHsvpZPpE3wd4hdvTpTVdbU2/gkhCu6TfICj65DCYI6dJ9Qn yE3Jwc3mrx/gH/l1UNQrQOC3GlIiykQ0VTqg1yV21/19BRYlSCf74Vfh+jzBUQYypjVx M1cA== X-Gm-Message-State: AO0yUKVBrm3PzEqmGwvFHDXUlz/4IuznAXTbmsAVmGNn3Wwsbt6FmaPr IXa4oM1rme8asmeDziXtvrd5mHuDI5knWB/j X-Google-Smtp-Source: AK7set+SjW5IJqKTCNNUc6TudQZOrebSD3Q+HUGRw5/toGZtPbviNR5AFnfGenbEr+IxuhuELwjRCA== X-Received: by 2002:a05:6830:44a1:b0:684:ac9d:1a17 with SMTP id r33-20020a05683044a100b00684ac9d1a17mr5670465otv.3.1677091957394; Wed, 22 Feb 2023 10:52:37 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza , Andrew Jones Subject: [PATCH v7 06/10] target/riscv: remove RISCV_FEATURE_EPMP Date: Wed, 22 Feb 2023 15:52:01 -0300 Message-Id: <20230222185205.355361-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222185205.355361-1-dbarboza@ventanamicro.com> References: <20230222185205.355361-1-dbarboza@ventanamicro.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::331; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x331.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.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 @ventanamicro.com) X-ZM-MESSAGEID: 1677092016326100002 Content-Type: text/plain; charset="utf-8" RISCV_FEATURE_EPMP is always set to the same value as the cpu->cfg.epmp flag. Use the flag directly. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Bin Meng Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei --- target/riscv/cpu.c | 10 +++------- target/riscv/cpu.h | 1 - target/riscv/csr.c | 2 +- target/riscv/pmp.c | 4 ++-- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index aec7830c44..807a466f34 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -927,17 +927,13 @@ static void riscv_cpu_realize(DeviceState *dev, Error= **errp) riscv_set_feature(env, RISCV_FEATURE_PMP); } =20 - if (cpu->cfg.epmp) { - riscv_set_feature(env, RISCV_FEATURE_EPMP); - + if (cpu->cfg.epmp && !cpu->cfg.pmp) { /* * Enhanced PMP should only be available * on harts with PMP support */ - if (!cpu->cfg.pmp) { - error_setg(errp, "Invalid configuration: EPMP requires PMP sup= port"); - return; - } + error_setg(errp, "Invalid configuration: EPMP requires PMP support= "); + return; } =20 =20 diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 5295c2d701..d4da420912 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -88,7 +88,6 @@ enum { RISCV_FEATURE_MMU, RISCV_FEATURE_PMP, - RISCV_FEATURE_EPMP, }; =20 /* Privileged specification version */ diff --git a/target/riscv/csr.c b/target/riscv/csr.c index e220c4a5fd..951327022d 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -428,7 +428,7 @@ static RISCVException pmp(CPURISCVState *env, int csrno) =20 static RISCVException epmp(CPURISCVState *env, int csrno) { - if (env->priv =3D=3D PRV_M && riscv_feature(env, RISCV_FEATURE_EPMP)) { + if (env->priv =3D=3D PRV_M && riscv_cpu_cfg(env)->epmp) { return RISCV_EXCP_NONE; } =20 diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 4bc4113531..aa4d1996e9 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -88,7 +88,7 @@ static void pmp_write_cfg(CPURISCVState *env, uint32_t pm= p_index, uint8_t val) if (pmp_index < MAX_RISCV_PMPS) { bool locked =3D true; =20 - if (riscv_feature(env, RISCV_FEATURE_EPMP)) { + if (riscv_cpu_cfg(env)->epmp) { /* mseccfg.RLB is set */ if (MSECCFG_RLB_ISSET(env)) { locked =3D false; @@ -239,7 +239,7 @@ static bool pmp_hart_has_privs_default(CPURISCVState *e= nv, target_ulong addr, { bool ret; =20 - if (riscv_feature(env, RISCV_FEATURE_EPMP)) { + if (riscv_cpu_cfg(env)->epmp) { if (MSECCFG_MMWP_ISSET(env)) { /* * The Machine Mode Whitelist Policy (mseccfg.MMWP) is set --=20 2.39.2