From nobody Tue Feb 10 03:50:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.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; dmarc=fail(p=none dis=none) header.from=wdc.com ARC-Seal: i=1; a=rsa-sha256; t=1607978575; cv=none; d=zohomail.com; s=zohoarc; b=MbAcuPx3Tw0DANcY+pR6JSFNd++HMrI3WQVk4jR6lVBI7oGwmC92nAavjrYp89chs3bW5oTao5neRMA31DYRAMBpL7uTu3KnBhVcy8Gl4UuAlg+sJIkARNkucgZPfycb5tOEjHZUx6MvhAAcm6hmWRWlNVraRIk+oCehKzEEY/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607978575; 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=1znvUdH2WEmL2VhS0Y+LGR0hQi4s3nzWD4QslKceKpA=; b=aWRx4JKdEMk+L8Bb9aMQpqBNUv5/2ddMuAcUSa9JDXptT8T1DQmj/CQXH/TAk1g6V+TLInVGd9qiTvuhSvaua32zmzRNIOphTD70zlaOhyp7pKboDgw/UATP6xmt9lh6WSw+AI1Dm7oQClaw6BioUHW17kMo2vjTJ4ywX5jeUJ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@wdc.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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607978575646998.0729078380361; Mon, 14 Dec 2020 12:42:55 -0800 (PST) Received: from localhost ([::1]:50110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kougI-0005FJ-ED for importer@patchew.org; Mon, 14 Dec 2020 15:42:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouYJ-0001yS-6z; Mon, 14 Dec 2020 15:34:39 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:20009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouYG-0007wY-Me; Mon, 14 Dec 2020 15:34:38 -0500 Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Dec 2020 04:34:34 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 12:19:54 -0800 Received: from cnf006900.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.62.52]) by uls-op-cesaip01.wdc.com with ESMTP; 14 Dec 2020 12:34:35 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1607978076; x=1639514076; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zG6vmoOS680GqNHSDMcma3CCsMEus1pGBzvPiMAQeuo=; b=FF1ow48kT9eHoq8eeK5psLvhXRNqbSfLkrUdwWypoMz77jU9Kbnss/6a ub1ewF0ozW1MmJwuslPiYI6QkwDfVMaZy8uSGXsPSz94ikmhC8MBIg4JD +2PSIu/6ZjOKlst+uGLjYZH9aW6bDHo4W0pMDk8aFUdhj3OXNUqvHNzy3 JpRD0w89X05079bZignd3iZwZtn1aSWyjr5SzeJ32/zELaokvHP5ngB6R Ir1FwOIwZml4qPppzLLmpk4Z6TGLOdVaRBVCaxuZt/EUo+zcqFqk4DmBD Hfq1ATw883hq2mH5N6QLddFUqV+kNzF7vKi0LG6jj6cjEBQzZNI4Chw6d w==; IronPort-SDR: v8IrYUIc8EsOYxFFEIfJ1VDaY1jXJe+xSttWQZ+gnBDVWwksMVwyimwU9JmmVJh5YUnt70GPUX sDNo1+HXwDiElG9UIMFtLbqx4y4fubnhh4UI1xc0pRL8pc0z+U5nMMDIrgDV8XNYPmU2TsffUb 1yycPhFnPlYmR3ZTMDgFvcszjRCorEnfrpgapZhlJzhJlbZ70i/SE2pt4gFSuzzGf6k0avz9x+ eRSE0lTID6JyMcIRsMUwxQ32ahII2R8WzMnR96Go6fUa1xHQjIX0gYmcpXfD71XKbdmnhrpAru jak= X-IronPort-AV: E=Sophos;i="5.78,420,1599494400"; d="scan'208";a="265318155" IronPort-SDR: kbgvzwYPs5yPtkmbZnTKjkQVqBTpH8s84oA8bZrkQY9NrLN18Y6PWe0MfjYIMieYUbP2gjmQ7a Kuab3ZK7/rEgZCJTY8V5V+ekfif7DEnCUUbbUmfACNAY7+gN5PgMuuYvE7aJAEBYbLVhdkSi/0 acjtS+3hvyGPE3HsOA7p9ApBpJ+hponJz9eLBtVQWCfUzmtmqJxWqq5MvZjeAMmkZCeCwVH69u 3sUjryvZosJJZY7o07WhApTP+wIWVy7cnqN6I1cfbjcJbTMpEdMEV/wrf8NDdMt6i3fetuyJrH bSO27G1cKYvA58tx+rnFEyFs IronPort-SDR: JhbCzoGcDcbh4g9fgm67nIw6fzWWwHzegyH40XNUPkRa15Nm2tj54/9b8L7uf34u6Sfe0pzXsl zk9OY1XodrI58UMvzVIddYTAyesevUFM7BEFumUdp0TBrzM3Xv9Bw35O85cvGjBu6jPkBfHRYn CrlsrjVfyKF+yiHWbZC0YiI/vsAP7o7WoLSMPk6083jTPXr6wm7YKaGZgCOkDrWUcMfmqeKjfA ZHzhiqGti6+VUDBvpAPIkTRRqpF1TgTDTpc6tSURHJC8lpSv+XXqDctHyWaccS87joiBEc3Xtz N28= WDCIronportException: Internal From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v3 14/15] target/riscv: csr: Remove compile time XLEN checks Date: Mon, 14 Dec 2020 12:34:34 -0800 Message-Id: <8f85e44940d5f4f5f947a92033685531b3df7aea.1607967113.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: 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=68.232.141.245; envelope-from=prvs=61015ee87=alistair.francis@wdc.com; helo=esa1.hgst.iphmx.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_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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: alistair.francis@wdc.com, bmeng.cn@gmail.com, palmer@dabbelt.com, alistair23@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Alistair Francis Reviewed-by: Bin Meng --- target/riscv/cpu_bits.h | 4 +- target/riscv/csr.c | 176 +++++++++++++++++++++------------------- 2 files changed, 92 insertions(+), 88 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 24b24c69c5..1337269ae8 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -437,9 +437,7 @@ #define HSTATUS_VGEIN 0x0003F000 #define HSTATUS_VTVM 0x00100000 #define HSTATUS_VTSR 0x00400000 -#if defined(TARGET_RISCV64) -#define HSTATUS_VSXL 0x300000000 -#endif +#define HSTATUS_VSXL 0x300000000 =20 #define HSTATUS32_WPRI 0xFF8FF87E #define HSTATUS64_WPRI 0xFFFFFFFFFF8FF87EULL diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 93263f8e06..63b818c1dd 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -102,44 +102,65 @@ static int ctr(CPURISCVState *env, int csrno) return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; } break; -#if defined(TARGET_RISCV32) - case CSR_CYCLEH: - if (!get_field(env->hcounteren, HCOUNTEREN_CY) && - get_field(env->mcounteren, HCOUNTEREN_CY)) { - return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; - } - break; - case CSR_TIMEH: - if (!get_field(env->hcounteren, HCOUNTEREN_TM) && - get_field(env->mcounteren, HCOUNTEREN_TM)) { - return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; - } - break; - case CSR_INSTRETH: - if (!get_field(env->hcounteren, HCOUNTEREN_IR) && - get_field(env->mcounteren, HCOUNTEREN_IR)) { - return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; - } - break; - case CSR_HPMCOUNTER3H...CSR_HPMCOUNTER31H: - if (!get_field(env->hcounteren, 1 << (csrno - CSR_HPMCOUNTER3H= )) && - get_field(env->mcounteren, 1 << (csrno - CSR_HPMCOUNTER3H)= )) { - return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + if (riscv_cpu_is_32bit(env)) { + switch (csrno) { + case CSR_CYCLEH: + if (!get_field(env->hcounteren, HCOUNTEREN_CY) && + get_field(env->mcounteren, HCOUNTEREN_CY)) { + return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + break; + case CSR_TIMEH: + if (!get_field(env->hcounteren, HCOUNTEREN_TM) && + get_field(env->mcounteren, HCOUNTEREN_TM)) { + return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + break; + case CSR_INSTRETH: + if (!get_field(env->hcounteren, HCOUNTEREN_IR) && + get_field(env->mcounteren, HCOUNTEREN_IR)) { + return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + break; + case CSR_HPMCOUNTER3H...CSR_HPMCOUNTER31H: + if (!get_field(env->hcounteren, 1 << (csrno - CSR_HPMCOUNT= ER3H)) && + get_field(env->mcounteren, 1 << (csrno - CSR_HPMCOUNTE= R3H))) { + return -RISCV_EXCP_VIRT_INSTRUCTION_FAULT; + } + break; } - break; -#endif } } #endif return 0; } =20 +static int ctr32(CPURISCVState *env, int csrno) +{ + if (!riscv_cpu_is_32bit(env)) { + return -RISCV_EXCP_ILLEGAL_INST; + } + + return ctr(env, csrno); +} + #if !defined(CONFIG_USER_ONLY) static int any(CPURISCVState *env, int csrno) { return 0; } =20 +static int any32(CPURISCVState *env, int csrno) +{ + if (!riscv_cpu_is_32bit(env)) { + return -RISCV_EXCP_ILLEGAL_INST; + } + + return any(env, csrno); + +} + static int smode(CPURISCVState *env, int csrno) { return -!riscv_has_ext(env, RVS); @@ -161,6 +182,16 @@ static int hmode(CPURISCVState *env, int csrno) return -RISCV_EXCP_ILLEGAL_INST; } =20 +static int hmode32(CPURISCVState *env, int csrno) +{ + if (!riscv_cpu_is_32bit(env)) { + return 0; + } + + return hmode(env, csrno); + +} + static int pmp(CPURISCVState *env, int csrno) { return -!riscv_feature(env, RISCV_FEATURE_PMP); @@ -310,7 +341,6 @@ static int read_instret(CPURISCVState *env, int csrno, = target_ulong *val) return 0; } =20 -#if defined(TARGET_RISCV32) static int read_instreth(CPURISCVState *env, int csrno, target_ulong *val) { #if !defined(CONFIG_USER_ONLY) @@ -324,7 +354,6 @@ static int read_instreth(CPURISCVState *env, int csrno,= target_ulong *val) #endif return 0; } -#endif /* TARGET_RISCV32 */ =20 #if defined(CONFIG_USER_ONLY) static int read_time(CPURISCVState *env, int csrno, target_ulong *val) @@ -333,13 +362,11 @@ static int read_time(CPURISCVState *env, int csrno, t= arget_ulong *val) return 0; } =20 -#if defined(TARGET_RISCV32) static int read_timeh(CPURISCVState *env, int csrno, target_ulong *val) { *val =3D cpu_get_host_ticks() >> 32; return 0; } -#endif =20 #else /* CONFIG_USER_ONLY */ =20 @@ -355,7 +382,6 @@ static int read_time(CPURISCVState *env, int csrno, tar= get_ulong *val) return 0; } =20 -#if defined(TARGET_RISCV32) static int read_timeh(CPURISCVState *env, int csrno, target_ulong *val) { uint64_t delta =3D riscv_cpu_virt_enabled(env) ? env->htimedelta : 0; @@ -367,7 +393,6 @@ static int read_timeh(CPURISCVState *env, int csrno, ta= rget_ulong *val) *val =3D (env->rdtime_fn(env->rdtime_fn_arg) + delta) >> 32; return 0; } -#endif =20 /* Machine constants */ =20 @@ -406,19 +431,17 @@ static const target_ulong sip_writable_mask =3D SIP_S= SIP | MIP_USIP | MIP_UEIP; static const target_ulong hip_writable_mask =3D MIP_VSSIP | MIP_VSTIP | MI= P_VSEIP; static const target_ulong vsip_writable_mask =3D MIP_VSSIP; =20 -#if defined(TARGET_RISCV32) -static const char valid_vm_1_10[16] =3D { +static const char valid_vm_1_10_32[16] =3D { [VM_1_10_MBARE] =3D 1, [VM_1_10_SV32] =3D 1 }; -#elif defined(TARGET_RISCV64) -static const char valid_vm_1_10[16] =3D { + +static const char valid_vm_1_10_64[16] =3D { [VM_1_10_MBARE] =3D 1, [VM_1_10_SV39] =3D 1, [VM_1_10_SV48] =3D 1, [VM_1_10_SV57] =3D 1 }; -#endif /* CONFIG_USER_ONLY */ =20 /* Machine Information Registers */ static int read_zero(CPURISCVState *env, int csrno, target_ulong *val) @@ -441,7 +464,11 @@ static int read_mstatus(CPURISCVState *env, int csrno,= target_ulong *val) =20 static int validate_vm(CPURISCVState *env, target_ulong vm) { - return valid_vm_1_10[vm & 0xf]; + if (riscv_cpu_is_32bit(env)) { + return valid_vm_1_10_32[vm & 0xf]; + } else { + return valid_vm_1_10_64[vm & 0xf]; + } } =20 static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val) @@ -459,13 +486,14 @@ static int write_mstatus(CPURISCVState *env, int csrn= o, target_ulong val) MSTATUS_SPP | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM | MSTATUS_MPP | MSTATUS_MXR | MSTATUS_TVM | MSTATUS_TSR | MSTATUS_TW; -#if defined(TARGET_RISCV64) - /* - * RV32: MPV and GVA are not in mstatus. The current plan is to - * add them to mstatush. For now, we just don't support it. - */ - mask |=3D MSTATUS_MPV | MSTATUS_GVA; -#endif + + if (!riscv_cpu_is_32bit(env)) { + /* + * RV32: MPV and GVA are not in mstatus. The current plan is to + * add them to mstatush. For now, we just don't support it. + */ + mask |=3D MSTATUS_MPV | MSTATUS_GVA; + } =20 mstatus =3D (mstatus & ~mask) | (val & mask); =20 @@ -477,7 +505,6 @@ static int write_mstatus(CPURISCVState *env, int csrno,= target_ulong val) return 0; } =20 -#ifdef TARGET_RISCV32 static int read_mstatush(CPURISCVState *env, int csrno, target_ulong *val) { *val =3D env->mstatus >> 32; @@ -497,7 +524,6 @@ static int write_mstatush(CPURISCVState *env, int csrno= , target_ulong val) =20 return 0; } -#endif =20 static int read_misa(CPURISCVState *env, int csrno, target_ulong *val) { @@ -895,10 +921,10 @@ static int write_satp(CPURISCVState *env, int csrno, = target_ulong val) static int read_hstatus(CPURISCVState *env, int csrno, target_ulong *val) { *val =3D env->hstatus; -#ifdef TARGET_RISCV64 - /* We only support 64-bit VSXL */ - *val =3D set_field(*val, HSTATUS_VSXL, 2); -#endif + if (!riscv_cpu_is_32bit(env)) { + /* We only support 64-bit VSXL */ + *val =3D set_field(*val, HSTATUS_VSXL, 2); + } /* We only support little endian */ *val =3D set_field(*val, HSTATUS_VSBE, 0); return 0; @@ -907,11 +933,9 @@ static int read_hstatus(CPURISCVState *env, int csrno,= target_ulong *val) static int write_hstatus(CPURISCVState *env, int csrno, target_ulong val) { env->hstatus =3D val; -#ifdef TARGET_RISCV64 - if (get_field(val, HSTATUS_VSXL) !=3D 2) { + if (!riscv_cpu_is_32bit(env) && get_field(val, HSTATUS_VSXL) !=3D 2) { qemu_log_mask(LOG_UNIMP, "QEMU does not support mixed HSXLEN optio= ns."); } -#endif if (get_field(val, HSTATUS_VSBE) !=3D 0) { qemu_log_mask(LOG_UNIMP, "QEMU does not support big endian guests.= "); } @@ -1053,11 +1077,7 @@ static int read_htimedelta(CPURISCVState *env, int c= srno, target_ulong *val) return -RISCV_EXCP_ILLEGAL_INST; } =20 -#if defined(TARGET_RISCV32) - *val =3D env->htimedelta & 0xffffffff; -#else *val =3D env->htimedelta; -#endif return 0; } =20 @@ -1067,15 +1087,14 @@ static int write_htimedelta(CPURISCVState *env, int= csrno, target_ulong val) return -RISCV_EXCP_ILLEGAL_INST; } =20 -#if defined(TARGET_RISCV32) - env->htimedelta =3D deposit64(env->htimedelta, 0, 32, (uint64_t)val); -#else - env->htimedelta =3D val; -#endif + if (riscv_cpu_is_32bit(env)) { + env->htimedelta =3D deposit64(env->htimedelta, 0, 32, (uint64_t)va= l); + } else { + env->htimedelta =3D val; + } return 0; } =20 -#if defined(TARGET_RISCV32) static int read_htimedeltah(CPURISCVState *env, int csrno, target_ulong *v= al) { if (!env->rdtime_fn) { @@ -1095,7 +1114,6 @@ static int write_htimedeltah(CPURISCVState *env, int = csrno, target_ulong val) env->htimedelta =3D deposit64(env->htimedelta, 32, 32, (uint64_t)val); return 0; } -#endif =20 /* Virtual CSR Registers */ static int read_vsstatus(CPURISCVState *env, int csrno, target_ulong *val) @@ -1374,26 +1392,20 @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE]= =3D { /* User Timers and Counters */ [CSR_CYCLE] =3D { ctr, read_instret = }, [CSR_INSTRET] =3D { ctr, read_instret = }, -#if defined(TARGET_RISCV32) - [CSR_CYCLEH] =3D { ctr, read_instreth = }, - [CSR_INSTRETH] =3D { ctr, read_instreth = }, -#endif + [CSR_CYCLEH] =3D { ctr32, read_instreth = }, + [CSR_INSTRETH] =3D { ctr32, read_instreth = }, =20 /* In privileged mode, the monitor will have to emulate TIME CSRs only= if * rdtime callback is not provided by machine/platform emulation */ [CSR_TIME] =3D { ctr, read_time = }, -#if defined(TARGET_RISCV32) - [CSR_TIMEH] =3D { ctr, read_timeh = }, -#endif + [CSR_TIMEH] =3D { ctr32, read_timeh = }, =20 #if !defined(CONFIG_USER_ONLY) /* Machine Timers and Counters */ [CSR_MCYCLE] =3D { any, read_instret = }, [CSR_MINSTRET] =3D { any, read_instret = }, -#if defined(TARGET_RISCV32) - [CSR_MCYCLEH] =3D { any, read_instreth = }, - [CSR_MINSTRETH] =3D { any, read_instreth = }, -#endif + [CSR_MCYCLEH] =3D { any32, read_instreth = }, + [CSR_MINSTRETH] =3D { any32, read_instreth = }, =20 /* Machine Information Registers */ [CSR_MVENDORID] =3D { any, read_zero = }, @@ -1410,9 +1422,7 @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = =3D { [CSR_MTVEC] =3D { any, read_mtvec, write_mtvec = }, [CSR_MCOUNTEREN] =3D { any, read_mcounteren, write_mcounter= en }, =20 -#if defined(TARGET_RISCV32) - [CSR_MSTATUSH] =3D { any, read_mstatush, write_mstatush= }, -#endif + [CSR_MSTATUSH] =3D { any32, read_mstatush, write_mstatu= sh }, =20 [CSR_MSCOUNTEREN] =3D { any, read_mscounteren, write_mscounte= ren }, =20 @@ -1452,9 +1462,7 @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = =3D { [CSR_HGEIP] =3D { hmode, read_hgeip, write_hgeip= }, [CSR_HGATP] =3D { hmode, read_hgatp, write_hgatp= }, [CSR_HTIMEDELTA] =3D { hmode, read_htimedelta, write_htime= delta }, -#if defined(TARGET_RISCV32) - [CSR_HTIMEDELTAH] =3D { hmode, read_htimedeltah, write_htime= deltah}, -#endif + [CSR_HTIMEDELTAH] =3D { hmode32, read_htimedeltah, write_hti= medeltah}, =20 [CSR_VSSTATUS] =3D { hmode, read_vsstatus, write_vssta= tus }, [CSR_VSIP] =3D { hmode, NULL, NULL, rmw_vsip = }, @@ -1477,9 +1485,7 @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = =3D { [CSR_HPMCOUNTER3 ... CSR_HPMCOUNTER31] =3D { ctr, read_zero = }, [CSR_MHPMCOUNTER3 ... CSR_MHPMCOUNTER31] =3D { any, read_zero = }, [CSR_MHPMEVENT3 ... CSR_MHPMEVENT31] =3D { any, read_zero = }, -#if defined(TARGET_RISCV32) - [CSR_HPMCOUNTER3H ... CSR_HPMCOUNTER31H] =3D { ctr, read_zero = }, - [CSR_MHPMCOUNTER3H ... CSR_MHPMCOUNTER31H] =3D { any, read_zero = }, -#endif + [CSR_HPMCOUNTER3H ... CSR_HPMCOUNTER31H] =3D { ctr32, read_zero = }, + [CSR_MHPMCOUNTER3H ... CSR_MHPMCOUNTER31H] =3D { any32, read_zero = }, #endif /* !CONFIG_USER_ONLY */ }; --=20 2.29.2