From nobody Fri May 17 21:58:35 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=1697841702; cv=none; d=zohomail.com; s=zohoarc; b=UKneNay6xYRlJLKbsRlbfYvdyhP6QIW3z63/STov/RZ19rZ7tkhGRYna3bxma4WViH5NHAM00qRUik/YO2p4gItIHJoj/hIjlt1tLfGgU7cJLyr4SR/nPe403SdEZEMVUFEQmeJ+qOvQ4Fh0C4pt1RuXyTtBiNNKh+guGfmhyI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697841702; 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=cH73iYW00MKQlg6C3zYWP4/VcvIG6BlNVXpiDaV3yow=; b=KdJFfpctA6nI8h88A6GV+F/in71efY5rgIdZZrEZUYEXCBAALCRX6SnRwbTrj6vNEqWQSUIdKGSO7BKW2JdnohS82Rj4ex87fX1yY/nQV2H/bvTUj8oamHJHNwR+X+0m0hE2h67y5Ozv4I9aauLNzt/euXuQ/0iDMud7BGwO4Ag= 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 1697841702437999.1438910472981; Fri, 20 Oct 2023 15:41:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtyA5-0003v4-Ja; Fri, 20 Oct 2023 18:40:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtyA4-0003uk-IQ for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:08 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qty9z-0007TL-Bq for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:08 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c9e06f058bso18726945ad.0 for ; Fri, 20 Oct 2023 15:40:02 -0700 (PDT) Received: from grind.. ([177.45.186.249]) by smtp.gmail.com with ESMTPSA id h1-20020a170902704100b001c61921d4d2sm1992373plt.302.2023.10.20.15.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697841601; x=1698446401; 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=cH73iYW00MKQlg6C3zYWP4/VcvIG6BlNVXpiDaV3yow=; b=U1pxTaRCOmHLxIdY+O5C1YJCEYGOTf4hK9ylzR2SsuEct7XsgqtBMVEfJrV2+ju9n5 FUD1vRccxPPIdSf+sI/D2uxdf63E/apqqaN2f6M78QZUj9K3ZwO+HIMfug0xH5FGhXcq 0TwO1O1jXSTSEgi1265A/fLwSPW6jRuIvi79T13P3ksWs5Vamvncwl0Usfc7291usdji ZiVXNmN4O/ncBbcGBvfbphJYuQ1ceXk//zErCsvGQBFiVfgG1ee73B+GcNBSwHPVmDlD LC2b/0yQHdbkRi8EHZZyv3ch6dX52g3EkHsX0sJqV+InRzH1OJL10l5l+/QdyCjMBvmU ug0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697841601; x=1698446401; 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=cH73iYW00MKQlg6C3zYWP4/VcvIG6BlNVXpiDaV3yow=; b=KjlF6StyXmOnFZVK9ltlTmn6wdLLbzk5LW021JoaCSeL0VgeJbjRYyS1by/vWu8IMC xCymVVbyWb6jS1VauT0Gkhgekamg6UELNG/ut/3kl43hTknSYwmUIrR7+ElLvorNExdM LCD05+nMhuzH5OW4pGwT6WcelfhReQvsxxO61DLuFohkKAwR8OGu/3WGHPnpwW1l5SDT t9ZXJG4yulXyOqLxts7ZShMPoU5ajPnx797fTL2Yp+D9IDfWzCCNoiEw5TNhHvpQzNR2 BmIC2ndai+Cnf7KGzIJhodzkHI/eK6T3QZLH8qzT5zufHDZYkidIsxiyFD/F1gsEBfug GR1g== X-Gm-Message-State: AOJu0YwzFuehWyt67jq9xdgylfTwOfEQrSPsXAu4svMFOs1iqhX+9+kg C0bZFtse+3OiB+vyDikXzTCVDT625g6e7tNJFLM= X-Google-Smtp-Source: AGHT+IGnqnNapjRe8bhM2oQSmhj8yCTfFQbpaw/vu2Fqqp1vOAJU/7W+nVX8VsArm/rCbwqj4rvAuA== X-Received: by 2002:a17:903:184:b0:1c9:fccb:3b1 with SMTP id z4-20020a170903018400b001c9fccb03b1mr9273068plg.24.1697841601673; Fri, 20 Oct 2023 15:40:01 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v3 1/6] target/riscv: add rva22u64 profile definition Date: Fri, 20 Oct 2023 19:39:46 -0300 Message-ID: <20231020223951.357513-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020223951.357513-1-dbarboza@ventanamicro.com> References: <20231020223951.357513-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::636; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1697841704261100006 Content-Type: text/plain; charset="utf-8" The rva22U64 profile, described in: https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc#rva22-profi= les Contains a set of CPU extensions aimed for 64-bit userspace applications. Enabling this set to be enabled via a single user flag makes it convenient to enable a predictable set of features for the CPU, giving users more predicability when running/testing their workloads. QEMU implements all possible extensions of this profile. The exception is Zicbop (Cache-Block Prefetch Operations) that is not available since QEMU RISC-V does not implement a cache model. For this same reason all the so called 'synthetic extensions' described in the profile that are cache related are ignored (Za64rs, Zic64b, Ziccif, Ziccrse, Ziccamoa, Zicclsm). An abstraction called RISCVCPUProfile is created to store the profile. 'ext_offsets' contains mandatory extensions that QEMU supports. Same thing with the 'misa_ext' mask. Optional extensions must be enabled manually in the command line if desired. The design here is to use the common target/riscv/cpu.c file to store the profile declaration and export it to the accelerator files. Each accelerator is then responsible to expose it (or not) to users and how to enable the extensions. Next patches will implement the profile for TCG and KVM. Signed-off-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- target/riscv/cpu.c | 20 ++++++++++++++++++++ target/riscv/cpu.h | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index c64cd726f4..1b75b506c4 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1397,6 +1397,26 @@ Property riscv_cpu_options[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +/* Optional extensions left out: RVV, zfh, zkn, zks */ +static RISCVCPUProfile RVA22U64 =3D { + .name =3D "rva22u64", + .misa_ext =3D RVM | RVA | RVF | RVD | RVC, + .ext_offsets =3D { + CPU_CFG_OFFSET(ext_zicsr), CPU_CFG_OFFSET(ext_zihintpause), + CPU_CFG_OFFSET(ext_zba), CPU_CFG_OFFSET(ext_zbb), + CPU_CFG_OFFSET(ext_zbs), CPU_CFG_OFFSET(ext_zfhmin), + CPU_CFG_OFFSET(ext_zkt), CPU_CFG_OFFSET(ext_zicntr), + CPU_CFG_OFFSET(ext_zihpm), CPU_CFG_OFFSET(ext_zicbom), + CPU_CFG_OFFSET(ext_zicboz), + + RISCV_PROFILE_EXT_LIST_END + } +}; + +RISCVCPUProfile *riscv_profiles[] =3D { + &RVA22U64, NULL, +}; + static Property riscv_cpu_properties[] =3D { DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true), =20 diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 7f61e17202..53c1970e0a 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -66,6 +66,18 @@ const char *riscv_get_misa_ext_description(uint32_t bit); =20 #define CPU_CFG_OFFSET(_prop) offsetof(struct RISCVCPUConfig, _prop) =20 +typedef struct riscv_cpu_profile { + const char *name; + uint32_t misa_ext; + bool enabled; + bool user_set; + const int32_t ext_offsets[]; +} RISCVCPUProfile; + +#define RISCV_PROFILE_EXT_LIST_END -1 + +extern RISCVCPUProfile *riscv_profiles[]; + /* Privileged specification version */ enum { PRIV_VERSION_1_10_0 =3D 0, --=20 2.41.0 From nobody Fri May 17 21:58:35 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=1697841728; cv=none; d=zohomail.com; s=zohoarc; b=hJ2UNy7+OJPbcz21Jx15Ps8hKsqIrCh1TsvpU69F96646h9m9zDav/BLIJuF0JIcYL/BirMJkTn/9C5wq6bF9ogTYW5GKJfPUNm0F2cxNyH76jT+7HII19TAxDVF/07E0BifMxx+h3m2UJ74U0IAwJB0JHTeLAuKxZgy0/lky9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697841728; 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=ZQI5ijPPAWnzvl5s7eyVjdDxDQDVn8uFjnkA4RU/+zg=; b=cD2Po5/A6Q8mumtLWC9KieDo9sI3zp1+w1IZHef0qCq6tYPZU7prytkAvo5l2TwI9Ofrx6zleyV33Tw4C3PRDkI5enGyqcltk/OROLahhLiNWurM0+IGNe98FNCJSKG9z4WFZz2U2FuHm0xZQifPEEkMxmBdA0SwVcFKUs31kA8= 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 1697841728886177.51690056129019; Fri, 20 Oct 2023 15:42:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtyAA-0003wI-1T; Fri, 20 Oct 2023 18:40:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtyA8-0003vs-9d for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:12 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtyA2-0007gE-FW for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:12 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1bdf4752c3cso10068195ad.2 for ; Fri, 20 Oct 2023 15:40:06 -0700 (PDT) Received: from grind.. ([177.45.186.249]) by smtp.gmail.com with ESMTPSA id h1-20020a170902704100b001c61921d4d2sm1992373plt.302.2023.10.20.15.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697841605; x=1698446405; 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=ZQI5ijPPAWnzvl5s7eyVjdDxDQDVn8uFjnkA4RU/+zg=; b=MtVBNdhMZ4Orlx7wETqC7c9+jNoc/aNpImUa0JSQTv4MOxMh2aw/XXrGrYAYLWrICk Ln9zuzQjzI8ga/YjU2KjRRdSaXv57EIZrlbeyzz/ZRuOYMfSdrus9Fd2sOoJQ7wuoYAh uRfachKTICugAISWcD16ZFkAo9SUsTPbiucIcwSpiIZn+KERRfO2W+ZMfvWXUlTMUEPt xEM1UTUhxsxO0ajifVke1CIToSiRRlYOg2JqYCUDVHKWNV5Lc+fxRrJlSmUQaP74DxFn STGnRbfDas1J8/qvyFnDpexKSF4gMK+7tHriQ+rZfxT9NVPHJ75/3tzBifwWsG9X2vxG dx8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697841605; x=1698446405; 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=ZQI5ijPPAWnzvl5s7eyVjdDxDQDVn8uFjnkA4RU/+zg=; b=k7oUhhxJvYFFUryBtg5wjT9RiPWtChI5Ea1lJ95kGeORp/SNCB4snlCw2z4G+UYR5g mHlRHfZ3ko2smMl6FutdsMkcjuzMkwPtEy6JEEt8WYlYmnKBoptRSxf42MwRr5Mka6eo +OyYgHnN5bcKswSnksPa1WX/BQGY03WCC9F8GT1WDisOkmvk5OGxA9S88ZuR/puQWvKK SVSawRQxu+xOW6me99WOo3YOLXxkXlvYPgUuNH9NVxc2pIX2bNF+qQ0PSyUUQXGT0IUL JaCwJGmtwkfzcDthUHDrsQzHaMB1aJ2lMHfmdZN+g1QNPvOXz4WWMXCp/bDNgc1Ut+/Z I9/Q== X-Gm-Message-State: AOJu0Yw79ySSH3X+2QGh9N8/AfSnPNtEFX+/RBS+3CEOlDYsRAV/xTk/ fr1kuPlAzTrTIMUFLbeLerLCLA52XO/IZJnPAlM= X-Google-Smtp-Source: AGHT+IGLith4pUNyVcih6lFn5qB8eVUOe7IbNl85fMlYkOy2BfB5eTZfLIr3CVGWygtxgfElbW2x4g== X-Received: by 2002:a17:902:c94d:b0:1c8:91d8:d5ca with SMTP id i13-20020a170902c94d00b001c891d8d5camr2809782pla.42.1697841604778; Fri, 20 Oct 2023 15:40:04 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v3 2/6] target/riscv/kvm: add 'rva22u64' flag as unavailable Date: Fri, 20 Oct 2023 19:39:47 -0300 Message-ID: <20231020223951.357513-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020223951.357513-1-dbarboza@ventanamicro.com> References: <20231020223951.357513-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::632; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1697841730355100001 Content-Type: text/plain; charset="utf-8" KVM does not have the means to support enabling the rva22u64 profile. The main reasons are: - we're missing support for some mandatory rva22u64 extensions in the KVM module; - we can't make promises about enabling a profile since it all depends on host support in the end. We'll revisit this decision in the future if needed. For now mark the 'rva22u64' profile as unavailable when running a KVM CPU: $ qemu-system-riscv64 -machine virt,accel=3Dkvm -cpu rv64,rva22u64=3Dtrue qemu-system-riscv64: can't apply global rv64-riscv-cpu.rva22u64=3Dtrue: 'rva22u64' is not available with KVM Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: LIU Zhiwei --- target/riscv/kvm/kvm-cpu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 5246fc2bdc..dc14c54ce4 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -360,7 +360,7 @@ static void cpu_set_cfg_unavailable(Object *obj, Visito= r *v, } =20 if (value) { - error_setg(errp, "extension %s is not available with KVM", + error_setg(errp, "'%s' is not available with KVM", propname); } } @@ -440,6 +440,11 @@ static void kvm_riscv_add_cpu_user_properties(Object *= cpu_obj) riscv_cpu_add_kvm_unavail_prop_array(cpu_obj, riscv_cpu_extensions); riscv_cpu_add_kvm_unavail_prop_array(cpu_obj, riscv_cpu_vendor_exts); riscv_cpu_add_kvm_unavail_prop_array(cpu_obj, riscv_cpu_experimental_e= xts); + + /* We don't have the needed KVM support for profiles */ + for (i =3D 0; riscv_profiles[i] !=3D NULL; i++) { + riscv_cpu_add_kvm_unavail_prop(cpu_obj, riscv_profiles[i]->name); + } } =20 static int kvm_riscv_get_regs_core(CPUState *cs) --=20 2.41.0 From nobody Fri May 17 21:58:35 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=1697841702; cv=none; d=zohomail.com; s=zohoarc; b=ixAhp+oAcFtS09rFhyGQSb5mZCrUFS7ghbWNi5kAsQ0DZTjFaM+bUKrIA0nTxxDrmBmE3N1G3zcFUvFKhslxbwmmcn0QVF9MQJT6e9TBrkW/SYu75DodQa7oYTRPwkvXgX8OAA1UTFJmF4Gdq4AaKDYeBUxHtHE8ZVfA638WfjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697841702; 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=SRdblqbrELDE0asWl5/HSfsmSop8dDyM1YB2Q3zehig=; b=WT8nFH8vGVRsf4L9wgJWc9q8Gr9dJnZYOiRY1R1bgwFxfb3czwUFYv5Lg1l+bM+xCQ92q/Z5LmfZftU5ui6joogHlSoXW+cqRLwgHiE8thoLp3gf4+YtlZGJ2KlhSJ0k5rDW4pTBQrTWt/CxZ5RTe0+ESqr0Fp5NK/omRPAsPEM= 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 1697841702432881.1145210212575; Fri, 20 Oct 2023 15:41:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtyAF-0003yu-6z; Fri, 20 Oct 2023 18:40:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtyAE-0003yT-5O for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:18 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtyA6-0007hR-O0 for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:17 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9bca1d96cso10550785ad.3 for ; Fri, 20 Oct 2023 15:40:10 -0700 (PDT) Received: from grind.. ([177.45.186.249]) by smtp.gmail.com with ESMTPSA id h1-20020a170902704100b001c61921d4d2sm1992373plt.302.2023.10.20.15.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697841608; x=1698446408; 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=SRdblqbrELDE0asWl5/HSfsmSop8dDyM1YB2Q3zehig=; b=V5Jj2Oy/37tc85HJwWmqWUoYsXL3JnRZmrq9e9UFM8NFzKLg8He4/qIlqE+O7pn+eE 92L053A5PvzZjMZjWULw3gUUZqJWZpydq06C2UNtXAD2pxOa+rgN9uF9XhKb3EqZUwwP jAu8ojTB4YlHSsxW07TWNkQtoFyhxQLoo0pEwc8F6J6UCxBtpgq9MYpRHXg7QMgjkTyf wnv28ULoSViUk/bh6Kff87H+ZrtNFKrrES63RDz3he23a36m7OLQRKbSOTyz1qf0b2Q4 rbpN5aniRYWD2h61yV7JxUN9ulp7OFV60Ww2wlnlHW2IKvsn17DDML9gygMAwraEJC8y kOcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697841608; x=1698446408; 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=SRdblqbrELDE0asWl5/HSfsmSop8dDyM1YB2Q3zehig=; b=wLGR7KNf00hifzQscMzWKB0VQE6S1Ov0VSpNyAJy4wyYPgXekBkDQfqg+MjL9HvpIj xmY2eVo11Wuw/fwF1DK+i3kph/cVAOnl1So3bBj7zVcdImv3gXZknf++sftWpt/r24xk pKrrz48XcN3GVmQD11zfSS633C+VD/30B4XV/f1fK6Yf3VE6T6bPRB5YGDFmbGJM8wMW UTTJX1Cd0mCUfD9KMQ4mjFgXj2VL+1okfz7vX4tNJandmXJVIQy90W64i45VcCM4gf2v 4jjY71IR080zafomZTAwiy7hZ77wjANM0o+Iue7OFWaeP46k9HuqGKUtJdY4UvBPDGhP sqGA== X-Gm-Message-State: AOJu0Yz4GNlGDvbIeal58XjHIm8J8FsBxTarl/B/r60pJRi7wHbZsf4L CR82dAW0WvIhLRVC58ioDJEsh283WrPmyBZhkbw= X-Google-Smtp-Source: AGHT+IE+e7QsdKOMwi8EfRuPua7X6GgG977pGRVmEKGhsR7O7vbNp8jqqZL5CuGMXsyxb0QrpEZDbw== X-Received: by 2002:a17:902:cf4f:b0:1ca:64f:35ff with SMTP id e15-20020a170902cf4f00b001ca064f35ffmr2755441plg.48.1697841607696; Fri, 20 Oct 2023 15:40:07 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v3 3/6] target/riscv/tcg: add user flag for profile support Date: Fri, 20 Oct 2023 19:39:48 -0300 Message-ID: <20231020223951.357513-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020223951.357513-1-dbarboza@ventanamicro.com> References: <20231020223951.357513-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::635; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1697841704289100008 Content-Type: text/plain; charset="utf-8" The TCG emulation implements all the extensions described in the RVA22U64 profile, both mandatory and optional. The mandatory extensions will be enabled via the profile flag. We'll leave the optional extensions to be enabled by hand. Given that this is the first profile we're implementing in TCG we'll need some ground work first: - all profiles declared in riscv_profiles[] will be exposed to users. TCG is the main accelerator we're considering when adding profile support in QEMU, so for now it's safe to assume that all profiles in riscv_profiles[] will be relevant to TCG; - we'll not support user profile settings for vendor CPUs. The flags will still be exposed but users won't be able to change them. The idea is that vendor CPUs in the future can enable profiles internally in their cpu_init() functions, showing to the external world that the CPU supports a certain profile. But users won't be able to enable/disable it; - Setting a profile to 'true' means 'enable all mandatory extensions of this profile, setting it to 'false' means disabling all its mandatory extensions. Disabling a profile is discouraged for regular use and will issue an user warning. User choices for individual extensions will take precedence, i.e. enabling a profile will not enable extensions that the user set to 'false', and vice-versa. This will make us independent of left-to-right ordering in the QEMU command line, i.e. the following QEMU command lines: -cpu rv64,zicbom=3Dfalse,rva22u64=3Dtrue,Zifencei=3Dfalse -cpu rv64,zicbom=3Dfalse,Zifencei=3Dfalse,rva22u64=3Dtrue -cpu rv64,rva22u64=3Dtrue,zicbom=3Dfalse,Zifencei=3Dfalse They mean the same thing: "enable all mandatory extensions of the rva22u64 profile while keeping zicbom and Zifencei disabled". For now we'll handle multi-letter extensions only. MISA extensions need additional steps that we'll take care later. Signed-off-by: Daniel Henrique Barboza Acked-by: LIU Zhiwei --- target/riscv/tcg/tcg-cpu.c | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 7a4400e2ba..3dd4783191 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -757,6 +757,63 @@ static void riscv_cpu_add_misa_properties(Object *cpu_= obj) } } =20 +static void cpu_set_profile(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + RISCVCPUProfile *profile =3D opaque; + RISCVCPU *cpu =3D RISCV_CPU(obj); + bool value; + int i, ext_offset; + + if (object_dynamic_cast(obj, TYPE_RISCV_DYNAMIC_CPU) =3D=3D NULL) { + error_setg(errp, "Profile %s only available for generic CPUs", + profile->name); + return; + } + + if (!visit_type_bool(v, name, &value, errp)) { + return; + } + + if (!value) { + warn_report("Disabling the '%s' profile is a debug/development " + "tool, not recommended for regular use", + profile->name); + } + + profile->enabled =3D value; + + for (i =3D 0; profile->ext_offsets[i] !=3D RISCV_PROFILE_EXT_LIST_END;= i++) { + ext_offset =3D profile->ext_offsets[i]; + + if (cpu_cfg_ext_is_user_set(ext_offset)) { + continue; + } + + isa_ext_update_enabled(cpu, ext_offset, profile->enabled); + } +} + +static void cpu_get_profile(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + RISCVCPUProfile *profile =3D opaque; + bool value =3D profile->enabled; + + visit_type_bool(v, name, &value, errp); +} + +static void riscv_cpu_add_profiles(Object *cpu_obj) +{ + for (int i =3D 0; riscv_profiles[i] !=3D NULL; i++) { + const RISCVCPUProfile *profile =3D riscv_profiles[i]; + + object_property_add(cpu_obj, profile->name, "bool", + cpu_get_profile, cpu_set_profile, + NULL, (void *)profile); + } +} + static bool cpu_ext_is_deprecated(const char *ext_name) { return isupper(ext_name[0]); @@ -880,6 +937,8 @@ static void riscv_cpu_add_user_properties(Object *obj) =20 riscv_cpu_add_multiext_prop_array(obj, riscv_cpu_deprecated_exts); =20 + riscv_cpu_add_profiles(obj); + for (Property *prop =3D riscv_cpu_options; prop && prop->name; prop++)= { qdev_property_add_static(DEVICE(obj), prop); } --=20 2.41.0 From nobody Fri May 17 21:58:35 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=1697841732; cv=none; d=zohomail.com; s=zohoarc; b=EPxj29BMmXwI+2EM7EKLvSM5IHWG1q1MDRKZUmXDms2bij4fN6uqZgl5G/qvtJNeXjjnnKX8i+Rv4RZiJPH/IoAN7BLt4izYpBFP9/WkS4i9DX/RVwegEvNZajJ1ZrnTNebrIuMhvdeRRj0tIhqYn7rudpm2+OHSjpyEJbTqqfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697841732; 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=Sy4kLpVJRuW/SgpzplTJbAsp6e9iAb3C3a2/ZEAAxKs=; b=RIkAbtuwDMkNFSFTFPecSVh2oZHjHz9YTeT1YaI+k8wzhUyHx2CTNmNg3fEzkqiNCTnYxvTqn0XqUeE89xF8VPTeDOM62nqF/GwyomYbIKxAIU/3ia6fjVr3ksTYagGwf7+OCy8JjgMu4+g3fpM3NuDsEEm0Y99qco2IbA9Migg= 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 169784173224972.2150755252568; Fri, 20 Oct 2023 15:42:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtyAH-0003zX-03; Fri, 20 Oct 2023 18:40:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtyAF-0003yv-6f for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:19 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtyA9-0007in-0e for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:18 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1ca74e77aecso18548645ad.1 for ; Fri, 20 Oct 2023 15:40:12 -0700 (PDT) Received: from grind.. ([177.45.186.249]) by smtp.gmail.com with ESMTPSA id h1-20020a170902704100b001c61921d4d2sm1992373plt.302.2023.10.20.15.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697841611; x=1698446411; 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=Sy4kLpVJRuW/SgpzplTJbAsp6e9iAb3C3a2/ZEAAxKs=; b=ED/Xe3uMU3SQyUFgCeQ1xXQj3mNZhAZlVFFQgnj3KVh3z6bTYHKJHPEbZbArVg/VJh bwdCB9I15B5+oXAlUX0XxNQPckbwIF//9lMhC4Be1Xa3B3XU+2KJmHMz5XVqAKNWiLps SGC5nLRfkOjZMRQFLIBPgaUJJbnTauBHeTMmVYWtrzRmtIYcEDAu03FobzjP6NFzfBJ+ hQUFlokW/ofg8Auu8hSl1AnJrOg2INEVkFeXDgW/3oNugepTNkt9LHbfkxzntazgQt42 odtg+fuWkozGFvlgQYRJTYOasyrfaUKsP4xuhTj1NuiKGLpxjx+1nFcef4qrYYt0siui +fZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697841611; x=1698446411; 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=Sy4kLpVJRuW/SgpzplTJbAsp6e9iAb3C3a2/ZEAAxKs=; b=cASv1F/UwbcX4PebMINTTq+dwvPm5RliK9PxnauZWGBxBjS/oH8rd8yfolJLhoS2jx Op4WX8sMiDSUhRtOyGj3CgWyo+EM7rDFsYJIXmB2GtU69sONLhFJycj+cwunL5yGr+Ku 4NzaWHltzW88DsEIyWOalAEtGcGKipyqWL8BuLRncwCP4O8ziiQp1LoxJzaYgeehOrcd w4xBepo3p6kGNWiAkhbTI8HeG7+2bY3i29iErLTdpzfFj/j5ri+mVUycqTOM0kzovmNR kZdzKdmZN32o3Fb50HDWgHSodqFTBLyTYmNQSsrM6nvGWvJ19J+DnHOvpOQqMGvff3fO 9apA== X-Gm-Message-State: AOJu0Ywn0+Xz3LwGNyRKL4ks/LHFI/pFVEMExJ6cIY/IIDbVqI+W0vdW ANjl07CqwjenRkgUfeMroxuWRj2SmJyYYN772tI= X-Google-Smtp-Source: AGHT+IHqYB0tBIePJQPzG4s6N6BRd06BiDk9m8bVuUeDERQfRjwUpPugg3XQGZXoP0Am3LntwFXdCA== X-Received: by 2002:a17:902:ce88:b0:1bc:1e17:6d70 with SMTP id f8-20020a170902ce8800b001bc1e176d70mr4573127plg.24.1697841611363; Fri, 20 Oct 2023 15:40:11 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v3 4/6] target/riscv/tcg: add MISA user options hash Date: Fri, 20 Oct 2023 19:39:49 -0300 Message-ID: <20231020223951.357513-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020223951.357513-1-dbarboza@ventanamicro.com> References: <20231020223951.357513-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::636; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1697841734313100007 Content-Type: text/plain; charset="utf-8" We already track user choice for multi-letter extensions because we needed to honor user choice when enabling/disabling extensions during realize(). We refrained from adding the same mechanism for MISA extensions since we didn't need it. Profile support requires tne need to check for user choice for MISA extensions, so let's add the corresponding hash now. It works like the existing multi-letter hash (multi_ext_user_opts) but tracking MISA bits options in the cpu_set_misa_ext_cfg() callback. Note that we can't re-use the same hash from multi-letter extensions because that hash uses cpu->cfg offsets as keys, while for MISA extensions we're using MISA bits as keys. After adding the user hash in cpu_set_misa_ext_cfg(), setting default values with object_property_set_bool() in add_misa_properties() will end up marking the user choice hash with them. Set the default value manually to avoid it. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: LIU Zhiwei --- target/riscv/tcg/tcg-cpu.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 3dd4783191..59b75a14ac 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -34,6 +34,7 @@ =20 /* Hash that stores user set extensions */ static GHashTable *multi_ext_user_opts; +static GHashTable *misa_ext_user_opts; =20 static bool cpu_cfg_ext_is_user_set(uint32_t ext_offset) { @@ -669,6 +670,10 @@ static void cpu_set_misa_ext_cfg(Object *obj, Visitor = *v, const char *name, return; } =20 + g_hash_table_insert(misa_ext_user_opts, + GUINT_TO_POINTER(misa_bit), + (gpointer)value); + prev_val =3D env->misa_ext & misa_bit; =20 if (value =3D=3D prev_val) { @@ -732,6 +737,7 @@ static const RISCVCPUMisaExtConfig misa_ext_cfgs[] =3D { */ static void riscv_cpu_add_misa_properties(Object *cpu_obj) { + CPURISCVState *env =3D &RISCV_CPU(cpu_obj)->env; bool use_def_vals =3D riscv_cpu_is_generic(cpu_obj); int i; =20 @@ -752,7 +758,13 @@ static void riscv_cpu_add_misa_properties(Object *cpu_= obj) NULL, (void *)misa_cfg); object_property_set_description(cpu_obj, name, desc); if (use_def_vals) { - object_property_set_bool(cpu_obj, name, misa_cfg->enabled, NUL= L); + if (misa_cfg->enabled) { + env->misa_ext |=3D bit; + env->misa_ext_mask |=3D bit; + } else { + env->misa_ext &=3D ~bit; + env->misa_ext_mask &=3D ~bit; + } } } } @@ -989,6 +1001,7 @@ static void tcg_cpu_instance_init(CPUState *cs) RISCVCPU *cpu =3D RISCV_CPU(cs); Object *obj =3D OBJECT(cpu); =20 + misa_ext_user_opts =3D g_hash_table_new(NULL, g_direct_equal); multi_ext_user_opts =3D g_hash_table_new(NULL, g_direct_equal); riscv_cpu_add_user_properties(obj); =20 --=20 2.41.0 From nobody Fri May 17 21:58:35 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=1697841702; cv=none; d=zohomail.com; s=zohoarc; b=I5cf13+aYLk28fTgZtlhg7LZ4KfB7C2a1HBOKg3r9Nd4X56qSW2zF3EC/UV7YnsSTE+401fMOnsuZUVTQ2jsex3gy7VZ01WA0nOzLuqpz6YsL0IGWzgJIoyKkFdaYE0E7vMWsRv2xYTnLvNeKDpaQvBoWgwgb8WAYlpNjSjhnt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697841702; 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=38V46/Na8GbB2MFByOT/BTnEIfG+mdTlZvxewyQn28Q=; b=WPdurFAvj+iyuv7C2auDsh5USEzLf966dqxlWsDWGvfCUAVxizjbk8LnivfN+xz9/z7n6o5WrSgZIxCbVouMEPVtDuhfvUR6vkFIxlfmaJP80vxXy8sxjfdSEv1+GSe+R6NQwSx/6anxXhp9w8ueUQgJ9PKIQmN/lfRlEOo5oes= 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 1697841702390293.45797796261627; Fri, 20 Oct 2023 15:41:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtyAK-00040f-4k; Fri, 20 Oct 2023 18:40:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtyAJ-00040V-7C for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:23 -0400 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 1qtyAD-0007kD-WE for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:22 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c0ecb9a075so10606315ad.2 for ; Fri, 20 Oct 2023 15:40:16 -0700 (PDT) Received: from grind.. ([177.45.186.249]) by smtp.gmail.com with ESMTPSA id h1-20020a170902704100b001c61921d4d2sm1992373plt.302.2023.10.20.15.40.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697841615; x=1698446415; 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=38V46/Na8GbB2MFByOT/BTnEIfG+mdTlZvxewyQn28Q=; b=gBxwqO9l6uuz2Q0HhhARNChPjOF41Ie2xcTt/2JISHnBMHc7hzxDYmnjH0B2mzP+XD TLbOxbUkDh36K0BOhLib74NdZ2LsLPSYAr7WKj+Jpe5++sZ3KhgsGkfpPROB1mTMrZlX AorEWLqf8XnZ0MSBt7/B3MmFP7v4Yey5n5FVbuQqTk1NFOlAMv0FwQkNbdBEK+7EobBV uARi296FHiX2pFcWreyJMWd3J10F5XgU7JC4RS5ngEotRPjCaK1TCmCnTgkomU1GMVfn hKTTYFb4QAOWHxxjbUQoJ+ZLVMRys1DJOzITyPEeAEaEx6QU6pIRDzXgrADrmoGLEjRt cqgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697841615; x=1698446415; 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=38V46/Na8GbB2MFByOT/BTnEIfG+mdTlZvxewyQn28Q=; b=qCpDfq3PnSgsNVvdwKAt8Lf2lGG1KtAlu0oYKglETk6C+qI9+qEv1DWaUDpSV9AtWd a2cjksGYPOuLgRGLoxrYTiAFXGviUOL98MgGakYGesffPprSCf6G243seGTXPuofZzP8 +MqF+dMNVo2OdGez3rN466mWNmlnVxsBDtA1TYiHPlTbk64NqzNnb+nlsQ7EWfaFODRX QCeybWgaTMEEmfn52eLpKQO3eQK/e2gP4z6ToFK0bCRt4AeRiXhOij6ozpn0BxFQXgDI aGEeZgUjo369M56jgLgzZ/43ZWuPGtCU/GIlJb9tP5ihkGZUV6QkXmFrz+/AC+cH2Mh6 ZN3A== X-Gm-Message-State: AOJu0YyQoRy0nGERXY6sOHpjO/mv2HmHLb2VCqLyLGml1o/XzpDQ+Kqu EndTKGw9i604kck8BqMeYfcTxirrr8FS4vLGJ7I= X-Google-Smtp-Source: AGHT+IFUqHYwoaIdUezwsD1ERcTJFThr2I+ArE/8aScKSt8svz0lGRsqL+AEdnPG0dwui8hIvSBRKg== X-Received: by 2002:a17:903:280b:b0:1ca:86b:7ed3 with SMTP id kp11-20020a170903280b00b001ca086b7ed3mr2635469plb.40.1697841615102; Fri, 20 Oct 2023 15:40:15 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v3 5/6] target/riscv/tcg: add riscv_cpu_write_misa_bit() Date: Fri, 20 Oct 2023 19:39:50 -0300 Message-ID: <20231020223951.357513-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020223951.357513-1-dbarboza@ventanamicro.com> References: <20231020223951.357513-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::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, T_SPF_TEMPERROR=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: 1697841704222100002 Content-Type: text/plain; charset="utf-8" We have two instances of the setting/clearing a MISA bit from env->misa_ext and env->misa_ext_mask pattern. And the next patch will end up adding one more. Create a helper to avoid code repetition. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: LIU Zhiwei --- target/riscv/tcg/tcg-cpu.c | 44 ++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 59b75a14ac..ba11d0566d 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -42,6 +42,20 @@ static bool cpu_cfg_ext_is_user_set(uint32_t ext_offset) GUINT_TO_POINTER(ext_offset)); } =20 +static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint32_t bit, + bool enabled) +{ + CPURISCVState *env =3D &cpu->env; + + if (enabled) { + env->misa_ext |=3D bit; + env->misa_ext_mask |=3D bit; + } else { + env->misa_ext &=3D ~bit; + env->misa_ext_mask &=3D ~bit; + } +} + static void riscv_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb) { @@ -680,20 +694,14 @@ static void cpu_set_misa_ext_cfg(Object *obj, Visitor= *v, const char *name, return; } =20 - if (value) { - if (!generic_cpu) { - g_autofree char *cpuname =3D riscv_cpu_get_name(cpu); - error_setg(errp, "'%s' CPU does not allow enabling extensions", - cpuname); - return; - } - - env->misa_ext |=3D misa_bit; - env->misa_ext_mask |=3D misa_bit; - } else { - env->misa_ext &=3D ~misa_bit; - env->misa_ext_mask &=3D ~misa_bit; + if (value && !generic_cpu) { + g_autofree char *cpuname =3D riscv_cpu_get_name(cpu); + error_setg(errp, "'%s' CPU does not allow enabling extensions", + cpuname); + return; } + + riscv_cpu_write_misa_bit(cpu, misa_bit, value); } =20 static void cpu_get_misa_ext_cfg(Object *obj, Visitor *v, const char *name, @@ -737,7 +745,6 @@ static const RISCVCPUMisaExtConfig misa_ext_cfgs[] =3D { */ static void riscv_cpu_add_misa_properties(Object *cpu_obj) { - CPURISCVState *env =3D &RISCV_CPU(cpu_obj)->env; bool use_def_vals =3D riscv_cpu_is_generic(cpu_obj); int i; =20 @@ -758,13 +765,8 @@ static void riscv_cpu_add_misa_properties(Object *cpu_= obj) NULL, (void *)misa_cfg); object_property_set_description(cpu_obj, name, desc); if (use_def_vals) { - if (misa_cfg->enabled) { - env->misa_ext |=3D bit; - env->misa_ext_mask |=3D bit; - } else { - env->misa_ext &=3D ~bit; - env->misa_ext_mask &=3D ~bit; - } + riscv_cpu_write_misa_bit(RISCV_CPU(cpu_obj), bit, + misa_cfg->enabled); } } } --=20 2.41.0 From nobody Fri May 17 21:58:35 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=1697841703; cv=none; d=zohomail.com; s=zohoarc; b=SOUO94gH2+0ooJ/IICev6VCc/PWx1hde98Ko2HyADeOmr4pQzkMqHZ/KsJoAqRHIrbcWaLSWmyE5j/O6A8U8m8bVcqP6PXC9fhYJP6ohi3L0gRCeJv8Ndfcjvn+X7mVEkbqaryZb/3b3xXXpd8WjTqDNnJMgakXDBO+DOXW/Cl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697841703; 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=pYiBcU3Fn0p70tChmz3TC4ARZgksdFnrCu6UPFtrSy0=; b=feIcjj5FalsXu+JEwHHa6rhOlurQnaIATuUDsP8B7j/bt5GgLZgZJDRnPwxx9GB7pl99n5ckRnWaALWOD3tvwagUWs97BQHZrFmNwI/m3Tmvuc+UAlx833P50JM1lgQmQ+0JkpDLd94IVinad8qvSBg8a6ecwUlF+a2J+pDwidQ= 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 1697841702997791.7144668416248; Fri, 20 Oct 2023 15:41:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtyAM-00041R-SY; Fri, 20 Oct 2023 18:40:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtyAL-00041A-LI for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:25 -0400 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 1qtyAH-0007mD-EI for qemu-devel@nongnu.org; Fri, 20 Oct 2023 18:40:25 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c9bca1d96cso10551675ad.3 for ; Fri, 20 Oct 2023 15:40:20 -0700 (PDT) Received: from grind.. ([177.45.186.249]) by smtp.gmail.com with ESMTPSA id h1-20020a170902704100b001c61921d4d2sm1992373plt.302.2023.10.20.15.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697841619; x=1698446419; 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=pYiBcU3Fn0p70tChmz3TC4ARZgksdFnrCu6UPFtrSy0=; b=LboLpCG5rPLh5LQgzt+I/4WBptT1rqJn9jFvRfzd7AC8S/TCFGHnukexevlVz1i3g0 qyRqVOk+m4K1J7jv9PtLxj6+IJUbsSE+F720TirPB9xX6k63xipP9Mdjxsde5Hn9cDT8 ZUuVL8xO9bmnK6z1Oo4zh1dHdH6ThRMGVuJ9Maqa5otPrSaxpoHramYUju3YYx5bL73D KhmzCyckRcGSNvMjYZ5srsSJ58VoFR7PqA7ZrOPh4gVxZu0pm7ldBlLbG9hqbT4HYQez VD8AfuKeSGXOd8GKAzM5gL40pbbLT0wNp8/2+Dpr1sZkBEwauJnG1+Jmz5Y8yad8sTpY KNUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697841619; x=1698446419; 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=pYiBcU3Fn0p70tChmz3TC4ARZgksdFnrCu6UPFtrSy0=; b=tJkAOxwtdrUHym/sDjUfc3SI9+qyPMVxM3731diG2yFf3ZvSkzR3YLEHvxdJIhGAxm Had9Xt4S9LNSe9qaD1QJmk1puZYan9YEq6/3w0vTjdbA4M18XK92oejvEEKJ2GxxE6z2 fxdk2m/5iMSTa6n5+QSbDy+y5F5lS/Zfi09Vk+X5ILrcxMHafAo86fFlROKrPDn7gogM Q+363ESO4i5kyWcByNsCrNbIVApqB7Cd3qXdpZhHstZYNK+MGLcZDR0ZfFDIJJ3zUQyf DMeP8r3+TUAK1/5GOmk3v1Sg/h+0rofq2QXtFnvOQm/LeavWw74KFYuMvDVBn65CTf3t ll4A== X-Gm-Message-State: AOJu0Yy7G0pRR3cd1lNT5F/2pKuFfIgMdG9iszxHm4ZeN9E20W1r02AU bts6EA58MhqbKuBi4nOpFW2dWMmye6oUftM2zNI= X-Google-Smtp-Source: AGHT+IFXlG+SDx5bKeKJ2fQcl6xOQyxoRNVExJd9pk3L65bw/f0Vxo3TNcrc9SiurTgbjsy95vvKjA== X-Received: by 2002:a17:902:e5cb:b0:1ca:220:ce42 with SMTP id u11-20020a170902e5cb00b001ca0220ce42mr3194478plf.37.1697841618761; Fri, 20 Oct 2023 15:40:18 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v3 6/6] target/riscv/tcg: handle profile MISA bits Date: Fri, 20 Oct 2023 19:39:51 -0300 Message-ID: <20231020223951.357513-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020223951.357513-1-dbarboza@ventanamicro.com> References: <20231020223951.357513-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::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1697841704229100003 Content-Type: text/plain; charset="utf-8" The profile support is handling multi-letter extensions only. Let's add support for MISA bits as well. We'll go through every known MISA bit. If the user set the bit, doesn't matter if to 'true' or 'false', ignore it. If the profile doesn't declare the bit as mandatory, ignore it. Otherwise, set or clear the bit in env->misa_ext and env->misa_ext_mask depending on whether the profile was set to 'true' or 'false'. Signed-off-by: Daniel Henrique Barboza Reviewed-by: LIU Zhiwei --- target/riscv/tcg/tcg-cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index ba11d0566d..73c7453af6 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -42,6 +42,12 @@ static bool cpu_cfg_ext_is_user_set(uint32_t ext_offset) GUINT_TO_POINTER(ext_offset)); } =20 +static bool cpu_misa_ext_is_user_set(uint32_t misa_bit) +{ + return g_hash_table_contains(misa_ext_user_opts, + GUINT_TO_POINTER(misa_bit)); +} + static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint32_t bit, bool enabled) { @@ -797,6 +803,16 @@ static void cpu_set_profile(Object *obj, Visitor *v, c= onst char *name, =20 profile->enabled =3D value; =20 + for (i =3D 0; misa_bits[i] !=3D 0; i++) { + uint32_t bit =3D misa_bits[i]; + + if (cpu_misa_ext_is_user_set(bit) || !(profile->misa_ext & bit)) { + continue; + } + + riscv_cpu_write_misa_bit(cpu, bit, profile->enabled); + } + for (i =3D 0; profile->ext_offsets[i] !=3D RISCV_PROFILE_EXT_LIST_END;= i++) { ext_offset =3D profile->ext_offsets[i]; =20 --=20 2.41.0