From nobody Tue Feb 10 02:55:35 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 16381553353421004.6931348699725; Sun, 28 Nov 2021 19:08:55 -0800 (PST) Received: from localhost ([::1]:59118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrX2D-0001Mh-Vj for importer@patchew.org; Sun, 28 Nov 2021 22:08:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrWyB-0000pM-SG for qemu-devel@nongnu.org; Sun, 28 Nov 2021 22:04:44 -0500 Received: from [2607:f8b0:4864:20::1030] (port=33465 helo=mail-pj1-x1030.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mrWxy-0008Re-Si for qemu-devel@nongnu.org; Sun, 28 Nov 2021 22:04:36 -0500 Received: by mail-pj1-x1030.google.com with SMTP id w33-20020a17090a6ba400b001a722a06212so10846434pjj.0 for ; Sun, 28 Nov 2021 19:04:30 -0800 (PST) Received: from frankchang-ThinkPad-T490.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id oj11sm17904040pjb.46.2021.11.28.19.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Nov 2021 19:04:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HbSDlUb46Zy7F0MfwTJOq6CpMFSbzyMialZNGzKfRZA=; b=IA/Ak0bEBmMP9YoXWPAj5sHaOr6nuS9idqhXwYLCoFPPtDjA7DBTzV2rrEDy5kK7xu 4WoanpCDHIw7/JasTbQEt8QqvLJ5p/8vavuR1v35qxhsVL4uhtrGh14DPYtbCXXqPE/I 6kGjyD9mC3DHaRIca+RgQE+OsMcSJ+wMwszfx1ZlU2mn/X6Y20YwI40CnnWpinRKXHxG 6dYLtAW+bLfsyHwoAWa9vjX1Kl/X3PtGqKwj5p09uJfSGB1si0FBB8birXEf5hKATRzo OHuwxNi8ScR90pvNyY2yEB0/SuQmxSrbgz8d8iigE/aFQcTZS5R4T5FBt9ycZPei6EXI cn4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HbSDlUb46Zy7F0MfwTJOq6CpMFSbzyMialZNGzKfRZA=; b=js0O9UbwkTbVrXqF2CFZhqRIUwzF+jg2tSVhArjnfXxDFjfc+fA2TFpADxteYPUdXQ 7qabRR169LD+zgy7CZlk+ctpOUVpqKD+hufAIxWQSvAH/0Do7UrFGYqsh30ROxZkwt1q 2jE6Gk+wQmeUJhIqdqUGnO18m/AtDW9wcaQrwIZZxz80PRx7GSxHfCpfOstOerfW1ByA KyOtig7tw4ZJWv1l2N997QHkzCovZMD+7NPT8mO3UtgRCfJLyvUxaFypWb2wlzUGqjPq gdOajZH79SIWpencojCqWWWe+khZUx5/t8nSJphEApY7k0Qg3RNPhDf8vcPJjZz1mzxb z89g== X-Gm-Message-State: AOAM533iS0KMEGel/rR9LXVmxfX8VrsY83AQftV50XC8OYtnwDfFccbC 9elEGzRDhW2MiJAfYB0c+6WF4OacrYuPbQph X-Google-Smtp-Source: ABdhPJyYwzVPIK7JZxjdR5qSnpQbj+fiITk3o+YqpYOQMxHitWRzLveqpvYFuNrY7AaksVSMOn+kjQ== X-Received: by 2002:a17:90b:3b48:: with SMTP id ot8mr35866405pjb.78.1638155069079; Sun, 28 Nov 2021 19:04:29 -0800 (PST) From: frank.chang@sifive.com To: qemu-devel@nongnu.org Subject: [PATCH v10 10/77] target/riscv: rvv-1.0: add vlenb register Date: Mon, 29 Nov 2021 11:02:30 +0800 Message-Id: <20211129030340.429689-11-frank.chang@sifive.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211129030340.429689-1-frank.chang@sifive.com> References: <20211129030340.429689-1-frank.chang@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1030 (failed) 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::1030; envelope-from=frank.chang@sifive.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, 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: , Cc: qemu-riscv@nongnu.org, Frank Chang , Bin Meng , Richard Henderson , Alistair Francis , Greentime Hu , Palmer Dabbelt Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638155336519100001 Content-Type: text/plain; charset="utf-8" From: Greentime Hu Signed-off-by: Greentime Hu Signed-off-by: Frank Chang Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis --- target/riscv/cpu_bits.h | 1 + target/riscv/csr.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 8dc6aa62c64..1e31f4d35f5 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -63,6 +63,7 @@ #define CSR_VCSR 0x00f #define CSR_VL 0xc20 #define CSR_VTYPE 0xc21 +#define CSR_VLENB 0xc22 =20 /* VCSR fields */ #define VCSR_VXSAT_SHIFT 0 diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 832ccdcf331..5d1eec1ea05 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -285,6 +285,12 @@ static RISCVException read_vl(CPURISCVState *env, int = csrno, return RISCV_EXCP_NONE; } =20 +static int read_vlenb(CPURISCVState *env, int csrno, target_ulong *val) +{ + *val =3D env_archcpu(env)->cfg.vlen >> 3; + return RISCV_EXCP_NONE; +} + static RISCVException read_vxrm(CPURISCVState *env, int csrno, target_ulong *val) { @@ -1835,6 +1841,7 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] =3D { [CSR_VCSR] =3D { "vcsr", vs, read_vcsr, write_vcsr }, [CSR_VL] =3D { "vl", vs, read_vl }, [CSR_VTYPE] =3D { "vtype", vs, read_vtype }, + [CSR_VLENB] =3D { "vlenb", vs, read_vlenb }, /* User Timers and Counters */ [CSR_CYCLE] =3D { "cycle", ctr, read_instret }, [CSR_INSTRET] =3D { "instret", ctr, read_instret }, --=20 2.25.1