From patchwork Wed Nov 13 17:17:47 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: 13874017 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 75AE8D637A2 for ; Wed, 13 Nov 2024 17:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0O-00008z-HB; Wed, 13 Nov 2024 12:18: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 1tBH0M-00007y-Eq for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:10 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0K-0003k1-VN for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:10 -0500 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-7ee020ec76dso5347368a12.3 for ; Wed, 13 Nov 2024 09:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518287; x=1732123087; 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=1rGaIJlJUbuhCUG8sC2dah6C7SrySAgZlFZil3t+2Qw=; b=LrS757i0S99GrVISy0hwD63cZevuN0ePIRxg9IgjXcluAL67mXVOS9q7wuwvgJaS9Q fwro0pX1EyEI03X1KRLr+tSFMVwocr7Zj7ldPdN490QX+mLSOnVcWmLDB57RjJEAStfQ zztTrC3zZDiCCJCAyaE/rLdclgA5lsTIUnAw3L364n5RR621q3KwksCAlSAujLpTIrdG 5Bpbdgi1v42YhdXjukjkB7NPvKlX6iw0H7jI8l1e70+3TyZh+YdzUHkrrpoQ8DZYBSH7 iUJdf0ExxlpS+fi/5+9BGqx46il4Bc5Q+toUGELUEoWI6v15jvPPRt7i8WsnAFT0sk4U +BNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518287; x=1732123087; 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=1rGaIJlJUbuhCUG8sC2dah6C7SrySAgZlFZil3t+2Qw=; b=SAO2qlMhiNSYqU7I9q3x5fHZ1QkjWRRpXoVWLNQV9eH8gYBLjv+naMNSmuOFMKnAYK ubOx6mP4A4je3r7qBfDaf6KLVTm5tAJvstuQymlvAls4JZtFFmlSN97plMFMGfU8wLbB iab79YjYQn7UZ3FmoSlljUWWHHOegVAAU7AnEC4wk3QsA/emhlp15xGkai82wCCqWQ4e 47jyL0ApYMSXZciqurbn+zWzvyLUltlC3Ls2vf4rSneZfc5BQpFH5n0zjflS4yFK5I/R Wn+cx6EDVY3OXAVfYgc0ur0BnCS9PSj2L6QJ6Ay+NC4bMjdHaHJ1md03LzOLV182p07A iVRg== X-Gm-Message-State: AOJu0YwQCfpwsmCxzBIvhE6L2J1QBxsOWVgjPOTmmfli6M4RP2ExqAAb H2fxqNmAzAxiiPgbaD9VPTVAqXE1AyvtpN7s8+CIVCcT6OPYCTgHEzeYIPMtrJQXMROiQivIM/5 N X-Google-Smtp-Source: AGHT+IHnSZ/MQSOGvPcLpzVNXU9qbeg3NYHKpsqYD3nTvhuiqXn12KVw5/xYebc4vhUaMSeFs5eG4g== X-Received: by 2002:a17:903:244e:b0:20c:d2e4:dc33 with SMTP id d9443c01a7336-21183c65cbcmr311579785ad.14.1731518287065; Wed, 13 Nov 2024 09:18:07 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18: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 for-10.0 1/9] target/riscv/tcg: hide warn for named feats when disabling via priv_ver Date: Wed, 13 Nov 2024 14:17:47 -0300 Message-ID: <20241113171755.978109-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=dbarboza@ventanamicro.com; helo=mail-pg1-x531.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 --- 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 c62c221696..cd83968166 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 Nov 13 17:17:48 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: 13874016 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 79A15D637A4 for ; Wed, 13 Nov 2024 17:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0R-00009o-AA; Wed, 13 Nov 2024 12:18:15 -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 1tBH0P-00009M-Nf for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:13 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0O-0003kY-7q for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:13 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-72097a5ca74so5985467b3a.3 for ; Wed, 13 Nov 2024 09:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518290; x=1732123090; 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=hxOZ1xHRmyOPMiXb0/ok1USMd7LW6yZMmDme9/JAjGU=; b=G33wVJdW/c/ZUP8X8Xa6Nsy2UDU/OAEqh3BQ93vPsodEhjfJGXc+NSX3KGP2rwxKtX JwptIwrRgcMuzJ2JMrO2qobLiYcz88E3Xb5SsjNspEkLCJtzts6Fd6cmP18Nr4GU3HmX sE5ERZ64HuXWCCJUz87AzdMl9WLMbWEqMffEqBNWnudSVPCt1aOH1RwJo7TeBeKCJnLj MwDWuMs0vRxQPaDLs7WYLNA9qk/IOrElFNoqObzNoyljBj654rOokwkR5gH5E7kQsHbo xyiMpFay+lRmvM7iUFVJhtzpRwYlWs+wW7vohgHTPDfp7Lmhh17Rfo1aU7m3BLHLeMnU TpLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518290; x=1732123090; 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=hxOZ1xHRmyOPMiXb0/ok1USMd7LW6yZMmDme9/JAjGU=; b=ZGdyF5p6itVG6kEbpQTh+2RE0GGpjpguua6S6S6vg+LG6b4jH71L5cUOyobrbK3Y0Z rnd/i/RriPZVFQY5eRvZt1LvAZ6DNCsNW9mCwFSze1hPK43PLpEcmgYxKFeDPS0qZGyf WPqQikUbV2uZX3WpshQXZFP8Wc/uIwrB0ej36O7TUm3wyd/hjQbjoUz2c8sbVmY73VB7 p5Lc1CA5Gq6JzDm3fenWmGVbyIJ4bjI4mkzcZFD348vOIImgyjovuwRScdlbL/UJXzXd CQYdl/g/GxcHRZjoiHcfL6OpR9guci38Q7CLnPThuH+4QuwWSo7CpLli5cE3OFCFycJj Z7Iw== X-Gm-Message-State: AOJu0Yy8FQAhxRgwrEQ9CJiIqdL0IOE8kmu57KZABCJGdqH+i4eV008L m/hsiqfjPdgow1brF99FpuIpF6nIvEwjXmEb/vMy/KGHmAnb4ikfpYWi0WIA+Q+4xnaA8Gjec4O G X-Google-Smtp-Source: AGHT+IEeqllOGf9YcxQRsEgnC36t3oHcOCNhwh+pK1pzVtheB/iMShil1/IAOrcvAJ/gFJV/6cb8NQ== X-Received: by 2002:a05:6a00:3d55:b0:71e:695:41ee with SMTP id d2e1a72fcca58-72413278a86mr27996285b3a.5.1731518290187; Wed, 13 Nov 2024 09:18:10 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:09 -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 for-10.0 2/9] target/riscv: add ssstateen Date: Wed, 13 Nov 2024 14:17:48 -0300 Message-ID: <20241113171755.978109-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42e.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 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 --- 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 f219f0c3b5..4ad91722a0 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), @@ -1607,6 +1608,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 59d6fc445d..c7bf455614 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -139,6 +139,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 cd83968166..0b9be2b0d3 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 Nov 13 17:17:49 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: 13874015 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 AEACED637A5 for ; Wed, 13 Nov 2024 17:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0U-0000Ab-FI; Wed, 13 Nov 2024 12:18:18 -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 1tBH0S-0000AE-Q2 for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:16 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0R-0003lB-F7 for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:16 -0500 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-71e5130832aso5715151b3a.0 for ; Wed, 13 Nov 2024 09:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518293; x=1732123093; 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=+7o8RmsaAOBH8IeqzRchnYHz4h5jWSdWaUM/ctLWYAQ=; b=AZaydr3vT9KSEXo4/JLLvWxk4A9sJr+TJWzUUpPTJu7/4uYPISNHMaFHXbXiemO0LI gDDxEufGTTpv64Qoqp5NXacZqm5JLAatjLmLkOn3dwH+n74g3+O1/wlz6S4cy5cIuxp9 ROc7YxID9HAF/FvxJE+tXSB+C9C1psp9qVTDzwPHCnbJxVMEUDgNAXxj52JHrqi+sqQ8 E92hLAq8Kzem2MG3tC96arC9HUALOtxExQHOftVoCNsSqBwPo26UIGG0uNykivJFBUb9 j5KmeWzPQFa6BTLS+JlwH1MU4wvROWBBd90daY+TLlPRXCQ/BCQiVsj2xXxPPKJyDx5R 6C2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518293; x=1732123093; 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=+7o8RmsaAOBH8IeqzRchnYHz4h5jWSdWaUM/ctLWYAQ=; b=Z43c/ji/Ao7q8kE5UAkx8/QFuuF76ZAAUE1PlwVOWf5sHGnUiE1N1fC5caUwfsyin1 9oqK8xvRf1HBncm85gy0seQWyiQ20/7oykKmrgXEycFUvdYr5FPqcwt3rgsGJapsSRjZ uAvvxNBPdEZMTj1Q9ilap70l97Q6jMhXP0BHmO0gzG8bTMvJqZL2FEo0R6phwwpcsw2j KkcpJd1zU07uuC1fnpEAFcOJHoHlzlZF7l1Ij423qTlrbuYzuR5BkfiR/6CCXM7DKOBf D7VZxXHAnAOWXKy8KH6KmYJJx3ZOiBlEWewT+F+SgWPeUZQdkz+uacJM2hzCiv3szNy2 3MkA== X-Gm-Message-State: AOJu0Yy/VAxuWNe0PTyVyjBmClCV6vf1GMSMoafp8tSilnLNCg5BrRvm Mted/HuCd5CynWI7krWSjoJSLvAMN7AckMs4cpWvq8QmbcW6ywh3p5fVhpgUSUV1mrpLxfYWBc3 2 X-Google-Smtp-Source: AGHT+IGTri8kdjjFaz87jgzKJ2k8TV06p2JBlenDnRzdylUfo7+phEGyUecPlbGR+GOEsyWvdfy9zg== X-Received: by 2002:a05:6a00:2d9c:b0:71e:4ba:f389 with SMTP id d2e1a72fcca58-7241329bd75mr30656823b3a.10.1731518293221; Wed, 13 Nov 2024 09:18:13 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:12 -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 for-10.0 3/9] target/riscv: add shcounterenw Date: Wed, 13 Nov 2024 14:17:49 -0300 Message-ID: <20241113171755.978109-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x429.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 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 --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 4ad91722a0..6bfb1b1530 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 Nov 13 17:17:50 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: 13874019 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 3AD2CD637A1 for ; Wed, 13 Nov 2024 17:20:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0X-0000Bf-AP; Wed, 13 Nov 2024 12:18: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 1tBH0V-0000B8-1C for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:19 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0T-0003lV-Ko for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:18 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-72041ff06a0so5850369b3a.2 for ; Wed, 13 Nov 2024 09:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518296; x=1732123096; 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=eRsWqGprKpXr4X4s9nrV4tM7SW7VHpVfdMt6ILf4bJ4=; b=NLnEPwThBgKpTtaewnZd0nXqZkBjweLnRX7ruGjHs2HAEvfQiWBDtYgPvWFDsAeRbI pMFiKKVFkdYNLAavLvdAeN55olDQvq0uE3sC84AcHcmwCUgHkaQGkknQOXhm9SmvnZvI PutqE6spFNqxFGiDAkPj3yPJd6q1w4tSxbiCFEQxVnMv6JPJJsYQakap64L9IfOkKbz/ S9rblCDRMQVMIN845eJM8G+qBWygyrPu08EAEzkT8itQ+LY6R8lFtwmFrS5YG8qqFcMJ Qlkuzf3M6AyBfUJkzEUmMiBWvjW8hIwzut9FdHAOtJlgz3unbrudxiQcKg3HCXl2zfA6 sfVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518296; x=1732123096; 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=eRsWqGprKpXr4X4s9nrV4tM7SW7VHpVfdMt6ILf4bJ4=; b=Bo/+Ytv5Nbzm0qDQIBVDHb7FYExQf3jvHSFFHCK5SumDTaVBjuKZxNxqv9Zx0deDiv KnEt7ynTAg69Y7MefNzGKH8RgukWePywsFAr0gdlNnZIGeJwZ2i38y9ROd+DbjemGxoz ESYq55WkfnGsnM/SzQbiGiTbtxz8gVdHoktOLp0KGX4/tjR4uKDWuDo7Ui7OC5iW8ZDy AYHjndo2JOn8LidsKmQ7WbsFkWsGv7cPx8t9W5uq5Sd5iTZ9ErIK6GbCfNtNt8AwMju/ 2o8jmYn1XUIfkKplk8OviuySrDziehW8vSU9W8uxAgfhkMNFBnnJIO2+lkhBATFsCVdF J+Yg== X-Gm-Message-State: AOJu0YwDWiApDWPmOuS0VKjxmvQN8k4MfgNL/L0YTXyBkXuLTlRmfZqc ThrP4SiIiPHAKt0NJikyXUeBwlP+u/91Vgc6c6aa1JXrntYwUAy+TvSGFDTKhMMaFcCJt+lDWD7 y X-Google-Smtp-Source: AGHT+IG+UPYIm2taWxPvh5O2pEptxs1c4ZKZwoeGuqTCFBlL7V08SLnldrT8ykOqQOrqnbOTA41AyQ== X-Received: by 2002:aa7:88d2:0:b0:71e:e3:608 with SMTP id d2e1a72fcca58-724133a03b9mr23823495b3a.26.1731518296092; Wed, 13 Nov 2024 09:18:16 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:15 -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 for-10.0 4/9] target/riscv: add shvstvala Date: Wed, 13 Nov 2024 14:17:50 -0300 Message-ID: <20241113171755.978109-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42e.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 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 --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 6bfb1b1530..11a0d2d04a 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 Nov 13 17:17:51 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: 13874014 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 673D5D637A1 for ; Wed, 13 Nov 2024 17:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0g-0000E1-DM; Wed, 13 Nov 2024 12:18:30 -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 1tBH0Y-0000Bu-Bz for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:22 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0X-0003m7-0h for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:22 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-723f37dd76cso7378154b3a.0 for ; Wed, 13 Nov 2024 09:18:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518299; x=1732123099; 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=wDSyRePK0ZioZyeNhXDT45o3z8pIP1oRwjHKVCbyFfc=; b=SprwXX6lTL12KO1fwZTVrWORfDqGC0pThz1qRVbfr91UXlzyKbwQIdTnXua8ZdH6Oe rtgXSyBHrEktbcpTkPiFw1QxizCAN1fT1b1xq5f8I/tzMMQX5SXajzP5oL002oduSJf9 0w+QtvT8q89z9KCq7xGCaKT1Hk0JrDNUa0p6SURAyDS7kFk/pPmuZsJdhQNsawyYpwfU 2inKL/GM7AjwCcGtFZ8RhLtr5zHOr1iqBfsC0y/o/h+KO7jqzRUBZwmB0glVf3bS9Ogl 2+z6DEaT+pAzskW2Ghiz4x/YjRjs89inv9msi7s5MrJdcMEtX6v+zP4L97yXHErrea0O TePw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518299; x=1732123099; 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=wDSyRePK0ZioZyeNhXDT45o3z8pIP1oRwjHKVCbyFfc=; b=o2SjLrYKKMjYwifnpYYx9yaKWYw+cMrSSTuVoTUs7rItrYM9gIcQtyHmV79IsI6nUk 7l1TjQeDigbVMFpXwAXiPzl5s2/3le9GSp8qk52oWKN1Ea+51d/WwtOMDYB6V6riiAE6 aLR1R0fQi6LuDMMKGfNCnmM9/mP5p1Be3nRfEHTZnGDL05dqdzoq502WWAe3nVmpvl8W o2j+2qnIAVSDfJEuiGjIXQjBQc5D3Vzvx490TjzwdfurvVDSFEtH78O9r2dOpdHpHHrz QHdyolEKw12l3OVopWPYZaU/rz32nI84vhBXPdPdpHT0xhsFQNLQaMehanFcz18gGt1y bMCQ== X-Gm-Message-State: AOJu0YxrM0EjjvTbXi5WowDXe4u2p6Rgl/RSnsfN8qfhcBQ4EoYSGCku +reqbGGdITtQS/dTjRLzbO9Z239cae5xZcZlOY0fN8pfYdj3dUC7MPFx7ktRms8RG9y1tXu+D1v r X-Google-Smtp-Source: AGHT+IHJb0RtUnogiD3Wf4efT62Rwq4GmsCPMhd464qj9dPqTkGPhHxvfC787jAErNqllYGVzzZDAg== X-Received: by 2002:a05:6a00:398a:b0:71e:59d2:9c99 with SMTP id d2e1a72fcca58-7245796a1ebmr4371542b3a.4.1731518298988; Wed, 13 Nov 2024 09:18:18 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:18 -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 for-10.0 5/9] target/riscv: add shtvala Date: Wed, 13 Nov 2024 14:17:51 -0300 Message-ID: <20241113171755.978109-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42b.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 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 --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 11a0d2d04a..7b54c50794 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(shtvala, 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), From patchwork Wed Nov 13 17:17:52 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: 13874021 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 EC3EFD637A1 for ; Wed, 13 Nov 2024 17:20:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0o-0000Hn-1i; Wed, 13 Nov 2024 12:18:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBH0b-0000Cd-HC for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:27 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0a-0003mN-2N for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:25 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-71e681bc315so785640b3a.0 for ; Wed, 13 Nov 2024 09:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518302; x=1732123102; 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=LoLy9V+Tq0tnbCkjsd2u8voyf6dYjq7HZXIKxiU3iJw=; b=HD4zDiuORj/FkrBGSJWMWawRmJmLULCZqaVhUpwzozDVYToWjr3kHvi0MXsgxMhDMo ksaCw9Ey+5UdxIhSEMobnjeSpOaW8NvZpZtj6z9oDpVbMzRXhEL83UP99Tqs8kftqAX0 uUkGDJlnBAWF8nQd9ZlXAEOMW8h8/+xRXfK+aBNZtSrdwkKPKgPj2kSQSOB3FCtEoOgR qU2WTOi6ROW4TtTjloTQeRj/axZwpkh4c7OVGHCf1Vh4sIxYAYxjLi0eAF61N1ZgatnE V624Q0WjXQ8XFpVzDPhJ5CFePfxwSoNS4xXhHMTNgy5Vj6tcO/VO22Q0d1SL9EMR1ty3 Ps2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518302; x=1732123102; 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=LoLy9V+Tq0tnbCkjsd2u8voyf6dYjq7HZXIKxiU3iJw=; b=CV9LnA8Xd4r20tKD9ELDMiYhB0OJepDIVwZ5C8EEr/OepBJzZkKSuHts2WrcF+mZax /jMcXS2Z2tYC7hbLz40IAr7W5LbajqfJr22gVGLj2AuxBOMrxmhDHYE8XgFPZxJBR9PF jWfTDsyhIqlIfjBSzXY1PP2GsZtmrJWIoB5CYRNoa5boOE28rpiOvxo8UDFAy3vnC1Hf /7JYpoy6oKGPJIoHtrWSn+HRbI71e6PnDy5oh3Fj+RCYiZAHHIgqLsskARmb6kFg533N ELjsWgLO4cOkpoUnBTgkrf9B0PwdnAkW/iSf9g5sC0+yNllYn7OwiomdODInynTUUesT 0QTQ== X-Gm-Message-State: AOJu0YxrdYOYmCoEbqicCuRjXd5JA8NJPfYGT8DJV838E1mrFfEEWpyy /z2yhDIYQMO7o+vUFQS0dGdS6heQrkKeyiDBhUVthQ5jKLBEFdX9akzYkFvVCWje5oJK1HvpzJs S X-Google-Smtp-Source: AGHT+IHJ9NC6KYJGWIvBLOHzPYaeuYNzFbU7byjzc6s9fsnw2f3c2yFYQZUb7BuXfb5soFNoHN098A== X-Received: by 2002:a05:6a00:3d0c:b0:71e:71ba:9056 with SMTP id d2e1a72fcca58-724667936c7mr149528b3a.10.1731518301880; Wed, 13 Nov 2024 09:18:21 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:21 -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 for-10.0 6/9] target/riscv: add shvstvecd Date: Wed, 13 Nov 2024 14:17:52 -0300 Message-ID: <20241113171755.978109-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x432.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 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 --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7b54c50794..ae5676976b 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -186,6 +186,7 @@ const RISCVIsaExtData isa_edata_arr[] = { 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(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), 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 Nov 13 17:17:53 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: 13874020 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 1CD43D637A2 for ; Wed, 13 Nov 2024 17:20:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0o-0000I9-AQ; Wed, 13 Nov 2024 12:18:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBH0g-0000Ea-IM for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:30 -0500 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0d-0003mm-VI for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:29 -0500 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-7245a9d0e92so802353b3a.0 for ; Wed, 13 Nov 2024 09:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518305; x=1732123105; 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=wjMJ6Uq7LJenMqOe2Iuftby9TyEVWwxqXl1Fm+TaTQ8=; b=jf94k9vKt0jKCgEh4w0RhTsoqC39dTEtsD/83UKDR7OXaLigZK/b8Z+pHWnulnX5l5 w5OcXyOiL0Re1u7ZOmXKPgwxi3cN57Y3kEGAPUG8p/njSvmzKdYsqzwAHMXq9cWccYyu L9INU7EGqbHYtD0mb7IIlxkZvsYnmfsmRpbqR1BX08DVtLHYAIZM+c/CfWuAhkLeqPn1 UuuOmqynrHCVgjyUEFMvw7/5iOQjejHGkRldsufGxIi6ebxuRs4VPCbRJohZ//+fNmKI o4uRq/W/xDe0LoAYFHDtw11Rpn8l2enzifBGV+1ZsgyUFsWwUOOsNnKBsUXvlOO/yFnB Y2Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518305; x=1732123105; 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=wjMJ6Uq7LJenMqOe2Iuftby9TyEVWwxqXl1Fm+TaTQ8=; b=IpPOgUO4Rrz6fWKigMVKJzEyMMFL6ixbOCTVg7Mash+pLwe9Vk+Nkmsa6irPY8SxwO zQ6mFyEjh4bSXeh1aa3OCxsRPUnRR/OC04xhUu4FUgb9ll2+6DY205JmkJ2IgvqQvHZx Hkve14xwrd6BqAsQ9i7Ig98bQi84trGoBNR7LOrSv9SrL9VVrpY5TDGcp7ERSHTTWAUM F8YcKOixA7PXKr0+O22Uvp7SJxoxpw5lUrj+yHF+YZZNcKTFBSUNFI1WANG93MprLXYn gnBBrSD6h1Eqq/iK7jJ3aK4iWMooe4st1nRkcMrHB2Zq1D/fQl+oT3WL8cX+ik2ds2Wv UmSQ== X-Gm-Message-State: AOJu0YzG4U+zUZODk7eslxIDZD3LA+w4jRyOuF86X+Vu2FzGu/WaCJnF fjVmq/ab7MJmKr6JBd1pV+Cd43KscEZNlCNcm/Ev7KbnJ6LK9FeHQwoxPPEnZ5RBuBS+aokvbOe v X-Google-Smtp-Source: AGHT+IGarIYB5NsHnbu2KyN/DKWvMxd7PL3UHYhfdroQD5QPsRgaAs9djSjpQ2rcRRGlDT+6fQi1tQ== X-Received: by 2002:a05:6a00:998:b0:71e:3b8:666b with SMTP id d2e1a72fcca58-724579c5ff7mr4404549b3a.15.1731518304940; Wed, 13 Nov 2024 09:18:24 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:24 -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 for-10.0 7/9] target/riscv: add shvsatpa Date: Wed, 13 Nov 2024 14:17:53 -0300 Message-ID: <20241113171755.978109-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x430.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 --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index ae5676976b..068b019564 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 Nov 13 17:17:54 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: 13874022 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 EB762D637A1 for ; Wed, 13 Nov 2024 17:20:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0o-0000Hg-1h; Wed, 13 Nov 2024 12:18:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBH0h-0000FN-OM for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:33 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBH0g-0003nJ-BQ for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:31 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-21145812538so66631935ad.0 for ; Wed, 13 Nov 2024 09:18:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518308; x=1732123108; 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=/LTsgycx238NK4SFPWzXaAV3vV2r5w2wkO+45OR4ay4=; b=MR1kcmN/aU9MSI16Fsr2YxjhkGwGRVcuJsUbEnA8p80yuuW9GbFbi1XJEuFb5HeqsH VRmUZF4zPPyhZd1On+djI+wxU+5O/y6e4he8BTk8CT348veTKCVUiGdD+y7uUjTq7KhG qzQgGXfBKil5vPmKad604UE5H1G1PHjQwR2uIZUsrXZ46WC8F8XYBVbDN59w1VbPutM0 NDDZOUSuEHOKr23yBIvLRsWb7FjSBQlwH7CuPw12X/ijJZQsKtkyjy1e3pFjk4yorjmo ydG+2SxzBNkDvY3r1nEM284VRQW9myTPd8MxqIdZ+Zq0KUbsUjmzRMX1zZ0xJHb9kZ1q mTAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518308; x=1732123108; 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=/LTsgycx238NK4SFPWzXaAV3vV2r5w2wkO+45OR4ay4=; b=I+CfpwiI+umh5SFmGeNziH6inE/+KqkcYSiyaltAI26VIM1AfCzV8mo4JjogYHvrqp gXX7aWYcJlN69Mc0n5Vg8YWg9pRLTO2fljQb0a5+KycZgf5cPn0o1cUpvOsmHk4qIP86 DKONiHSZcobbOEjyW3l2PYBTZ27eoibchhmGBQ2FUunHjVH8YDFX0YbXlPawgpQqs4lv qAH0p1SI2P1GtgMIpriYt1qSkaWOVJruKY1leKGyi1uXRzoMYjSjQemPa6Eg3XjYtVco Y3UrFwBw+sfJnJNizlofdxjbbT0W2dXC2CJtYytf3hlT9/XhqNaVgPCd7OkwdMyxIgKf e1KA== X-Gm-Message-State: AOJu0YxGkN/Tg96+JosiQZmnZl3bLw9SpRThSidUe9gw8GA/8uTVi2gR cAE5kCws/FutRW2dS0HIsq5GTK01Id/6LsDAPuHHZN7XYDyLm36Ky1erXFcWBu86oRbyx8dJ2T1 1 X-Google-Smtp-Source: AGHT+IE46CKv1B78UNZ1wO7vYUtMANQLWLDQsMfCdeOccvO9k0FH0UO3K8gH6qHUApStNTUWLmzu9w== X-Received: by 2002:a17:903:2448:b0:20c:f27f:fbf with SMTP id d9443c01a7336-21183ceaa93mr302841835ad.25.1731518308018; Wed, 13 Nov 2024 09:18:28 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:27 -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 for-10.0 8/9] target/riscv: add shgatpa Date: Wed, 13 Nov 2024 14:17:54 -0300 Message-ID: <20241113171755.978109-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x634.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 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 --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 068b019564..fff7010647 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 Nov 13 17:17:55 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: 13874018 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 7F2D1D637A0 for ; Wed, 13 Nov 2024 17:19:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBH0q-0000JL-JN; Wed, 13 Nov 2024 12:18:40 -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 1tBH0p-0000IO-B0 for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:39 -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 1tBH0n-0003oK-Fm for qemu-devel@nongnu.org; Wed, 13 Nov 2024 12:18:38 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20ca388d242so76068835ad.2 for ; Wed, 13 Nov 2024 09:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1731518311; x=1732123111; 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=vIAieBmW047uDIhnx+/2hQRCiiVtdno4nQvJZeYlWlw=; b=BT0qVAJR6WGH6IWofvXlAz4cjIcXmi8nwZOhJ6b8xdt7DUnYaj0udXzl3EeTR5yfEi sH90Frvlib1vvVcqGaBOHnEgRZsbTZkd9kgIwTxn9AurinPx188GsbdxI1x0VDHuv2WW dmMS88M7QSMEC9+Oo0EIkmKoW6vLhpI08iq10R1S4TgXYdgP+NFjqhJv3iYKjdst4Yhr veXJagLco3ddR01YJBiD6KoXWNJs3GzdH5cEteS5f2K5Ml63mzw5aoBW7gL8/GUupvCH I0SMhm8ZF2fAYw676kfK0UGZlVamWcLDMknWrdeWd32xCgoKY2c0e80zfHvn274oCTCj /N9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731518311; x=1732123111; 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=vIAieBmW047uDIhnx+/2hQRCiiVtdno4nQvJZeYlWlw=; b=o8ZIBVH/nm22q5NDwmUu4u8+peaKiUoDTHNZFakXA9eBjg82uriz0Nt9yI7cfswk48 PoDgw0nzoc4QJX2j4EQSOJZkJRjiGjhnvfKcUJoktR4xPyMbczLXywP4oQw9yJkzj8Er Jnj9HKer0MuChxhQobp960m7BB4109ci+OBNceay8Ts1naVj4Ipf66PvF42ZjeLu46QG ym8YkWxpXE3eqBjADbDGKBwoBxrQw/a6COZvS0x4HYS4LE1Kag2tMmkLBIUtg6T3xyNW D3vE1BKHhTuHyxn7GNdIy9t6GPhwWDKMLH6fdAGfsHGcRej0G7hFr74/mFDN6+f2fhdj W/wA== X-Gm-Message-State: AOJu0Yy2pjaI7GL25pZ6b9darYec6WcD3kDNnzSd/Jmg7vIRQfPvXu/Z ZDMYGxtXKyhfEzO4zyC6BQOzSo/WUjMrd+vWYHaMsfwZLLZJ2UMrN3m69LJMslkVo7neRqNvrS8 i X-Google-Smtp-Source: AGHT+IFe/3SzphQ+oIR09CWG8x7/OksudLrg4yNImhZ6X0SaI7rUytK+j3hL0ZxpDohmpU8948q6PA== X-Received: by 2002:a17:902:cf02:b0:211:6b68:ae89 with SMTP id d9443c01a7336-21183e6e6f8mr245130165ad.54.1731518310842; Wed, 13 Nov 2024 09:18:30 -0800 (PST) Received: from grind.. ([187.101.65.72]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a9063sm13392889b3a.75.2024.11.13.09.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 09:18:30 -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 for-10.0 9/9] target/riscv/tcg: add sha Date: Wed, 13 Nov 2024 14:17:55 -0300 Message-ID: <20241113171755.978109-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241113171755.978109-1-dbarboza@ventanamicro.com> References: <20241113171755.978109-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 --- 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 fff7010647..a8b8c9e775 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), @@ -1615,6 +1616,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 c7bf455614..7c60a5becb 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -140,6 +140,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 0b9be2b0d3..b06638cca4 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)