From patchwork Thu Mar 28 02:23:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Chien X-Patchwork-Id: 13607920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40BB4C47DD9 for ; Thu, 28 Mar 2024 02:25:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpfQu-0005Hy-0F; Wed, 27 Mar 2024 22:24:00 -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 1rpfQs-0005HR-7h for qemu-devel@nongnu.org; Wed, 27 Mar 2024 22:23:58 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpfQq-0007lG-F5 for qemu-devel@nongnu.org; Wed, 27 Mar 2024 22:23:57 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5ce9555d42eso255195a12.2 for ; Wed, 27 Mar 2024 19:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1711592634; x=1712197434; darn=nongnu.org; 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=1nX8g46jrb1foRbjzo8kZ8avJMnnOZf3AMnjXKsGhuE=; b=WwyRwZxt6Iz4+o2/Jtcc9ray1nuk0FOJQrN2bHz5w0VCyT9VuRTztui+w7lEpT1I2J FgWuXelLTTEaCJYAki2wZRZqYneh7PFVUtrr5cxljM0daUN1o8VL+kgRN/vBV0HCi9g1 i8wjfpcDAmvFiL95AqkDML6TEnSv62ikl88VR2Dg5e21J6vTqIzCeA9DyJiHh/JKcWrL DV00PS8aghzu92wTfvM4ajcuWIG9N9ChhZuMtGGpGYhUBXBBodRc1gDI7jWTPn7gGXqW d+wLslldYc1jJw4XBWTLmFjB2Vfyj61uekOlKg5LEvgbQbMD52I/edFHDxlX4A5JwUUn cL5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711592634; x=1712197434; 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=1nX8g46jrb1foRbjzo8kZ8avJMnnOZf3AMnjXKsGhuE=; b=cRdqxDHF/I74RlkLJGYTvN0P/MAmp8qay4nhfKWZbmAIjHEVhG2GBqbgQbf1csYz1g 2lxbvgi9huuw1mKqqyBGSQQuAnVcQbY4Hs+Z2z1sAlkzll2Ci0zIQ8BBA4UwQA15IZT3 4CL/s+W+OUkwBwaYsmqlbPpq8b5ydvjG2CWR8hZ6G+Cve+9qmxr4CU4P4bz8iHLI08H9 G0x9ARWLTs+CixqPC/tY0ynDkLeoWkVfTYZ5anOLa/manJjfMMd61KEialdA9ejiZ4B6 7GWrl8uvxX2FXvVm3Hs3p0hQA3pfFHoq9r1M5uTcQKOnAAe2iz5MTS3NO3DS3IopQpah iV9Q== X-Gm-Message-State: AOJu0Yxows7M8ww8yX3y5T/krJFOFAfOTOsWGldtxNTtu4EMItPoqT9F ym6SdooxhCn7QhSVSsSspdFEezanJ4rWuoHbSVp3bK3M5ljjjJKyCwXKPTqodwoK0IeCpeDBbb9 E58I8nJZYUQ20iNPTt6JCQk6iOqPfC6FnnLZ8Js3upqqCIgCH8Q3DNyKZa7KWf3VdDn9EC0wRYm frSNvnsMQzPTIFQ/TWX6smHgOPwrMljUox7lSyJSA= X-Google-Smtp-Source: AGHT+IEBaX+X1PT+5WQDcJfE5Fj0+yECQ1efNC3Lvgzs7Elqpj6/BOoLiVfgsusK8OO7Za2zq0/B9Q== X-Received: by 2002:a05:6a20:1584:b0:1a3:bfd5:f829 with SMTP id h4-20020a056a20158400b001a3bfd5f829mr1879893pzj.58.1711592633720; Wed, 27 Mar 2024 19:23:53 -0700 (PDT) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d9-20020a170903230900b001e14807c7dfsm247424plh.86.2024.03.27.19.23.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 19:23:53 -0700 (PDT) From: Jason Chien To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Jason Chien , Frank Chang , Max Chou , Daniel Henrique Barboza , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Richard Henderson , Andrew Jones Subject: [PATCH v3 1/3] target/riscv: Add support for Zve32x extension Date: Thu, 28 Mar 2024 10:23:10 +0800 Message-ID: <20240328022343.6871-2-jason.chien@sifive.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240328022343.6871-1-jason.chien@sifive.com> References: <20240328022343.6871-1-jason.chien@sifive.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=jason.chien@sifive.com; helo=mail-pg1-x530.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add support for Zve32x extension and replace some checks for Zve32f with Zve32x, since Zve32f depends on Zve32x. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou Reviewed-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 2 ++ target/riscv/cpu_cfg.h | 1 + target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/insn_trans/trans_rvv.c.inc | 4 ++-- target/riscv/tcg/tcg-cpu.c | 16 ++++++++-------- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 36e3e5fdaf..6bd8798bb5 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -153,6 +153,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zvbb, PRIV_VERSION_1_12_0, ext_zvbb), ISA_EXT_DATA_ENTRY(zvbc, PRIV_VERSION_1_12_0, ext_zvbc), ISA_EXT_DATA_ENTRY(zve32f, PRIV_VERSION_1_10_0, ext_zve32f), + ISA_EXT_DATA_ENTRY(zve32x, PRIV_VERSION_1_10_0, ext_zve32x), ISA_EXT_DATA_ENTRY(zve64f, PRIV_VERSION_1_10_0, ext_zve64f), ISA_EXT_DATA_ENTRY(zve64d, PRIV_VERSION_1_10_0, ext_zve64d), ISA_EXT_DATA_ENTRY(zvfbfmin, PRIV_VERSION_1_12_0, ext_zvfbfmin), @@ -1472,6 +1473,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = { MULTI_EXT_CFG_BOOL("zfh", ext_zfh, false), MULTI_EXT_CFG_BOOL("zfhmin", ext_zfhmin, false), MULTI_EXT_CFG_BOOL("zve32f", ext_zve32f, false), + MULTI_EXT_CFG_BOOL("zve32x", ext_zve32x, false), MULTI_EXT_CFG_BOOL("zve64f", ext_zve64f, false), MULTI_EXT_CFG_BOOL("zve64d", ext_zve64d, false), MULTI_EXT_CFG_BOOL("zvfbfmin", ext_zvfbfmin, false), diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index cb750154bd..dce49050c0 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -91,6 +91,7 @@ struct RISCVCPUConfig { bool ext_zhinx; bool ext_zhinxmin; bool ext_zve32f; + bool ext_zve32x; bool ext_zve64f; bool ext_zve64d; bool ext_zvbb; diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index fc090d729a..b13a50a665 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -72,7 +72,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc, *pc = env->xl == MXL_RV32 ? env->pc & UINT32_MAX : env->pc; *cs_base = 0; - if (cpu->cfg.ext_zve32f) { + if (cpu->cfg.ext_zve32x) { /* * If env->vl equals to VLMAX, we can use generic vector operation * expanders (GVEC) to accerlate the vector operations. diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 726096444f..d96feea5d3 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -93,7 +93,7 @@ static RISCVException fs(CPURISCVState *env, int csrno) static RISCVException vs(CPURISCVState *env, int csrno) { - if (riscv_cpu_cfg(env)->ext_zve32f) { + if (riscv_cpu_cfg(env)->ext_zve32x) { #if !defined(CONFIG_USER_ONLY) if (!env->debugger && !riscv_cpu_vector_enabled(env)) { return RISCV_EXCP_ILLEGAL_INST; diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc index 7d84e7d812..eec2939e23 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -149,7 +149,7 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) { TCGv s1, dst; - if (!require_rvv(s) || !s->cfg_ptr->ext_zve32f) { + if (!require_rvv(s) || !s->cfg_ptr->ext_zve32x) { return false; } @@ -179,7 +179,7 @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) { TCGv dst; - if (!require_rvv(s) || !s->cfg_ptr->ext_zve32f) { + if (!require_rvv(s) || !s->cfg_ptr->ext_zve32x) { return false; } diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index b5b95e052d..ff0d485e7f 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -511,9 +511,13 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) return; } - if (cpu->cfg.ext_zve32f && !riscv_has_ext(env, RVF)) { - error_setg(errp, "Zve32f/Zve64f extensions require F extension"); - return; + /* The Zve32f extension depends on the Zve32x extension */ + if (cpu->cfg.ext_zve32f) { + if (!riscv_has_ext(env, RVF)) { + error_setg(errp, "Zve32f/Zve64f extensions require F extension"); + return; + } + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32x), true); } if (cpu->cfg.ext_zvfh) { @@ -658,13 +662,9 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbc), true); } - /* - * In principle Zve*x would also suffice here, were they supported - * in qemu - */ if ((cpu->cfg.ext_zvbb || cpu->cfg.ext_zvkb || cpu->cfg.ext_zvkg || cpu->cfg.ext_zvkned || cpu->cfg.ext_zvknha || cpu->cfg.ext_zvksed || - cpu->cfg.ext_zvksh) && !cpu->cfg.ext_zve32f) { + cpu->cfg.ext_zvksh) && !cpu->cfg.ext_zve32x) { error_setg(errp, "Vector crypto extensions require V or Zve* extensions"); return; From patchwork Thu Mar 28 02:23:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Chien X-Patchwork-Id: 13607918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D46BCD1280 for ; Thu, 28 Mar 2024 02:25:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpfQy-0005J6-K2; Wed, 27 Mar 2024 22:24:04 -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 1rpfQw-0005IO-OM for qemu-devel@nongnu.org; Wed, 27 Mar 2024 22:24:02 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpfQu-0007ln-WF for qemu-devel@nongnu.org; Wed, 27 Mar 2024 22:24:02 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1e0f3052145so4944035ad.2 for ; Wed, 27 Mar 2024 19:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1711592639; x=1712197439; darn=nongnu.org; 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=tF2OlAR3EBMx1Df6LSEev281Y2uuwVlXzu3oKih88BI=; b=Vmby8dicAfgbKIWhP390pdRLDA5rNc6Zo+zyxn/D3CaRf9h1846zxsTJHMnMKUJ3JQ rptslCysH1eij9sXHsCq5EW5zWEUFaiBhQpxByYGSNbGffmR35l/MI/tcf5bh64s2fng rZfA5sJxBWAn0sLGS2MLzfGyPzPgwlzlsOtZ/0dyQMuXU8dfogj85KuRYC5CV97EMJ12 tGWHqMQwO5UOsDE1MjEDMbu6m7WqWtCzmEH/+6SslWSH5WePDVRWX7z8fRFxieZSFoX5 e1ZqAWEARIDxBm+fkNiset1IgThj3TdJjTrZC9sHAy8VLMmQZ00708AIq2F1HeCAzqP1 mTOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711592639; x=1712197439; 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=tF2OlAR3EBMx1Df6LSEev281Y2uuwVlXzu3oKih88BI=; b=hyLP6JkdbggUSKCOOrnkdTuXn+4tkQBJbFgra5Q3RXbdM3LCdAdJVuHpvCBqhpKVjR 7uJW0HSfvk2PpBc+Cfy8jo1hNuWSa8Q4vzTEYP3G3Lv805kDq9aSiq0o6dQOhpRy1eyB w0gqeiZ2aAs8AEVG+WHc2Ph0sK1hFiaSQ4sXIas6aisQ4gg4g1//OpHWopKA9JH5OB5P I53eMu5aFwGH0dOHvM3HUIFGBse78kLiJDjkB0hOtcAgFu2i1Y1sAXRZ/n9v3Dhodjsd UM6LKQfREteXCpAUg8OphQeS8LPPSSXkmEsQr3qfQbMojKBq536LJt/85f9umV2geBNg s33g== X-Gm-Message-State: AOJu0YyVIv6sloaVvKIbL9JSvYndbyM9L1Zb106kBEd2e3AFOr6wHnxt 4yXUD1hYu/Dsw53NNtPDua3Na+6TiPS6J8SLfwMEietxqaV/Cy6FeuH2U+RGZmgGZyM80PkxWu3 e8ICPodiSy96RRHfCHoHq5dZM6EhM0+N1HRSgGUF1iiy2hIPEtA1GasS3wbZGKHwn2zxukjR9ya bI0dZbTPMwfEUvwZL1CDNxA9FebfeICVD5vtgrZOw= X-Google-Smtp-Source: AGHT+IGDdy2ggZTqskIbJ8nYyIIk8X2IXPA2mlJaibfkLs6Dfp54Xb6oEoy1mfVN2L7Dx/s/tudICw== X-Received: by 2002:a17:902:a3c4:b0:1dd:651d:cc47 with SMTP id q4-20020a170902a3c400b001dd651dcc47mr1298164plb.28.1711592638492; Wed, 27 Mar 2024 19:23:58 -0700 (PDT) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d9-20020a170903230900b001e14807c7dfsm247424plh.86.2024.03.27.19.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 19:23:58 -0700 (PDT) From: Jason Chien To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Jason Chien , Frank Chang , Max Chou , Daniel Henrique Barboza , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Andrew Jones Subject: [PATCH v3 2/3] target/riscv: Add support for Zve64x extension Date: Thu, 28 Mar 2024 10:23:11 +0800 Message-ID: <20240328022343.6871-3-jason.chien@sifive.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240328022343.6871-1-jason.chien@sifive.com> References: <20240328022343.6871-1-jason.chien@sifive.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=jason.chien@sifive.com; helo=mail-pl1-x631.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add support for Zve64x extension. Enabling Zve64f enables Zve64x and enabling Zve64x enables Zve32x according to their dependency. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2107 Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou Reviewed-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 2 ++ target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 17 +++++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 6bd8798bb5..18e1ae66f4 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -156,6 +156,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zve32x, PRIV_VERSION_1_10_0, ext_zve32x), ISA_EXT_DATA_ENTRY(zve64f, PRIV_VERSION_1_10_0, ext_zve64f), ISA_EXT_DATA_ENTRY(zve64d, PRIV_VERSION_1_10_0, ext_zve64d), + ISA_EXT_DATA_ENTRY(zve64x, PRIV_VERSION_1_10_0, ext_zve64x), ISA_EXT_DATA_ENTRY(zvfbfmin, PRIV_VERSION_1_12_0, ext_zvfbfmin), ISA_EXT_DATA_ENTRY(zvfbfwma, PRIV_VERSION_1_12_0, ext_zvfbfwma), ISA_EXT_DATA_ENTRY(zvfh, PRIV_VERSION_1_12_0, ext_zvfh), @@ -1476,6 +1477,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = { MULTI_EXT_CFG_BOOL("zve32x", ext_zve32x, false), MULTI_EXT_CFG_BOOL("zve64f", ext_zve64f, false), MULTI_EXT_CFG_BOOL("zve64d", ext_zve64d, false), + MULTI_EXT_CFG_BOOL("zve64x", ext_zve64x, false), MULTI_EXT_CFG_BOOL("zvfbfmin", ext_zvfbfmin, false), MULTI_EXT_CFG_BOOL("zvfbfwma", ext_zvfbfwma, false), MULTI_EXT_CFG_BOOL("zvfh", ext_zvfh, false), diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index dce49050c0..e1e4f32698 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -94,6 +94,7 @@ struct RISCVCPUConfig { bool ext_zve32x; bool ext_zve64f; bool ext_zve64d; + bool ext_zve64x; bool ext_zvbb; bool ext_zvbc; bool ext_zvkb; diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index ff0d485e7f..4ebebebe09 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -498,17 +498,22 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) /* The Zve64d extension depends on the Zve64f extension */ if (cpu->cfg.ext_zve64d) { + if (!riscv_has_ext(env, RVD)) { + error_setg(errp, "Zve64d/V extensions require D extension"); + return; + } cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64f), true); } - /* The Zve64f extension depends on the Zve32f extension */ + /* The Zve64f extension depends on the Zve64x and Zve32f extensions */ if (cpu->cfg.ext_zve64f) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64x), true); cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32f), true); } - if (cpu->cfg.ext_zve64d && !riscv_has_ext(env, RVD)) { - error_setg(errp, "Zve64d/V extensions require D extension"); - return; + /* The Zve64x extension depends on the Zve32x extension */ + if (cpu->cfg.ext_zve64x) { + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32x), true); } /* The Zve32f extension depends on the Zve32x extension */ @@ -670,10 +675,10 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) return; } - if ((cpu->cfg.ext_zvbc || cpu->cfg.ext_zvknhb) && !cpu->cfg.ext_zve64f) { + if ((cpu->cfg.ext_zvbc || cpu->cfg.ext_zvknhb) && !cpu->cfg.ext_zve64x) { error_setg( errp, - "Zvbc and Zvknhb extensions require V or Zve64{f,d} extensions"); + "Zvbc and Zvknhb extensions require V or Zve64x extensions"); return; } From patchwork Thu Mar 28 02:23:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Chien X-Patchwork-Id: 13607919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D3C5CD11DF for ; Thu, 28 Mar 2024 02:25:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpfR2-0005Jm-GL; Wed, 27 Mar 2024 22:24:08 -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 1rpfR0-0005JH-Rz for qemu-devel@nongnu.org; Wed, 27 Mar 2024 22:24:06 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpfQz-0007mI-EB for qemu-devel@nongnu.org; Wed, 27 Mar 2024 22:24:06 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1e0000cdf99so4566885ad.0 for ; Wed, 27 Mar 2024 19:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1711592643; x=1712197443; darn=nongnu.org; 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=q026NYb4ZHzOUxF7VvpJFc4wjD5B0PSeAlVXt5PkoW8=; b=Fx1dknnM47cKt2mAGyUrkyZ3eSUoBmCokd4k1xXvcO1uBPleOFfbKgOKKc3KhFO5Nx DLnaELz+NE7Aje1HDQ9Xmd0QxwDZh7ON9kyC6sUjtD9YDHzCG/WnHV2E30EZ5XAdmxU7 vfmdXf6cLGP650xnr1wVg0v/V6Z7FAmuDaSsOB6NS1POejU+nCtKJ6i9Vl7mHTRH1pvb 8/Jsep7qUaHGMKkskOeSLZx5wkDT2Int5v5bJG9fHQSXNl0mdnOBwWvqWNPGeULPW44Z +wfICCo9E/NA/uN8sdrDsNJxlTmdMBtpRjEPMzHPNi3yZJtCrDVCzFIRrGCxI54ZPrL/ 0DuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711592643; x=1712197443; 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=q026NYb4ZHzOUxF7VvpJFc4wjD5B0PSeAlVXt5PkoW8=; b=eOFlSr2sjFkmdCuIYZxDILfHjAB2SbC9K472pCg6D2kWchnpf6r0kf70I+xaKnaZ8U 2gy9Jm8LDSNr+mUkvg0lFJk18C4EjH6BLHUvfK/mvX5B4bfdjdR3u8fibaxeTnEoMsxb Dv34d9A1Y42nfi+/g2LAesOP8IdR60nYXep3tTsDOiCzo2YVhWsKbs8Db6ABXWuEeLeK TiVukETMOnF8dLWag4mDT7thtKfMz/x0jxkqnVywzHXY1bcSJAZO1STmuM3rm236gss/ UtnGOfaszzVX2iFaZIz26JaI6PCw7yGlslNCdHoY+AGtvr0U9rkDeARN9NmmP4hm45RN sYUQ== X-Gm-Message-State: AOJu0YyjFII7JO4nMsMVdJ+cVhySkN8aPOk9EJBRXTWX15TSoAo0wXcc DGuaMH70FKafRfhy6uL1s4B5wcKoYsGoGApjsKee48QApOvjch/UUquQ0X6zUAAiPq5/CaA8bwL yyJprXrUNhuVGoPj4HyG3MgLYLcHxh8Nu+n1jnEXBclDVbYUfjv0BsAn4ioD2TA0a6BY4L/xkMT 93wdhwrfJ1dti/NYE2rkfeIcTLaMne014x/zS5mqY= X-Google-Smtp-Source: AGHT+IHj8OlxxfGYdC6cUr2aDqK3ew7acXUi8nJv0CqnERCoD1llD0xQ0f5UN7SyiiWVBAn6y2I0ng== X-Received: by 2002:a17:902:ec8d:b0:1e0:c224:abea with SMTP id x13-20020a170902ec8d00b001e0c224abeamr1630801plg.43.1711592642801; Wed, 27 Mar 2024 19:24:02 -0700 (PDT) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d9-20020a170903230900b001e14807c7dfsm247424plh.86.2024.03.27.19.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 19:24:02 -0700 (PDT) From: Jason Chien To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Jason Chien , Frank Chang , Max Chou , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PATCH v3 3/3] target/riscv: Relax vector register check in RISCV gdbstub Date: Thu, 28 Mar 2024 10:23:12 +0800 Message-ID: <20240328022343.6871-4-jason.chien@sifive.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240328022343.6871-1-jason.chien@sifive.com> References: <20240328022343.6871-1-jason.chien@sifive.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=jason.chien@sifive.com; helo=mail-pl1-x62c.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In current implementation, the gdbstub allows reading vector registers only if V extension is supported. However, all vector extensions and vector crypto extensions have the vector registers and they all depend on Zve32x. The gdbstub should check for Zve32x instead. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index be7a02cd90..d0cc5762c2 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -338,7 +338,7 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) gdb_find_static_feature("riscv-32bit-fpu.xml"), 0); } - if (env->misa_ext & RVV) { + if (cpu->cfg.ext_zve32x) { gdb_register_coprocessor(cs, riscv_gdb_get_vector, riscv_gdb_set_vector, ricsv_gen_dynamic_vector_feature(cs, cs->gdb_num_regs),