From nobody Sat May 18 10:57:19 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=1690496075; cv=none; d=zohomail.com; s=zohoarc; b=SFA0m5csWRqa0X9ewNFju9X/H98p4bXKURdgRfPTG++e/6h1Ls3A/cyA/Ci/UvSES6avMKnK69n5+xPJ8HbL6cwuHSFRmicKG1zbOjHcw9EtNW5PHuNbjkZImYQBc0ZTQRgIo7/0qyDhKVWfQnKEESwwX/WpNIZjsns0EO4qSWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690496075; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=42PIj32buZwdPK3ft7O84bBw+UCjeAyJ2u2SBVdq0V4=; b=HorZT+lPz73ruaFqZF9s71AqVCtTh393Kvi2i/6qXiOemSsv/0Qbfsun0clLboX+m+xzgN1NRdyJ/P5dOM3P6jbE9a9AK3M3V2YvGJxqkLNa0sVUeXA2arJ+z39Snl2RRs51m8kMjHBIDkFtYBrxMpnMrucuuLOtKN0A8zQYVY8= 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 1690496075854731.5267684042444; Thu, 27 Jul 2023 15:14:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9Ax-0001Fn-Jt; Thu, 27 Jul 2023 18:09:39 -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 1qP9Aw-0001F3-1n for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:38 -0400 Received: from mail-oa1-x2a.google.com ([2001:4860:4864:20::2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9Au-0004rS-Bk for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:37 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1bba7717d3bso1099028fac.1 for ; Thu, 27 Jul 2023 15:09:36 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495775; x=1691100575; 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=42PIj32buZwdPK3ft7O84bBw+UCjeAyJ2u2SBVdq0V4=; b=eFX0Ms8qtnR0TsGdWMsXaLRrg4Vnak/spflVDKZJXMWsb9BjTt8tGNz5EfYKioj2Zv TE+jVjjrCAZAz7fwhh1Cq+EbeYJozeMIlJ4r9VQdkEuSoIGNJeyCG98YhkFiKK/rRE9y ptK48exymhzZcYm1RkH1XHKQEpil10OgPId7V5O3PvRvz2Tt129JjgE0AAtigAm7mFHT BRj3CbBogalyvALbKnkwosPAQBSfwXO53O0YR8uo/bDNTJEwQosh5SBNZ+xrFopgiqiq 44S+n8BCPW1IaZqvKzP7WxKi/ucoHDR/BwyLxeKbAly+/+SsDEe3CPFWBkYhXwrXgf1e dGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495775; x=1691100575; 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=42PIj32buZwdPK3ft7O84bBw+UCjeAyJ2u2SBVdq0V4=; b=Ur8PSuV/x2XHBCRKQL612bYDs2B69HMF2PgTh4HdsZFlS5LfMi1Rupd/lDY2AoNNOx qNh9KRTl+zedDkGI6MV74dMnNqYYsi9Ja8dYYqD5Ps/v0xSBgPDymwPc8TBZVhSA/xHX iJrDnwsnrYLNqsZ9OHCp+I9cGd2tIfW11SoxFp6FLeMvPD1ls9s8byD09w2i5T0IVfn5 2h5/oQ3BvoT64KcFpZnoo5ofhMpRsaMyfPM5/BOWjo9wucJe+0Xf57tJkjpDBcRoVK1D KHmFFpDYZn7t8CCkTfPWHZcASS90/IH+AHKoqWMoxUDzypCzOk9Se5FwlyIeH961ZsrD 5zmw== X-Gm-Message-State: ABy/qLb+xzVpZtEo53gzMoEeNDwayrdJqtWcniv8JdQyNQI/rOsuVxzB Y0vWZZcGG4nMCEpF8iSjHmN1PDBr5s5y7EQi7u1Gkw== X-Google-Smtp-Source: APBJJlGf3DCjXUhInbVH4d5jTNT3TlV4WG2buaMqY9lHhtyijXYizfLf3vAwvRkEhXAze4ny0MA7VQ== X-Received: by 2002:a05:6870:b155:b0:1bb:9b40:268 with SMTP id a21-20020a056870b15500b001bb9b400268mr790815oal.44.1690495775100; Thu, 27 Jul 2023 15:09:35 -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 v6 01/12] target/riscv/cpu.c: split CPU options from riscv_cpu_extensions[] Date: Thu, 27 Jul 2023 19:09:16 -0300 Message-ID: <20230727220927.62950-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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=2001:4860:4864:20::2a; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x2a.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: 1690496076520100001 Content-Type: text/plain; charset="utf-8" We'll add a new CPU type that will enable a considerable amount of extensions. To make it easier for us we'll do a few cleanups in our existing riscv_cpu_extensions[] array. Start by splitting all CPU non-boolean options from it. Create a new riscv_cpu_options[] array for them. Add all these properties in riscv_cpu_add_user_properties() as it is already being done today. 'mmu' and 'pmp' aren't really extensions in the usual way we think about RISC-V extensions. These are closer to CPU features/options, so move both to riscv_cpu_options[] too. In the near future we'll need to match all extensions with all entries in isa_edata_arr[], and so it happens that both 'mmu' and 'pmp' do not have a riscv,isa string (thus, no priv spec version restriction). This further emphasizes the point that these are more a CPU option than an extension. No functional changes made. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 921c19e6cd..61bce2dc55 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1759,7 +1759,6 @@ static void riscv_cpu_add_misa_properties(Object *cpu= _obj) =20 static Property riscv_cpu_extensions[] =3D { /* Defaults for standard extensions */ - DEFINE_PROP_UINT8("pmu-num", RISCVCPU, cfg.pmu_num, 16), DEFINE_PROP_BOOL("sscofpmf", RISCVCPU, cfg.ext_sscofpmf, false), DEFINE_PROP_BOOL("Zifencei", RISCVCPU, cfg.ext_ifencei, true), DEFINE_PROP_BOOL("Zicsr", RISCVCPU, cfg.ext_icsr, true), @@ -1771,15 +1770,8 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("Zve32f", RISCVCPU, cfg.ext_zve32f, false), DEFINE_PROP_BOOL("Zve64f", RISCVCPU, cfg.ext_zve64f, false), DEFINE_PROP_BOOL("Zve64d", RISCVCPU, cfg.ext_zve64d, false), - DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true), - DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), DEFINE_PROP_BOOL("sstc", RISCVCPU, cfg.ext_sstc, true), =20 - DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec), - DEFINE_PROP_STRING("vext_spec", RISCVCPU, cfg.vext_spec), - DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128), - DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64), - DEFINE_PROP_BOOL("smstateen", RISCVCPU, cfg.ext_smstateen, false), DEFINE_PROP_BOOL("svadu", RISCVCPU, cfg.ext_svadu, true), DEFINE_PROP_BOOL("svinval", RISCVCPU, cfg.ext_svinval, false), @@ -1810,9 +1802,7 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("zhinxmin", RISCVCPU, cfg.ext_zhinxmin, false), =20 DEFINE_PROP_BOOL("zicbom", RISCVCPU, cfg.ext_icbom, true), - DEFINE_PROP_UINT16("cbom_blocksize", RISCVCPU, cfg.cbom_blocksize, 64), DEFINE_PROP_BOOL("zicboz", RISCVCPU, cfg.ext_icboz, true), - DEFINE_PROP_UINT16("cboz_blocksize", RISCVCPU, cfg.cboz_blocksize, 64), =20 DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false), =20 @@ -1856,6 +1846,21 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +static Property riscv_cpu_options[] =3D { + DEFINE_PROP_UINT8("pmu-num", RISCVCPU, cfg.pmu_num, 16), + + DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true), + DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), + + DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec), + DEFINE_PROP_STRING("vext_spec", RISCVCPU, cfg.vext_spec), + + DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128), + DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64), + + DEFINE_PROP_UINT16("cbom_blocksize", RISCVCPU, cfg.cbom_blocksize, 64), + DEFINE_PROP_UINT16("cboz_blocksize", RISCVCPU, cfg.cboz_blocksize, 64), +}; =20 #ifndef CONFIG_USER_ONLY static void cpu_set_cfg_unavailable(Object *obj, Visitor *v, @@ -1924,6 +1929,14 @@ static void riscv_cpu_add_user_properties(Object *ob= j) #endif qdev_property_add_static(dev, prop); } + + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { + /* Check if KVM created the property already */ + if (object_property_find(obj, riscv_cpu_options[i].name)) { + continue; + } + qdev_property_add_static(dev, &riscv_cpu_options[i]); + } } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690496187; cv=none; d=zohomail.com; s=zohoarc; b=R1yAM8eYwBDc9CM7YVg76niB6e8e/mZCnxLaca7DZwyeCQV6IkN3xbP23UTXEVGYuO7vR8Ya8MUuLGMEe95qC/Ly3uCUPvPFp7nEv+qCOIQo/siLO2aySB9flKIIVQsJWF97FeQErwRr6UJNVod4XBIZpYtxkLX2z0P1py0et0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690496187; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yjV/lXMlLL0s1HNGB7Ip1ecl2fc6UaDsgtjj2kLtd2c=; b=C4FfZIsV3WLqJ4CN0PXSnTMtxpmP/rppmDVT77msVIwVGh+gKnObG5L0oQnzsEAK5BPOl8nO9UYlWvOk7CbyCMdymqjGllC84n8l5y+OopAQf654cQNGhpscjaM6ichI+wmfhs+YqAEBa1P1CdHahbjNXYmKCpiV81/D+JAIAek= 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 169049618746952.1820592088975; Thu, 27 Jul 2023 15:16:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9B0-0001GY-B4; Thu, 27 Jul 2023 18:09:42 -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 1qP9Ay-0001G7-Kt for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:40 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9Ax-0004sK-73 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:40 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6b9b835d302so1060510a34.1 for ; Thu, 27 Jul 2023 15:09:38 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495777; x=1691100577; 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=yjV/lXMlLL0s1HNGB7Ip1ecl2fc6UaDsgtjj2kLtd2c=; b=D8EPvMY9Z9I9fsHQfb6Me8zf2VMKWsTNcxSmtFTQFBL5qIIpwsLXjzxl1VPF+AOyTJ 9YYaxf+kdTfgKQbGdeF7f+9PD3UnNNs8kOjohjzWqsy7VSvptsB8cGCmsvvvjjgfVm7u K3wn3raVdjHT8vF9UClsr7ogyTZxbdCUg5nvgzu4fVxcY5+YXYIXIvMvY7EVr6YEkfOZ UYorTQEzwIYRsQ+zVufnDq2eKshZviORmqR9G9q5H3wky08pBSN6+7kd6k4B5NsyjI/G Y/FIXqdG80FpskzPm1LT09J1e2qXNnWv77Fw87QC3f1bXn6Q1F5J6Vk/7YGe07TzPN+M TEBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495777; x=1691100577; 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=yjV/lXMlLL0s1HNGB7Ip1ecl2fc6UaDsgtjj2kLtd2c=; b=WBkFKKSLnnN0J6XuiyJvcfXCbCIOsGzqutnp90AW4fZp8pmrHhsTBYwVSlS3JL+CUz 0BOekF7f4HjIozl19zl1PHYViC2kJeVZStdmZJfab+LXN+SdPmhbnEo0KXeRJwrmd2zd WxtGGhNQLULTNEQ0M6fe+KuDfjqgNArrjy/QCMYpvsayJxWmE+12CbwmLYMU6WMQ0gcO xnM0jchFkA4Sjq7CRYOK7LkdayP7i0i6TSpWZzuIXk72NmD5lTEsv9NlCfbkn1eFOwJM iMWCeq+TEfwM4hw3wkZUEkmmpv1ZLz5F3Q6pEGXF/0FFJTzr4q/CcSi32jbCijrV/L8L i3WA== X-Gm-Message-State: ABy/qLbjRSmDMInRUQM4DhrK/qvFMIMTWuTdmA4WlWbTejGehtxDEQgm 286MMIktrXy3tO15/yp206U+dnXg+hsdM0TpfirpGw== X-Google-Smtp-Source: APBJJlG+Djdd6jTImfIbfrWMimL2VxPXPiVm6lwz8NyxW2JLSoxgzIAcfXD0EYQ6RyjQvDU/uhP1Vg== X-Received: by 2002:a05:6870:d59a:b0:1b5:688b:5c24 with SMTP id u26-20020a056870d59a00b001b5688b5c24mr835657oao.32.1690495777654; Thu, 27 Jul 2023 15:09:37 -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 v6 02/12] target/riscv/cpu.c: skip 'bool' check when filtering KVM props Date: Thu, 27 Jul 2023 19:09:17 -0300 Message-ID: <20230727220927.62950-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::331; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x331.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: 1690496189406100001 Content-Type: text/plain; charset="utf-8" After the introduction of riscv_cpu_options[] all properties in riscv_cpu_extensions[] are booleans. This check is now obsolete. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 61bce2dc55..2fa2581742 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1914,17 +1914,11 @@ static void riscv_cpu_add_user_properties(Object *o= bj) * Set the default to disabled for every extension * unknown to KVM and error out if the user attempts * to enable any of them. - * - * We're giving a pass for non-bool properties since they're - * not related to the availability of extensions and can be - * safely ignored as is. */ - if (prop->info =3D=3D &qdev_prop_bool) { - object_property_add(obj, prop->name, "bool", - NULL, cpu_set_cfg_unavailable, - NULL, (void *)prop->name); - continue; - } + object_property_add(obj, prop->name, "bool", + NULL, cpu_set_cfg_unavailable, + NULL, (void *)prop->name); + continue; } #endif qdev_property_add_static(dev, prop); --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690497639; cv=none; d=zohomail.com; s=zohoarc; b=Num4T1mFm3sILHJQ2ADHAt0KwYEdIJGpJ6rkrxcvu+zurwdyXCqHU7ewD6604cTuwXPe37GHRSz5qUVF0/mWpGciF7dGyGBLolvLtrsA516msdWLy99NX/46OsaTHYDd4P4TQqacIBuE3uN1jm/uAvlmXyfjtX4uQKlYcDsT8Bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690497639; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZB106qDcqCPEEX28m2ZsSGLTI4RFzwz7nPc4dEn3fSk=; b=KWSU0kwmQovc4Q8wVrA/atg7IESddYZe8WlaYU5jq+ZjNrqJqb3Wtx/b7vdvVUnKKT1LGKTfqJ+6xTzUyhXIE+i7XtqgRdf2wsW8b1jYDi6gpWewS/WuaxphfazWQlld8iXGzhc+6HBYEItErU/cLrkcsrkVQty8yH5tcg8ZqXo= 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 1690497639427326.73136013846886; Thu, 27 Jul 2023 15:40:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9B3-0001Hj-Lj; Thu, 27 Jul 2023 18:09:45 -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 1qP9B1-0001Gt-95 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:43 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9Az-0004si-Me for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:43 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5634db21a58so1058607eaf.0 for ; Thu, 27 Jul 2023 15:09:41 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495780; x=1691100580; 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=ZB106qDcqCPEEX28m2ZsSGLTI4RFzwz7nPc4dEn3fSk=; b=TrwPVu6pzcQzCxSqgpF/EK5PsR2/dtoyD04rrvOOyIeG1qYPG/M9rECZrspDRZVcXM q2aGoBsiWkgPTf8tjpAp+CHruQUBobt4CNlrtDbLZJUK0n6cPuKjNqqiDlPHhoU3GLQr HjTS3NKaWb3yVTbgGQg5sr/vhqDHJzgkMqKXY7SF2kLP65cFF5yoO4OiWe2QHr3YqCKX 5hOV5wN53ZXuzASU/xEzXdzkiATqzrJDofRfJyvLqk/sGdQnpO6tzzRhy2N79lareaGd 7t7HdHwWBa6g9YNkIulmG4wDv0uDYZLwrVNcNWtanKFzRNfmtgjk7DFIt52nOE1gB4JQ bmmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495780; x=1691100580; 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=ZB106qDcqCPEEX28m2ZsSGLTI4RFzwz7nPc4dEn3fSk=; b=POe8zxOulFKEB87nZSmGwIa5XHslZNctTjM1RmxSwen6i4jPjFC5CNMC8VCr9J4dJO d/X7XZXSbOS8VjcZ7LhNtsN2LDKqWNM7ioS7LDia3uiNTjGbjs3S1jLK/elO+aQcej+t Fg5zjkVb3g1yjTrQwkl/SgIQeveeP62hu3wMsVIpZfv/Ox0AbE7d7apH9r9df6eiD7Ak FzljaHpwsYdiRRU38O0ch4N8fB1/HBKKmjRIl9/exZ7adkM4XINTZCqiaCM9clkQ5mRh hZAue/o+L4TsOZJnTTKkihvu8LJvwGo14EN17Y15ofAuCR2S5jR/lwMAtLB8mhkinLPm 3nIA== X-Gm-Message-State: ABy/qLaAJ8G3/cPAynYlJCdv9XL+BCSIhVsBFKx9rEKAOUvigvyGt5DG WV7rTvl91JC69pozcpgASoRyjqDZ4bbV4n1uIZhydQ== X-Google-Smtp-Source: APBJJlFDyl/Zr9CrTi45TW6jhedlVLMsRPR2cOH34U91MOKJopqEz1qOHH6GF/TmzfSgCkpjDH7uuw== X-Received: by 2002:a4a:2a49:0:b0:565:83d1:e3cc with SMTP id x9-20020a4a2a49000000b0056583d1e3ccmr811109oox.2.1690495780204; Thu, 27 Jul 2023 15:09:40 -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 v6 03/12] target/riscv/cpu.c: split kvm prop handling to its own helper Date: Thu, 27 Jul 2023 19:09:18 -0300 Message-ID: <20230727220927.62950-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c2e; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2e.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: 1690497640369100001 Content-Type: text/plain; charset="utf-8" Future patches will split the existing Property arrays even further, and the existing code in riscv_cpu_add_user_properties() will start to scale bad with it because it's dealing with KVM constraints mixed in with TCG constraints. We're going to pay a high price to share a couple of common lines of code between the two. Create a new riscv_cpu_add_kvm_properties() that will be forked from riscv_cpu_add_user_properties() if we're running KVM. The helper includes all properties that a KVM CPU will add. The rest of riscv_cpu_add_user_properties() body will then be relieved from having to deal with KVM constraints. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 65 ++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 2fa2581742..f1a292d967 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1881,6 +1881,46 @@ static void cpu_set_cfg_unavailable(Object *obj, Vis= itor *v, } #endif =20 +#ifndef CONFIG_USER_ONLY +static void riscv_cpu_add_kvm_unavail_prop(Object *obj, const char *prop_n= ame) +{ + /* Check if KVM created the property already */ + if (object_property_find(obj, prop_name)) { + return; + } + + /* + * Set the default to disabled for every extension + * unknown to KVM and error out if the user attempts + * to enable any of them. + */ + object_property_add(obj, prop_name, "bool", + NULL, cpu_set_cfg_unavailable, + NULL, (void *)prop_name); +} + +static void riscv_cpu_add_kvm_properties(Object *obj) +{ + Property *prop; + DeviceState *dev =3D DEVICE(obj); + + kvm_riscv_init_user_properties(obj); + riscv_cpu_add_misa_properties(obj); + + for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { + riscv_cpu_add_kvm_unavail_prop(obj, prop->name); + } + + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { + /* Check if KVM created the property already */ + if (object_property_find(obj, riscv_cpu_options[i].name)) { + continue; + } + qdev_property_add_static(dev, &riscv_cpu_options[i]); + } +} +#endif + /* * Add CPU properties with user-facing flags. * @@ -1896,39 +1936,18 @@ static void riscv_cpu_add_user_properties(Object *o= bj) riscv_add_satp_mode_properties(obj); =20 if (kvm_enabled()) { - kvm_riscv_init_user_properties(obj); + riscv_cpu_add_kvm_properties(obj); + return; } #endif =20 riscv_cpu_add_misa_properties(obj); =20 for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { -#ifndef CONFIG_USER_ONLY - if (kvm_enabled()) { - /* Check if KVM created the property already */ - if (object_property_find(obj, prop->name)) { - continue; - } - - /* - * Set the default to disabled for every extension - * unknown to KVM and error out if the user attempts - * to enable any of them. - */ - object_property_add(obj, prop->name, "bool", - NULL, cpu_set_cfg_unavailable, - NULL, (void *)prop->name); - continue; - } -#endif qdev_property_add_static(dev, prop); } =20 for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { - /* Check if KVM created the property already */ - if (object_property_find(obj, riscv_cpu_options[i].name)) { - continue; - } qdev_property_add_static(dev, &riscv_cpu_options[i]); } } --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690496343; cv=none; d=zohomail.com; s=zohoarc; b=KoGuUmf/AVtZ88bV4uxlsttoCtyNk8O1/AKbf2poTrJouwAZazeeTLt58g90MAVzsXIpQ6/0StRs92W3Nbp1VCi0oGGCis0gWcNhriNBk9rVhko/R/d6/3mSLgKg5BRd4zXDfG69F/ewK6wUBiB0WLt0yPNp9/j7paOYE+qQmmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690496343; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sHWPH6ZDd4/g5ZGPy4OVuAieR6dV6/jBAR0dJfNNJ0k=; b=TDvTvZ3TrmmHXhyUW3FcemA0ks2h8I4h+a7fYZclvJVSEqUtpiKPSGsmChDmUPC+sbyuYNgH94V/hO9NXAtCSwPAO2ddYnV2JepMLaCA3fpPAXXMD3L8s0hYBA/HRtgTduFNY3wKHBa7PJW+HbVJv2+dB19TxpGrY1d2vQ44L9s= 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 1690496343669913.1539583788951; Thu, 27 Jul 2023 15:19:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9B5-0001Jo-Vu; Thu, 27 Jul 2023 18:09:48 -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 1qP9B4-0001Ht-IY for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:46 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9B2-0004tJ-5K for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:46 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-565f2567422so1019084eaf.2 for ; Thu, 27 Jul 2023 15:09:43 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495782; x=1691100582; 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=sHWPH6ZDd4/g5ZGPy4OVuAieR6dV6/jBAR0dJfNNJ0k=; b=e/v0+MTKpMfxe6370JPbdyPeKb70SMlsXtdXTu3hm4bjHkcRP7TywxinpfUu271w/u cq3JCMhRTrWGfQ72GTU/FFz/BpBc4hScIo9yDqzlQ7RJCpYlwHfKWbaWCoBjvTU0jjB8 W+tvwbVWP3lswYv8eWPf/xcVkufTnPH1SNlXJ6ZynTHYNwlEkm7OaOfaWFg25O3JTcjK T6QN+cK/Jl34R8JScW+5qpoW9WujYBWITLiItRl1HpG1MbBAO7NM4kwJu0igkCmeKa6i 7WriiezQsStRjRlTfjX6sjCNST9shfbWxnI1UMn+GeCtXi9JvEdaJRgNT//iaFtb5kdv LEhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495782; x=1691100582; 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=sHWPH6ZDd4/g5ZGPy4OVuAieR6dV6/jBAR0dJfNNJ0k=; b=DrmESmpiER7Jjd0r7WxguJx4/76DwxSJl1796dAFT/1ktb6EMG8fd0YNuUbwrKaVvm PFwrHjATKk/YFVeJH6ns1Fh+Vbd0AnUASgOmr3HQ2M9PbX9BavgGEJ8PvOc2ToibzHPc VAe8Yog5aOBd5y89BJkm7y/y9pzP0zcWuuZR8XMFyV3Izqqjb8sbc0gtSQyXz1/jmu/+ jrmXZgdSZ58je7Jhp96/h3AYWclX9mt9u3MACWQcajHIeTbWxDYurL/xeF5NwcGRZ9Eq VsTa9peewmWjdpVnHMFSr0yOsJl6vGHdN/RSDvHFrTEKZSfBppP+rjm3gf/A+J1nXF+d sBbw== X-Gm-Message-State: ABy/qLZSQuVQeVLd6x1QwioN8zj3INw3BqRP29xdjw6O4vV5lHpm1xkL grC31t6WVuZI2XOSc+2YFC9p80RhJcfKdbsOh45GEA== X-Google-Smtp-Source: APBJJlGOuP9vN1TE8fcHZ+GoG2+clwD5Y3C6JWSzCM90HB+HD9iZh35eV4fHqGJyNJDuTiY3EHbFIA== X-Received: by 2002:a05:6870:b155:b0:1bb:9b40:268 with SMTP id a21-20020a056870b15500b001bb9b400268mr791130oal.44.1690495782758; Thu, 27 Jul 2023 15:09:42 -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 v6 04/12] target/riscv/cpu.c: del DEFINE_PROP_END_OF_LIST() from riscv_cpu_extensions Date: Thu, 27 Jul 2023 19:09:19 -0300 Message-ID: <20230727220927.62950-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c2b; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2b.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: 1690496344319100002 Content-Type: text/plain; charset="utf-8" This last blank element is used by the 'for' loop to check if a property has a valid name. Remove it and use ARRAY_SIZE() instead like riscv_cpu_options is already using. All future arrays will also do the same and we'll able to encapsulate more repetitions in macros later on. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li --- target/riscv/cpu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f1a292d967..33a2e9328c 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1842,8 +1842,6 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("x-zfbfmin", RISCVCPU, cfg.ext_zfbfmin, false), DEFINE_PROP_BOOL("x-zvfbfmin", RISCVCPU, cfg.ext_zvfbfmin, false), DEFINE_PROP_BOOL("x-zvfbfwma", RISCVCPU, cfg.ext_zvfbfwma, false), - - DEFINE_PROP_END_OF_LIST(), }; =20 static Property riscv_cpu_options[] =3D { @@ -1901,14 +1899,13 @@ static void riscv_cpu_add_kvm_unavail_prop(Object *= obj, const char *prop_name) =20 static void riscv_cpu_add_kvm_properties(Object *obj) { - Property *prop; DeviceState *dev =3D DEVICE(obj); =20 kvm_riscv_init_user_properties(obj); riscv_cpu_add_misa_properties(obj); =20 - for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { - riscv_cpu_add_kvm_unavail_prop(obj, prop->name); + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) { + riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_extensions[i].name); } =20 for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { @@ -1929,7 +1926,6 @@ static void riscv_cpu_add_kvm_properties(Object *obj) */ static void riscv_cpu_add_user_properties(Object *obj) { - Property *prop; DeviceState *dev =3D DEVICE(obj); =20 #ifndef CONFIG_USER_ONLY @@ -1943,8 +1939,8 @@ static void riscv_cpu_add_user_properties(Object *obj) =20 riscv_cpu_add_misa_properties(obj); =20 - for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { - qdev_property_add_static(dev, prop); + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) { + qdev_property_add_static(dev, &riscv_cpu_extensions[i]); } =20 for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690497060; cv=none; d=zohomail.com; s=zohoarc; b=TFjvSfWArx78uFzyXoR6SklIuKCEZCw2SHXE5sMZOzrICA37xZ3wQuRJIr6K7kJaygAKvjkgDevxOZZyi5W0TYhKDmG2uPkOX8/AcXhY5/mAm19kBFhtMyvqr8DwET78ydLXy/P/vzk4WfSFzj4XocOGTMYc1nakqEWpYNwUnbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690497060; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hCeGqZOqU3/KmLKkLA2Ofj9O0444tQLInbZA480lJ3A=; b=baa8yJ3ps4WUXsS03C+c1cvXcPYsfhNl1gpzeHE+vI1YgVLRlQ8Tr2HQhnDfySnnxCb/dgrpUvojA4XYnFZSR5XMd+cryj8WTJxGqDVfHJVkhVQaw+fzcxKcRJuyvLVIKo5KlC52scrnz8M+xsZfofnZ+2Kc4ZZzmWVryC3I1VI= 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 1690497060033965.4991003651348; Thu, 27 Jul 2023 15:31:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9B8-0001Kr-66; Thu, 27 Jul 2023 18:09:50 -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 1qP9B6-0001Ju-9c for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:48 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9B4-0004tc-OF for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:48 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-56c42bb70abso1005116eaf.3 for ; Thu, 27 Jul 2023 15:09:46 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495785; x=1691100585; 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=hCeGqZOqU3/KmLKkLA2Ofj9O0444tQLInbZA480lJ3A=; b=QGFlX64joZOTPOAv3O9iDqUyfQGzczHeuf5ttRCuIGIb61yBwtRF+o56+j6T1/2IGs m3cuhWP6HgRh7xTJAlmGSDBs9ZJjUjNw3g3560seEkY3i34IrwIiuBjoO6Ad20j8c7/8 SwyUkg/odZDMmC1WoYFFb/DLRh/RyMhSHQQrMrfLeInlpmlIr3MHmS88PS8b21bTD+d8 zHtdrT80ooZogQZCgVE8+G7jIOQSpB9ehz5ycwtJGHWyqw7B6iA2IQLYmN25X/1btk33 PmNpylwVS+0I8C4uKhGZUX2heRLIRZDaFqw5COv/faR7n3kHaUrtlbBCPa0pQPVWZNNr 7KzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495785; x=1691100585; 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=hCeGqZOqU3/KmLKkLA2Ofj9O0444tQLInbZA480lJ3A=; b=XlKGF+UgtlpBZ7WStboMPGkpSSlB8i5PY0zIYVAVoD5lmpKaZDoUYXQClhUH0SThMd F6T64+GuCYnXoVt6f+2cYPY85yMC72+FuMZUcSKIvdcoXOVvuWtulIEfhUefesT21RSm eduweD2rHb4beOzM2e1CJ8NCKuUk4AufbuhEN88I2GBZ7FsXmKkGk/sa8OiDZUDCyyEd TgGSDGcd06TubWcLdCQrNeBWum97NlfbZisnBVKUMbx6psVwtRzOWncBZNuKsMAoy/pH m7bKthRMsd/RAY068EVzijsINDR6TCi6z1C5tswmPKyXcgUes/e1HEY7eC93Mi3YMxPT QFOw== X-Gm-Message-State: ABy/qLa564+fZehjGW3/1VU1977zlNp+0aBMEChFG+883cUG8ZoUwJpZ vo3uRG1+tN/jP5A6J88fmliuvTvloR+wbMutYe82qQ== X-Google-Smtp-Source: APBJJlHUK/JnF19JBmbsYqbVdr77aQOV1vaKY5SPrIrNNBzuiCxkBe1mEOBXVXKA12CbF1c4suVY0g== X-Received: by 2002:a4a:341e:0:b0:566:f211:5fc4 with SMTP id b30-20020a4a341e000000b00566f2115fc4mr788473ooa.5.1690495785427; Thu, 27 Jul 2023 15:09:45 -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 v6 05/12] target/riscv/cpu.c: split vendor exts from riscv_cpu_extensions[] Date: Thu, 27 Jul 2023 19:09:20 -0300 Message-ID: <20230727220927.62950-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c33; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc33.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: 1690497061940100003 Content-Type: text/plain; charset="utf-8" Our goal is to make riscv_cpu_extensions[] hold only ratified, non-vendor extensions. Create a new riscv_cpu_vendor_exts[] array for them, changing riscv_cpu_add_user_properties() and riscv_cpu_add_kvm_properties() accordingly. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 33a2e9328c..c8e1de68d3 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1814,20 +1814,6 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("zcmp", RISCVCPU, cfg.ext_zcmp, false), DEFINE_PROP_BOOL("zcmt", RISCVCPU, cfg.ext_zcmt, false), =20 - /* Vendor-specific custom extensions */ - DEFINE_PROP_BOOL("xtheadba", RISCVCPU, cfg.ext_xtheadba, false), - DEFINE_PROP_BOOL("xtheadbb", RISCVCPU, cfg.ext_xtheadbb, false), - DEFINE_PROP_BOOL("xtheadbs", RISCVCPU, cfg.ext_xtheadbs, false), - DEFINE_PROP_BOOL("xtheadcmo", RISCVCPU, cfg.ext_xtheadcmo, false), - DEFINE_PROP_BOOL("xtheadcondmov", RISCVCPU, cfg.ext_xtheadcondmov, fal= se), - DEFINE_PROP_BOOL("xtheadfmemidx", RISCVCPU, cfg.ext_xtheadfmemidx, fal= se), - DEFINE_PROP_BOOL("xtheadfmv", RISCVCPU, cfg.ext_xtheadfmv, false), - DEFINE_PROP_BOOL("xtheadmac", RISCVCPU, cfg.ext_xtheadmac, false), - DEFINE_PROP_BOOL("xtheadmemidx", RISCVCPU, cfg.ext_xtheadmemidx, false= ), - DEFINE_PROP_BOOL("xtheadmempair", RISCVCPU, cfg.ext_xtheadmempair, fal= se), - DEFINE_PROP_BOOL("xtheadsync", RISCVCPU, cfg.ext_xtheadsync, false), - DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps,= false), - /* These are experimental so mark with 'x-' */ DEFINE_PROP_BOOL("x-zicond", RISCVCPU, cfg.ext_zicond, false), =20 @@ -1844,6 +1830,21 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("x-zvfbfwma", RISCVCPU, cfg.ext_zvfbfwma, false), }; =20 +static Property riscv_cpu_vendor_exts[] =3D { + DEFINE_PROP_BOOL("xtheadba", RISCVCPU, cfg.ext_xtheadba, false), + DEFINE_PROP_BOOL("xtheadbb", RISCVCPU, cfg.ext_xtheadbb, false), + DEFINE_PROP_BOOL("xtheadbs", RISCVCPU, cfg.ext_xtheadbs, false), + DEFINE_PROP_BOOL("xtheadcmo", RISCVCPU, cfg.ext_xtheadcmo, false), + DEFINE_PROP_BOOL("xtheadcondmov", RISCVCPU, cfg.ext_xtheadcondmov, fal= se), + DEFINE_PROP_BOOL("xtheadfmemidx", RISCVCPU, cfg.ext_xtheadfmemidx, fal= se), + DEFINE_PROP_BOOL("xtheadfmv", RISCVCPU, cfg.ext_xtheadfmv, false), + DEFINE_PROP_BOOL("xtheadmac", RISCVCPU, cfg.ext_xtheadmac, false), + DEFINE_PROP_BOOL("xtheadmemidx", RISCVCPU, cfg.ext_xtheadmemidx, false= ), + DEFINE_PROP_BOOL("xtheadmempair", RISCVCPU, cfg.ext_xtheadmempair, fal= se), + DEFINE_PROP_BOOL("xtheadsync", RISCVCPU, cfg.ext_xtheadsync, false), + DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps,= false), +}; + static Property riscv_cpu_options[] =3D { DEFINE_PROP_UINT8("pmu-num", RISCVCPU, cfg.pmu_num, 16), =20 @@ -1908,6 +1909,10 @@ static void riscv_cpu_add_kvm_properties(Object *obj) riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_extensions[i].name); } =20 + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_vendor_exts); i++) { + riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_vendor_exts[i].name); + } + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { /* Check if KVM created the property already */ if (object_property_find(obj, riscv_cpu_options[i].name)) { @@ -1946,6 +1951,10 @@ static void riscv_cpu_add_user_properties(Object *ob= j) for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { qdev_property_add_static(dev, &riscv_cpu_options[i]); } + + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_vendor_exts); i++) { + qdev_property_add_static(dev, &riscv_cpu_vendor_exts[i]); + } } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690496562; cv=none; d=zohomail.com; s=zohoarc; b=WAZihY3+RoxwAkNCUefZC2tXSF0WHpWCqlxae+9aRPp/Zur/V6GrGdCVQsMLeQmo/PX6cN78oAP0B5Jf5VlFJLBNj6mbEAP6JjJ4xrPkr2OVRyeI4SFKb/jaBGE74nWfsYSM/BVOB/MrNG6idLDLbp6fCYdQhsszjujeWfyysQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690496562; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Sb7b3Ja0mlFb1eGR3Lro0dwO838RnJMqT2CPVh/wgOA=; b=httANZL/mDZhbUu/Ud/MhI+Qrr7GPNAksx6W4TiLmtyHnASFO68hAnbw1Re2eJZGXnjDYj6pDN6RN6G8tHwIkTxLKGqo9kM4mNd67bhjWlOAujznDE8bYJrtwd9NSP6s5R/+oZrAfln/fd9HQvKr6USDKv9Ws5wpfHn5inyyrZk= 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 169049656210937.27407461137807; Thu, 27 Jul 2023 15:22:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BB-0001Lo-Ma; Thu, 27 Jul 2023 18:09:53 -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 1qP9BA-0001LE-5y for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:52 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9B7-0004uB-HS for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:51 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-5634db21a58so1058656eaf.0 for ; Thu, 27 Jul 2023 15:09:49 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495788; x=1691100588; 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=Sb7b3Ja0mlFb1eGR3Lro0dwO838RnJMqT2CPVh/wgOA=; b=gNwwiSkp/o8Dc3NupZd8nvP8/IMjCIku1eMT/WEGZ7IosCyCz79rFTe41+wSh1krdQ rfpV5/u0Z+qXID1cF4HEnHTgMlHJwu7Jccr9Yu9FWeXRazMOAt0xsPz1B4z3x676Q0Mf guK9YRIXEXHlCXa7ZqJaSG21G3CyI7S3UcinKIHGWzldnvPwFbDhYp5a0xO4/9UDueXH wLfZgijAB05eS/l5Vb23Ls/MwB7OYO2GRph3PZG5R9gkRuO+eRmPpmZznFrXNNMabEPm 08ZS/LlGRewrGyFx1Yoy2hZIJVQf/QaUNk/JmeMmF0GJmCsjuIhUgzIhncr0PGLCv9u4 sXjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495788; x=1691100588; 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=Sb7b3Ja0mlFb1eGR3Lro0dwO838RnJMqT2CPVh/wgOA=; b=DWOp5G13x6ucS0SmFaEehiIJb9yGhAZPCQCQlV25lAsG47OODywy07cwZaygtREQU3 OAbH0gcsokYFwKYtdd9qjwAS5AqWuUSDY36JzPfbIBSBL/rnaDsEcFXqCPLn2KEwfCGd O4YJAfkXskMw5GQSqT2JFuNsexjADP047FSeYilvCqjrcTl2jylcrXMw1voh4GFAbDyv Zwojj8d26MZJ7SrxGA0JTnB7dR+H7n0K5fzJvNbPa/PG+wDjfsJiKT2U3ydiE/MKZkKq JrijuCeiu0R4oh3kcGg7TbbJxIQD3Ykc3J59X0q71pPJMNZi2X1/D35p6ytGN96TGu9O Fe2g== X-Gm-Message-State: ABy/qLbDacD7+nBpI0ITd5HmtHqFViXuBsD+QoY4RE8f+AkmhjHk3C/0 UnJOtHOg71mNGNmeGSec35SbJiTn4CYixrQR55axhQ== X-Google-Smtp-Source: APBJJlFi4FTlMuIYfzfdr9VBIwp+/Wv5jpdE3znddxfe0F/itc+acgtw2dludR8poNJLcdc7lcNXlw== X-Received: by 2002:a4a:851a:0:b0:569:e93d:1660 with SMTP id k26-20020a4a851a000000b00569e93d1660mr696112ooh.9.1690495788007; Thu, 27 Jul 2023 15:09:48 -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 v6 06/12] target/riscv/cpu.c: split non-ratified exts from riscv_cpu_extensions[] Date: Thu, 27 Jul 2023 19:09:21 -0300 Message-ID: <20230727220927.62950-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c2f; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2f.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: 1690496563933100003 Content-Type: text/plain; charset="utf-8" Create a new riscv_cpu_experimental_exts[] to store the non-ratified extensions properties. Once they are ratified we'll move them back to riscv_cpu_extensions[]. riscv_cpu_add_user_properties() and riscv_cpu_add_kvm_properties() are changed to keep adding non-ratified properties to users. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index c8e1de68d3..d829517f40 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1813,21 +1813,6 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_BOOL("zcf", RISCVCPU, cfg.ext_zcf, false), DEFINE_PROP_BOOL("zcmp", RISCVCPU, cfg.ext_zcmp, false), DEFINE_PROP_BOOL("zcmt", RISCVCPU, cfg.ext_zcmt, false), - - /* These are experimental so mark with 'x-' */ - DEFINE_PROP_BOOL("x-zicond", RISCVCPU, cfg.ext_zicond, false), - - /* ePMP 0.9.3 */ - DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false), - DEFINE_PROP_BOOL("x-smaia", RISCVCPU, cfg.ext_smaia, false), - DEFINE_PROP_BOOL("x-ssaia", RISCVCPU, cfg.ext_ssaia, false), - - DEFINE_PROP_BOOL("x-zvfh", RISCVCPU, cfg.ext_zvfh, false), - DEFINE_PROP_BOOL("x-zvfhmin", RISCVCPU, cfg.ext_zvfhmin, false), - - DEFINE_PROP_BOOL("x-zfbfmin", RISCVCPU, cfg.ext_zfbfmin, false), - DEFINE_PROP_BOOL("x-zvfbfmin", RISCVCPU, cfg.ext_zvfbfmin, false), - DEFINE_PROP_BOOL("x-zvfbfwma", RISCVCPU, cfg.ext_zvfbfwma, false), }; =20 static Property riscv_cpu_vendor_exts[] =3D { @@ -1845,6 +1830,23 @@ static Property riscv_cpu_vendor_exts[] =3D { DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps,= false), }; =20 +/* These are experimental so mark with 'x-' */ +static Property riscv_cpu_experimental_exts[] =3D { + DEFINE_PROP_BOOL("x-zicond", RISCVCPU, cfg.ext_zicond, false), + + /* ePMP 0.9.3 */ + DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false), + DEFINE_PROP_BOOL("x-smaia", RISCVCPU, cfg.ext_smaia, false), + DEFINE_PROP_BOOL("x-ssaia", RISCVCPU, cfg.ext_ssaia, false), + + DEFINE_PROP_BOOL("x-zvfh", RISCVCPU, cfg.ext_zvfh, false), + DEFINE_PROP_BOOL("x-zvfhmin", RISCVCPU, cfg.ext_zvfhmin, false), + + DEFINE_PROP_BOOL("x-zfbfmin", RISCVCPU, cfg.ext_zfbfmin, false), + DEFINE_PROP_BOOL("x-zvfbfmin", RISCVCPU, cfg.ext_zvfbfmin, false), + DEFINE_PROP_BOOL("x-zvfbfwma", RISCVCPU, cfg.ext_zvfbfwma, false), +}; + static Property riscv_cpu_options[] =3D { DEFINE_PROP_UINT8("pmu-num", RISCVCPU, cfg.pmu_num, 16), =20 @@ -1913,6 +1915,11 @@ static void riscv_cpu_add_kvm_properties(Object *obj) riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_vendor_exts[i].name); } =20 + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_experimental_exts); i++) { + riscv_cpu_add_kvm_unavail_prop(obj, + riscv_cpu_experimental_exts[i].name= ); + } + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { /* Check if KVM created the property already */ if (object_property_find(obj, riscv_cpu_options[i].name)) { @@ -1955,6 +1962,10 @@ static void riscv_cpu_add_user_properties(Object *ob= j) for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_vendor_exts); i++) { qdev_property_add_static(dev, &riscv_cpu_vendor_exts[i]); } + + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_experimental_exts); i++) { + qdev_property_add_static(dev, &riscv_cpu_experimental_exts[i]); + } } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690497457; cv=none; d=zohomail.com; s=zohoarc; b=jutXbDYbyQlX2uthWpOGjGRp1co/o248WTYbC9jOCHvYT5yigd9CjwsEzuXBStHm1BGamGxL4HZ0zrNLCd8HCGkw0iWUPLK13/j6eMEhuz4LgD9xPxN5YP/wLUZzqnZXcsBYa8+4MfhIlqV240Ud9JZN0QVB1XgXDVvdNenwyi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690497457; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oF5CeMRc1qhvGJ6s6NeTiIJwq3Ap4HqQ5wxvWLCfVCo=; b=JW/9XbSkKxaaT5B15zhRLrX5RfmsHGvSrXOqs7wPA/KLJorOOboSncCVY+zKZj+jZYryVI3iVZsDMchKNob0lXyVaR4deqMUlIdUpqyNhJh/9cTp1zzEYhPq3YkblUBebmPMWeyry5k43Vb6/ITdGZ3QSxbCHJJEXluUT8jSlC4= 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 1690497457434901.8234595210359; Thu, 27 Jul 2023 15:37:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BD-0001MR-Ab; Thu, 27 Jul 2023 18:09:55 -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 1qP9BB-0001LZ-Ff for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:53 -0400 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9B9-0004uZ-RJ for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:53 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1bbb9fcac6bso905609fac.1 for ; Thu, 27 Jul 2023 15:09:51 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495790; x=1691100590; 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=oF5CeMRc1qhvGJ6s6NeTiIJwq3Ap4HqQ5wxvWLCfVCo=; b=lrgT0uwHdRvKybCBv3GmxnJoi3hIHXhFJ7Cr9Wap6VuYU2/PocH74CJjQCxm159WKJ Ly5d7YSKRCaZCd+oHpTz72L/8qMn28PXJ+R+/wWANiy1qOwDJjrSbSaqTn+g6MqM5sEW nSJBX0yCRusNtIhynBSoHJEWR7Zdyxu/cqZ3yDr6qsaTldaVC2si/ZNX66Iz4cm45G1W yUDv371lz5Zznz4Bxz5RxJFce/LlFfLWdlvBu2Y7h3a/OLl6s09YEzyNWwkEnIaWHmvq zLg5FtFM5IbCzYDX6w0ycZSE6TzxZXNS8/DpIvwl37VVTgi6kZwzIDQo8j6Mnh04TehX sgyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495790; x=1691100590; 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=oF5CeMRc1qhvGJ6s6NeTiIJwq3Ap4HqQ5wxvWLCfVCo=; b=lxCV1fjRId++qkTukPP3eSdeV0W/RqW229mshoLHsL2SER9+dggCvOvpCWxWrTgkPP 1cjpk64fHYw4d3eU/CCuSxDPzTiN+/JnQ/Ci51kR/nwsYgbge2Es5v7YrJ/JDKqDi2tu dyCDBdxc7kxVFfos2+RLCbhAYca634923hpwJCwRO9naDgpL9M0owy5Qtb8Q68phLpPu H1g0zpY7G5HQODCb0hIBWa44WziiN/25M6Q3RA4vXUrqUtmAQHIS8/yjgnfcoq5TipBs LOgY1ZEm2e95cvAVh+UEh2W4iqDLXcvaS9LPF7vBzGLs5JyHlH3PhUb7PYfbm5NJWPrB 6SWw== X-Gm-Message-State: ABy/qLZkYGHEwDhoMrIw6feVoRvDfv8oNit0TQNcXNrTWHWBPK4YNJCw nOklmPAacn2nlvtB2njiFHFS1SJYGqcdxsXcnjzf9w== X-Google-Smtp-Source: APBJJlHjNi6YL/4AEgs7jPr3V2XZ5+wh7kRVoC0845o2ygbQUarL87dDYCJBhKVKJl+C9f681Y+r8g== X-Received: by 2002:a05:6871:b0d:b0:1ba:dabb:d5da with SMTP id fq13-20020a0568710b0d00b001badabbd5damr3188735oab.15.1690495790603; Thu, 27 Jul 2023 15:09:50 -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 v6 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro Date: Thu, 27 Jul 2023 19:09:22 -0300 Message-ID: <20230727220927.62950-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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=2001:4860:4864:20::30; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x30.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: 1690497460257100003 Content-Type: text/plain; charset="utf-8" The code inside riscv_cpu_add_user_properties() became quite repetitive after recent changes. Add a macro to hide the repetition away. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li --- target/riscv/cpu.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index d829517f40..971dcb2aec 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1882,6 +1882,13 @@ static void cpu_set_cfg_unavailable(Object *obj, Vis= itor *v, } #endif =20 +#define ADD_CPU_QDEV_PROPERTIES_ARRAY(_dev, _array) \ + do { \ + for (int i =3D 0; i < ARRAY_SIZE(_array); i++) { \ + qdev_property_add_static(_dev, &_array[i]); \ + } \ + } while (0) + #ifndef CONFIG_USER_ONLY static void riscv_cpu_add_kvm_unavail_prop(Object *obj, const char *prop_n= ame) { @@ -1951,21 +1958,10 @@ static void riscv_cpu_add_user_properties(Object *o= bj) =20 riscv_cpu_add_misa_properties(obj); =20 - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) { - qdev_property_add_static(dev, &riscv_cpu_extensions[i]); - } - - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { - qdev_property_add_static(dev, &riscv_cpu_options[i]); - } - - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_vendor_exts); i++) { - qdev_property_add_static(dev, &riscv_cpu_vendor_exts[i]); - } - - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_experimental_exts); i++) { - qdev_property_add_static(dev, &riscv_cpu_experimental_exts[i]); - } + ADD_CPU_QDEV_PROPERTIES_ARRAY(dev, riscv_cpu_extensions); + ADD_CPU_QDEV_PROPERTIES_ARRAY(dev, riscv_cpu_options); + ADD_CPU_QDEV_PROPERTIES_ARRAY(dev, riscv_cpu_vendor_exts); + ADD_CPU_QDEV_PROPERTIES_ARRAY(dev, riscv_cpu_experimental_exts); } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690497802; cv=none; d=zohomail.com; s=zohoarc; b=WarGGPY8vD12Au++DEK4Z+eN9Mt5G5nYuwf4mJJLZQKZ2QDzk3u0jLEpUYnhZNBTZ/IA48H3PWjtBCk6Z2B7+Tg5+W4TV9UPpRWs3vypX//hdaaP/+MFo+xf32R6Eiv/WB0VQzREmEMW0me+aiKeSRy7UvBccBGRL5NmhLtOMvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690497802; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Iuey/+ud8lCVZSrBfFSHOKRgV5c7Mqn96fr5/rKtORQ=; b=eXqmM9QzEybxmLIca7BT6BRbzSsYcWjxik14vaP09V8/Uj7giC8ROi3WJaFwkjzWXEfZtu4N06bn/TpgfOxQO+zrRQiWd3mIik+P+/IUmHuAaKwvNgDu+t6kBNXERgs0Lg19xfw/7PpSO8pi5P7GXPpBp3qvoS3ZcwJ6p9bnoJg= 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 1690497802027453.86232664955116; Thu, 27 Jul 2023 15:43:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BF-0001NJ-Un; Thu, 27 Jul 2023 18:09:57 -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 1qP9BE-0001Mu-CK for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:56 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9BC-0004vY-Lj for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:56 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-56368c40e8eso1092777eaf.0 for ; Thu, 27 Jul 2023 15:09:54 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495793; x=1691100593; 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=Iuey/+ud8lCVZSrBfFSHOKRgV5c7Mqn96fr5/rKtORQ=; b=UMKLNt4VIqQhX+m23AROFsmB90aJ9oUrf5/kU/kEhME8egBN7XUWGzDtfDvZfiCNdt 7twEi/u/OnrcJyFURN4NUNAJ9M4TNbCj/8dp1bFZLlwLNEMUY4mwi27MkGFMJdd7CdjX 2N3aLSCkYhPpmSFIbd+7mPHPTfEuwASWgZRQCYnV6fwUnOBgX7MekUf8hFctU8VUa7So MtFsI460gFSclW/FP3wkxybFSczUvh8zqSkJBe2y3MR03Xb4E6OaxmjBo3+/ydcWL/z7 WL7I/WXqjkSNxtUe6/DVB+IYjv+5mGrN13aKJNeo0KWSzrBRU0UTvC8lA1ry354UWxbp XYKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495793; x=1691100593; 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=Iuey/+ud8lCVZSrBfFSHOKRgV5c7Mqn96fr5/rKtORQ=; b=D5Y7x1Ao5TaaAyHtHhysgZdHt9+tG7TePBo3MbZZZj4kU1vatWF/UgywzDLVnuIr1t ygaoG2kpfoURosqDmjUOFSRoFw0ZGBAswiy1chbfoGSXhlZJJBCqqCVZXdygukWV2jwD LSyqsfW6hJjgz1IExNGQTI74q1mdCQuRfZjFr35M8NVH7DlwQaF7X+fiTYMhWtvAqNtO 6LHogP1Dhm24ivaoiPfXbkfoHNka+nKbOOZCZlAl8phrZlQz1m8edgYbhWiM3Y74KewK Hh31tluv4qbZeQ0L2MP6ozIRDXAaTA/kwRRDHdD+7Kk7rT2b0NL7ToBI7hHyf5/Yvt1v 7ubw== X-Gm-Message-State: ABy/qLaYIRGO3ezXPJXI0IXOvuqFiSIGByDRfgm9H5WZVWs+6yEex0FY rvvMyaNl13tUAJ+KCznILg2oIm9U4mPOvVkjyZD8Sw== X-Google-Smtp-Source: APBJJlEy7tOXR4Hzs1I1uXUwsiXU3RmxNOs9123L0gZMfsuPkH8yBxEt773EhKGxC2ZXSc0cF/rb2A== X-Received: by 2002:a4a:6219:0:b0:567:8412:7fc8 with SMTP id x25-20020a4a6219000000b0056784127fc8mr803255ooc.1.1690495793124; Thu, 27 Jul 2023 15:09:53 -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 v6 08/12] target/riscv/cpu.c: add ADD_UNAVAIL_KVM_PROP_ARRAY() macro Date: Thu, 27 Jul 2023 19:09:23 -0300 Message-ID: <20230727220927.62950-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c2f; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2f.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: 1690497804165100003 Content-Type: text/plain; charset="utf-8" Use a macro in riscv_cpu_add_kvm_properties() to eliminate some of its code repetition, similar to what we're already doing with ADD_CPU_QDEV_PROPERTIES_ARRAY(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li --- target/riscv/cpu.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 971dcb2aec..08f61ed051 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1907,6 +1907,13 @@ static void riscv_cpu_add_kvm_unavail_prop(Object *o= bj, const char *prop_name) NULL, (void *)prop_name); } =20 +#define ADD_UNAVAIL_KVM_PROP_ARRAY(_obj, _array) \ + do { \ + for (int i =3D 0; i < ARRAY_SIZE(_array); i++) { \ + riscv_cpu_add_kvm_unavail_prop(_obj, _array[i].name); \ + } \ + } while (0) + static void riscv_cpu_add_kvm_properties(Object *obj) { DeviceState *dev =3D DEVICE(obj); @@ -1914,18 +1921,9 @@ static void riscv_cpu_add_kvm_properties(Object *obj) kvm_riscv_init_user_properties(obj); riscv_cpu_add_misa_properties(obj); =20 - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) { - riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_extensions[i].name); - } - - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_vendor_exts); i++) { - riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_vendor_exts[i].name); - } - - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_experimental_exts); i++) { - riscv_cpu_add_kvm_unavail_prop(obj, - riscv_cpu_experimental_exts[i].name= ); - } + ADD_UNAVAIL_KVM_PROP_ARRAY(obj, riscv_cpu_extensions); + ADD_UNAVAIL_KVM_PROP_ARRAY(obj, riscv_cpu_vendor_exts); + ADD_UNAVAIL_KVM_PROP_ARRAY(obj, riscv_cpu_experimental_exts); =20 for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { /* Check if KVM created the property already */ --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690496500; cv=none; d=zohomail.com; s=zohoarc; b=FN5pDnfqSeGUF/RvOrQrnRxxWDmXpVKN+/lOL/YuT5/AjSGxWVfGz+1OZer3cKb49dZUFNAFi33/7dE4TbpPlsmacSITdAVdtRBZjrhyu5MjS3KipgRbYuJqUP8MC3Wd0Qb46D73zXXZu58R3OOOKHZRdvd1++3VzXs0ubV3Wj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690496500; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qRCR9Mf5plbjelwhDbaxnwtPLp8voenW02dvjtM3a34=; b=kFFII2lgecsfZYTA42wgUR1fo+3LArYGc5LRzdnrljd8cP7zfX7jc8fHjqs5Wkr+Wb+BVjC87uWKNOLHhr2kVaLqSUs6oIaTjQIQez+KLvGX0f3yc5jabNR0/MKbe/hsNU0AXZ5n2RuQXeA6ozpuVDiOHd5qXyKqTuTUkVoa8zk= 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 1690496500258283.0896284011426; Thu, 27 Jul 2023 15:21:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BI-0001OC-NT; Thu, 27 Jul 2023 18:10:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP9BG-0001Nh-V5 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:59 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9BF-0004wB-6t for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:09:58 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5657d8ecdd3so1026665eaf.1 for ; Thu, 27 Jul 2023 15:09:56 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495795; x=1691100595; 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=qRCR9Mf5plbjelwhDbaxnwtPLp8voenW02dvjtM3a34=; b=CWpmXPPsJxpIaoNoWN7lKrw5wmn7Co1oza0s07Vis/FlpHQ4XR8i6zShgjMIj3NxCH RqmPdo/AnHqmqaMuS0CAy4xFNrIcjehhb17SeYpMXPMyOkU4m2fsH/xlBeI4TBLEQMXD IQ+D2jDK0/pDwIUCEqon4fgQ6FIuQiJnWcC/tQhQrCJ8MR/dFToXlOQirtXXH3JRo++a R5QonwXp31CyPmZzv6CJRHJOuAIcL27NWqh/zOXJ9Iyg7qVTo2rQH12tVPIiajZSW522 uJCxiazQ19TPv7QMQKwWXS1JmJ4uGNW9mNAQ3Nuzt22xmIGJnmB5f86wleaDlVO6IUHk ML6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495795; x=1691100595; 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=qRCR9Mf5plbjelwhDbaxnwtPLp8voenW02dvjtM3a34=; b=I2rqv3zG5Cb/AUY50Ztm2g/n4EHPggTqg5bhjpL9zYlJsKtgmzykRlcGmFbKyrA8s3 CVGcFJurLJ06C+H3ZIX8CBuaMH2SiO/ju6ulHmoMhyKD2IR7RAljWBtAhLSxm2IlsXyV /ylCPDCdk8chq7ecl6JFyxScfnbSA/CRXVb3cOJrH7OD+qv/GCKiR52E+IAfuAlEsWzb Pzhfr6E/TyCOmPmSezdKldTrfd0aPQNEFdAIzqs5K3yx0akOJjA7zKb8jkMkF025t/MX SGI533r73dprhp3lVNQ8gRnEvEf+/skPDWjrValR6rfpvlZWLe2lrBPbITBnQT3ygu/f iaSg== X-Gm-Message-State: ABy/qLbMclacshjshvGMW0W43BHFFCn0hnMIITDCuHAu6oZ7tBy6IssF LcmCQZWx/u/n1A4V8i2rR/p8NdDywMz5C7WEX1ImIg== X-Google-Smtp-Source: APBJJlGflDNeHSvQTDLU8AJSYQ3P+mxwnDkw41RnthKSK57DAhU49E3nV7VUyMjlyPZuEo2dRcYMTg== X-Received: by 2002:a4a:760a:0:b0:566:f69c:a6e4 with SMTP id t10-20020a4a760a000000b00566f69ca6e4mr757943ooc.9.1690495795751; Thu, 27 Jul 2023 15:09:55 -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 v6 09/12] target/riscv/cpu.c: limit cfg->vext_spec log message Date: Thu, 27 Jul 2023 19:09:24 -0300 Message-ID: <20230727220927.62950-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c2c; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2c.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: 1690496501854100003 Content-Type: text/plain; charset="utf-8" Inside riscv_cpu_validate_v() we're always throwing a log message if the user didn't set a vector version via 'vext_spec'. We're going to include one case with the 'max' CPU where env->vext_ver will be set in the cpu_init(). But that alone will not stop the "vector version is not specified" message from appearing. The usefulness of this log message is debatable for the generic CPUs, but for a 'max' CPU type, where we are supposed to deliver a CPU model with all features possible, it's strange to force users to set 'vext_spec' to get rid of this message. Change riscv_cpu_validate_v() to not throw this log message if env->vext_ver is already set. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Weiwei Li --- target/riscv/cpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 08f61ed051..01b0d228f5 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -939,8 +939,6 @@ static void riscv_cpu_disas_set_info(CPUState *s, disas= semble_info *info) static void riscv_cpu_validate_v(CPURISCVState *env, RISCVCPUConfig *cfg, Error **errp) { - int vext_version =3D VEXT_VERSION_1_00_0; - if (!is_power_of_2(cfg->vlen)) { error_setg(errp, "Vector extension VLEN must be power of 2"); return; @@ -963,17 +961,18 @@ static void riscv_cpu_validate_v(CPURISCVState *env, = RISCVCPUConfig *cfg, } if (cfg->vext_spec) { if (!g_strcmp0(cfg->vext_spec, "v1.0")) { - vext_version =3D VEXT_VERSION_1_00_0; + env->vext_ver =3D VEXT_VERSION_1_00_0; } else { error_setg(errp, "Unsupported vector spec version '%s'", cfg->vext_spec); return; } - } else { + } else if (env->vext_ver =3D=3D 0) { qemu_log("vector version is not specified, " "use the default value v1.0\n"); + + env->vext_ver =3D VEXT_VERSION_1_00_0; } - env->vext_ver =3D vext_version; } =20 static void riscv_cpu_validate_priv_spec(RISCVCPU *cpu, Error **errp) --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690498299; cv=none; d=zohomail.com; s=zohoarc; b=NwBcqP02ph9lbcJeZNwS03MiYVut/k0CLGb58rdBGnpBkuTybZHxIr9n20SMApRntfQC7epa/prRtytR5J9XjQo1JIqFCGB5ZDmEPL0pJDsvqjuKbFpm94/DiUEaNPctqgR1tsF9eG0YQaCT48Ug2s/KDb3C/bSqiWY7cFcYH2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690498299; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ggsx4MiKNFlzSbhiIdfiNyI940n+7CVZmyY4XDG05O8=; b=S/UJGysuuFtHwVxImAZTI/jVnLyxPT6YCd2/jHuFtsy9ekve13dm2WD7ehoIE08r3dDJhMIFs0n0sL+we4Fr0GMyeN67uxyBw+GjY8zXZn3vQ1LEAcB/4hM526P3kHkZxtr4p5H2aaFFDvtJG2pd+YJ1g/QxgLWZgf1KflctrFg= 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 16904982996111016.2924381420008; Thu, 27 Jul 2023 15:51:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BK-0001Oo-Ea; Thu, 27 Jul 2023 18:10:02 -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 1qP9BJ-0001Od-9z for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:10:01 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9BH-0004we-LC for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:10:01 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-565f8e359b8so1023274eaf.2 for ; Thu, 27 Jul 2023 15:09:59 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495798; x=1691100598; 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=Ggsx4MiKNFlzSbhiIdfiNyI940n+7CVZmyY4XDG05O8=; b=CcG6NRcUdPRmrmXD/Q7eqMoubwA/5aYDeKYdNK3Co3t7TpO7AUzYnhPglM3PdATh2D jM/fR/4LluJLf+XqgikuBFWVoBSjaEotk9c2H8PAerq+To5KeHp4MfV9adEVyGTuTiva 0n8ZstYbnTGWCH4D+MsMAqdnPKRWrpLxPTAB0cLMiCn0CxfdBxk4utvdQQPSNqv/aSmd 7ECTVDlRVutr+GvnBVuX/CVZY/aCUw71gVfccNtoMy6odfiGswR4/4NakQdd3DNWlub2 sDZPK0y1n0YJX61vHDHxwuXFnnbWtO5wcXbhBDClX2aIJuovAkoCXeD8koEjIhuX9i4Q bbUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495798; x=1691100598; 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=Ggsx4MiKNFlzSbhiIdfiNyI940n+7CVZmyY4XDG05O8=; b=P+2D/b93a7czu2rTcGPTRIvda8K06VZ+SVTczI6XqcfoJ1/7IAtPOIs7jvq680z9lJ 3Urzua2SDK9GywSjwfMTFn2EXkDlJ9A3JutJqd2s5Yeg81yAPUbyJ0/2GGEpqkcUqAhW 7qyo8CNaeUF95WuQKEPGCRN3D2cf6BvV7uDeHmfL69H/qiGu2fnA76Zi0mQIv/y2actw /5C//WBeU6Frvw2PN/ik8leMEOAI4dbjFcbkueAGHBlhRFXTJVJirp3W80xCt98BE8Ww NBuEBUfEHQc+783KK/4cb8qpAm4JeC1QvTzxrW/tL6ePlfOT2bg6xxfJCFcpkzkE+7+7 FnGw== X-Gm-Message-State: ABy/qLa7Q25bsz+BQdCBbPBpSCC6Buv8zqsQ1T6HI2ZFHxO5Zy72sBBg h4KoxSTqa4cy/GhhHDJdTR1Y6lQIB8pHgTn0ts64Rg== X-Google-Smtp-Source: APBJJlHAratV+eqmltBa1fH8V/2N7H3YnDvkFHu6gMLzd/SPQSkhlPRSASUL2tkzjuVcxXhvZVzbZA== X-Received: by 2002:a4a:6c5b:0:b0:567:d:c8 with SMTP id u27-20020a4a6c5b000000b00567000d00c8mr727665oof.9.1690495798311; Thu, 27 Jul 2023 15:09:58 -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 v6 10/12] target/riscv: add 'max' CPU type Date: Thu, 27 Jul 2023 19:09:25 -0300 Message-ID: <20230727220927.62950-11-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c31; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc31.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: 1690498302721100001 Content-Type: text/plain; charset="utf-8" The 'max' CPU type is used by tooling to determine what's the most capable CPU a current QEMU version implements. Other archs such as ARM implements this type. Let's add it to RISC-V. What we consider "most capable CPU" in this context are related to ratified, non-vendor extensions. This means that we want the 'max' CPU to enable all (possible) ratified extensions by default. The reasoning behind this design is (1) vendor extensions can conflict with each other and we won't play favorities deciding which one is default or not and (2) non-ratified extensions are always prone to changes, not being stable enough to be enabled by default. All this said, we're still not able to enable all ratified extensions due to conflicts between them. Zfinx and all its dependencies aren't enabled because of a conflict with RVF. zce, zcmp and zcmt are also disabled due to RVD conflicts. When running with 64 bits we're also disabling zcf. MISA bits RVG, RVJ and RVV are also being set manually since they're default disabled. This is the resulting 'riscv,isa' DT for this new CPU: rv64imafdcvh_zicbom_zicboz_zicsr_zifencei_zihintpause_zawrs_zfa_ zfh_zfhmin_zca_zcb_zcd_zba_zbb_zbc_zbkb_zbkc_zbkx_zbs_zk_zkn_zknd_ zkne_zknh_zkr_zks_zksed_zksh_zkt_zve32f_zve64f_zve64d_ smstateen_sscofpmf_sstc_svadu_svinval_svnapot_svpbmt Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index 04af50983e..f3fbe37a2c 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -30,6 +30,7 @@ #define CPU_RESOLVING_TYPE TYPE_RISCV_CPU =20 #define TYPE_RISCV_CPU_ANY RISCV_CPU_TYPE_NAME("any") +#define TYPE_RISCV_CPU_MAX RISCV_CPU_TYPE_NAME("max") #define TYPE_RISCV_CPU_BASE32 RISCV_CPU_TYPE_NAME("rv32") #define TYPE_RISCV_CPU_BASE64 RISCV_CPU_TYPE_NAME("rv64") #define TYPE_RISCV_CPU_BASE128 RISCV_CPU_TYPE_NAME("x-rv128") diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 01b0d228f5..3e840f1a20 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -250,6 +250,7 @@ static const char * const riscv_intr_names[] =3D { }; =20 static void riscv_cpu_add_user_properties(Object *obj); +static void riscv_init_max_cpu_extensions(Object *obj); =20 const char *riscv_cpu_get_trap_name(target_ulong cause, bool async) { @@ -376,6 +377,25 @@ static void riscv_any_cpu_init(Object *obj) cpu->cfg.pmp =3D true; } =20 +static void riscv_max_cpu_init(Object *obj) +{ + RISCVCPU *cpu =3D RISCV_CPU(obj); + CPURISCVState *env =3D &cpu->env; + RISCVMXL mlx =3D MXL_RV64; + +#ifdef TARGET_RISCV32 + mlx =3D MXL_RV32; +#endif + set_misa(env, mlx, 0); + riscv_cpu_add_user_properties(obj); + riscv_init_max_cpu_extensions(obj); + env->priv_ver =3D PRIV_VERSION_LATEST; +#ifndef CONFIG_USER_ONLY + set_satp_mode_max_supported(RISCV_CPU(obj), mlx =3D=3D MXL_RV32 ? + VM_1_10_SV32 : VM_1_10_SV57); +#endif +} + #if defined(TARGET_RISCV64) static void rv64_base_cpu_init(Object *obj) { @@ -1961,6 +1981,41 @@ static void riscv_cpu_add_user_properties(Object *ob= j) ADD_CPU_QDEV_PROPERTIES_ARRAY(dev, riscv_cpu_experimental_exts); } =20 +/* + * The 'max' type CPU will have all possible ratified + * non-vendor extensions enabled. + */ +static void riscv_init_max_cpu_extensions(Object *obj) +{ + RISCVCPU *cpu =3D RISCV_CPU(obj); + CPURISCVState *env =3D &cpu->env; + + /* Enable RVG, RVJ and RVV that are disabled by default */ + set_misa(env, env->misa_mxl, env->misa_ext | RVG | RVJ | RVV); + + for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) { + object_property_set_bool(obj, riscv_cpu_extensions[i].name, + true, NULL); + } + + /* set vector version */ + env->vext_ver =3D VEXT_VERSION_1_00_0; + + /* Zfinx is not compatible with F. Disable it */ + object_property_set_bool(obj, "zfinx", false, NULL); + object_property_set_bool(obj, "zdinx", false, NULL); + object_property_set_bool(obj, "zhinx", false, NULL); + object_property_set_bool(obj, "zhinxmin", false, NULL); + + object_property_set_bool(obj, "zce", false, NULL); + object_property_set_bool(obj, "zcmp", false, NULL); + object_property_set_bool(obj, "zcmt", false, NULL); + + if (env->misa_mxl !=3D MXL_RV32) { + object_property_set_bool(obj, "zcf", false, NULL); + } +} + static Property riscv_cpu_properties[] =3D { DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true), =20 @@ -2299,6 +2354,7 @@ static const TypeInfo riscv_cpu_type_infos[] =3D { .abstract =3D true, }, DEFINE_DYNAMIC_CPU(TYPE_RISCV_CPU_ANY, riscv_any_cpu_init), + DEFINE_DYNAMIC_CPU(TYPE_RISCV_CPU_MAX, riscv_max_cpu_init), #if defined(CONFIG_KVM) DEFINE_CPU(TYPE_RISCV_CPU_HOST, riscv_host_cpu_init), #endif --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690497309; cv=none; d=zohomail.com; s=zohoarc; b=QRniNgmNh7Nq13Ob6FiAfjbNUkddUBXrxn1NjvkU7VGV+qgKTMsCP76IkR8NzEvkkauRfZ6T3oT2OFREjBqvfLtwwKSsGaXluxg+w2PHJ7fcrDKcP+v/bft1MPHp1fYw6hVK00dRxNKNgSEYYCHKarDAbP8LGFSmpV3kjXzQfvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690497309; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+mkt2khv3HlTYD2I5HX8C8vkoqmlMW0ZXesjrMFYxT0=; b=Cvz081wbHst4emv/KnnfFPLQ2Qu7SnWRPJ/0AuG2nW8Xyecgqe5v9Q2YW1inY/sTtbdb/T8vKJqFg9Yqzfgr1Sa87hxoyDIaUe/Pf18eDuDJylKxP6h3u4llEwOKVcQuNi3QQvfeG5iYl2qwQaZLROQe4II6yCf8xCG0Pb1uUWU= 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 1690497309399286.5454652346515; Thu, 27 Jul 2023 15:35:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BM-0001Pf-MP; Thu, 27 Jul 2023 18:10:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP9BL-0001PO-QS for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:10:03 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9BK-0004xb-9G for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:10:03 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-55e1a9ff9d4so1574154eaf.1 for ; Thu, 27 Jul 2023 15:10:01 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495801; x=1691100601; 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=+mkt2khv3HlTYD2I5HX8C8vkoqmlMW0ZXesjrMFYxT0=; b=Lwdha/gIYdC4/GM+l6EjL7fY5LOJkczjSyGS+G6LUdiRD0V/km1u4bmOP+oe474DRQ KAeaSFSHCd2uwmOfrV3X4emFyfvbzRg53Ktu1NwTzJO3P3FwbnMF2LZlbw8Y827T3pbV ygW5D/7RRlfVbxkksdg2G/yGf+b3B8IMpSycmX+KVP2xe/NVPca1etq67+CS049sZMfz AO2wIcLMKvp2slIIRXkefzOQffQ396MWa1LsWiMbuhC3Lt49OFZ3gAS2BWjBY+dSQ1nP lnFRwnDy7TlIxAqGhZgVP+fofiZf9h+uQqOzg4HBzkLxxwDoTsJw5ijJbbiURtd8kz5M 37HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495801; x=1691100601; 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=+mkt2khv3HlTYD2I5HX8C8vkoqmlMW0ZXesjrMFYxT0=; b=QHv9qckHf/eCQt/mjbnnhKBtZCCsAoGY2Kgbj/cJ+a8VUeVAkTYHmQt7xdvFn/Y5me +G/GMw1amnZdVvwVN0+7dMTng7+FDPf2X0ThK+7QICn6MyoGxxZRbadsVo5+Tfi7O4YR SVSbVAzP5BjRxS51X2be/43Q0saOVXs1iHbxHmjMk9i9GvNA5TVYWkvDVPauRMLb1FU0 UavtuDizFTTdfxcTSkmYkHSDHVcmxwnFKtIU8sHi/locg5PV+ve+j2fIjyLDJTuISLQE Ont/d/OVm8m1SDVN9aOTMZ4XsOlYjUU7batujaaPcinYb4DDQYcqp0IgBggh6thI+zbX N2Qw== X-Gm-Message-State: ABy/qLZphA/DnHIK8/81/2H4cHG+bcbwCPOoplTtGYvOhF6fCYDDkFQk woxi87RiZJT2CoGknWWQGEHnVQbKe2Pmbi6f3SzycA== X-Google-Smtp-Source: APBJJlHG7i18R7Hn5NvUd7U1TneQT0lhYxBJykJ42kr0UIQsWHrBrT+XFxIZE6U18TdaTW4Nl9CkEQ== X-Received: by 2002:a05:6808:3081:b0:3a3:9b4a:3959 with SMTP id bl1-20020a056808308100b003a39b4a3959mr3520970oib.17.1690495801112; Thu, 27 Jul 2023 15:10: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 v6 11/12] avocado, risc-v: add opensbi tests for 'max' CPU Date: Thu, 27 Jul 2023 19:09:26 -0300 Message-ID: <20230727220927.62950-12-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c2f; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2f.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: 1690497310537100001 Content-Type: text/plain; charset="utf-8" Add smoke tests to ensure that we'll not break the 'max' CPU type when adding new ratified extensions to be enabled. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- tests/avocado/riscv_opensbi.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/avocado/riscv_opensbi.py b/tests/avocado/riscv_opensbi.py index bfff9cc3c3..15fd57fe51 100644 --- a/tests/avocado/riscv_opensbi.py +++ b/tests/avocado/riscv_opensbi.py @@ -61,3 +61,19 @@ def test_riscv64_virt(self): :avocado: tags=3Dmachine:virt """ self.boot_opensbi() + + def test_riscv32_virt_maxcpu(self): + """ + :avocado: tags=3Darch:riscv32 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Dcpu:max + """ + self.boot_opensbi() + + def test_riscv64_virt_maxcpu(self): + """ + :avocado: tags=3Darch:riscv64 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Dcpu:max + """ + self.boot_opensbi() --=20 2.41.0 From nobody Sat May 18 10:57:19 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=1690496849; cv=none; d=zohomail.com; s=zohoarc; b=QKLd2L1glHms4COGrY9l4Ks6zPu7EOEqw8xnnj1Z0Cgj1y+QGwSWT6S6iv66b+0QuAgH7d8QW4Y6QNGrlG8+6SjzKTrL45kBXjv+PbA8cJwFl1/GYQWU0dBnSAfjNdVgY2AOIG0AvpjaeyPCsWI+yTaLPDnQcKP3BPaMB1NJUsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690496849; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TT8K7Pgq6e6QtLVLiCrNKns9T2qf11s3cVvYvb10ScU=; b=SgWupuNA9YyqldRnsI1peeoenCL7txHD2mS8HA2vZ4ro1qQ54Zd/CWntSCEkBMPjPOIs6Y7+0GG7EudW97gISKgjDUAfqUFd3Ti+TxCV/vIw8LAU1msTK5CMtU3J0ssyBQS3hXsGrLeIj/3qncWcRROFJHx/mCSvyXuZ3bnv1wA= 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 1690496849648129.4460839079652; Thu, 27 Jul 2023 15:27:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP9BR-0001R4-Rf; Thu, 27 Jul 2023 18:10: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 1qP9BO-0001QE-UJ for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:10:06 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP9BN-00059a-6P for qemu-devel@nongnu.org; Thu, 27 Jul 2023 18:10:06 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-56c4c4e822eso753108eaf.3 for ; Thu, 27 Jul 2023 15:10:04 -0700 (PDT) Received: from grind.. (201-69-66-36.dial-up.telesp.net.br. [201.69.66.36]) by smtp.gmail.com with ESMTPSA id y136-20020a4a458e000000b0051134f333d3sm1070471ooa.16.2023.07.27.15.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690495804; x=1691100604; 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=TT8K7Pgq6e6QtLVLiCrNKns9T2qf11s3cVvYvb10ScU=; b=pMxfzMBdrvd82CWGYg86oNRaFJAXanjZK70NRyfOUs0qGPqFzivfOh9O2ngVsSQ/WZ jzUDwEpYQpOV8wGORXWoCe1FXg2cc8cJ0a3ahIlG2DrzYa8gOYaTYGd+G8zWQXyMNALG SPlXUJhiCdEgJx+WfLpWbivTCgKFbguGwBJRxz8rUT+eTP+PbNe3UDFMNj0yNukfU+lk HCgsAeAG5dlVbc4WgHe+ddG+3M/ZejiZEq7S0V6dp1Jk7EooHm2bVt324f0nT+aJDL4h glj7huceNVSguqow2rBJjrybvjXvZBlHtAz1f1y2QfkKUN5MQF7Lo23n87a1lclk94aa 7G4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690495804; x=1691100604; 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=TT8K7Pgq6e6QtLVLiCrNKns9T2qf11s3cVvYvb10ScU=; b=f4VMx/2aI5PFtwwIDNFW+WJDNhl/PavfNY5OjLAadyU9JvjyFsdtVuOXZ7xcdqnyIo 0sZOkcs7lnz2X4iw8jqzF5WHKlOz8TFtzfkJOzwkFOyTylULBm3b15HjfPlA/4jyzgTx JFWvFUPV6A6Sp23Iybl7BcspOCpqGA1vW27NCKl01zQk61HSaBWPpjjXFVXokBQPoRCL k4WespzhBkDLSLrDZm3lpeU9LqyO0GuyS1C77cyDnhEMh/ClnDOCFQZwxzPWu3406nkH lzPyt1hgPBs8dSZ9XdESodCLo9zfG+gT01CPg4SNuP4z8n3fFdS634mIxo3t6A1LQVzr iezg== X-Gm-Message-State: ABy/qLYn+TQMKiC3dJUzvkOwy+s0H30nkzQ3pdNZ3xmeeJJF0mMw4Jst sFXWe8eiSKtysCk0t4V3s/elIJV5JfVEiRZs2BhP1w== X-Google-Smtp-Source: APBJJlHiOPKnHku+ugc5hKpiGo/NlmOPAfiieJSTtOSrkY2748GR/Qdb4yuRySu0AG0vnPAAPzacdA== X-Received: by 2002:a4a:3c4e:0:b0:566:f1f6:9de7 with SMTP id p14-20020a4a3c4e000000b00566f1f69de7mr789556oof.9.1690495803860; Thu, 27 Jul 2023 15:10:03 -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 v6 12/12] target/riscv: deprecate the 'any' CPU type Date: Thu, 27 Jul 2023 19:09:27 -0300 Message-ID: <20230727220927.62950-13-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727220927.62950-1-dbarboza@ventanamicro.com> References: <20230727220927.62950-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::c33; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc33.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: 1690496850565100001 Content-Type: text/plain; charset="utf-8" The 'any' CPU type was introduced in commit dc5bd18fa5725 ("RISC-V CPU Core Definition"), being around since the beginning. It's not an easy CPU to use: it's undocumented and its name doesn't tell users much about what the CPU is supposed to bring. 'git log' doesn't help us either in knowing what was the original design of this CPU type. The closest we have is a comment from Alistair [1] where he recalls from memory that the 'any' CPU is supposed to behave like the newly added 'max' CPU. He also suggested that the 'any' CPU should be removed. The default CPUs are rv32 and rv64, so removing the 'any' CPU will have impact only on users that might have a script that uses '-cpu any'. And those users are better off using the default CPUs or the new 'max' CPU. We would love to just remove the code and be done with it, but one does not simply remove a feature in QEMU. We'll put the CPU in quarantine first, letting users know that we have the intent of removing it in the future. [1] https://lists.gnu.org/archive/html/qemu-devel/2023-07/msg02891.html Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- docs/about/deprecated.rst | 12 ++++++++++++ target/riscv/cpu.c | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 02ea5a839f..68afa43fd0 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -371,6 +371,18 @@ QEMU's ``vhost`` feature, which would eliminate the hi= gh latency costs under which the 9p ``proxy`` backend currently suffers. However as of to date no= body has indicated plans for such kind of reimplemention unfortunately. =20 +RISC-V 'any' CPU type ``-cpu any`` (since 8.2) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The 'any' CPU type was introduced back in 2018 and has been around since t= he +initial RISC-V QEMU port. Its usage has always been unclear: users don't k= now +what to expect from a CPU called 'any', and in fact the CPU does not do an= ything +special that aren't already done by the default CPUs rv32/rv64. + +After the introduction of the 'max' CPU type RISC-V now has a good coverage +of generic CPUs: rv32 and rv64 as default CPUs and 'max' as a feature comp= lete +CPU for both 32 and 64 bit builds. Users are then discouraged to use the '= any' +CPU type starting in 8.2. =20 Block device options '''''''''''''''''''' diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3e840f1a20..b5a2266eef 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1477,6 +1477,11 @@ static void riscv_cpu_realize(DeviceState *dev, Erro= r **errp) RISCVCPUClass *mcc =3D RISCV_CPU_GET_CLASS(dev); Error *local_err =3D NULL; =20 + if (object_dynamic_cast(OBJECT(dev), TYPE_RISCV_CPU_ANY) !=3D NULL) { + warn_report("The 'any' CPU is deprecated and will be " + "removed in the future."); + } + cpu_exec_realizefn(cs, &local_err); if (local_err !=3D NULL) { error_propagate(errp, local_err); --=20 2.41.0