From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085133; cv=none; d=zohomail.com; s=zohoarc; b=k/xEyIUCGqyjHx6lF7f1kVyu8dzIoCx0xNbzk4NooHNvpogamENJdAUpDRXHWwEHy6L9f79004mVFllVwBIysk1wGrKKITWqAUjAI1FFkqoOmoXT/4qyo3lCRMFX4nZIn6ZyvY6FsJMUjhLCMowh8Z2MyxquCdl3DlKl09Tv43U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085133; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=O6Cx6hq+HUMRF2lU3ZU7j52Tu06FE50ccwBQOiQWWbM=; b=gunKfh+kMlWl+tog0EJheFbPZNEQM5dBu6OtvdRwH3kLJyL1UaXgVH6g0vFkyd1g5Dj6YFzq2NaZ2KLwxd5KYscuffwTXu3r23voe6zjVYvtHT4eX+URMnOVqe3kuviJNeZAgoSj7k2H9rVE2SJBpSmfotkF+epxOWG/kJwGcRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085132923835.8366193577181; Mon, 27 Nov 2023 03:38:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwF-0003p2-0J; Mon, 27 Nov 2023 06:38:07 -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 1r7ZwD-0003nz-4L for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:05 -0500 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwB-0005Bz-3u for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:04 -0500 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6d30d9f4549so2541369a34.0 for ; Mon, 27 Nov 2023 03:38:02 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085081; x=1701689881; 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=O6Cx6hq+HUMRF2lU3ZU7j52Tu06FE50ccwBQOiQWWbM=; b=bbCEB7B6Hl4S+4Ia+bECS44EzvvUFNgEke8eKGYSc58vWFGuFEIi85vG697K+KMlMP 3ZVGP9+X1bF+BFcskSGgsMNfhnuJEEyhkGBG5xdZHpMMIbO0uOBSA8ykFKhCynpdDXUA uCbaFiyISbOO7cjHtnXsJJpLOFIa0slvLq9EV15L/6A/tPlo7x74xO6GkfPpx73TPoNG Z6VkTZXJdXlwWgzUR4my7943FfOO8QG9USqIOUTqwmWkfbjewnImhpcNa+gq2mBAuM6S XoFfyKAVDGrvlGBLvBx+rOvVjP9ODEjpnOTN+5EruJXC95k6wOgbKFsG21NW/bsR2J6u lzvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085081; x=1701689881; 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=O6Cx6hq+HUMRF2lU3ZU7j52Tu06FE50ccwBQOiQWWbM=; b=wSIcFtODAfHIs54Z6OmxCow/4jmp1SeRZHfjHvMPxV/EFQmyti4QzPFwkRKTrEEn+H dz6NJVj7UMtqSC/mMriowXoUecCZyf5ZpZcNTTpaR6w65Hc0lORoBGslIwa9bRm3OQmh 29yZkiPzJ7onCuD7JybvaRWwkjkfUwnFKm+U8A7h9XvClrrlyF1jGNezLEWao+1Bk+z6 juj64jKcpdH5BnkIAmEtM5fa01QTx0kAooJb/SX/N8h47tgJEbOyN3lGMwMH015oXa3a a++ffvjMeU0iTyLIRmqFWaAnQgbdWXxWDuUIt9bFhQK6CbhaKQOFUfFsIVsd1D71bmAe gBWQ== X-Gm-Message-State: AOJu0Yzy19dW2qaalCCaHFB7CTbqgPQE/j1vLDo6CXWj1PlBA7ru5hul b3iH04cbV3VTakePd0o9HLFrbfXxFrvbOX5KbVk= X-Google-Smtp-Source: AGHT+IGQoFqV3mXZFUhqqVLE77karmypdPlxVzdSMzHU6nlgAE8hcuMmyxCXTLlu72YlMdSRJDyyxg== X-Received: by 2002:a9d:654b:0:b0:6d8:1c12:4863 with SMTP id q11-20020a9d654b000000b006d81c124863mr5936576otl.21.1701085081465; Mon, 27 Nov 2023 03:38:01 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 1/8] target/riscv: implement svade Date: Mon, 27 Nov 2023 08:37:45 -0300 Message-ID: <20231127113752.1290265-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x329.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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085135582000001 Content-Type: text/plain; charset="utf-8" 'svade' is a RVA22S64 profile requirement, a profile we're going to add shortly. It is a named feature (i.e. not a formal extension, not defined in riscv,isa DT at this moment) defined in [1] as: "Page-fault exceptions are raised when a page is accessed when A bit is clear, or written when D bit is clear.". As far as the spec goes, 'svade' is one of the two distinct modes of handling PTE_A and PTE_D. The other way, i.e. update PTE_A/PTE_D when they're cleared, is defined by the 'svadu' extension. Checking cpu_helper.c, get_physical_address(), we can verify that QEMU is compliant with that: we will update PTE_A/PTE_D if 'svadu' is enabled, or throw a page-fault exception if 'svadu' isn't enabled. So, as far as we're concerned, 'svade' translates to 'svadu must be disabled'. We'll implement it like 'zic64b': an internal flag that profiles can enable. The flag will not be exposed to users. [1] https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 1 + target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3a230608cb..59b131c1fc 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1445,6 +1445,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_e= xts[] =3D { }; =20 const RISCVCPUMultiExtConfig riscv_cpu_named_features[] =3D { + MULTI_EXT_CFG_BOOL("svade", svade, true), MULTI_EXT_CFG_BOOL("zic64b", zic64b, true), =20 DEFINE_PROP_END_OF_LIST(), diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index 90f18eb601..46b06db68b 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -116,6 +116,7 @@ struct RISCVCPUConfig { bool ext_smepmp; bool rvv_ta_all_1s; bool rvv_ma_all_1s; + bool svade; bool zic64b; =20 uint32_t mvendorid; diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 04aedf3840..e395e2449e 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -188,6 +188,9 @@ static void riscv_cpu_enable_named_feat(RISCVCPU *cpu, = uint32_t feat_offset) cpu->cfg.cbop_blocksize =3D 64; cpu->cfg.cboz_blocksize =3D 64; break; + case CPU_CFG_OFFSET(svade): + cpu->cfg.ext_svadu =3D false; + break; default: g_assert_not_reached(); } @@ -381,6 +384,8 @@ static void riscv_cpu_update_named_features(RISCVCPU *c= pu) cpu->cfg.zic64b =3D cpu->cfg.cbom_blocksize =3D=3D 64 && cpu->cfg.cbop_blocksize =3D=3D 64 && cpu->cfg.cboz_blocksize =3D=3D 64; + + cpu->cfg.svade =3D !cpu->cfg.ext_svadu; } =20 static void riscv_cpu_validate_g(RISCVCPU *cpu) --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085170; cv=none; d=zohomail.com; s=zohoarc; b=TyeUHr5bjTy1WPEzoJVdmR7xD37by13OhLliR52CSd0xIuGCUWEbo2iDrFb7p2w+M2mn6g3lBopOBAtTi8y+2/2PoYuom0oyOnzbrpTypwfusgRuDOwvPFrhV/GZiy7VAEHG3zKA30/H0UHmJcB3tCNyxpUguPopESXO54eCu+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085170; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dGNqscTm0j47pNh5vB1J02Wn8NgcJ09lbo8OaJQCkt0=; b=KkWVzZ8b8sz5SF0a+g7PteWn3sOk/pYXt4PE+M81jia3ohdj9qPB2i10W8VXGYF/C1nK5WmdHIMYcXepgMohev08iWqJLbMJDR9CAUa31g+g+zRmw/MJabvd+sgAY9fealS49vDWNIXGyxSCIG4IYSTS/y0T1QtnNVLvSuDqiRw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085170659326.1968910705506; Mon, 27 Nov 2023 03:39:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwJ-0003qt-1c; Mon, 27 Nov 2023 06:38:11 -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 1r7ZwH-0003qD-4C for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:09 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwE-0005Ge-4x for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:08 -0500 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6d7eb7ff384so2693403a34.0 for ; Mon, 27 Nov 2023 03:38:05 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085084; x=1701689884; 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=dGNqscTm0j47pNh5vB1J02Wn8NgcJ09lbo8OaJQCkt0=; b=okmEcH04fRHdKvmeVgga+gfgEMNxdoPI+kpEcfR38/CpS75Xwk7xz8/efhZxrWOvxr yGwkLizcqAHCo1IJysQZSQ/jSqsKjui5JD7t+Xk2mbr5QV4Ve5USCbtiL5gGKtCvuWkw wlpj8VjPGR5iKeRr7PRGIPQgk2A8ffClOhhtlX0woXHBNTDv43jjNrBK2uCvNbGzdDld LKFmCOolpzcEhAe9gl9HgxnfEH72XBB5cinp9UC5L9qOGeT4FQWgRTeWeyQ+uFLPsYj4 O3xDC7q8GqnbaW+tjusYqTqLSnEopfYz2aKTyg3o7KsqvCFMGz8cpC9ShJdOsxuvmAm0 1nRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085084; x=1701689884; 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=dGNqscTm0j47pNh5vB1J02Wn8NgcJ09lbo8OaJQCkt0=; b=xFwDvk5FhqAR1ukem9xPFjwNEl0BMKdHyUf7egIO0Z/XfjxTVHb+A4f1npWRxdpREN YWgnQk3jXmI1Gmfy/jG1AqhX2WbJ4JR7zZ5sKblW7sRrkvRaXLX9Gf5A19KYvtJR6lY8 iMf1YLT8DD2h2I4lB+mAc7LOB3Qb6LVg7PPyIJ0NNbY/8qW8ouB2yKXh7YRjGAM4Y9M8 iUju6HUD0G8//TvJ5EOiqbvsAzNKGhjwTgu8piM97TE12/+poIzUi+lxRWcjFFWKSgSw i16A8+Mbzuphecj6rQTRKF4amsU5Tl6EtRC8MW+vrGP9y78D+eyKMqSAS25bMtCD89/g 2Ysw== X-Gm-Message-State: AOJu0YzqLzqsQsfRlTXvwu71rMAA7nBD/cq3YyW11MVEz6EGXXZR0SbK jh0qmamKJaVV/IktNL4/2hnMe5wvhPuc20d8/Jo= X-Google-Smtp-Source: AGHT+IFO4nub4CFKBoScddwqgyPE6APX3r3t2ZJRaunzsq6VUBtg+zRYPgER0EHbQVKKLXXtv0mLkg== X-Received: by 2002:a9d:6c90:0:b0:6ce:2789:7195 with SMTP id c16-20020a9d6c90000000b006ce27897195mr11117799otr.31.1701085084503; Mon, 27 Nov 2023 03:38:04 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 2/8] target/riscv: add priv ver restriction to profiles Date: Mon, 27 Nov 2023 08:37:46 -0300 Message-ID: <20231127113752.1290265-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32b.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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085171504000005 Content-Type: text/plain; charset="utf-8" Some profiles, like RVA22S64, has a priv_spec requirement. Make this requirement explicit for all profiles. We'll validate this requirement finalize() time and, in case the user chooses an incompatible priv_spec while activating a profile, a warning will be shown. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 2 ++ target/riscv/tcg/tcg-cpu.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 59b131c1fc..29a9f77702 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1537,6 +1537,7 @@ Property riscv_cpu_options[] =3D { static RISCVCPUProfile RVA22U64 =3D { .name =3D "rva22u64", .misa_ext =3D RVI | RVM | RVA | RVF | RVD | RVC | RVU, + .priv_spec =3D RISCV_PROFILE_ATTR_UNUSED, .ext_offsets =3D { CPU_CFG_OFFSET(ext_zicsr), CPU_CFG_OFFSET(ext_zihintpause), CPU_CFG_OFFSET(ext_zba), CPU_CFG_OFFSET(ext_zbb), diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 5ff629650d..1f34eda1e4 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -81,10 +81,12 @@ typedef struct riscv_cpu_profile { uint32_t misa_ext; bool enabled; bool user_set; + int priv_spec; const int32_t ext_offsets[]; } RISCVCPUProfile; =20 #define RISCV_PROFILE_EXT_LIST_END -1 +#define RISCV_PROFILE_ATTR_UNUSED -1 =20 extern RISCVCPUProfile *riscv_profiles[]; =20 diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index e395e2449e..4d25fc43d2 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -74,6 +74,20 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint= 32_t bit, } } =20 +static const char *cpu_priv_ver_to_str(int priv_ver) +{ + switch (priv_ver) { + case PRIV_VERSION_1_10_0: + return "v1.10.0"; + case PRIV_VERSION_1_11_0: + return "v1.11.0"; + case PRIV_VERSION_1_12_0: + return "v1.12.0"; + } + + g_assert_not_reached(); +} + static void riscv_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb) { @@ -755,11 +769,24 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu,= Error **errp) static void riscv_cpu_validate_profile(RISCVCPU *cpu, RISCVCPUProfile *profile) { + CPURISCVState *env =3D &cpu->env; const char *warn_msg =3D "Profile %s mandates disabled extension %s"; bool send_warn =3D profile->user_set && profile->enabled; bool profile_impl =3D true; int i; =20 + if (profile->priv_spec !=3D RISCV_PROFILE_ATTR_UNUSED && + profile->priv_spec !=3D env->priv_ver) { + profile_impl =3D false; + + if (send_warn) { + warn_report("Profile %s requires priv spec %s, " + "but priv ver %s was set", profile->name, + cpu_priv_ver_to_str(profile->priv_spec), + cpu_priv_ver_to_str(env->priv_ver)); + } + } + for (i =3D 0; misa_bits[i] !=3D 0; i++) { uint32_t bit =3D misa_bits[i]; =20 @@ -1048,6 +1075,10 @@ static void cpu_set_profile(Object *obj, Visitor *v,= const char *name, profile->user_set =3D true; profile->enabled =3D value; =20 + if (profile->enabled) { + cpu->env.priv_ver =3D profile->priv_spec; + } + for (i =3D 0; misa_bits[i] !=3D 0; i++) { uint32_t bit =3D misa_bits[i]; =20 --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085168; cv=none; d=zohomail.com; s=zohoarc; b=HlQmDX0N7skAjvqoczxFLP/4y6NJpWMd7oi1/KuK790yhJI5dW/auP0RUqvDoRfbG1IFXF9ZY3EpnedZ72e8gbCUWZXoPzvtRIOsCswWkj9Y4qrqyWKVFi/ByXEBfolCR9UtxDLrpm59erO0/kndAAQL0uGzRq5rd+MnVi3ooc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085168; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IFIiKbikcqzRdI/piBFTJ1Oi22cwo4vdUZE7XSpcBYM=; b=RON4ocBLdd7Ezv8+4C/ueinctTlF1klGEkeCsKWRMMgkYX4roiMj8Vn2OCSJaE/ZjqXXeevsiFdyoiSyUPwrkKmrdjPBuRN3ufYQSVgm7xMqMVH8ZdVY3aZvBwRwFyF6y5PnghekoMT3pXyaeQEwQ+wzQKR0ilYwSOatzn9OH0U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085168104252.33619328475754; Mon, 27 Nov 2023 03:39:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwX-0003x1-Vi; Mon, 27 Nov 2023 06:38:25 -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 1r7ZwX-0003wU-4v for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:25 -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 1r7ZwI-0005Jm-CJ for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:23 -0500 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b20a48522fso3110119b3a.1 for ; Mon, 27 Nov 2023 03:38:09 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085088; x=1701689888; 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=IFIiKbikcqzRdI/piBFTJ1Oi22cwo4vdUZE7XSpcBYM=; b=kzr/ecxw4nXAxdhDJVnAx9qv67J25qEFYlWoKJY5jKKxIgHy7W6wF/7u6nnh/ulP0Q V/Nm+f7nd9pmFTOgP7JiWUltC4LepYAqfKRTGtVA4Ip8xC7ap8UWeP1Hnp+CgSYnz1zf fuGq9zpyDxyNSWWoonEYC+Q3VcDLAV7bETYEKULNbyydAXLzaz6tY3hcdZNTIc4FqCA3 LbH7lyYkNywJ9IkAtrvHRMwrwHA82T1RoCkoWcc3lEDDf5W290xXzqax0Q2/7lL5B/kI raNosJ3Ktwns+tSuJzxw+qyj6ch6FRAagVLlkKf696CjYCPYqZAy1zUqSMRi07u2mXae ULWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085088; x=1701689888; 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=IFIiKbikcqzRdI/piBFTJ1Oi22cwo4vdUZE7XSpcBYM=; b=KplJx5MaDEew63yjhri6xwQaFZDHD4N85AMLAXh6Ap1O6UKXbJzIDxafpPyptkTt8k R0E/rU8r2N+g2FG9d84HVojpaSPcjn37weZ/QfH6GLuoPgh1hq/HM//aTrVS0T86xJvl bsIpyYq24YKRavwg0q0YftAwLb9vUEtQHmX14z+3eRqDdRwhoh6a0H/MU8cByBY+huH1 wf3j8QZ5nPIR2LVFr3VmEo/1znlYHxKNlVkQSbeO0/sD2DmbLFwv5IZKBcrak7gAY2r0 jzxxdW8A9+ZKTjxMfc3tgT+3ZuwqOvRTmJBXAMLRhb6m/s6o4b1+c23564B3p7T0rBVi HUQw== X-Gm-Message-State: AOJu0YwmxU5RD0I2T6wJL9JoF623VuM5+qRelF77febxAvPcUo4mjA8S O/xuBkVRNG/bSPjQS0mKexTltrWM+0gK7oV3NSU= X-Google-Smtp-Source: AGHT+IEJOsY0Ijav334YjzFjvVmEm0ItSdN6jcFbWMkUAm/F85jAFNAPaRBqYOSeCY4oH4z/ILmqMA== X-Received: by 2002:a05:6a00:1d24:b0:6cb:aa0a:6fcc with SMTP id a36-20020a056a001d2400b006cbaa0a6fccmr11988718pfx.1.1701085087676; Mon, 27 Nov 2023 03:38:07 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 3/8] target/riscv/cpu.c: finalize satp_mode earlier Date: Mon, 27 Nov 2023 08:37:47 -0300 Message-ID: <20231127113752.1290265-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085169380000001 Content-Type: text/plain; charset="utf-8" Profiles will need to validate satp_mode during their own finalize methods. This will occur inside riscv_tcg_cpu_finalize_features() for TCG. Given that satp_mode does not have any pre-req from the accelerator finalize() method, it's safe to finalize it earlier. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 29a9f77702..a395c77bda 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1056,6 +1056,14 @@ void riscv_cpu_finalize_features(RISCVCPU *cpu, Erro= r **errp) { Error *local_err =3D NULL; =20 +#ifndef CONFIG_USER_ONLY + riscv_cpu_satp_mode_finalize(cpu, &local_err); + if (local_err !=3D NULL) { + error_propagate(errp, local_err); + return; + } +#endif + /* * KVM accel does not have a specialized finalize() * callback because its extensions are validated @@ -1068,14 +1076,6 @@ void riscv_cpu_finalize_features(RISCVCPU *cpu, Erro= r **errp) return; } } - -#ifndef CONFIG_USER_ONLY - riscv_cpu_satp_mode_finalize(cpu, &local_err); - if (local_err !=3D NULL) { - error_propagate(errp, local_err); - return; - } -#endif } =20 static void riscv_cpu_realize(DeviceState *dev, Error **errp) --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085137; cv=none; d=zohomail.com; s=zohoarc; b=WyGFAZv+oLDcRnqj67HVACaiZce711IBoY899zhgKixZF/cdIg84nwebrCADcpLgooQYcWum0NUUiKNatttIFMPejR2qyzUEBpeiNaop0SnTzRt/jjd4ItnVuALKwDTgFj++LoXaAO9cOziJr1LGSjedEVacve0wVFPCrpFdxvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085137; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4laNBhxjdOpN77Tvpdchd1EPt51g2nh+UO7IavgEcW0=; b=BQFzT0ue8WLeSeOeUmbuR+vk/IpwzlXRBW3yDOvtYoJ5WU2dFuK/ce1EY4nrTV20xKSWoUehI/PKY22fdep3AGgsTpuugZPhyYzXta++ETv2YMrmLS6GCLUaDGOHgGBTE9kyPs6S9N3iX0AY0FSr2KXjSg33fa14WTKruu1740Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085137222716.842477149584; Mon, 27 Nov 2023 03:38:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwN-0003tO-6X; Mon, 27 Nov 2023 06:38: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 1r7ZwM-0003t7-42 for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:14 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwK-0005Ki-6E for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:13 -0500 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b8603e0fbaso931480b6e.0 for ; Mon, 27 Nov 2023 03:38:11 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085090; x=1701689890; 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=4laNBhxjdOpN77Tvpdchd1EPt51g2nh+UO7IavgEcW0=; b=RK/R6uieFmz4KkoT+t1uqVd3GlWFq1RVURPqlfOh9pBWD8/DKFkgXeyb8w+37kEhaV m4sFRztPxBGjHwRdKi+E/JCD/0aPdOi6pbNfdz4o8iD7MQat0rBgAoWU27p2XuikB9Sq DpJQhLJjwVifHxeU1n5jNjoFYDroPnH5V+YujR/0djlVRRrIIElw6zyWfxs/uZVoLxKP NXPVxXdYnrAUBWQUn+cNT4Mp5olifESS8F0CGDciynXRASQCKycpoo6R+bQlMigDfpyl 2SS+lR8FsjUmTJUgjYZSMp+nRIcF3ikS/BQTLQ1IYzrI8M5wAfPAbvJlaCCIX0OFzzlc g1IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085090; x=1701689890; 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=4laNBhxjdOpN77Tvpdchd1EPt51g2nh+UO7IavgEcW0=; b=KcTO948R9Xca4oxvyPgqUp15ttmvs/gsUwbUtW63y+ZgLKuAXububRwZhGc0VaWAhc RWaGFCBp4IbKMB7CyQY27kk/wdFLRsysLE8aUZVxipPDYN0GF3h6UadbfTOBTmDR4JQc M2H0HqvWsKChypqzQB9rX/bW3P+atNNzjWhf2Tui1b15c5L1ZKbOEDXGd0fRiE9wSL83 EymTrbpINjaP5b/NiC3BwipI4vHAm52MM0qHdpwfOAs1qv/Oph/paUQwOwSUaiV7B7Ve sd+3sO2huqObf3Lyp7bZi41QS16iz5yHHs2Q7R9eAQhETHnd3LKTBi8Q1dOHV0YJs9Sn ot3Q== X-Gm-Message-State: AOJu0Yx+zsibioaZA2yHVYqZWBpI3d65fjZDOR9dZq3wCI1SET6uk0Zd VQpfIBReneo+PaKu/Ns+5gZdznl23tWMYTPNPOk= X-Google-Smtp-Source: AGHT+IEyJTK/0jwx7bM228cf01Q7fKLr1kfNQnjq6w/q78iiJG+lJWoJ2+SLpYADmuR/SssORL9APQ== X-Received: by 2002:a05:6808:1304:b0:3b2:f431:e02d with SMTP id y4-20020a056808130400b003b2f431e02dmr14712138oiv.26.1701085090711; Mon, 27 Nov 2023 03:38:10 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 4/8] target/riscv/cpu.c: add riscv_cpu_is_32bit() Date: Mon, 27 Nov 2023 08:37:48 -0300 Message-ID: <20231127113752.1290265-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x232.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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085139205000002 Content-Type: text/plain; charset="utf-8" Next patch will need to retrieve if a given RISCVCPU is 32 or 64 bit. The existing helper riscv_is_32bit() (hw/riscv/boot.c) will always check the first CPU of a given hart array, not any given CPU. Create a helper to retrieve the info for any given CPU, not the first CPU of the hart array. The helper is using the same 32 bit check that riscv_cpu_satp_mode_finalize() was doing. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/riscv/cpu.c | 7 ++++++- target/riscv/cpu.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a395c77bda..2b79fe861b 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -53,6 +53,11 @@ const uint32_t misa_bits[] =3D {RVI, RVE, RVM, RVA, RVF,= RVD, RVV, #define BYTE(x) (x) #endif =20 +bool riscv_cpu_is_32bit(RISCVCPU *cpu) +{ + return riscv_cpu_mxl(&cpu->env) =3D=3D MXL_RV32; +} + #define ISA_EXT_DATA_ENTRY(_name, _min_ver, _prop) \ {#_name, _min_ver, CPU_CFG_OFFSET(_prop)} =20 @@ -980,7 +985,7 @@ static void riscv_cpu_disas_set_info(CPUState *s, disas= semble_info *info) #ifndef CONFIG_USER_ONLY static void riscv_cpu_satp_mode_finalize(RISCVCPU *cpu, Error **errp) { - bool rv32 =3D riscv_cpu_mxl(&cpu->env) =3D=3D MXL_RV32; + bool rv32 =3D riscv_cpu_is_32bit(cpu); uint8_t satp_mode_map_max, satp_mode_supported_max; =20 /* The CPU wants the OS to decide which satp mode to use */ diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 1f34eda1e4..485d2da3c2 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -695,6 +695,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc, uint64_t *cs_base, uint32_t *pflags); =20 void riscv_cpu_update_mask(CPURISCVState *env); +bool riscv_cpu_is_32bit(RISCVCPU *cpu); =20 RISCVException riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value, --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085204; cv=none; d=zohomail.com; s=zohoarc; b=cU1gC0HRUIAhY97ypg/zdEG2LI6RjsLK7ClNN7gT2qcmE5Q4ChPblc/ilp1vuSzWHd9DG0cUkDA144sku/G867cmAgo3hksbNtAfBU6muTf3XNL1HXYj3kDuHE1izCmF9ify2xSY0oL2RGeEkpfVMFOu7+XIPp0VR4ESjwT49QY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085204; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/Pb1Caogol+24prXi47Ua7g4M4/tgt8iGoHokMfLRK4=; b=bNzN/uKPvg819rcOpnTbO5cOFIKzdrWexuixtCckm9iZ2O15EfasfeoSHjYtLlCqXyQ58VNXixKa9+aMP5oV/HWDX9bPipZUxR+BY7LeAy3pfTUtGZbDNwo2ojCf2HYXPL3XgEUJHs1yTqnTqDW7TTNJ6F+xnUrwcK8jkj42YAg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085204554397.0758339591389; Mon, 27 Nov 2023 03:40:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwR-0003vQ-JP; Mon, 27 Nov 2023 06:38:19 -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 1r7ZwP-0003uZ-Kq for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:17 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwN-0005NB-Sv for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:17 -0500 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6cb66fbc63dso2801585b3a.0 for ; Mon, 27 Nov 2023 03:38:15 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085094; x=1701689894; 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=/Pb1Caogol+24prXi47Ua7g4M4/tgt8iGoHokMfLRK4=; b=ozbjjnxJnL90LRMWazZvrT9Io7HLiA/PEvXkeej4ObPyeu5oABJeUYJdhLNmOdrPkq mk/tPY1DMYY+f3+TUX8AW1J6OMQByJvwWMvjjkMS4DMhfW5XcQ67DyDhH6iFVpVXDMqZ e1L+IiLq4+biKOg+QnIG0PsTy+jnoake+SUnAmzvuj+My149m2RD3sgyMtZaGxL/IYJL pnRvGKQAXTfTb/QUKErf4vs/2xqCASwQPM1PBzIXvkUbkXPM920K5M3Y0CZi9TEY8y2x tYtjTfRfxP7pu2ZWqNqOQh8knOth59BFagkOMPrLmaenOccAVW70xpIFoyEFAt3+lteq 2nSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085094; x=1701689894; 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=/Pb1Caogol+24prXi47Ua7g4M4/tgt8iGoHokMfLRK4=; b=KTq6izTuFjL5wE2XSslbLLEFKOBerSE029tICuEw4+lBK/NMl+X8IZF8RyybzDnmVM mp3KOh3k/5MN1XIcA++7Ngs0AckOdNhwPui29yZKR+4uNlJOA0/eBPE68wyQmW9gB4iL ToIIP60W17X9rv0z1b3fdWuPYrTFmF2j9C01q0Eu3s27cCM/6NfZhBDGx5yHWZrurrZ4 4BLckNTxL00SYpfXiWlweTBMXMLNAv/4Bmcq0rmfVtMnnp4fSyZcIipRXA6o11bQ62lE 2541HzKU/zpH+Eo8XYw++PfM6dcD/eT7KqJJ7qiUbbKWOMytUhk3kYfnmjESMDLAKBFx ktSA== X-Gm-Message-State: AOJu0Yx/o2+J/ex33j7UAbQ9EnLwMg0Jw1lrn1AgQ6eObjsC6afhOn+a yOujNQJpgpaPzXquIWsV2jtKj01usmxY1gZPcTs= X-Google-Smtp-Source: AGHT+IEXnuods7P5hG44eRu2clPUOdegcXXHHRcdn24r7dVT80PpFpIUy+EvmGPf//6JljbZ3JTs6w== X-Received: by 2002:a05:6a20:748d:b0:18b:594a:284c with SMTP id p13-20020a056a20748d00b0018b594a284cmr19542435pzd.15.1701085093736; Mon, 27 Nov 2023 03:38:13 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 5/8] target/riscv: add satp_mode profile support Date: Mon, 27 Nov 2023 08:37:49 -0300 Message-ID: <20231127113752.1290265-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x436.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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085206408000002 Content-Type: text/plain; charset="utf-8" 'satp_mode' is a requirement for supervisor profiles like RVA22S64. User-mode/application profiles like RVA22U64 doesn't care. Add 'satp_mode' to the profile description. If a profile requires it, set it during cpu_set_profile(). We'll also check it during finalize() to validate if the running config implements the profile. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 1 + target/riscv/tcg/tcg-cpu.c | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 2b79fe861b..a77118549b 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1543,6 +1543,7 @@ static RISCVCPUProfile RVA22U64 =3D { .name =3D "rva22u64", .misa_ext =3D RVI | RVM | RVA | RVF | RVD | RVC | RVU, .priv_spec =3D RISCV_PROFILE_ATTR_UNUSED, + .satp_mode =3D RISCV_PROFILE_ATTR_UNUSED, .ext_offsets =3D { CPU_CFG_OFFSET(ext_zicsr), CPU_CFG_OFFSET(ext_zihintpause), CPU_CFG_OFFSET(ext_zba), CPU_CFG_OFFSET(ext_zbb), diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 485d2da3c2..6c5fceb5f5 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -82,6 +82,7 @@ typedef struct riscv_cpu_profile { bool enabled; bool user_set; int priv_spec; + int satp_mode; const int32_t ext_offsets[]; } RISCVCPUProfile; =20 diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 4d25fc43d2..152f95718b 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -766,6 +766,31 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, = Error **errp) riscv_cpu_disable_priv_spec_isa_exts(cpu); } =20 +#ifndef CONFIG_USER_ONLY +static bool riscv_cpu_validate_profile_satp(RISCVCPU *cpu, + RISCVCPUProfile *profile, + bool send_warn) +{ + int satp_max =3D satp_mode_max_from_map(cpu->cfg.satp_mode.supported); + + if (profile->satp_mode > satp_max) { + if (send_warn) { + bool is_32bit =3D riscv_cpu_is_32bit(cpu); + const char *req_satp =3D satp_mode_str(profile->satp_mode, is_= 32bit); + const char *cur_satp =3D satp_mode_str(satp_max, is_32bit); + + warn_report("Profile %s requires satp mode %s, " + "but satp mode %s was set", profile->name, + req_satp, cur_satp); + } + + return false; + } + + return true; +} +#endif + static void riscv_cpu_validate_profile(RISCVCPU *cpu, RISCVCPUProfile *profile) { @@ -775,6 +800,13 @@ static void riscv_cpu_validate_profile(RISCVCPU *cpu, bool profile_impl =3D true; int i; =20 +#ifndef CONFIG_USER_ONLY + if (profile->satp_mode !=3D RISCV_PROFILE_ATTR_UNUSED) { + profile_impl =3D riscv_cpu_validate_profile_satp(cpu, profile, + send_warn); + } +#endif + if (profile->priv_spec !=3D RISCV_PROFILE_ATTR_UNUSED && profile->priv_spec !=3D env->priv_ver) { profile_impl =3D false; @@ -1079,6 +1111,14 @@ static void cpu_set_profile(Object *obj, Visitor *v,= const char *name, cpu->env.priv_ver =3D profile->priv_spec; } =20 +#ifndef CONFIG_USER_ONLY + if (profile->satp_mode !=3D RISCV_PROFILE_ATTR_UNUSED) { + const char *satp_prop =3D satp_mode_str(profile->satp_mode, + riscv_cpu_is_32bit(cpu)); + object_property_set_bool(obj, satp_prop, profile->enabled, NULL); + } +#endif + for (i =3D 0; misa_bits[i] !=3D 0; i++) { uint32_t bit =3D misa_bits[i]; =20 --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085150; cv=none; d=zohomail.com; s=zohoarc; b=IoUu54sWLDXxLioQ47qwqoIKut3LOiLrPQajQgM2oliKJJPCF7zWBzdtsq/oM7wuBDV8TEF3mDoqE4uw0kjNQpbgb5hJJZEBP8Okvwqhzvf7m6rRHvXk5HjAC1epCeRMpcPK14HlZvKsmoZSE1AbTxEUbMGSJApTuJFJc6o5VI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085150; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7yElVsIHzCua4iZ431C/kmIyyY3CeuHOk6mNAF42rzU=; b=FCR/PR3GF9OnNuP/ZQH6viu3Lhxm1zcazVyjrTAmJNwjN9AgukZPzuO27exOcSJ2xUg8IbASjxmXkSdyc8gimFbUzzysvcCiK/BeLPt4BqCx/yyjpiA1kp4rPzDUnepAbhUIo7Ye2/Rgp8eL4DeN9fDDyk987dfMilutygtU/sc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085150343229.54096094440968; Mon, 27 Nov 2023 03:39:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwU-0003vs-53; Mon, 27 Nov 2023 06:38:22 -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 1r7ZwS-0003vf-Ug for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:20 -0500 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwR-0005PU-AA for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:20 -0500 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6d7f3a4bbc6so2386898a34.2 for ; Mon, 27 Nov 2023 03:38:18 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085097; x=1701689897; 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=7yElVsIHzCua4iZ431C/kmIyyY3CeuHOk6mNAF42rzU=; b=okeMCogZ62waKfAbiBbHnmcvZyZ8zBF4rb3ZjdgKGDXRSo2eSFha6wdKHRU+5IH6pX gLCuPyzHzwLe4hYJ1XHhOFio2lA8KYO7EXKrfXm6vM9p6zaaF2Mw/L3ILfPzGdU/HtuA pjIk359S5LVUAj+k70r8yfy3v4CrV5rNy78wCL6IrVfYW1A+QDWVbgkc+S8nFF+yIVi/ AMPRXX8orKuw363bwXIB0wJBDpw4779bGhj9S+XQfqLXUaPwHfUgYTH+bZgmz3XDN9oy jzBRtsvaHmEDyH+oWDf9ss4d4I/EEGvz4vh4vwVgq/VjHNiOXBBkO+TN2PZCwjwenrN5 QSvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085097; x=1701689897; 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=7yElVsIHzCua4iZ431C/kmIyyY3CeuHOk6mNAF42rzU=; b=FuU2fJOGCu4Ckh5d10D6MZYdj+k0ZWm9aTzdsy8H51H1tXNYDy2zUqtPGsGm1vpUpp iH46mCLcM8ZYaEdv8nXgUf+mNIIJUdFz/qlAjC3qH3W1+Hn/5oBKcH/plE3LEeeSpPXu uOjoQScvSGsMPgoiYau962cwxB5mxoGVCFTJMZMwVkrPMrFab4Eq9LLwXeZ3vgW0tOnf hMb6Rg/s3EQhMeCcx1kkQBxcu1Ee2DrOSnoJG0JVvMPbUa9Xe0Pv+b3dJOLetCSIK/dl 5dY7XNdAMgQHoJ4oyk165i1W4vGuOQlDK4tkcw5VU8QXoaGj9QpSmDnro87+RVPnAJTt 0Rag== X-Gm-Message-State: AOJu0YztLJt7SZEBjDTfZsP7EvCx3DM3ZcXEgoWDk88ypawyQ0Zgzk4L Hms15/ZP3hYAPDpNiBaExqkT1Te9e+bWhn6WRqc= X-Google-Smtp-Source: AGHT+IFoVE84r8JGtV3jEtfZAjDU0G+cEMJr0ecngAsqegkGryFU+vqDWniQTFg/X17zlo/4s7KhYA== X-Received: by 2002:a05:6830:1be2:b0:6cd:179:f80b with SMTP id k2-20020a0568301be200b006cd0179f80bmr13227840otb.30.1701085097180; Mon, 27 Nov 2023 03:38:17 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 6/8] target/riscv: add 'parent' in profile description Date: Mon, 27 Nov 2023 08:37:50 -0300 Message-ID: <20231127113752.1290265-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32f.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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085150927000001 Content-Type: text/plain; charset="utf-8" Certain S-mode profiles, like RVA22S64 and RVA23S64, mandate all the mandatory extensions of their respective U-mode profiles. RVA22S64 includes all mandatory extensions of RVA22U64, and the same happens with RVA23 profiles. Add a 'parent' field to allow profiles to enable other profiles. This will allow us to describe S-mode profiles by specifying their parent U-mode profile, then adding just the S-mode specific extensions. We're naming the field 'parent' to consider the possibility of other uses (e.g. a s-mode profile including a previous s-mode profile) in the future. Suggested-by: Andrew Jones Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 1 + target/riscv/tcg/tcg-cpu.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a77118549b..6957b4b9be 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1540,6 +1540,7 @@ Property riscv_cpu_options[] =3D { * having a cfg offset) at this moment. */ static RISCVCPUProfile RVA22U64 =3D { + .parent =3D NULL, .name =3D "rva22u64", .misa_ext =3D RVI | RVM | RVA | RVF | RVD | RVC | RVU, .priv_spec =3D RISCV_PROFILE_ATTR_UNUSED, diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 6c5fceb5f5..44fb0a9ca8 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -77,6 +77,7 @@ const char *riscv_get_misa_ext_description(uint32_t bit); #define CPU_CFG_OFFSET(_prop) offsetof(struct RISCVCPUConfig, _prop) =20 typedef struct riscv_cpu_profile { + struct riscv_cpu_profile *parent; const char *name; uint32_t misa_ext; bool enabled; diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 152f95718b..6284d36809 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -797,7 +797,7 @@ static void riscv_cpu_validate_profile(RISCVCPU *cpu, CPURISCVState *env =3D &cpu->env; const char *warn_msg =3D "Profile %s mandates disabled extension %s"; bool send_warn =3D profile->user_set && profile->enabled; - bool profile_impl =3D true; + bool parent_enabled, profile_impl =3D true; int i; =20 #ifndef CONFIG_USER_ONLY @@ -850,6 +850,13 @@ static void riscv_cpu_validate_profile(RISCVCPU *cpu, } =20 profile->enabled =3D profile_impl; + + if (profile->parent !=3D NULL) { + parent_enabled =3D object_property_get_bool(OBJECT(cpu), + profile->parent->name, + NULL); + profile->enabled =3D profile->enabled && parent_enabled; + } } =20 static void riscv_cpu_validate_profiles(RISCVCPU *cpu) @@ -1107,6 +1114,11 @@ static void cpu_set_profile(Object *obj, Visitor *v,= const char *name, profile->user_set =3D true; profile->enabled =3D value; =20 + if (profile->parent !=3D NULL) { + object_property_set_bool(obj, profile->parent->name, + profile->enabled, NULL); + } + if (profile->enabled) { cpu->env.priv_ver =3D profile->priv_spec; } --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085138; cv=none; d=zohomail.com; s=zohoarc; b=RPbi0qCMKk74JIUrjTeFZ6IKnMdMaIWX0kwcbS7zgTBGXYEk3HGHK8Wipu320AATbxPw32cshvW3bTTg/vaQOXgRpjKCKjXaTW/fnFNcs6o/roqMLmcfUIvZNAw/b/yyCiw0+Th6/WW3le1wHFjFPT6z/eN9uG1Hs9uXrh/tIwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085138; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HyYNWAP0AMYoeZAQS0uh/Aq/GdjBljujYDiVnxqQaYk=; b=bRrgwZRavdASoZNpJjjFRbKmfJeG4eUh7P1UiIyiomEn/K/YLXYyk/a1rpi5nKoMTdc9Sr4/B6o2uLjwBwwgXEgdV04o/ebGzwbn6bg5coo7wOqtqGgaQAdjNN6z/hlf5ZOM0qIUxG1QZacyfyPRVOlrspohrlfQy+ZPihRNcFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17010851388471.7891918891582463; Mon, 27 Nov 2023 03:38:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7ZwZ-0003xV-H5; Mon, 27 Nov 2023 06:38:27 -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 1r7ZwY-0003x3-4w for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:26 -0500 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwU-0005Pv-Ut for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:25 -0500 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3b83ed78a91so2548285b6e.1 for ; Mon, 27 Nov 2023 03:38:22 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085101; x=1701689901; 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=HyYNWAP0AMYoeZAQS0uh/Aq/GdjBljujYDiVnxqQaYk=; b=fdoS5KSTykh1hny4vd5do+DXbAmZVenqiHbOcQXpaEi5CfSHIoVhKBXgxcqSGYX2mD XhJaaFvivilz8ckd3/D87s/rK0eqVatSrSVzgaH6dtzVYNd3A1LNXSy6QgXWVdyIN9WD mIkj1eSTaZguaIdUP7broAcTrdJz6K4CITM2HuHNZVDyEqalQhFh1M5D7u4PAk+/0AUj XwThOdnwGInITMpiCSk+Z0Ux8Ysuq0zpvWSqAJskLp9U0byYo5b2xAbSLAFNUkfY0gpP BGMKmideKXtxnbENn+7HXddRz+2GjdExgE4/BSEmH61FzZluK/YOshW+q6IB9+PAvwfO yQ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085101; x=1701689901; 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=HyYNWAP0AMYoeZAQS0uh/Aq/GdjBljujYDiVnxqQaYk=; b=s7ctLLaZFIkMND+mE5GlcpywVFkivkmuQ7hebe6/CBeUMp8DmmbGDavptLjW9YwfoJ ujG+F81g7Xi/RFmERJ0IUX9sWtpm+FCL6iv+h0APCxEi2rVHplrH6zU85uk1Wm2RaV4R lfEzla5UU9hM/jy1nJjSc1L/Yumfs71WqwfayZJ50D5BMLS/qGFd+GdE0Qt5kni8WLAa IJpyId8LNci83J1d58nSwdwJYHEIT9VGoQMN1+wJRyqsFV8q3N84sTwN9DvsuItB61UT oi7ITJwGqr82nRcTwXVJJHS8DmsHxA5vXqWXNa3spK/5EBiQtqyZX9jT8/XBH6G/PMDt J2sA== X-Gm-Message-State: AOJu0YwbZZfvcoQK5ENXjAuJ2MkgRhoFoKOhrk2PyOV3ipFAbf1aQRgs 7qaKXrPOOEdZvQtl1E/VAtUUyTy5zUxIjOY8Fu4= X-Google-Smtp-Source: AGHT+IHacOeTNR+63y0IoHOazyuQ1gINepRh7CBOKW7z0noOllvdGvsjGzD2Sf6bn5IOvp22q/TP9Q== X-Received: by 2002:a05:6808:1483:b0:3a7:1e3e:7f97 with SMTP id e3-20020a056808148300b003a71e3e7f97mr14735971oiw.4.1701085100997; Mon, 27 Nov 2023 03:38:20 -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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 7/8] target/riscv: add RVA22S64 profile Date: Mon, 27 Nov 2023 08:37:51 -0300 Message-ID: <20231127113752.1290265-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22d.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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085140729000005 Content-Type: text/plain; charset="utf-8" The RVA22S64 profile consists of the following: - all mandatory extensions of RVA22U64; - priv spec v1.12.0; - satp mode sv39; - Ssccptr, a cache related named feature that we're assuming always enable since we don't implement a cache; - Other named features already implemented: Sstvecd, Sstvala, Sscounterenw; - the new Svade named feature that was recently added. Most of the work is already done, so this patch is enough to implement the profile. After this patch, the 'rva22s64' user flag alone can be used with the rva64i CPU to boot Linux: -cpu rv64i,rva22s64=3Dtrue This is the /proc/cpuinfo with this profile enabled: # cat /proc/cpuinfo processor : 0 hart : 0 isa : rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_zihintpause_zi= hpm_zfhmin_zca_zcd_zba_zbb_zbs_zkt_svinval_svpbmt mmu : sv39 Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 6957b4b9be..fa056fb45f 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1560,8 +1560,40 @@ static RISCVCPUProfile RVA22U64 =3D { } }; =20 +/* + * As with RVA22U64, RVA22S64 also defines 'named features'. + * + * Cache related features that we consider enabled since we don't + * implement cache: Ssccptr + * + * Other named features that we already implement: Sstvecd, Sstvala, + * Sscounterenw + * + * Named features that we need to enable: svade + * + * The remaining features/extensions comes from RVA22U64. + */ +static RISCVCPUProfile RVA22S64 =3D { + .parent =3D &RVA22U64, + .name =3D "rva22s64", + .misa_ext =3D RVS, + .priv_spec =3D PRIV_VERSION_1_12_0, + .satp_mode =3D VM_1_10_SV39, + .ext_offsets =3D { + /* rva22s64 exts */ + CPU_CFG_OFFSET(ext_zifencei), CPU_CFG_OFFSET(ext_svpbmt), + CPU_CFG_OFFSET(ext_svinval), + + /* rva22s64 named features */ + CPU_CFG_OFFSET(svade), + + RISCV_PROFILE_EXT_LIST_END + } +}; + RISCVCPUProfile *riscv_profiles[] =3D { &RVA22U64, + &RVA22S64, NULL, }; =20 --=20 2.41.0 From nobody Wed Nov 27 02:28:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1701085194; cv=none; d=zohomail.com; s=zohoarc; b=eqd5j8r1qSPE91TCPD7P64i0HntY4wJuCsZ/o5tk0oWoECm7W3NDV0iShkATukEjAgjQ59WKgxJxJVr5Iuax8C8jbkTNb5PujyvtC8CozEuEY74waeNtZsnHYz/4QpqrVNgULK0p687bKVzUrb8c2Wlz36ltjmlG/VLCTScxUag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701085194; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tmRYxbcrT44VCzWYmzhlhuQ/rR3RdlkH5p1bUIHDcZI=; b=XWLh8K+rJ/cz2NC0HQMXvUE4P/t3ngBzQFmfNkXEGoE6D/W//oO6fmTHpG/u1x9w9aYi+EUDqFIJPtc1hxh7VByd2rMe9KRLIn6S9iLutm1K3si3m/c/+DQWNAJRF8nb6fyzgfH2dEnp0EJlKOy6hyJj0I6Eouym7+au/t62bDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701085194469588.3772484380695; Mon, 27 Nov 2023 03:39:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7Zwb-0003yX-Pc; Mon, 27 Nov 2023 06:38: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 1r7ZwZ-0003xi-RS for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:27 -0500 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7ZwY-0005QQ-A1 for qemu-devel@nongnu.org; Mon, 27 Nov 2023 06:38:27 -0500 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3b842e28917so1871161b6e.1 for ; Mon, 27 Nov 2023 03:38:25 -0800 (PST) Received: from grind.. ([2804:7f0:bdcd:fb00:6501:2693:db52:c621]) by smtp.gmail.com with ESMTPSA id q15-20020a63e94f000000b00578b40a4903sm7618323pgj.22.2023.11.27.03.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:38:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701085104; x=1701689904; 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=tmRYxbcrT44VCzWYmzhlhuQ/rR3RdlkH5p1bUIHDcZI=; b=ce+6E2/PlMKeV6iigaewFB0/Q1zaD8XXkPbAPkA4hsJ3ebvEFg6csHdS+dSbxrKa+O dnr+kIbgS6ym9a25LijO5w24SYVQVpRtGqWgebedBlZK9HR0q+lv/UCZk7isGuBqZFWj L4qjOQjW+pIdRiBFEIusAEhG5gcP57duEgPVU61tctiRp5XAFiBuOjpEE6WK0vKrsX3v PzVUaEGWm0eE/yimWkT4haSDt4aRbQQobvcV9yodf7Zib+N958faHvOw1fAjKhy/Q0jb WI9pUJf7uPcAUt20W1fNSQRvkr+VK8SGgxwWcyybX8ghaBQW9YCbTI/y3dYRenEtyCuN Zdcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085104; x=1701689904; 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=tmRYxbcrT44VCzWYmzhlhuQ/rR3RdlkH5p1bUIHDcZI=; b=SQcgx9tKGAG+1xI2GtOcTWrBItq64iG/v52lmm1pxQogI8xc4cpTVE0wr5l/OgyU4P 7HUKgfE8sS40pYshQoBnuZ8yFck6oQ46jeVNjqn+8SWuatpkvw83j53h0lVnW97acO/m +Gdzutz7tzxmixV/U1MsXypzBmxZNVfyy9uRHMmZwmlIlnq2KuQOPOAtHIoVesT7IpRc BF2812LtmLgK3/NlyYIEraKvTxSRSX9aOwk7b6GsTfHPWlIfMFtL7TadYqZRK4zHGIYL xe5cHIkhvYDvzMjj29GtTUBuJQ+MK0091AW24kzUMYTTKmfRHtQdK2n1qpyH0TLxeqY8 IGGw== X-Gm-Message-State: AOJu0Yy2Kn9C86H56YBSftCEIr9ivZlXLyxoChZAGUVG+ugfKfzgUbUK QZvP2j4DCg7y3LaqJnvP2TIPwdCiQcZb6dG2yuA= X-Google-Smtp-Source: AGHT+IEdDLn4fANEtxaGtgSTCKtJtfHcr1BHcZmtfwltJCP0wiZnlQzWVfINsjoTTOckZUmkWoaYPA== X-Received: by 2002:a05:6808:f90:b0:3a9:cfb5:462a with SMTP id o16-20020a0568080f9000b003a9cfb5462amr12354975oiw.36.1701085104231; Mon, 27 Nov 2023 03:38: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, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 8/8] target/riscv: add rva22s64 cpu Date: Mon, 27 Nov 2023 08:37:52 -0300 Message-ID: <20231127113752.1290265-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231127113752.1290265-1-dbarboza@ventanamicro.com> References: <20231127113752.1290265-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22e.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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1701085196129000002 Content-Type: text/plain; charset="utf-8" Add a new profile CPU 'rva22s64' to work as an alias of -cpu rv64i,rva22s64 Like the existing rva22u64 CPU already does with the RVA22U64 profile. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index 12fe78fc52..9219c2fcc3 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -36,6 +36,7 @@ #define TYPE_RISCV_CPU_BASE128 RISCV_CPU_TYPE_NAME("x-rv128") #define TYPE_RISCV_CPU_RV64I RISCV_CPU_TYPE_NAME("rv64i") #define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64") +#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") #define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex") #define TYPE_RISCV_CPU_SHAKTI_C RISCV_CPU_TYPE_NAME("shakti-c") #define TYPE_RISCV_CPU_SIFIVE_E31 RISCV_CPU_TYPE_NAME("sifive-e31") diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index fa056fb45f..99bdb96335 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1624,6 +1624,13 @@ static void rva22u64_profile_cpu_init(Object *obj) =20 RVA22U64.enabled =3D true; } + +static void rva22s64_profile_cpu_init(Object *obj) +{ + rv64i_bare_cpu_init(obj); + + RVA22S64.enabled =3D true; +} #endif =20 static const gchar *riscv_gdb_arch_name(CPUState *cs) @@ -1968,6 +1975,7 @@ static const TypeInfo riscv_cpu_type_infos[] =3D { DEFINE_DYNAMIC_CPU(TYPE_RISCV_CPU_BASE128, rv128_base_cpu_init), DEFINE_BARE_CPU(TYPE_RISCV_CPU_RV64I, rv64i_bare_cpu_init), DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22U64, rva22u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22S64, rva22s64_profile_cpu_init), #endif }; =20 --=20 2.41.0