From nobody Tue Nov 4 06:25:19 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=1677092036; cv=none; d=zohomail.com; s=zohoarc; b=GfbBwR3vmZMz13Trv0CY0g4felpx+Qbr8fXRw4KyQZ/xTiZ/cqeXH9zES9I22jYaxRNm90TF06/C9SPYt0h4myTO5tTo0KkjDcwW9osMzAu8aKoPAbh9t08kHo7TV0Qq5QuzSmi8It2UgMXEhZXQXXXNSCKvaOd6+xdaOCldoo0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677092036; 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=fSRZDgVynDAj9ItsD5H9AyS0Nai5Zcqgb4y0gtfbud4=; b=SS97nQ4f/lkzU5KUeN10SLxrzvWBKAA/zVl2XXeHXqfkCccjRsi8uCeW3ZLd6IXzyJ9I35C/ocGVpMknF2FKJ+JfKfbcENugRoBgP6oCr75WN3rvWaOU+cadK3G/gvwNmxWcND1xJy3bAYvJAAsZBt8yLp1VO9ZzilUfcflgd9s= 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 167709203620540.859717480790096; Wed, 22 Feb 2023 10:53:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUuEI-0007Cp-UC; Wed, 22 Feb 2023 13:52:38 -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 1pUuEE-0007BJ-Qk for qemu-devel@nongnu.org; Wed, 22 Feb 2023 13:52:34 -0500 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUuED-0004MJ-Bw for qemu-devel@nongnu.org; Wed, 22 Feb 2023 13:52:34 -0500 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-17213c961dfso10454018fac.0 for ; Wed, 22 Feb 2023 10:52:32 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 10:52:30 -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=fSRZDgVynDAj9ItsD5H9AyS0Nai5Zcqgb4y0gtfbud4=; b=o7cBHkgOSXgLIc3MIypDwaLaMKc76LYsAol8ZfWJKaClk1jsrcreMWI//pxDxk8QJk ERJ6ZokXT7Ao1j3cGJivfSQs2zXcP+8W24LlwaRHq4J6ZaH0w0ISzGbK/M16/ez+YwKO YHOiBOAExRhQHRFCk0e8LX6qGSxfaibT0bkRNREKyYtHl7gdOyKj8h+rb6tdb6Odx8M3 yeWdw0jmvi5KdMFzFs5G2PrMoNsdU1VbEYNpWjPWaO3tZjlpkZnAXV9YBsSoy/IQ+Urs ORBE5SnLjsm+40XBx484p17RXUurYaheMwH9JpkpX/nwoGx/5c+we9gJeBr9gDImcZmx q/AA== 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=fSRZDgVynDAj9ItsD5H9AyS0Nai5Zcqgb4y0gtfbud4=; b=OKXmDwl8mADx9yIrb+k24meDwBaNXtO8whUt8Z+y/VGCVm471E4Hx6cSap/cuyESwO LDEIC6KZyQF4adWVSjhCM2cxVUYn5J/qdZA0tXxGa7GvE10Vqt+fRkmyoXAnU0XFeh/q vdISMBKSU+5x2xsXfo2RjIxRu/G/2qXOv629ql51ogDJh8k8oxT8uDIW3hXuaCIegaRD 3L/o+7/Ye7GuiRNgoPN3RZeobZkC+BUR/NEeDbXddLbM2POxxbjZcUxodfJZhPuZTvsQ KMHI0ZHF1qtYaQRNJzdqk+mmJbk3aCscWR/lbf+59U4NHvivNFB0qRIC1cRs3jdO9TVr 7KvA== X-Gm-Message-State: AO0yUKVH4lfzCE882ZFgPKvGTIs7AMiiHdJz7zYniuCIeqdf2dym2txO wcHBYEbAsaMXkkvCJTvATcl+zmIMahtk8dD0 X-Google-Smtp-Source: AK7set/TZxqcsqvlCL0VJUFdtOwULv71dEJ7HnCnSqhZBiHCKMK/ADXY9bPYRPk1/aHWrmbi6Ayj6w== X-Received: by 2002:a05:6870:f14e:b0:172:721b:7edf with SMTP id l14-20020a056870f14e00b00172721b7edfmr246986oac.12.1677091950640; Wed, 22 Feb 2023 10:52:30 -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 04/10] target/riscv: remove RISCV_FEATURE_DEBUG Date: Wed, 22 Feb 2023 15:51:59 -0300 Message-Id: <20230222185205.355361-5-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=2001:4860:4864:20::35; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x35.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: 1677092038037100001 Content-Type: text/plain; charset="utf-8" RISCV_FEATURE_DEBUG will always follow the value defined by cpu->cfg.debug flag. Read the flag instead. 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 | 6 +----- target/riscv/cpu.h | 1 - target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/machine.c | 3 +-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 1d637b1acd..13e55ec5bd 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -637,7 +637,7 @@ static void riscv_cpu_reset_hold(Object *obj) set_default_nan_mode(1, &env->fp_status); =20 #ifndef CONFIG_USER_ONLY - if (riscv_feature(env, RISCV_FEATURE_DEBUG)) { + if (cpu->cfg.debug) { riscv_trigger_init(env); } =20 @@ -935,10 +935,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error = **errp) } } =20 - if (cpu->cfg.debug) { - riscv_set_feature(env, RISCV_FEATURE_DEBUG); - } - =20 #ifndef CONFIG_USER_ONLY if (cpu->cfg.ext_sstc) { diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 9d3304bcda..5295c2d701 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -89,7 +89,6 @@ enum { RISCV_FEATURE_MMU, RISCV_FEATURE_PMP, RISCV_FEATURE_EPMP, - RISCV_FEATURE_DEBUG }; =20 /* Privileged specification version */ diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index ad8d82662c..4cdd247c6c 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -105,7 +105,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ul= ong *pc, flags =3D FIELD_DP32(flags, TB_FLAGS, MSTATUS_HS_VS, get_field(env->mstatus_hs, MSTATUS_VS)); } - if (riscv_feature(env, RISCV_FEATURE_DEBUG) && !icount_enabled()) { + if (cpu->cfg.debug && !icount_enabled()) { flags =3D FIELD_DP32(flags, TB_FLAGS, ITRIGGER, env->itrigger_enab= led); } #endif diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 3cb8d2ffad..e220c4a5fd 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -437,7 +437,7 @@ static RISCVException epmp(CPURISCVState *env, int csrn= o) =20 static RISCVException debug(CPURISCVState *env, int csrno) { - if (riscv_feature(env, RISCV_FEATURE_DEBUG)) { + if (riscv_cpu_cfg(env)->debug) { return RISCV_EXCP_NONE; } =20 diff --git a/target/riscv/machine.c b/target/riscv/machine.c index c6ce318cce..4634968898 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -226,9 +226,8 @@ static const VMStateDescription vmstate_kvmtimer =3D { static bool debug_needed(void *opaque) { RISCVCPU *cpu =3D opaque; - CPURISCVState *env =3D &cpu->env; =20 - return riscv_feature(env, RISCV_FEATURE_DEBUG); + return cpu->cfg.debug; } =20 static int debug_post_load(void *opaque, int version_id) --=20 2.39.2