From patchwork Wed Dec 18 11:40:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913527 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 50B4FE77188 for ; Wed, 18 Dec 2024 11:41:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQB-0007XH-E4; Wed, 18 Dec 2024 06:40:56 -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 1tNsQ8-0007WW-Vm for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:40:53 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQ5-0007u3-Ld for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:40:52 -0500 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-21644e6140cso59736825ad.1 for ; Wed, 18 Dec 2024 03:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522046; x=1735126846; 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=k7nDbsNP0P9IVUZA2PPfFuTOFOME244LSx7bFTFtjMM=; b=fBhBjQYzNq2nhiJbthBwY8wDhttwH68aBV69Hq0QYZN45pCCX4EK9BLu+oq0cOXoGg bIiEx7sruZDWEMciLPMldR8s5XTtZnq0MizcMGGAIaDxOpfQXy74rsme4kjLPs5cBT3X ty9+mmheQzNsdnyTpKyPAUDzPL9iFbcSIrTs3pahGvzDp8P2WxhpdOPYeM0omol5Cw7E w8ONaWNSLn232PDi83cVT+cQToA3WaazcnXzrcnLnRcMtojFcDy5TXfJ5X5mWy+6YNRY 8sGMDWfXD8+UrEIdL8T2gmxCYa8ElHG8inYWj0ftlTXpkvDuVzSert33sAF6wtaRwoEP rb7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522046; x=1735126846; 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=k7nDbsNP0P9IVUZA2PPfFuTOFOME244LSx7bFTFtjMM=; b=X/JK74kJ5v2tdS8SB0Q0+/NmI6mbl/rjGUlWR7SwRrlTUSKsc7ZeQ9YN7HXreePeq8 JDKiiioq0qEbALClhEpv1npqj4zCJs5jBBRqMNIxQDjuo7qLmD+9Gq7nG2i68QXgJzek Ni6rNsFnVp20/j+tZRhbtoGMXxvU5s6Ql2Ro+OBmksg4yl+eYb85lG0EBmD8GVwNKnS/ O9c3n8MsfoiQSsu+wKgmk+0Zio0Q6P6bkm8H2REIUH0XE9TrivV10VPBcpPXl/hjKcnY 9lCAkCz6VmGfPOG1NnmxW8dpXAEOD2v20w/NHJhd+tnSzPB6r5A0ZFq04n9cB2K1uDYk vJzQ== X-Gm-Message-State: AOJu0YxX159v29JwMYSSvJ9fshAAzRmK0sMssANYkN7BbQgoJBsnX2SS PvfhuvJp6CJeDQAod1R+CFlUyvp442YAR2W2UrZqYWekB2a5Pi8sVIiOkV/54OYGnGDgqo++S8n BKYQ= X-Gm-Gg: ASbGncvQlLLwJiWNl0cYc3i53y/eiIRwZl4j0CN4czaQL4reCpO4jdp7OBxljhjhRFo aX5XWolid5IBU0K1tyeF6TDK8qepo6vTEh1akR2JM+rvZspZ4yjNifCjAMBCtVlW/LmkYbysHO+ NHtdP1LLnXKmWLneUS437T0XTvezck4Hie75oNzKPqQoTpMCGSnsUCPCT1QUFY8hllXALJiLaU1 CMCL93yIoz931LMp8M26OHA2WqE3RR7GLYwyD3gTJpO5qsjs3GVEqtTWp8G33emNZOPO78Vra8e 1w== X-Google-Smtp-Source: AGHT+IGlsTxBD11Yn/dOlXZOoT2TRNVVLitkx+BKIoe04tewVnlOIUsjD5pEhf1cb1KO2V3agTkGSQ== X-Received: by 2002:a17:902:eccf:b0:216:591a:8544 with SMTP id d9443c01a7336-218d7230503mr33690345ad.34.1734522046233; Wed, 18 Dec 2024 03:40:46 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:40:45 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 1/9] target/riscv/tcg: hide warn for named feats when disabling via priv_ver Date: Wed, 18 Dec 2024 08:40:18 -0300 Message-ID: <20241218114026.1652352-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x633.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=ham 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 Commit 68c9e54bea handled a situation where a warning was being shown when using the 'sifive_e' cpu when disabling the named extension zic64b. It makes little sense to show user warnings for named extensions that users can't control, and the solution taken was to disable zic64b manually in riscv_cpu_update_named_features(). This solution won't scale well when adding more named features, and can eventually end up repeating riscv_cpu_disable_priv_spec_isa_exts(). Change riscv_cpu_disable_priv_spec_isa_exts() to not show warnings when disabling a named feature. This will accomplish the same thing we're doing today while avoiding having two points where we're disabling exts via priv_ver mismatch. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/tcg/tcg-cpu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 3b99c8c9e3..48a55ba1d8 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -304,6 +304,15 @@ static void riscv_cpu_disable_priv_spec_isa_exts(RISCVCPU *cpu) } isa_ext_update_enabled(cpu, edata->ext_enable_offset, false); + + /* + * Do not show user warnings for named features that users + * can't enable/disable in the command line. See commit + * 68c9e54bea for more info. + */ + if (cpu_cfg_offset_is_named_feat(edata->ext_enable_offset)) { + continue; + } #ifndef CONFIG_USER_ONLY warn_report("disabling %s extension for hart 0x" TARGET_FMT_lx " because privilege spec version does not match", @@ -331,11 +340,9 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu) cpu->cfg.has_priv_1_13 = true; } - /* zic64b is 1.12 or later */ cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 && cpu->cfg.cbop_blocksize == 64 && - cpu->cfg.cboz_blocksize == 64 && - cpu->cfg.has_priv_1_12; + cpu->cfg.cboz_blocksize == 64; } static void riscv_cpu_validate_g(RISCVCPU *cpu) From patchwork Wed Dec 18 11:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913535 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 82FFDE77187 for ; Wed, 18 Dec 2024 11:43:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQE-0007Yk-Pz; Wed, 18 Dec 2024 06:40:58 -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 1tNsQD-0007Y5-Ba for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:40:57 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQ8-0007uI-Og for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:40:57 -0500 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2167141dfa1so5971535ad.1 for ; Wed, 18 Dec 2024 03:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522049; x=1735126849; 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=zabmXRbNE9RUxJY0tWbP7vXaB9YVIkHS3ox3ss6uxK0=; b=KU3aaIeetbzCmxG+99ePeYvfPtAvsWKBs3SmIHq4J7Yykv1NsgTua69jFDGUL0Oxe0 vBbuHqJMqFFFTveKcZIIfKG1bVY28RNBvOnIA3kGQAi5UO3weIhsVi1Ob/gz9/lN9RnE Apotb66S1M9JigP7X3kpF02qFTcXrAupqCEeYLphOrOAgVKMhps16CaMws6OGzt5CHoK sqafFGgq9LwE6/VMr1i89+xTSHzyAsGPule4M1AUHRQppxeROOttaqoclgXZP++Lvz/z mOLjsFJ3cWSvvUveIgjXQkmS7IFBiaYZS5zV/eKnPdInjxIEaY2yUQb+SI7pqFMAUH/6 unCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522049; x=1735126849; 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=zabmXRbNE9RUxJY0tWbP7vXaB9YVIkHS3ox3ss6uxK0=; b=VnIBtzbQCcB/wbNj5Ez9xG+KZ6Raylv7URVRtXx8C1BP+snS1xceui6ajKvBTRnRt2 FiaV56wfJnbIkXHuFi34/6/VTK0lk5DuXKbR9kWNPFXuwTT2mufkNHeTP6qSh3d/7aL4 WqMoghFfSDX4Et650LSy0T2YUnr2To91PumWAxXSmeeN+CgmI9T0fOdgvQ9bGjCv6AQ6 f5uTTtD+DC7m0tnenprw+KaZE57ESHTQF9ZWCmMOxPXUaoIyntqHGDmfAiCxoICc0fTL Y8N69P4wxHVxR4Kx1eyT9XHXNlCPTdUIpXeEt27F2dAtI8gL8MF8iSklWVGbmmF9QrWP w8sQ== X-Gm-Message-State: AOJu0Yx0xARXFq+ubXNIksRUjzZBd+TZ/ZEQwxN+tUNOOuesor1Fn1+I 3c5q/C7erJ9raFYjaABUqyxt+BDd+j6elcBHhlRYgqsUMC4SvUBOrBTXyxiaanDAxQD/qYryypU cDLU= X-Gm-Gg: ASbGncvpD/WNk6w/AyZHxI1QYFCjJ41jt5/EG2bbojPIC9ZdTpskzE88zWBiULdgstl WiWfp/Iz8tZNkFG/aJVI42CMRdIwLOJIadCQllQe9A9oXL9Kg2w6nuAi2jQUivBX8cVOuDn1q11 qKsgrQ8zokKm8yt3Di4w/Vs/VJIGWRzNfuV5FmSzRXYlr6+Ie8/MZC8cRycZwGYUk8xZf66KNao 1I3WTudra8iH9pnuOugTi9OsZczRm/iaoUZGH9LWQ6Q1TvmtEMc+u9WI0liFbwCNvZ5MpAg6ZoT Qw== X-Google-Smtp-Source: AGHT+IEvKc2Pu7GxTK2wRq/08pjC4bE/1WhobFYaKuzNtdsYeGHz73UzLzLpNEeP+5eDxknPu3Lm4g== X-Received: by 2002:a17:902:da8b:b0:215:a2f4:d4ab with SMTP id d9443c01a7336-218d72917c0mr34742655ad.7.1734522049238; Wed, 18 Dec 2024 03:40:49 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:40:48 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza , Andrew Jones Subject: [PATCH v2 2/9] target/riscv: add ssstateen Date: Wed, 18 Dec 2024 08:40:19 -0300 Message-ID: <20241218114026.1652352-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x636.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, T_SPF_TEMPERROR=0.01 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 ssstateen is defined in RVA22 as: "Supervisor-mode view of the state-enable extension. The supervisor-mode (sstateen0-3) and hypervisor-mode (hstateen0-3) state-enable registers must be provided." Add ssstateen as a named feature that is available if we also have smstateen. Signed-off-by: Daniel Henrique Barboza Acked-by: Alistair Francis Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 2 ++ target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f2db449c2d..58bb5196a8 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -191,6 +191,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(ssccptr, PRIV_VERSION_1_11_0, has_priv_1_11), ISA_EXT_DATA_ENTRY(sscofpmf, PRIV_VERSION_1_12_0, ext_sscofpmf), ISA_EXT_DATA_ENTRY(sscounterenw, PRIV_VERSION_1_12_0, has_priv_1_12), + ISA_EXT_DATA_ENTRY(ssstateen, PRIV_VERSION_1_12_0, ext_ssstateen), ISA_EXT_DATA_ENTRY(sstc, PRIV_VERSION_1_12_0, ext_sstc), ISA_EXT_DATA_ENTRY(sstvala, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(sstvecd, PRIV_VERSION_1_12_0, has_priv_1_12), @@ -1705,6 +1706,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = { */ const RISCVCPUMultiExtConfig riscv_cpu_named_features[] = { MULTI_EXT_CFG_BOOL("zic64b", ext_zic64b, true), + MULTI_EXT_CFG_BOOL("ssstateen", ext_ssstateen, true), DEFINE_PROP_END_OF_LIST(), }; diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index d8771ca641..a1457ab4f4 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -140,6 +140,7 @@ struct RISCVCPUConfig { /* Named features */ bool ext_svade; bool ext_zic64b; + bool ext_ssstateen; /* * Always 'true' booleans for named features diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 48a55ba1d8..cbf2cf1963 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -204,10 +204,15 @@ static void riscv_cpu_enable_named_feat(RISCVCPU *cpu, uint32_t feat_offset) * All other named features are already enabled * in riscv_tcg_cpu_instance_init(). */ - if (feat_offset == CPU_CFG_OFFSET(ext_zic64b)) { + switch (feat_offset) { + case CPU_CFG_OFFSET(ext_zic64b): cpu->cfg.cbom_blocksize = 64; cpu->cfg.cbop_blocksize = 64; cpu->cfg.cboz_blocksize = 64; + break; + case CPU_CFG_OFFSET(ext_ssstateen): + cpu->cfg.ext_smstateen = true; + break; } } @@ -343,6 +348,8 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu) cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 && cpu->cfg.cbop_blocksize == 64 && cpu->cfg.cboz_blocksize == 64; + + cpu->cfg.ext_ssstateen = cpu->cfg.ext_smstateen; } static void riscv_cpu_validate_g(RISCVCPU *cpu) From patchwork Wed Dec 18 11:40:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913531 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 ED00BE77187 for ; Wed, 18 Dec 2024 11:42:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQO-0007aQ-T5; Wed, 18 Dec 2024 06:41:12 -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 1tNsQH-0007ZF-2f for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:02 -0500 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 1tNsQA-0007um-7x for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:00 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2167141dfa1so5972085ad.1 for ; Wed, 18 Dec 2024 03:40:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522052; x=1735126852; 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=+Ul9OmMmNncJxsT3etvbDtuzsNQUV/Abcq80OE4i3YE=; b=E413wdg5MdnAvpYvu4HidieaDaKX4MVVl/SnJTCSshDw6zDvMevp1UH53CCvryWEgP +mKuvFrNiCD5Dlw2OohFySQ36fEnww/ebDHGfgWIzqZgMtxp+2QA665vh2nkqTNz2Izu dgV1vzOWTHzpkVFs3lshNbJUQY6oXGLZFPqumCfxBpVcNpioRteyC29J3XXlWLXNyrps SPhngIZ183vzTMHT8blOGTRGEfiNaFjVRpXeeU9NC7tlwQJ15CEVwBg4Syf9zUagpa0U p3YC/OXoXcsH+p+KvhM5tCBDQnx/mZ+CaOnx89xdPSb+/f9nzuOuKnFwBXH+EJMxyVBZ 6Edg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522052; x=1735126852; 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=+Ul9OmMmNncJxsT3etvbDtuzsNQUV/Abcq80OE4i3YE=; b=RD1CRouV93DwBn3pGs9i8KtCa5uoAgFtb8cCDiDglKvBcyLmSHTr5TYeinWaW3tGYo FeIlHg1W5FikPP3nU6qBqssexk6E3bkN9Mcc9eX6WgwEDTEQzt/1Pwj0d5WzAj89pW0i +ZwV/d05WNgKLAFNxZocvGqxl/xuhelm+Lk9byjRky/GTT2aGzMCZXF6nvJHkbhsln64 LiOlxoVYi7bStZT+R4lOHbimtCW9EMDu3bjU3QdYrG4NuPxmFmXFOLeBtoBlkOuG9Cvi C0NMcBPvfKHX7R2hObHYsuANYMeIwqy61qxGfx4wOPhYz0kU9wxWFxyNSKFgun/7SImf iUOQ== X-Gm-Message-State: AOJu0YwlqmJ8uoVZCtVyV8/jJqupPW9p/sr0EkUqbDvr/P1DMRv/CN1W tZNRGt2ACh/V/4lIgdjAu1tmsV8cNdrDy4NtWspVWmvF5VIRP5lBoaVvM1NnOuARB1k06g0AQbE E4ds= X-Gm-Gg: ASbGncs68Jd4xkhKHOqSzo++1rlCcC8E/3kVYYsjjIq3x6m7nHktU+6TAlISb9gI6WT PN+GwTas9c3DU+/pMsPTfoYMo9iZYd8AGG77WhL2brS6NrX3mXKr7XtTcIkgeK3yGK/eacxyn7q xX5e5lb6tTcsn/iLAeaLagbG9I86w+Zf+VJzCh4gDOxq3XVdQTWwY3NiXrmRtWlci6UK/j+hFQs rCF/m+1TBdpa4kko4yI8Rxtwc+Ci3VLOgS5OPGCXQou5olzssOqGegBerHM6KTrr8elt1+BSrd2 4w== X-Google-Smtp-Source: AGHT+IGVuyeyLF/ffMo9xj5H7d7cZNiu3A7t7rKsg5LWgAHz6Z9r4NxNnNTLJRBQU6HZ7Sx5u6kNHg== X-Received: by 2002:a17:903:8c6:b0:215:3998:189f with SMTP id d9443c01a7336-218d7283495mr37959335ad.6.1734522052028; Wed, 18 Dec 2024 03:40:52 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:40:51 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 3/9] target/riscv: add shcounterenw Date: Wed, 18 Dec 2024 08:40:20 -0300 Message-ID: <20241218114026.1652352-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=dbarboza@ventanamicro.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, SPF_HELO_NONE=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.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 shcounterenw is defined in RVA22 as: "For any hpmcounter that is not read-only zero, the corresponding bit in hcounteren must be writable." This is always true in TCG so let's claim support for it. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 332 -> 346 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index 4f231735abad925435c3cd052e6641b1b4187278..460808d017baef93ccdd8fd8d1d4722edefd3b86 100644 GIT binary patch delta 55 zcmX@Zbc=~A$iq1#ijjeV(RCu10qYM2Muztj?N@PUB=9N!;ZarC%QJKSl Lk%7UAk%0jK&9M)4 delta 43 zcmcb`bcTs5$iq3rhmnDSk#8cG0qZLUMutZd?N?3wW;xk_QHeu|k%2*nk%0jK|2PU) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 58bb5196a8..7091eb683e 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -183,6 +183,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zvkt, PRIV_VERSION_1_12_0, ext_zvkt), ISA_EXT_DATA_ENTRY(zhinx, PRIV_VERSION_1_12_0, ext_zhinx), ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin), + ISA_EXT_DATA_ENTRY(shcounterenw, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(smaia, PRIV_VERSION_1_12_0, ext_smaia), ISA_EXT_DATA_ENTRY(smcntrpmf, PRIV_VERSION_1_12_0, ext_smcntrpmf), ISA_EXT_DATA_ENTRY(smepmp, PRIV_VERSION_1_12_0, ext_smepmp), From patchwork Wed Dec 18 11:40:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913529 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 01CECE77187 for ; Wed, 18 Dec 2024 11:42:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQG-0007Ys-LR; Wed, 18 Dec 2024 06:41:00 -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 1tNsQE-0007YE-27 for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:40:58 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQC-0007v8-GU for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:40:57 -0500 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-801c8164ef9so508327a12.1 for ; Wed, 18 Dec 2024 03:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522055; x=1735126855; 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=iNTvqcQvDiPTLItRbovaMEM3ypoPCWocSxqCoBEoP38=; b=eE77p4mFQBh6oLZl6wSAIyo9hXwmkqV3jf1+R+u3qn96tfl3ETGWvnlo8wOoIBF7/Q 8C/MdqJ9ZHkUUOVmTtthfVKjKLeS8uFrPWRL/lPep4AE1/OnNY+9oFFFc6uRLaX+Wn6Z hz98Z3THQqzbWqG34TQwmU9IkkwhWl0J0s1HNG4cdvhcbGe99hw0QnnbiV4wAIyDSi3a TJCsGfmw0Uj7xK+kBSiQJQEF+/bTa2+zBkooDLdLT/Mx8aJpguggbNp0oa/7ilp+HYUb 9AFgvF14aI/TYihlXjZgiAV6KqsXR6m1QPtJVfJ1V3Sz16MAaDbRT2xFZBKvw8aAIhbv 6plQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522055; x=1735126855; 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=iNTvqcQvDiPTLItRbovaMEM3ypoPCWocSxqCoBEoP38=; b=VBTanyI4RfHC6qKECa7qRe9PXxCvnSg7WvNhp1xqWgJtcSTtQ0aCxrVpTK3RqU1rMa kFIO3E40N9hNZrE8ce0tWeAeVdYfoZwk1c10rOSs1Ln4UYHpX+N1eZuL10t88hWrmjzF InGGivSzLZRkQiykbOuALvNPlt9t3bb1P+EJdZXI/ZYhbJya2xRwA5W3gBvFHZd4T22U jICxBKB83tMmqCbd/zNK8AMdX184wG90UpnQRsxRfFH6Rqw1A6CiyPy/SV7S2IGvpEJT WlsFDEy9NR4VCxygT5GkGkUgt+X4Dd5axwomPAdrEjGlVnlr81errg72URrArcAzIEFb daBw== X-Gm-Message-State: AOJu0YyMKpUKxHQgXBTj8wjfp71gJWLxz0kjD3+i71FKYU0q0x94nA7D a8hS0sOXZfdBOJsCDPNuhPK6vUh+Il+On3e1VG4eQvh2xiFu0B2Ttkpm5fKLbXinJbjwPULVBv+ FtHo= X-Gm-Gg: ASbGncu1VdtnBNcFhNv/bTmn5HkSMIz+ncEscLKT+oB1ibl3P7ibaYiYn1wB8c7YXqR vi0XGhK4u/ZtfqXWFjmViDsZS6iQsJbfuH7BI0o/l+iC1tz4+X5w4M+CZCDwb86VomJhv8VhtQ/ 5e25lzBY4au/Mj4+e8TBrzZQpUsYN8olk+B8E9vyxXxmrDmxuJ/UPVWvwMVNfFZvtEZNJZsfCXN ZtFPme6axyQdUwXJzHTVT3mlzHow+jgVm6V276m57Srf+H6NBobmX4X8jQf1d1gZ1j5YOtU2WMy oA== X-Google-Smtp-Source: AGHT+IHGvEpwznqrZEgLJCBktXBDSR5v/dhgWI+rrZnOQnWj0j8a3qcdFM4COnZInDN+b5ofxGHpSg== X-Received: by 2002:a17:90b:33cd:b0:2ee:463d:8e8d with SMTP id 98e67ed59e1d1-2f2d8860fcbmr10741403a91.14.1734522054828; Wed, 18 Dec 2024 03:40:54 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:40:54 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 4/9] target/riscv: add shvstvala Date: Wed, 18 Dec 2024 08:40:21 -0300 Message-ID: <20241218114026.1652352-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=dbarboza@ventanamicro.com; helo=mail-pg1-x535.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=ham 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 shvstvala is defined in RVA22 as: "vstval must be written in all cases described above for stval." By "cases describe above" the doc refer to the description of sstvala: "stval must be written with the faulting virtual address for load, store, and instruction page-fault, access-fault, and misaligned exceptions, and for breakpoint exceptions other than those caused by execution of the EBREAK or C.EBREAK instructions. For virtual-instruction and illegal-instruction exceptions, stval must be written with the faulting instruction." We already have sstvala, and our vstval follows the same rules as stval, so we can claim to support shvstvala too. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 346 -> 356 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index 460808d017baef93ccdd8fd8d1d4722edefd3b86..15b82b5bb1cf24cf501e74cb82682742e0041ea6 100644 GIT binary patch delta 48 zcmcb`^n{5k$iq1#g^_`Q@%ltA16C$RMuwjg?YDDelogkhCFUef{1V4u#mK2jNvd~WMHsjWMBXQ)M*Jp diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7091eb683e..f4997f488e 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -184,6 +184,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zhinx, PRIV_VERSION_1_12_0, ext_zhinx), ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin), ISA_EXT_DATA_ENTRY(shcounterenw, PRIV_VERSION_1_12_0, has_priv_1_12), + ISA_EXT_DATA_ENTRY(shvstvala, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(smaia, PRIV_VERSION_1_12_0, ext_smaia), ISA_EXT_DATA_ENTRY(smcntrpmf, PRIV_VERSION_1_12_0, ext_smcntrpmf), ISA_EXT_DATA_ENTRY(smepmp, PRIV_VERSION_1_12_0, ext_smepmp), From patchwork Wed Dec 18 11:40:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913532 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 A82F9E7718A for ; Wed, 18 Dec 2024 11:42:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQi-0007l4-Vu; Wed, 18 Dec 2024 06:41:29 -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 1tNsQL-0007a6-Hb for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:06 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQF-0007vo-Gg for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:05 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2162c0f6a39so5849875ad.0 for ; Wed, 18 Dec 2024 03:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522057; x=1735126857; 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=O//YerG7ZIihFW2lGVZjhXBesNDkTOryi2FknShtqrA=; b=DVBel1beqOULjwMV3hPzRB/hug7byTyN1j1I6U4I4Yfgp5MVxjh/TS5jOUOIfQEMmo 10Pkmw+ypvyKQy3xyOawFDh0giqXeKbCWV663x8S6+Ur6iwTqjaCZqN3JtHN668wUKBu 91E4QZU40YPWJ9Pwk7wyer9MG9yfy0GJ+AS0oxua5Xx6qnZ90jyrYHNV6kgAwDuvlx9m kZMxi2RCVcnzMwzKZyfyU+UGRe+btudcavHt0A1rUsdFxZ2b4KtIW6G/ML5Q+Fzk3Zue G93dC7h9ZBVaj99S2xxcWHy5i23QN180dWIcvjcTPw1cJK7rG46rWT0T01/fONCaq0Sz ri5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522057; x=1735126857; 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=O//YerG7ZIihFW2lGVZjhXBesNDkTOryi2FknShtqrA=; b=BSpVjz6StsDoiB29nn4hfv7ZjdNhFDOsju3IGLnNdDGDRKKl8XoCvSOAsoHi6ky/QB M2yAhMtwR02nVYt5O0R2Kkoh9LgYSeB2lgEZXCG0sOMFLbMdSQ/xrajEWZU2MGXNrfDn PxJwmrTmkZFVmTMsuS0Su9cpVBbqXdz28wlUnKnKphx/jjp2eKf1r2N+OpMYK1ymPlmH NwgbWu+PPiYerGfbENH9phksCDXSRJesbKcRs1JgKBloPNjOg1MhZXACMqgaF2aQaYT1 DZ4G5TY/mOe8QUTn8rEjBx63pPXOcdUbb/smiiiTZU27lY30rG6JdeF7sBGmKdZDpBtB k+Yw== X-Gm-Message-State: AOJu0YxXjMh0PtYckY7Rk8VcYaFfJtGKWZC/mCh7MI2Wh8iSX6FBOQlH DBgRCVtihMxYjtTzDBpU9p5pOt8UDy/ELSrL3qjB+96IbmHVdUTJWssCI56Du3+L7a5pgxaQ8J9 Xwnk= X-Gm-Gg: ASbGncsV9g+NFT3lIa4DSll50QwX6vZPfc5WPE4QJEkR+n1gEDYZ2ndrXHrT8ftJDer yRHMfvcY5XzvMFjWr826FMieX46eCtJ7NI+zC3K7+KhObCyZFOOYRCu2qy/nLjqbs9DSbXZby+n 0MVWxk8VIx2ffxFDcuDeYjAIGTS1eYVqMBasUfb4cM0D7Qud0I4nlZ9DxjN0QrjBO84hBarKCp9 V1mn74casiM2I+OeXSaqRgP5aQ2k2AXMwlKOatdKd35iAlL683k2pF5vbwarLHDtqxwqnNqxLcZ XQ== X-Google-Smtp-Source: AGHT+IFgI3wCgzOcWsy3RuqYgCXKX/lvGEoPoZrR8SIP96nwYfoTdmgSstBeLPzZGf1Hnp4H+koF5g== X-Received: by 2002:a17:902:c402:b0:215:7e49:8202 with SMTP id d9443c01a7336-218d73b30f7mr37655845ad.13.1734522057522; Wed, 18 Dec 2024 03:40:57 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:40:57 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 5/9] target/riscv: add shtvala Date: Wed, 18 Dec 2024 08:40:22 -0300 Message-ID: <20241218114026.1652352-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x632.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 shtvala is described in RVA22 as: "htval must be written with the faulting guest physical address in all circumstances permitted by the ISA." This is the case since commit 3067553993, so claim support for shtvala. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 356 -> 364 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index 15b82b5bb1cf24cf501e74cb82682742e0041ea6..065f894010272e7f27834b2c8d5d5fb0c21066a1 100644 GIT binary patch delta 46 zcmaFD^oEHm$iq1#hmnDSF=ir{0UH-1BLgGjM2GFHC1r^@i4(tMa5ynCF!(SsFaQ7$ CAPVCE delta 40 wcmaFE^n{5k$iq1#g^_`Q@%ltA12!f`MuwjZ6CJis{GZBU#mK X-Patchwork-Id: 13913533 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 AB200E77187 for ; Wed, 18 Dec 2024 11:43:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQa-0007fT-7C; Wed, 18 Dec 2024 06:41:20 -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 1tNsQN-0007aR-RN for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:09 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQH-0007wQ-Tf for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:07 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-21636268e43so77067465ad.2 for ; Wed, 18 Dec 2024 03:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522060; x=1735126860; 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=HeGHTv7WUGU2Badmf2iQKUYOhrgRKmlPJ9jE2wBhvhA=; b=lQjk1rCDSDGkeHOir7jiB6nfjWfnnUjlPP4Wtm6OYAuePGmT3pXy96uIIahg+HMOfz jnvt/Pj7cf9+YScXzhysgdO1DqTPzcvpzDerdhWVT71oco74i4q1UPpeHXqL0ZiC4Kvw BC5Klfn9iQ6BgU/4l9bZ0rYt4J+Do710cRZsDJlFhf7ixr7DvuqZkpetm0lMnoApzzZJ REn4Z2RGXeoa/et+sZOkmgHQKCEgOIkYrnRkpsJa9GddIP0TYphJtKWuz6WccLiCA6ms O462RwcSWWLyfvHDw7bak5K/FWc/7OUe0CeFFOnGk4JjxZgfzaF/KuGFPKLl+lCgLv2m VnPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522060; x=1735126860; 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=HeGHTv7WUGU2Badmf2iQKUYOhrgRKmlPJ9jE2wBhvhA=; b=TFD505BgC2qYHCUWbjhug9xSBZ+4Q0Q6uPvVgq/+FOgfbKR/xPP8UgfjUvfTCoIUr9 PsbwFt9v6Dwa4DaM3zPYgh+6mxY6b4zPprZpKRpMSiqB1Qm9fAZwB4E4F0USDO55Z9MT GG0gfdjMPBO24Iohxzdi819vOz2zbsPEz0mDRtQGzRVxBsp9bPV93adZOGt3PgTMn8zn OtkuOYsT1H2y5pZCTrHGMYU9QXdzfxW81+WN+UxSSRlIpe/qOtHsOGuunmRg1K5DNi/L HvM4z3zMJdxGxvgRS0xESIt9egZEcbvwtzjyik4MjcR91FXpIavliJb7O78lFwep4HFX rNUw== X-Gm-Message-State: AOJu0YyQUvr8Y7Z5TF880dfhWETnS5jMYLF7g8rkiNE8bVriMqv8lox4 4iKoV+kf5hRgr/dClLrh8h5NQqjDNKrriirb28uhslHmHxygEehpdrthXgfo0TytMGk8CzmRumy Vg5g= X-Gm-Gg: ASbGncuLFQEb4jx/Qb5GwLErbeDuryNJM0wHhfVYvarV5EVln/6Iqb7rOeQk3I0DWcW VjZSawlK2S5EUfr3XceJFqCGYdWXN//0HMUsUZcAwdCx7ja0py5QEkVuVCDOPvWH1cP2ISRN69f MOvuDp35iG3F3hy6DgfwuPW6k3A5q88/0XHd+8rJn52VQe7JdcXrpSjRGXvke1mQ4Am2FNPuIpg fMud4jcBufckQyOzzyyVFZH4cIhOV3OfOrP2BRrzKC1UOpOXf/avtIeaHbEUH8jSQwZERkKyWBu Qg== X-Google-Smtp-Source: AGHT+IHyU8Wbomp5y51DyqLpTxl6Rb1sGktSfOtboz5QcDuNAbVcJmIaxxDWD3UfD0gu/9GDT8gqmA== X-Received: by 2002:a17:902:ce8b:b0:215:a3fd:61f5 with SMTP id d9443c01a7336-218d6fc137emr36718955ad.5.1734522060365; Wed, 18 Dec 2024 03:41:00 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:41:00 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 6/9] target/riscv: add shvstvecd Date: Wed, 18 Dec 2024 08:40:23 -0300 Message-ID: <20241218114026.1652352-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x62d.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, T_SPF_TEMPERROR=0.01 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 shvstvecd is defined in RVA22 as: "vstvec.MODE must be capable of holding the value 0 (Direct). When vstvec.MODE=Direct, vstvec.BASE must be capable of holding any valid four-byte-aligned address." This is always true for TCG so let's claim support for it. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 364 -> 374 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index 065f894010272e7f27834b2c8d5d5fb0c21066a1..2c7dc6c9ab8d8da9c30ad34294ef28427a4f8f1a 100644 GIT binary patch delta 49 zcmaFE^o@xt$iq3LjFEwX@#91;16C16Mh5PQ_9r X-Patchwork-Id: 13913530 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 43F19E77188 for ; Wed, 18 Dec 2024 11:42:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQm-0007mh-1g; Wed, 18 Dec 2024 06:41:32 -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 1tNsQV-0007cd-1b for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:18 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQO-0007x3-Kw for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:13 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-216728b1836so44396415ad.0 for ; Wed, 18 Dec 2024 03:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522063; x=1735126863; 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=jHmSZE7CHWvGDmRA2eHkri4i48DH29862/zQmSzlozM=; b=XzQrk/ig69yErSUwfrfKJOABMQtCnsM2X0DWV3pORX+VfdLNQiBRaFj5xZDxXO1B0R WjX2Y5S2KJL3g53KIDNkoYGgBelK7WHnCN2meOqsBaM6m11EgYkCApDs85WKL/ysCj4P y38avMvQP+GaLndfe4jhUMr0KxKT3YqipTfc5resmvfQMbbL6HSaVXlED0aBfNAlOnpz mpBrapyqT8+7alSwEZZZgIwo/+IZ4XtoRD0Tcu9ULVi18V2gSl13ytQBlcfoLdliG/6a 9hsWnRTCcp1ZkJLdVBVLmCxFlj4VbKU6uYCE8k65ZO4SjvhQhJJfKfyK9U0g0RvnXQyF Rrpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522063; x=1735126863; 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=jHmSZE7CHWvGDmRA2eHkri4i48DH29862/zQmSzlozM=; b=YX9iOSGmTgXVBb7rAT0MRJma/WFOmuig05kVIM223LVtI9ws49KdYG7E1vl0LBcb4q +eNBC2CjZvGfOGpgYI0TtD23u2MGCk8EoGi+eRD88Ef5wFlCkEAqFy9MwCdo5ZxydIxM FbImjBzSFiQZHHOQxU0i35S3AoAGg6IOyAy8INZXHiJ8xI6l/IxdRaIlINTtMkXPlEOG IwC4+PPViTlJjTZ4QCYX1AyfdCGKihELbgcCOPlEcKkCKoPIeOjGFuCR/Y8QA1cVrbPm h/WrOvIiQCZMgt4UNpVqFIgaLCxaxINUb4LiK7am1ZYH2xQSqZOjzJwXq4MOlZ1Chfaf d9/w== X-Gm-Message-State: AOJu0YwgicZdeGpI/ih2/0zEl0DfytoF4Qecsa48L6j44Gw7qUWKpPrK 8f7+TBJ/ce1MszIN2Jm1CfG5Hef3krqjbWW2/lzirUCLO2REioDEwwh8R4CXdzkT5HlgbMbz3zj tlao= X-Gm-Gg: ASbGncsqxZ1mHxYaxcZ09eQBK5HeYPe0xBUgj0Do4My0kHkpWWpe04jOpXo8g3/4HOt g7FJk8nBKSrcIyCFimcBNTG/xUFlwqbHsxtCRJj1IyCLPQn8kwmMyzhcW09S8ZgeVJNAO2fC0Mx Pjga8zlNk8553h1jr05owBcyd5pNzzkL+cIcePEEqkmzZjXwb7jjwd0fi693c0g36bTNvz9wEFc ESntHEbUzh1zAICZnPprGkCL99aQcgcK3kBOBdCRzk1MPdV8MG7/geJL8GWW55Ca90zeg9GCqah Cg== X-Google-Smtp-Source: AGHT+IFMpjN/SBTU28Vphb85HRm/82bg+8pa8um04x1NxUvv3mpfd36k89J7cwXgjzXIRbG8UwOsCg== X-Received: by 2002:a17:902:d48e:b0:216:18dc:43b3 with SMTP id d9443c01a7336-218d725a6d7mr27687265ad.42.1734522063116; Wed, 18 Dec 2024 03:41:03 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:41:02 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 7/9] target/riscv: add shvsatpa Date: Wed, 18 Dec 2024 08:40:24 -0300 Message-ID: <20241218114026.1652352-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x62f.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 shvsatpa is defined in RVA22 as: "All translation modes supported in satp must be supported in vsatp." This is always true in TCG so let's claim support for it. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 374 -> 382 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index 2c7dc6c9ab8d8da9c30ad34294ef28427a4f8f1a..fcd9c95a6ae6e6977e5d9c33a39785269a28aa58 100644 GIT binary patch delta 47 zcmeyy^pA-v$iq3Lj*)?Z@&80F16CPEMh20I_J^1gOA03b4w&r2sKgP%$iNWC$iM&q DMU4z8 delta 44 zcmeyz^o@xt$iq3LjFEwX@#91;16C16Mh5PQ_J<~OF?vl7W>n_zVPs$kV`N|e00!3y Az5oCK diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7aa8a136d6..b5ab97b4de 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -185,6 +185,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin), ISA_EXT_DATA_ENTRY(shcounterenw, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shtvala, PRIV_VERSION_1_12_0, has_priv_1_12), + ISA_EXT_DATA_ENTRY(shvsatpa, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shvstvala, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shvstvecd, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(smaia, PRIV_VERSION_1_12_0, ext_smaia), From patchwork Wed Dec 18 11:40:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913528 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 1F39BE77187 for ; Wed, 18 Dec 2024 11:42:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQb-0007fv-59; Wed, 18 Dec 2024 06:41:21 -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 1tNsQP-0007b5-JV for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:12 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQO-0007xJ-1j for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:09 -0500 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-21680814d42so52916585ad.2 for ; Wed, 18 Dec 2024 03:41:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522066; x=1735126866; 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=/AlFl+TxHMtjNlkR4E/snmXOdeZIi6lyTp35UQkY7Vg=; b=jgqcgj+yoi7k2kVRhPmClz2432Gdfe91EfW8a8Rulwmp70RVXAX8muiSUrKUf6DX4H 04IKrxlbMvZQsa6AIecZ1N/GkM4iVPPxXATEE0j1m1P2qveJvSwOS6CErTc1CfleOcRm dbSBYQHCneLtoxvmtyFkQuT3V1kKnKCh+Nj3NDI4jgnybeoKsdtrAV2obC0cjEl8sz+U o2zJOawNy3e3qNkPQFjhKueRne/YkIM69li0oG8nh4Vk3bTw1fy05eyqdOwY25yExZB+ gQj5kodU3TEPC/Fwdno5+XdAr/4xGHR/C0e7QAQ+no72EaDQUbHpJ/VG3DH7BvaqC24f JHjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522066; x=1735126866; 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=/AlFl+TxHMtjNlkR4E/snmXOdeZIi6lyTp35UQkY7Vg=; b=rcGzlFc2y2g4oMNT+KD7XRdIvH93g16z6NfmU2/qwuU8akyuzprB1YOebu5HrHq/1U tl6t33rCzZRNkd+m134afBhR1TkMNlge0WbeVm04gY4Sx10eWUj8GOch7ZuoJx135Fx+ BSveaJwwpa1Dnq+En+NJI52yYlEmC6+Gaj2x/KyJcNkWwnmxTAD3S5/hyJde7igv13Fa Jv6uKL27ttMjVH/uvdNtbWYkJRVhUT3Bz65UKJ++RWb74quT8Yx0K4duD26cbSWWCNQq CB5ALsm2x88MgWzSbmQ6NmJk4XJfBMFJtWwo3EBQIoDcnomVcv5QPahXWVq7eou6LGpt 5Buw== X-Gm-Message-State: AOJu0YzVz8YoYVvOBVfCufDJTN/cI3vLjH8bep9B5qCzZJJOecH+6JFg DJoG3WCWuGO3PW+ElQNJgR3enk9nSgylKdzv0VAp7WADgNmPa+qT5/dJJmHBtX98IHBUY+/ll5J JB1k= X-Gm-Gg: ASbGncsFFKJwrN0C/0gqVuWaqcCR/QAt77a30FZuscAW4a58Z/REM+xxQ4EHRoT8cXP nwd6vxFnFUUBF7YwSvqYos3G5BAlLoaNOu57Jf/NePL7FF8aRdeDk/XGcA6zClmkhcwzp6l0amt ifPmfMNdJo/68+5ZDsmi0TXoF2Hf2H9I8TngPjFlR6U5iWRfYI79KLObE3Y1Z62JSYcmKvKKFS3 vLIjILXNN1CWyL8ANSnMhvPHucGe7x5EG4fCxdh3DDtl0lV0o4YnY0S43BlYd7LBMxjAd4yO3O9 5A== X-Google-Smtp-Source: AGHT+IEIEUCIgSkiPbFpXZXqqQLlTgbOfXGKfn39bXcYy3KUwCtU81BLj0E+HmDJopLFxrKMPWZR+g== X-Received: by 2002:a17:902:d489:b0:210:fce4:11ec with SMTP id d9443c01a7336-218d6fd5de9mr36572675ad.1.1734522065914; Wed, 18 Dec 2024 03:41:05 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:41:05 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 8/9] target/riscv: add shgatpa Date: Wed, 18 Dec 2024 08:40:25 -0300 Message-ID: <20241218114026.1652352-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x635.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=ham 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 shgatpa is defined in RVA22 as: "For each supported virtual memory scheme SvNN supported in satp, the corresponding hgatp SvNNx4 mode must be supported. The hgatp mode Bare must also be supported." Claim support for shgatpa since this is always true for TCG. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 382 -> 390 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index fcd9c95a6ae6e6977e5d9c33a39785269a28aa58..695022d56c4ac16607d4c622955ad339fbbfe997 100644 GIT binary patch delta 45 zcmeyz)W*yel|HIAJ1}0jmllBZJID`yH(5i6sSz6TdWZ#4s{2q%kru000jj B3tRvI delta 39 vcmZo;{>Q`>6I_q0GBCt3GB5xD(EkaU diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index b5ab97b4de..41629019e2 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -184,6 +184,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zhinx, PRIV_VERSION_1_12_0, ext_zhinx), ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin), ISA_EXT_DATA_ENTRY(shcounterenw, PRIV_VERSION_1_12_0, has_priv_1_12), + ISA_EXT_DATA_ENTRY(shgatpa, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shtvala, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shvsatpa, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shvstvala, PRIV_VERSION_1_12_0, has_priv_1_12), From patchwork Wed Dec 18 11:40:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13913536 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 3BB6FE77187 for ; Wed, 18 Dec 2024 11:44:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNsQd-0007gg-6b; Wed, 18 Dec 2024 06:41:23 -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 1tNsQV-0007ce-1s for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:18 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNsQR-0007xx-TK for qemu-devel@nongnu.org; Wed, 18 Dec 2024 06:41:13 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2166651f752so66857245ad.3 for ; Wed, 18 Dec 2024 03:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1734522068; x=1735126868; 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=oQDYd8goWFdiiQvBBrxBKIN+0R/MG7OS8oAWf14cKlo=; b=eNgTxk8Tk1rQ+yXxzcUQhtl+CCtpalQMKYx4TvMdyHH4p2CVP5332Ihp28XpUDc74M PvbJaSjVBuXVuGkZhTEfwBtEoNJiH3ECv2M0bIwfZZfMdL9bR33JUx0ZLHDnpnVNr0qU YsOWcxGVtn6wHR/3MXSV4iHaAaF8RFhb5sOa4ilEiDh9jmP9A9CwRrYyu1fhD23LSwod +dsCMNYn4zbmZjuNJ1XqnPbyQDqf31Urim1f416TKzVQa6e/s3uLhIQWtGiouvJ8aY82 zxRdWOhhigPNXkIkksF60GGYxMVSivBniQKCruIN/m4rXRzhxJz1S5wgl4fqJGmanS3M zWAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522068; x=1735126868; 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=oQDYd8goWFdiiQvBBrxBKIN+0R/MG7OS8oAWf14cKlo=; b=K4iaA6VXaevOzqgHT2MQT6B3rOGikMgF5zvcli/uhdUBpXu7FQDAp1xmQj192yTY10 Eq8T8zebS6acs+e+FglpQE5XQRsomanpBb4vp1JSbRFfhVONU9RxhU7UyP9u8NuGQnKD hoTkUzP8VOwoFw4b6+AFa2ZTSvPqvb7adJKwRnMH4oPZ0vIWYVOOLjJncYSK3543jDSd w/jCd7pdjo0sRdRzL8QTtw/jphZoIQOPoPBKSTORISBsx1BU8hVgKEcxEfu9hrydIKVl sjX5Z8gvcMLtT+4OxCY7AxqxWBlOaoNkESVD5i2T4Z9U2oWkTiTQG0+31A7cV3u7iQKy CzlA== X-Gm-Message-State: AOJu0YyvH84gGJvhc213uf0biy0U4vpQi8km6cLAXkCtPS+wNuyKXUWQ IbmIElIb88XUtEsD+RLZuaiXMIQbYc4b3kbSYLVSMjfttN7OE89oH2VsCYR2qyZn1BnstJLOSBO rWDM= X-Gm-Gg: ASbGncvALS9ZtAXJpYfEOttPfiF2nfDNGX7XnMzuGxMIPwZ/w2zOFFCZh7rgzfFNLs6 2Vxt3SNAHLjusbe2MkUkK9srePqJXvjQ3RHU0AaLyy7qcbmp5vxgY4sFcEJVs4t5EWSkB97gtpS LB6YYTtfsw+0HaRcwIU4BtYy4siRDPNtHBVoMWzVTl7k3RkqVUZoGk8uHRVJ0J2LMW7Ya3yCzEp C4bJs1OaiSZZawOTWMWKL1B2PDvFyzHY+5gtNFOxrtJXV6/oOa37xXqouquutJ1Uj43BKxY78UC Uw== X-Google-Smtp-Source: AGHT+IGlbMKzSjQAr7+Exa84raNs/YbPOp6zO5xXJkkL81Qk7Rib8vvf8G97aZgunyVRf322FWA6hQ== X-Received: by 2002:a17:902:d481:b0:215:385e:921c with SMTP id d9443c01a7336-218d726cbf6mr29639195ad.51.1734522068679; Wed, 18 Dec 2024 03:41:08 -0800 (PST) Received: from localhost.localdomain ([2804:7f0:bcc0:51cf:9cf:d2f2:d49e:7bd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dcb447sm74462285ad.68.2024.12.18.03.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 03:41:08 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v2 9/9] target/riscv/tcg: add sha Date: Wed, 18 Dec 2024 08:40:26 -0300 Message-ID: <20241218114026.1652352-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114026.1652352-1-dbarboza@ventanamicro.com> References: <20241218114026.1652352-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x62e.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 'sha' is the augmented hypervisor extension, defined in RVA22 as a set of the following extensions: - RVH - Ssstateen - Shcounterenw (always present) - Shvstvala (always present) - Shtvala (always present) - Shvstvecd (always present) - Shvsatpa (always present) - Shgatpa (always present) We can claim support for 'sha' by checking if we have RVH and ssstateen. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 2 ++ target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 41629019e2..9b55198a46 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -184,6 +184,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(zhinx, PRIV_VERSION_1_12_0, ext_zhinx), ISA_EXT_DATA_ENTRY(zhinxmin, PRIV_VERSION_1_12_0, ext_zhinxmin), ISA_EXT_DATA_ENTRY(shcounterenw, PRIV_VERSION_1_12_0, has_priv_1_12), + ISA_EXT_DATA_ENTRY(sha, PRIV_VERSION_1_12_0, ext_sha), ISA_EXT_DATA_ENTRY(shgatpa, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shtvala, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(shvsatpa, PRIV_VERSION_1_12_0, has_priv_1_12), @@ -1713,6 +1714,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = { const RISCVCPUMultiExtConfig riscv_cpu_named_features[] = { MULTI_EXT_CFG_BOOL("zic64b", ext_zic64b, true), MULTI_EXT_CFG_BOOL("ssstateen", ext_ssstateen, true), + MULTI_EXT_CFG_BOOL("sha", ext_sha, true), DEFINE_PROP_END_OF_LIST(), }; diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index a1457ab4f4..fe0c4173d2 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -141,6 +141,7 @@ struct RISCVCPUConfig { bool ext_svade; bool ext_zic64b; bool ext_ssstateen; + bool ext_sha; /* * Always 'true' booleans for named features diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index cbf2cf1963..3480767b35 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -210,6 +210,11 @@ static void riscv_cpu_enable_named_feat(RISCVCPU *cpu, uint32_t feat_offset) cpu->cfg.cbop_blocksize = 64; cpu->cfg.cboz_blocksize = 64; break; + case CPU_CFG_OFFSET(ext_sha): + if (!cpu_misa_ext_is_user_set(RVH)) { + riscv_cpu_write_misa_bit(cpu, RVH, true); + } + /* fallthrough */ case CPU_CFG_OFFSET(ext_ssstateen): cpu->cfg.ext_smstateen = true; break; @@ -350,6 +355,9 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu) cpu->cfg.cboz_blocksize == 64; cpu->cfg.ext_ssstateen = cpu->cfg.ext_smstateen; + + cpu->cfg.ext_sha = riscv_has_ext(&cpu->env, RVH) && + cpu->cfg.ext_ssstateen; } static void riscv_cpu_validate_g(RISCVCPU *cpu)