From nobody Fri May 17 07:47:06 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=1689873630; cv=none; d=zohomail.com; s=zohoarc; b=gnl0PiovPzXfkuwDvRkBn143YEYrkJ2c1nCJgiLKHPc38UIjSRMn678WordZsixHvTTf7/WcoyOGbzE8X1NrNzr5o+Uq60nwIwGTAqWRTfe2ezISPEMipreQDNVcZIDh61bLBgeltp4sCcAkfXCaLM+0tNHVTDhMc0esSVIfVEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873630; 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=iglOPUpUDYagm/WGc0MkxtjDM9Sx4pyWG+Xb744oyQo=; b=n6nbbAHfJkQy1IOV7hcaIAfD2Ek+cNhTneHGmSjFSe0qdkUilnjZSfHLjt+joOdn90mbLpdY5cDDY2udjUG4gWWXdfGXwDATspff0tX5wbDQEu7uJwtfECGv6p9CE/gzILld6RCtqSAi17HCPzSwOjP6Oi2sdxxss5yaXHj1Q+k= 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 1689873630115323.11968631831803; Thu, 20 Jul 2023 10:20:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXJf-0007hL-GO; Thu, 20 Jul 2023 13:19: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 1qMXJa-0007gP-QB for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:46 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXJZ-0004Xu-63 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:46 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-566e793e0a0so719064eaf.2 for ; Thu, 20 Jul 2023 10:19:44 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873584; x=1690478384; 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=iglOPUpUDYagm/WGc0MkxtjDM9Sx4pyWG+Xb744oyQo=; b=Gv2ASJiWHN68DfRjKfU+/Y1Ot1wO0T+mWxkKcHX/3Y7r6ZqTmtS8cpen7QAH/eSuSk JIxDNfwfosPYgQBxTMrVCfVWOCQAAKwn1ANp0UItHOb6hNF6BpxikvYopknd8dkfsiPe ZG+A9BsffC6sIkhiMaRSS4Hj5UWkr//F9ABplTFd2U9wH0KVnG033Zm950lSGCfbnJTD V/s1bYSMrJsWjzhSslwjwmnxOnnkXmqpieMLiweOEwpHZHOpW708nZT6dm6g7FphMw9Z tJiBOWkdt18InYs3UrMec09X/hF1szCTrYQs3BSK2IdJsHaRhoN+n5nDMkkhSowT7N7b 2mtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873584; x=1690478384; 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=iglOPUpUDYagm/WGc0MkxtjDM9Sx4pyWG+Xb744oyQo=; b=SACySlMYQ7rPG8p+DgUV6fmeghtGNpfpVMAi5RkZlitDmomJjd83zinDWcOEpegr+A 81IECYALTExTlqNtQdvcMmDUnfWvjn+zA8N2CYw6PZm8c4e1dcfiJRJoi9y68ris/ShA tkkaPdeS4iXN4ZtFO9MZ7vVqhCQ+U5GrvvZXOAiDjrR9dR4QS1DszIr9O5CFjFb/AmYZ JxKPOMWcnNXrz6aSdUWgin2a9sxJ/v2Bb3NsCz3XsuJ9+qbTCytMZASDoZEhxjLGGA6f ijlgnrfM2teXWx9p/EHW336ISoWPGsax/fIjpaX9fTvgxarBK/B74vKvvn/viDpkmyaL vr1w== X-Gm-Message-State: ABy/qLYDhLmgg7qTjmDCCgEYwtgyhfFRYTE7le6eqEBQTdns9aY3zdf6 yHCRh+ZcSHODkL2CRVK5DbMlcva+Kxrr2ocoLndhdw== X-Google-Smtp-Source: APBJJlGtpAEINANf1VHYom5qiCQuNruutXvPn5mM+TlGSsg5JuQwPXDIE8JV86EHh6uOzPzn/dvaYQ== X-Received: by 2002:a4a:5242:0:b0:566:fa3f:ea29 with SMTP id d63-20020a4a5242000000b00566fa3fea29mr3091395oob.5.1689873583797; Thu, 20 Jul 2023 10:19:43 -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 for-8.2 v5 01/11] target/riscv/cpu.c: split CPU options from riscv_cpu_extensions[] Date: Thu, 20 Jul 2023 14:19:23 -0300 Message-ID: <20230720171933.404398-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::c2d; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1689873631438100001 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: Alistair Francis Reviewed-by: Weiwei Li --- 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 6b93b04453..9a3afc0482 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1752,7 +1752,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), @@ -1764,15 +1763,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), @@ -1803,9 +1795,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 @@ -1849,6 +1839,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, @@ -1917,6 +1922,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 Fri May 17 07:47:06 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=1689873647; cv=none; d=zohomail.com; s=zohoarc; b=CKMugm2JXKRnmmFt17c4ssMNofnz6AtL+aXsuoWGCkWYeh5HSCqPR0XkMy9f0mJ4yBflaDQtO2sOKiw2DNvBRAPcLB1Id/zBOk22tOcSeROjfrxxILEPhvWmACSWojmd6JhM1BC2Xnj1OO0jdnqYS7RG99nOFPUvX5kkqCKheww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873647; 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=P9lSDeBryekDaWv/Vc78YEkpFPDXZkfJPoxtpTCKUds=; b=H4gN0s3rqZqYGav9UAgENiUI0WN5fxqBOggGfuPCtW9VB4ENZoEkq3fPNvP3iGnnJMm593LV4q/IUoo9374ohr0Wpl5HoiQNCKpHfQ/wmk0CfwkmM1PCf965V3aYG0h4WbPExyjcOKWkJLb4500ev8rgih4k8Fk5YgPK/4fRm38= 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 1689873647700253.11766057110356; Thu, 20 Jul 2023 10:20:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXJl-0007iZ-BN; Thu, 20 Jul 2023 13:19:59 -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 1qMXJd-0007hQ-SR for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:51 -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 1qMXJc-0004YQ-Dz for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:49 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6b9f47214a3so874857a34.0 for ; Thu, 20 Jul 2023 10:19:48 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873586; x=1690478386; 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=P9lSDeBryekDaWv/Vc78YEkpFPDXZkfJPoxtpTCKUds=; b=X5qPg5Plsg4//wi6oqpcxILsdWPAtGEfgcTcZQprPppRHuCd6tZqcbt0CagV4f2amT 1csEmCoMC1qPxw73o7KX045+hn9MnFkhO5c/s7Sr8l0NsfQQXz2qffo2CXojhAGB/5IW PUN6KkRl8l0nWulnw+ISfKC0QkfDHUOff6mxIjCjataQ0QB0ZbvXzH7LCXLZ0+lcv58q 8/VEhRuBVhvf4ZKHOizkcuCYD3oNqOax0XQPDXt5SeYDI1Lu2xkyLErJ51TA8qVnupEB ejU+AC/yBh4Q7XHPzc/0SWzPItx0LM993FY/DyJHGgx+xDZvgMiyCs1LtrKaYmzhSCPB erKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873586; x=1690478386; 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=P9lSDeBryekDaWv/Vc78YEkpFPDXZkfJPoxtpTCKUds=; b=gx63PAQCDJ3P7WpOf2bi6pw2LBDo5GeSzS3HfmqMZ0CTS1+DowwsNCBSttdAiYEdrB RuaPj8WpOc86w4TOUnfkli6Hixwust8ogtyn1fovPTqTjQNem71EEOIy/HCmvX8t+s9i GIBxHJ4Q212IwknNllWs4vaGacdL583h09h8MtsPFdgxW5WJYuT36YolMtR4YgAv2nXW JUmT76Yw3jnAkv96qCCO+qbI0iLW8VLT3LVS92IkmTw7/kCOGYB99Zm3HWdH+znGsMNx ooiSWAl+ymBTa8ZSX1KNp0XNpfbimWYhhVoB1RXOXV/dGAiS8n0zkfQ6snOdrxhFImaM /i9g== X-Gm-Message-State: ABy/qLZdvWErE3yXbDx+qPXAoS/LL5pp/Y+RhTrxCNkxdOjsx2soneiw ULL5c2dc2jkfMmVx2V6WYetaBCLYlFnWTt41PaGcpQ== X-Google-Smtp-Source: APBJJlE9q5kTOkqA+oT1x+Vdn/T0ylKiX0hiljbWqLOrEKvO7eAbeuF+y6JP8JQ1G5VKMjbgAESqlQ== X-Received: by 2002:a05:6871:829:b0:1a5:4e57:e5d1 with SMTP id q41-20020a056871082900b001a54e57e5d1mr105362oap.49.1689873586545; Thu, 20 Jul 2023 10:19:46 -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 for-8.2 v5 02/11] target/riscv/cpu.c: skip 'bool' check when filtering KVM props Date: Thu, 20 Jul 2023 14:19:24 -0300 Message-ID: <20230720171933.404398-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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: 1689873649501100003 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 9a3afc0482..f10d40733a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1907,17 +1907,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 Fri May 17 07:47:06 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=1689873726; cv=none; d=zohomail.com; s=zohoarc; b=GMXa5yk2ITJdMu3ELxNzpsfQO7WeMadYVWNZs0WWVtVrJQ912rxn515djypN5fS9QZiA9hpcO4Mh5dUHocq9Z3DnRmeA23j34+gykiTU74s4enyA3js2q2qc7N6bXq7S7R1sKYwEKW7mngfMBFBoYIKcN8ip3oNQr1AqEbXd6gA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873726; 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=o6JFzw+wEBTu0YZP82X7kl8xYOd86b8mZa72wI1/UQo=; b=NYfep14SpthNr0FDvXumHXpvy4p+nu6Xc9JYOcRgrzBWWa8YM4jlqX+how7EzhuNgLBbwd93Uf5H7cgO29DAVOgJ4I3iw/T48Nnw6T394MKokETWmxt2/UivNiaARbEMKfjJwScMPuSXhhP8MeSTSPMOF82SVtIs2orHOTVMw/g= 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 168987372621823.40125023160465; Thu, 20 Jul 2023 10:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKL-00088P-3z; Thu, 20 Jul 2023 13:20:33 -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 1qMXJi-0007iO-7C for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:55 -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 1qMXJf-0004Yu-EE for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:53 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-56669eb7565so1329131eaf.0 for ; Thu, 20 Jul 2023 10:19:50 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873589; x=1690478389; 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=o6JFzw+wEBTu0YZP82X7kl8xYOd86b8mZa72wI1/UQo=; b=bXH8Wkc5R+Jlpn5s1GknUB/y7JSFziqWs7HWoOYTEz2YFjad9mGOQdow5IoGxkST/V 7p1h6sU1Ln4VA4AUNhVLe10gAzbuklv24wsi+ukNTviVfBbqvfR/HtDIjAyCBMDYwcSo Nymw/r83s7kHzFrLnayltcgUnDB3ymwiQMZU6+PBSVP9x84QlYsfHoomv/rLToboX0z2 pkzfcgCc0KnwlE5l+BTslSa0flbuWckpmeuiz5VI9ZcdO6UjOPLluNhWqlTSkxtIRxF1 yev3Fq/6SsOaXzkzQ5usVR3hdlmN4Wy1Eo3XFO/7FKWYpjzh7qY8nOYj9oKEqC/bKJkp /O0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873589; x=1690478389; 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=o6JFzw+wEBTu0YZP82X7kl8xYOd86b8mZa72wI1/UQo=; b=bBKadZCkaMkSbr31qgZf2KWxQiKde0Mr1HWG1qblEDWj2TqmromabyOJyai2aL6K1A oxQOCgN+rdgncBSIxRgKg2tvAtbL8Lqc+DCV9XKWroeVbqbdi6E8zd+pnyiNt9gSshQj NP6ttjYc0l7FJvu3mNTrzPmB15nzVZKQaGq86dLIaPXV5MzO+N5LWRmVuZnnp9YBNuCm ZX1zEOh0Ac9GH2mTWWLuiLKa8RfImRK5A68TIohMr0MBvZ00XYgOKyeWwu9lF2Ya6RR/ G7K6azBvSiDdYhdS8P2Z8titJUzTY7IxowLbyit8RazXcsaqB+jxz8z9sT2md4nRQdVF A61Q== X-Gm-Message-State: ABy/qLZ6lexhzcBR2IF+pT5nFkLeWGq+D9p/tXFQGKtiRNDZW2LNZCdE Y817OcRTWymk86/Ur6B8bBAPw1VAuFGb/9IzYXew5A== X-Google-Smtp-Source: APBJJlH5imwY/hAX0WzA4wktkkPTudtgpdZOn38B2PNr5Fjx7qKYJO8Gdb5tK5f1WImn6tNi+PXo/A== X-Received: by 2002:a05:6820:34c:b0:560:b9f0:b9fc with SMTP id m12-20020a056820034c00b00560b9f0b9fcmr2822143ooe.0.1689873589389; Thu, 20 Jul 2023 10:19:49 -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 for-8.2 v5 03/11] target/riscv/cpu.c: split kvm prop handling to its own helper Date: Thu, 20 Jul 2023 14:19:25 -0300 Message-ID: <20230720171933.404398-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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: 1689873728304100001 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 --- 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 f10d40733a..7f0852a14e 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1874,6 +1874,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. * @@ -1889,39 +1929,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 Fri May 17 07:47:06 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=1689873737; cv=none; d=zohomail.com; s=zohoarc; b=b10FQivg1m2wohIAsyGnUxt5WLj77rZ45+I3/L5CtXaQQ31oqOUeLGd49Ql3pe8BAsjnLzJdcvkNHWOr4vnequgxQzqeW+uCIocOyCUecuME6oee212Et7+MnZwIZDkJX/Be76/+3V+muLcA5H1g5iRef2d1DPpKx07i3Xukk2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873737; 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=xzgcRnLoiCaDy8vHSwQQ6Ea+tEzfQ/ngaUcJf6Qf3WI=; b=ETmN4okujP2fZT3UA5ZBjpBtkRAGQiwz6AHJCVbo14+K51ZBdrVpOvEmaZPm/xEy5+X/9/M1dWgWBQfqqQRq1g7hm34ggV8Je+fSe8Ki2TiJBskFngp262ldsb/Ycpcob50QU8JsfJWBl5cCbIkQr1a07ofER77uxOtFpx3plD8= 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 1689873737266573.5084333793441; Thu, 20 Jul 2023 10:22:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKQ-0008M8-C9; Thu, 20 Jul 2023 13:20:38 -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 1qMXJj-0007ia-QY for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:57 -0400 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXJi-0004Z9-AJ for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:55 -0400 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1baa6fc33f1so811706fac.1 for ; Thu, 20 Jul 2023 10:19:53 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873592; x=1690478392; 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=xzgcRnLoiCaDy8vHSwQQ6Ea+tEzfQ/ngaUcJf6Qf3WI=; b=bPUeuO73g+x7h672pvt6l5YPKMrwNzHASTkKQj5qLFurTtovgnFlM7bDYaUM43yRqM AIFIJyd/xMKrMSv2y3JVp+6mBah8i1RkyjhPBgtiZH2z1W3Is7cTiHGptffqi32aoaPF B17/atTk8TDnQDCoLmZhnBDB/H2gMubXJ1P4kTgg1D3at+xVbhq9AdGHJK2NX+ZObJQl IKQoNGwtQTqQBu3qgQ3laCKeALoEvw/KT3ObkDCsiUkGfwSBWLOfWvkzfa0pMjTrBftI +PEJofU6JsRY6VRJKksfwIfK0AFxaJv/T73LAWDLAZm6H0rfWf2Sszbq/I9oOrGp+C0z OA2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873592; x=1690478392; 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=xzgcRnLoiCaDy8vHSwQQ6Ea+tEzfQ/ngaUcJf6Qf3WI=; b=W0rMRVi9e6TFj6VHFPAgDEDsWDmQWAdh5deHFXoocBW+l4vZ9jQrNfSL7n91DP6wjz maGiYlvTF4QEo9W96pVdtKWmOgkt66q8mh3dvT+HMJEG6vXT8izbUa+ooEoMWQnJ8IpE 4op1EBE1fC2VNteTc34dgfC9b3pdJkSbqqtSfdNQ1lEcfSw/cuakbHb4XDWtqUsqOF9b 3PnLxdtmCW1CZfGdTUUNsgomXLLJ6DY23ozQSUKXr46Q8aeQSZkRM//dFM8jIJdYvmNT rBzqY+M+AuyPufnGI92nW4WTG/vgK7lh564rS7eH5lm7qMjGGCr3oHcuqVQ+C7Lt/2hh ceIQ== X-Gm-Message-State: ABy/qLbsTJHy+0nkfG8+qomsUIuI6L1gC2CguxBR16ypDSD+N0y/utV5 4zQhRFq5glmPbF8/ph/ifVwXwQGW4B2rqMS5L5/qmw== X-Google-Smtp-Source: APBJJlEqd7MmeVPgIGUtFKdZg7tETOoBrwmEv6gU4hwh1HbCZX8rWbGT0gkXIRAmOIEussFaIa60yg== X-Received: by 2002:a05:6870:73c7:b0:1ba:2c95:a168 with SMTP id a7-20020a05687073c700b001ba2c95a168mr120482oan.35.1689873592131; Thu, 20 Jul 2023 10:19:52 -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 for-8.2 v5 04/11] target/riscv/cpu.c: del DEFINE_PROP_END_OF_LIST() from riscv_cpu_extensions Date: Thu, 20 Jul 2023 14:19:26 -0300 Message-ID: <20230720171933.404398-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::2d; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x2d.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: 1689873738584100001 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 7f0852a14e..4dadb7f0a0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1835,8 +1835,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 { @@ -1894,14 +1892,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++) { @@ -1922,7 +1919,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 @@ -1936,8 +1932,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 Fri May 17 07:47:06 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=1689873692; cv=none; d=zohomail.com; s=zohoarc; b=Sdxoy+aHM96YWQfNZVmpbqHNJo5rCLlR0SYfAy0v3fguBg3UoDnmBs5hvNWYn5BtHniY6gYi4KtrbXa4qUbVEdEdpMWteSv3zGdWAy/3tpxGZNuZPpPhO+nzEVuTLmM3tlPKdwWrmQU+CqvDUdRuYoclvAX0vG3G5VoHLpmCjPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873692; 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=K9/FrzUx3PVpnnFHAiBC8xSPgKQwTkUU1opDFHziErI=; b=Sdcji9HmpU5CZAB9eBYBzvOqVphNi9QmR8tgH1oD2bji7SMjizJXcs0sODBqwIn9dYSQeBYJeEPRWF5lXGUidDNH8dnPCGaWigt7fF39FENBf/b6Flxrwo9IoZXkWVB3zFHUwsSH4VhXBJANDhmJGlGSfi3T2szOZBaF2s6UaK0= 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 1689873692140334.3484235462587; Thu, 20 Jul 2023 10:21:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKS-0008UJ-55; Thu, 20 Jul 2023 13:20:40 -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 1qMXJm-0007jH-AV for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:59 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXJk-0004a2-Nh for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:19:58 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1baf02c36e0so789403fac.2 for ; Thu, 20 Jul 2023 10:19:55 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873595; x=1690478395; 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=K9/FrzUx3PVpnnFHAiBC8xSPgKQwTkUU1opDFHziErI=; b=K1KyuWISc35DwNKs8uvuzpFiWr11q5PCzdNlCAJM3esH0M4gaqOoP/4OvSbYBBbmkA OwqAQ+na2oqjmQmJvP3Tr2aQU9E4gqItH4h1u5nzOhHlKGppZ9XKjnQYhHAeaftbpi9Z 4yIwM4WWHQx7K5fAlMNFxDgQndkTtnxVeMPbqTwXkmsrz2mhUP1PlhXMKNBvmaxwluYe IY4h9qVL77gG9SFyuJTNih2wnKnRCPOfQ/KIMU2l7c5YpB0A/i9Dx2/uKNFZUXkTe9dv v+e8BCIFL+e/yPk8kU6GQRWBP96f5iEEBF8wkP9MK5zHiWWLbLm24qF5pUSsSjQSx6H2 fonA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873595; x=1690478395; 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=K9/FrzUx3PVpnnFHAiBC8xSPgKQwTkUU1opDFHziErI=; b=gYxEBrnbA+gRsWbMNQFRPiBr4/JKCZMx9nPASq7F4t+VkDJ7taoALkROoVG1oApge0 QXeHTmsE5HsuPS38US9STEKybrV0HZyMhDMDjsDV+jiKbsSujCJxzygfMu1qBDxuZn2r mUnPcuE++9vv9cTCE4EJFMYCxMxy8JCSpRkCwUllusK4uEunmRhOh2Hq9y/92i7xh0P0 SVYTZvnbeZm6a2GufLwzadRQaIy78Y5KYNovE0fPUKmGkG2O8fdDFWL9wkY7W/ycFBnZ ALUPNOsfy3sNPi/EJHvckKfTZACLT8p6f2/hytRukFTj5q4lV+OwjzMEDxqrRDXCZ5Nt FAvw== X-Gm-Message-State: ABy/qLagwFGP2FG7VQvYYAYLU2SKAD0DDu53OMJih5y/sl1xV+zok3Ev eJj6gqxIwIao5RUAhwg8jb4Fq1seaMgz+Rfx3Ocq8g== X-Google-Smtp-Source: APBJJlG02zsC4HmVTQoAZhirG1wsUgtlvZ4gNh47UVFufaa6oPGt8hiINk0sv3xJhi10hCXfWaagHg== X-Received: by 2002:a05:6870:73c7:b0:1b0:2203:2bed with SMTP id a7-20020a05687073c700b001b022032bedmr90185oan.59.1689873594892; Thu, 20 Jul 2023 10:19:54 -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 for-8.2 v5 05/11] target/riscv/cpu.c: split vendor exts from riscv_cpu_extensions[] Date: Thu, 20 Jul 2023 14:19:27 -0300 Message-ID: <20230720171933.404398-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::36; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x36.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: 1689873694052100001 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 4dadb7f0a0..3a20a41dfc 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1807,20 +1807,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 @@ -1837,6 +1823,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 @@ -1901,6 +1902,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)) { @@ -1939,6 +1944,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 Fri May 17 07:47:06 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=1689873711; cv=none; d=zohomail.com; s=zohoarc; b=A9mnhV1QSzFnL4kLxFa2TcZHY/a0wew3ZOGsmemrSR588KFW/yGjarEsZO0ou4+98iFDzHJ3NEVGU3QU6hKrEiIj6wQLKjmf3rQS7Qn9pe5mMe/UXFjvDN025DiR4BF9unFm7b9EyO/dlTZOFdTOlVvN91eavwZ/+1oVnIMSAD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873711; 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=YWQaJgY2QjOrZe7qwwU8VpQcspvhm4afumz9mYtsjkA=; b=ATKPwMaEKY/9buG47xOeY4WJ2vwvVgKRxhnKJbMauir34QWtxr1fGBcqs3XPfRKPl171zZmnN9x9QwYpo6BLL1p3gOu2rCjq+CeZ+UvQaI7MuIQEeXkGYTyR80M5YnKLZwr0XF0W9tlTtrO0K8KLB0EsHdz3uSQRZbzNn2/WLPw= 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 1689873711636104.19001682916485; Thu, 20 Jul 2023 10:21:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKL-00088W-3q; Thu, 20 Jul 2023 13:20:33 -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 1qMXJs-0007kZ-2y for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:07 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXJm-0004af-Tt for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:03 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5634d8d1db0so736372eaf.0 for ; Thu, 20 Jul 2023 10:19:58 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873597; x=1690478397; 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=YWQaJgY2QjOrZe7qwwU8VpQcspvhm4afumz9mYtsjkA=; b=NM/AE30/ViCSf5b4cdmnUoCe9C4VaYyYqfCViVSqFQhL7QcUEjkmAQfv+/TvaVuY1J VXC83lFPssk/G27KPig6tCP1sTlXOfES5p3lrdb7OBarxDbN8YjMx3SmMbR/PWqe6Zin cxp9HBc16BqL1tiq5VME5MO5cON7W5PUXMPsNUdUV0ybaojPvhlF+WevfjLznJeNQn/u RbTJlyCUnZLJBu14VSTzGeiKrQlSzGom7wwz63ZJk5kkL+5O8HcEHFJX87UvpE2PpbCv RlqFGACpI9EcZQvq4Mi5AOnpN7C7zq68yFnJ7XK7u1OGkTwO/pRzQKmQZ1onRZlPyN3B cDGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873597; x=1690478397; 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=YWQaJgY2QjOrZe7qwwU8VpQcspvhm4afumz9mYtsjkA=; b=SXHXJKNCdIDHCPQfne+CsTUznDsZAoRxYUID1+9XKbkBlOEuPeWq0JHKBB/8rCfx72 /r2Ua5PimGv+7B7CnjaB7tc28igL0kWjrFTlQbDdRYcaoyfas2Q/2ZiEXhI2zZoCHD13 Uw4CGWY4wRvvYXCdHlSkmDvFJVVXbPUuTjSvBq9XTdKRlY1+xgFidolIlvFo8OlTD0KA aQKO1VGhIbnIJh7Wrj4QSRg9kM3aVKXkO4/VzDmMPNWSWAH1ZZmON3yTzV9P0TKOEvXZ QPoE4GwQEuGuMZu8jiz0wgQYXts4sVyC7OPCpuROLN7DkOEhLaQOIzcYi6mxi9slNW/u o3gA== X-Gm-Message-State: ABy/qLa/JwqYO5inGWBBTp9h6xurS5iexdXpopAGqSmvpJoEyUdKv72r U7aqzTZX7RH47xPHgODYHWminG4lXnulXI+vXgEqLA== X-Google-Smtp-Source: APBJJlFZ6kb9ZA/4x+4WnbHz323LD9PriVCULBsGhkMaIEbPo7yr8xbbWbvR/TrvOIbPyebr9Z29cg== X-Received: by 2002:a4a:4fcd:0:b0:566:fcc8:5b6e with SMTP id c196-20020a4a4fcd000000b00566fcc85b6emr2581780oob.6.1689873597635; Thu, 20 Jul 2023 10:19:57 -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 for-8.2 v5 06/11] target/riscv/cpu.c: split non-ratified exts from riscv_cpu_extensions[] Date: Thu, 20 Jul 2023 14:19:28 -0300 Message-ID: <20230720171933.404398-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::c2d; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc2d.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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1689873712166100001 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 3a20a41dfc..7c6060ffa3 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1806,21 +1806,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 { @@ -1838,6 +1823,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 @@ -1906,6 +1908,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)) { @@ -1948,6 +1955,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 Fri May 17 07:47:06 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=1689873648; cv=none; d=zohomail.com; s=zohoarc; b=OalIcJf7oELSwWWya+KtisGcT0WlW+L+kFA9A/TIUR/L97KYYKTgsgar8+OdjgeRmVs0kjtSrZOz0FVOzXq29iDuR+YY+RCaLyVvf4RJfdiyDwC9W5nSe/bsYoLWHuHH2jU9/trD0iqGOkDndGOYLnaCT3Pzbx8oVwIsiZftIws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873648; 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=zX5PXCGV4zGEdiqslCP4Ydail5D6wQ6xUkfarIksAVk=; b=KxTsKDBx+u4/bJ0MLhB4AhcGht0AhZu2A/Srv47VOZzDM0E4dXD2WE4y3DaIBRUTRsIcsd7IabkZgszmJ0mR6yGWKFmyZvfLCLHYXkQxU83d5ur7ClhMYgXgc955fSEmOgO63tEIQkDLWtDyQUSQzOfQKjlLaBcx69p0cwthrrw= 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 1689873648336702.4005843770504; Thu, 20 Jul 2023 10:20:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKS-00005G-SR; Thu, 20 Jul 2023 13:20:40 -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 1qMXJs-0007kk-Hf for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:07 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXJr-0004b5-3y for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:04 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-564e4656fecso684390eaf.0 for ; Thu, 20 Jul 2023 10:20:02 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873600; x=1690478400; 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=zX5PXCGV4zGEdiqslCP4Ydail5D6wQ6xUkfarIksAVk=; b=bnK9VLIozA0QlHtEFBZ4e3TsqLOapzl2JzeC3wyAgw+moPq7tpfDbVOSqNiXfjUX0w GmfyTCHKuKtslBdRqrmXiq3D41COdcU9atgklsE3lDnH6h1eCaf3NnPawza/i7i132/p tyYidKJLdqdLJuyXIJ5Vx7PGULMVNrCUsYMAiZn6znWMknTH6BuptwnqL5DxLil+Hx3i tQydjy8S9OqHBiMTitd9df06vpIemumxXqhHWFlYTflUVA1GvkBnF1lqaCabHOAZTI+f lDNjp4ylkv2+WU6CvZFpUMl9wT7VjFffmNGE1+tJg/+EWLf6PV/Bl2nT+BeoJMTAISNB mTWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873600; x=1690478400; 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=zX5PXCGV4zGEdiqslCP4Ydail5D6wQ6xUkfarIksAVk=; b=OcU4nLUHMOBiCaZY2Bgjx6z5HeU4np0S1SMOO5rPDaRyOP94WKB/dOx2zi8LOrAqv9 g7tSiGpmMG62fiOnrBmbq7599vukaMLxtQvLQBVHGighnRx2RlDBY5//szbnSjpsRDdM SXSc0Dyg1OYwaDpoSv6l2SyBp8vNkDqBbJ5docVwrP/tcfxRvS3ZRs7BhAHTVlcPn4Rg 7d7PSWHypm/ANwgUj9Jr5e89BoP/qhpyeYQ5356ALyrLt+a62pOdl3IRIjxUiyhcr9wq h33aUrnh5/kCPnhg1V7DinUCI3yf7pOnEkQrT/S8KEuy3zN/JWejjSvVPxPuHpHc/dYH uXZA== X-Gm-Message-State: ABy/qLZgKg5OhREOvjkq2HSQoue9dD8qnwtgytkvS2o3ohOdvTLwfgW5 nqSBVEgdSjSPzGItffTMaPIT0iiJiCT9u8wI1oxpig== X-Google-Smtp-Source: APBJJlEURJG6Uv/Zb8vX2YlN3rzS+JQ/zYCwGczJ9CByoMBhJvI9+59itrApPnHF09ilhY3GUBEV6g== X-Received: by 2002:a4a:5201:0:b0:566:f2b9:eb86 with SMTP id d1-20020a4a5201000000b00566f2b9eb86mr2820418oob.4.1689873600404; Thu, 20 Jul 2023 10:20:00 -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 for-8.2 v5 07/11] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro Date: Thu, 20 Jul 2023 14:19:29 -0300 Message-ID: <20230720171933.404398-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::c30; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc30.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: 1689873649611100004 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 7c6060ffa3..23169a606f 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1875,6 +1875,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) { @@ -1944,21 +1951,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 Fri May 17 07:47:06 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=1689873688; cv=none; d=zohomail.com; s=zohoarc; b=NFCrDnLxaYnf4aHWK7FGXy5MkC6+zYXFotiaX1d4pl9v7YZQKsVvgaSZ7SVxGfak8T/pu9y3fMF7amZYPeVFmBRhblHjY+aiLiNU34Enb9wx3oY7c0se4lIZfTQA9SCv2n3q+woMfBd2pHRldxmtcsS3cqSe/BUlrYjXCnl+W2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873688; 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=aQF+9SP8CkK5LKa2mDG+PRrucl4AFzrOqCCyKHU51/o=; b=Ty6hl//2/ed3/COBUzEZtDqPjx7nLnImF06juW/vtCnbjsLhIW1AFob9K5udIiwzNGgYSWJ7PpNFCcVfY1ZQ3DUtN8yL2EWBD7gvC/qV9F20bD8gYVK0s9EBm0ZL3aOaah4YaJzunP9fCLvGjmB8SaQ3HAlsC1I3jlAdAKbRtLw= 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 1689873688449893.8659530943712; Thu, 20 Jul 2023 10:21:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKN-0008Dv-U9; Thu, 20 Jul 2023 13:20:37 -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 1qMXJu-0007lF-6j for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:07 -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 1qMXJs-0004mW-NC for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:05 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1b00b0ab0daso819039fac.0 for ; Thu, 20 Jul 2023 10:20:04 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873603; x=1690478403; 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=aQF+9SP8CkK5LKa2mDG+PRrucl4AFzrOqCCyKHU51/o=; b=WGFDXVOl6i+Ymi0vllyir1AM8hyLp6rFp4gIL0g13nNhSZlc91xvnYMJkBIRBbxZj8 D/3shBs/4usDo30se09AKvLxXntqiVBF11rqTH7sbxE5Tm4nSbj7jpu2PGnRtq+lpEl4 PwVc2fJVxj65Gl235fHQ5tZcoqw23ykSei2zgOWsiiZvnaMDdTwNpcj8IF7SZYiR0bm1 Rlj5gvFeMzjxv4aW4iIGKm6UKI3fdxEyy2xKs+E47G5vL39uCxCSJcP2SuDLwXo9JtBg tddWnTmTukGfUUFD+ebROn7t7HpGwpR4QKFAAnHgMPLRySz5OSLmdxG2/oDB81bz7ylr XWtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873603; x=1690478403; 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=aQF+9SP8CkK5LKa2mDG+PRrucl4AFzrOqCCyKHU51/o=; b=BoZ9ArBqhS5aSV03GObw7Kn+TRB9+SxWRJWkr8e9ru1otM+5tsDrahAPbUj5j+3VGB YgeD9MM/Tc25rtRB2ZxV1nGXLcJ+8+b5Ty+K+/c9HLe2HZM8oDVbKvPArOONrnTDUicU Q4oojoqCQ1oOB5jdyZK2wbUqCCAGcvKi/UgEKYUx+VfQpsByXHwvyCY35u4rYPo45BTl I4zjfxc84QuTZgEOLiu1ZkTWTCbqOlBQSziu/CQEH9gjlEmq0dMzQ1RyEWvOZJyKeXN+ M9Ye0fRjQo9NIYGPCK4x8mmh66TGx7P3miWjR4xzg5MnO/13hBie9jXkDq2CT2+64/KZ PiHg== X-Gm-Message-State: ABy/qLYplB1NvLlSC4sJGkpF+x+e3pT/khHVDoE6lG9M50Hyw8I/SRIT FDmmuvZg87hXfy11AQrlCDea+2XiXgV6KGhrw3GJWQ== X-Google-Smtp-Source: APBJJlHnI2NzOyJraWKYMIt5XaSosoZYnwnWLm3mXze1egNkmOkClA003qKcZ7dMHZSKz+PO0WqRYw== X-Received: by 2002:a05:6870:f10f:b0:1b7:6158:621a with SMTP id k15-20020a056870f10f00b001b76158621amr122754oac.47.1689873603244; Thu, 20 Jul 2023 10:20: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 for-8.2 v5 08/11] target/riscv/cpu.c: add ADD_UNAVAIL_KVM_PROP_ARRAY() macro Date: Thu, 20 Jul 2023 14:19:30 -0300 Message-ID: <20230720171933.404398-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1689873689733100001 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 23169a606f..8675839cb4 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1900,6 +1900,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); @@ -1907,18 +1914,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 Fri May 17 07:47:06 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=1689873737; cv=none; d=zohomail.com; s=zohoarc; b=kL+7mNZ5l1WzOMP7Z3fGe7vAbh2fH7KjZ6rzgV2/XgV3bJ/sbKwqrwqSQvv78kj0GIdQ5ph0dUUJ2YLkwDyPdwkE+Oma3uM1bt6hIxtputAaSStMAK6/zAmfYFchg5tcTgYs4CozglioYTOySzj9M4QTKvlqVQ1vp9JySCpxhjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873737; 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=OTecljD2hhOXjTyOfGIIp3Yzl0RkJ2mhadw1+lmrCbI=; b=GxO1lFEwUpnARQC5joqc4esdn+Hm5duYQEj+5XP0R5vyyaGAMb1quwZ/GP4drlQ6wFoBPjmCqLbtp6fnM3sFxsbsjcjruhSY4qPSuWqW+lx8S+Vnignjx5SErTZvdDDZIrB+cgn41zqsG4/TK2tG+lyax4Oq+/5Pcqqum4lFzqk= 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 1689873737638984.5073808222868; Thu, 20 Jul 2023 10:22:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKT-00006X-Qc; Thu, 20 Jul 2023 13:20:41 -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 1qMXK4-0007oP-7R for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:19 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXJw-0004np-Pc for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:11 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a41da34780so690367b6e.0 for ; Thu, 20 Jul 2023 10:20:08 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873606; x=1690478406; 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=OTecljD2hhOXjTyOfGIIp3Yzl0RkJ2mhadw1+lmrCbI=; b=oWd5tux5uTwiBAkChH2xhjF/n650+zavuO7mo4DX5/sjOgRH2yD6l6jlXZ4BWEyjOm 0Vi8suJpK8jD4cuCXGa9PXIHkn9tV5H6lMd/ogsyW3d5TwrcPcbXWKyjZVSQ8Bc5GHR1 edVImS7I5GMfTbyTTHnwhRVAghoeKjVUNR253bqBnQTdHuQ+RBK8Spfzh4JyDqJ4Kvjn vyDpfzW568nb/qTEdPuoXQqz/ZcM2Zbq8NmtZGEJfeqidrIU4IZwkYnE+3fm38Ff7diE uPEEhIMIHZud7b5TmFrs99aZDQFCjGdoMQigctlyk5+cb6x4uagKs7c6Z3fqcjz/9QIR HKQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873606; x=1690478406; 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=OTecljD2hhOXjTyOfGIIp3Yzl0RkJ2mhadw1+lmrCbI=; b=cWYR8O4EkDuaQdxANw+NT/LTeuAOzwx5z/os5p3fj6Xe5u8qJHciQianYn61DmUbSl UZ500AsuuBJSBzaJotdh12IL69b68wWSX+53y8UESEKaAQpBc7rcMU/px1EFTGODiuYy wKLh6h/cEIOq6VEoyauSPc61jcMy++g9i5DwAset8lCTyYyxRSKgrmPy9IUgfzep7b8k UE0kOgtiG+G/uzOfAvIGYy3TrVdYEowfVvT+1xCZUcCtiQlKxuNGa5rIa9HWZ6awtj34 acYT+PMOIOJB4NFbPLvjg/GCjhkuaw37ttki7YLcLAN5UaLGB87Hi6x9qXTHR62kwa4Y Qg2Q== X-Gm-Message-State: ABy/qLY+B1m+4eVpuFLfailhBJ6MOrgsfFR9kKrXJfrBx7bqcX1UqhDe 9VP5by1W9816ErJcPdqG820xxBI9VCsUv7vHu7IFVw== X-Google-Smtp-Source: APBJJlFdXnCY3nw5A0uNfz6BEAVH+CC0Tkc7oYG02+wQU+fiTQ/qdbvPLIvj3AwJiUybUMOsosuTIQ== X-Received: by 2002:a54:4019:0:b0:3a4:225f:9ad5 with SMTP id x25-20020a544019000000b003a4225f9ad5mr111822oie.13.1689873605953; Thu, 20 Jul 2023 10:20:05 -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 for-8.2 v5 09/11] target/riscv: add 'max' CPU type Date: Thu, 20 Jul 2023 14:19:31 -0300 Message-ID: <20230720171933.404398-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::22b; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1689873738631100003 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 --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 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 8675839cb4..0221bfcbef 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -248,6 +248,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) { @@ -374,6 +375,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) { @@ -1955,6 +1975,38 @@ 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); + } + + /* 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 @@ -2293,6 +2345,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 Fri May 17 07:47:06 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=1689873649; cv=none; d=zohomail.com; s=zohoarc; b=Xmtpw6dPSK0SU/FszzhmYD1BvuQe+b7lKm28Clh62yjaEpGXszXxTeXqPGn857v0/3Liqa0WTNVErY+783DiGV4Pw7m1SCNlMpLzH3sQiA6E2pGMfggu+sEmrnKdI1uEvTZ8muBG9EXy/cFLxbc/c0bvnD1jUIEV4qcAOIiCLiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873649; 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=A7DBT8Z48gEKbRnYrns6lTdC9ZVFXnfE4z/61/h20O6uDUF0aUrHm66NxlIpUmHvsyyKXSVJu9hsXFeDFUctQ9eRNy8JT9P406qHA7mGMoV8RcMAQNEMwrTcXoy3A5LYAgYL0d1kJ2K0yllVlaUia/oww7AIcrclIvrw5rUCvB4= 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 16898736498191.0936330796843095; Thu, 20 Jul 2023 10:20:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKS-0008WV-Na; Thu, 20 Jul 2023 13:20:40 -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 1qMXKG-00085B-2c for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:29 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXK4-0004oc-GW for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:26 -0400 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3a4062577c0so1404535b6e.0 for ; Thu, 20 Jul 2023 10:20:09 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873609; x=1690478409; 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=ZRmzzzfwF6gsXbKrJ8642ga2z9t3M920KdSrjWOk/oRvWPfJmuwARTsuNrl+qRjfPf nf/d7HKin7/RMIM8o/zyBM1GKQDZiDQDevOtJcsqYaUIu93OG9S/I1TBMrksiAR4HA7a pYoqvUv9XFG3jK0VmO+nMPGtcYa7FKxCD5goJy8OHfeHjYooJLMYAnUEDwbGORaxs7x/ YregULSMemmI0hlPS5WJRvp848W3v7mtDJQRVHw8CApiLmYg2oOTBLn45I0ZLfy8ZYMe rt+pU8MRhyPYujWRkxxVFI+zsUJsSPDby1PNia6lEDv/JgDo4wLvMPunELS+Tx2VWg5Y ROOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873609; x=1690478409; 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=cziB+JA5VhjkxjNnJWPdirsKjmV4OT9mowB7tFm6ro/fteDFJaGWyeBAty/hQ0M7Ur Qo3HPjUTcXF8/+B19FiwEF3ZG3GQmPX6QbT6Q2zti92Dxd0Esn6bJmx2Qu2FE0Wob7n5 Us5keeCLVmkWMkEWUDBDfgW0T6AFGHDl2HBXzlQKUEURZRDAKCiBYR8Bgx+AxKeIiIc6 4Oc1ma7hVv5fFkt2FnLvKr3ccV681pKBvQSH5Wu3Ot3ckNjcrnK9gecR2WmVMAECeRBX l9KcRf3Zrsn6Tgt+THyuY393wgH91FydJalMgG0Sen83h1Xk201fQBNSEwCeaBVTTj3c VWFw== X-Gm-Message-State: ABy/qLZBgFSbo3NXFkhnBd5zBVT0IPOU1iPh6DXyQm/YNzY+Hw+pyJhp 1igyXfG5thbNa0wDvqzjCtasQvHEJAgjjtMRoyqTGg== X-Google-Smtp-Source: APBJJlGwBh2kFb966wrebfiu4wERvyRCr/UIEGJt4QVaZoCaW1jiepZ/jif5DUHKsk8SIH+/s4hn4A== X-Received: by 2002:aca:230d:0:b0:3a4:8e62:d9f1 with SMTP id e13-20020aca230d000000b003a48e62d9f1mr121486oie.1.1689873608763; Thu, 20 Jul 2023 10:20:08 -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 for-8.2 v5 10/11] avocado, risc-v: add opensbi tests for 'max' CPU Date: Thu, 20 Jul 2023 14:19:32 -0300 Message-ID: <20230720171933.404398-11-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::236; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1689873651720100009 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 --- 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 Fri May 17 07:47:06 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=1689873706; cv=none; d=zohomail.com; s=zohoarc; b=Cf/9JcQTmeA9HFyXHkr6/4pSYAfdJy0bx4J2TpTKTdWzZv6cvbexNS8JHE9haUAv/ZC1zvOXi1+ayzJab4/6Ip2VJUXcsSCSxCtW2tWm+tVO5bw1XWr86J35kzkeqLl3sFwaCf/sz46KARbwKomZ/EvQ2qJY1eXI0bQayquRoG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689873706; 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=klVhwGjdzcWF1Sjx5AxdZ9uqA77HCAP9UFtKj55zOHM=; b=aw+AIxqS8gxgmtK65gy1w6xCc7zpJiNevsIgWxOVPwb1/tjnxhq8j8pYTDqGShXX6lT12Oy/oc58L/24Lwq+muD3QOXPYAdWxI21hb/hhKxdH263pUjzkJbZmeZRvLDD065WU7nvAumrQq6AIC0y/VYEGbmCpgmJctg5/7l9B6c= 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 1689873706566353.1497951795069; Thu, 20 Jul 2023 10:21:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMXKR-0008SG-LA; Thu, 20 Jul 2023 13:20: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 1qMXKA-0007ue-F9 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:24 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMXK4-0004os-Hr for qemu-devel@nongnu.org; Thu, 20 Jul 2023 13:20:21 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-563531a3ad2so719446eaf.3 for ; Thu, 20 Jul 2023 10:20:12 -0700 (PDT) Received: from grind.. (201-69-66-211.dial-up.telesp.net.br. [201.69.66.211]) by smtp.gmail.com with ESMTPSA id i2-20020a4aab02000000b0055975f57993sm582564oon.42.2023.07.20.10.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 10:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689873611; x=1690478411; 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=klVhwGjdzcWF1Sjx5AxdZ9uqA77HCAP9UFtKj55zOHM=; b=bA7pc+piQvJ5Z9V4I+XekSgL/pBK562hzPVdosnLETI1WeGOm3QgWrexlYA3mWStq2 xQHrozPBheWlSQoBb92obeSMnYOsFs8P4BSpTrcP0bA1FbfDXWqFG9Cl7TXkZ9NC5sqm 11glMEFFg3Zjd2NdtqSfEib3wKTQLI7IpD+2WpKDElWM+QWi6qCmOYPQNB7HDW9vFOxC wu+nTX8VMffVnKFPR93/a6DZrImQ9ELlVWa+gyeq17p9EhK+EbySD1EJ4Z3Sh+fORqae F8Cj8L+Z12FjukxvSsdmgCJefSKN4tyMY1dobb6dlG7UgNhDru5P16ckhqrZ5y19IMXS jLVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873611; x=1690478411; 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=klVhwGjdzcWF1Sjx5AxdZ9uqA77HCAP9UFtKj55zOHM=; b=LbDV5FekxDP9napk2E9wBp4Y302f7mtbfiW3PLayWO2pSNW74dXF73u0oioNGgLF7s 1s7mq0qyEqwNgawu9lliTc2/+Zl+dKDOis4KkNf6R54ry/BKvIA/FHdr+AqvLdNOmS+i SxuA0YXcs3DqRuph3id7DDg7bnHYi9llKS1dwSLLdZif4tuluXaLg8gxPG8zhTbP3jYM GaISfZqMc08VJmeVvNH/HsADFE86EbECx4TH8YxvyAIVPSAkGfAmA9FGNh9UXRlTxAV8 qPVb5qUCXt+DJtBO7cAUuENaZJzRmY1ejeYZ3jc+WJVdhIKAT5XE+of+I3pChblJfWpo /ocQ== X-Gm-Message-State: ABy/qLZvEHELxzDEERyaSKZEzmrgkLj2RlitGFC+8k/rnoEF7W6nktW5 F0qnQfropOru5K+3tsMyEhs3yUZNaUfQp7NaL6ualQ== X-Google-Smtp-Source: APBJJlFDs+1J6kEPZ2sI9/7WaLII1T25rD/tW2DV6Zfaz5oc9OlDM2B92kwFTT9q1+1+Lu54IFwrEQ== X-Received: by 2002:a05:6870:8197:b0:1b0:6dec:265 with SMTP id k23-20020a056870819700b001b06dec0265mr89878oae.55.1689873611511; Thu, 20 Jul 2023 10:20:11 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH for-8.2 v5 11/11] target/riscv: deprecate the 'any' CPU type Date: Thu, 20 Jul 2023 14:19:33 -0300 Message-ID: <20230720171933.404398-12-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720171933.404398-1-dbarboza@ventanamicro.com> References: <20230720171933.404398-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::c30; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1689873708106100001 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 --- 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 0221bfcbef..9f21dc775e 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1471,6 +1471,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