From nobody Fri Nov 1 00:13:39 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=1692130613; cv=none; d=zohomail.com; s=zohoarc; b=PHpvHYgcMq6CXEOE5VJ/tNXoYCrL8aPvCQlscikF/bFtA48hrBaoGaHYZzBE+DkkDZJO5tpfd61MTpn+sRdH4YY8M4WaGyCAqvrU0UdtdwMH4H+Zt0qncEcmJ2PVNrUwLPuI/cyYWF0Hq2/99BPA7OZ9htx0ivp7O6mdD5iOeN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130613; 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=LCch6fM7rUgQScUqXb+DtD/viZ/OLl4eViDfh6qTFO8=; b=mKVbatgJ+gNfTZ1U3B3ROxH7FPEXUn81g3NwlQJbk05Tx2+s7PuAW6IuIVoQHaOfBQ1YnujLHjSdbJWe3L7XpViLWZldDqLGGqSJfqvShE7vKCPBrZemOZflsZ6fpCe9c/+c6cTSK+RMTjxjTopi6Qb8emKeeFIKF/Me5+Qc/Dk= 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 1692130613573963.9887856821997; Tue, 15 Aug 2023 13:16:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Sc-0001U1-Jq; Tue, 15 Aug 2023 16:16:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0Sb-0001Sr-4v for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:13 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0SY-0004v8-QF for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:12 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1c4c5375329so2362222fac.2 for ; Tue, 15 Aug 2023 13:16:10 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130569; x=1692735369; 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=LCch6fM7rUgQScUqXb+DtD/viZ/OLl4eViDfh6qTFO8=; b=j9LwFMtsi6WH7Ga73ugfrKgtABA0Gymig1uj4IbdD4RIyI4i7DSthNoBroglFFWgAY Rvxr56sG/GysFfEvLKsA5mqWgWqAghgNZSJsVmFdas3gATNyaTgRhqRrD2yp3AZvw16t QrfS/3DLXV0BhFGykI+E1Obq+ivsHNXz4vIAlyofsNk6BV+osGCgBHXbKkpG6qrgxJCB XdTSGxMfmJ2z5gTDfjpG6hSHDtN5a88SxHcf5IxtBsUGEWHrVffklR5uqh2LPPuycrsv mXejcE2OYxrO5ZG+qiSzBQBYPl7WE/Tk+6MSpPR2RKy12g4vnFpEylIKQv4BLA4TsRRX R2Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130569; x=1692735369; 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=LCch6fM7rUgQScUqXb+DtD/viZ/OLl4eViDfh6qTFO8=; b=EJ0aYWH7Y2YGwEu9Tb8eShbNplLOdRljuZQ7LoBdpEBf/ciqWjbN4hvZBUXRfqa5Wh Yo1tMjJNO2B0NX+MrKE8EvkPWJBwDrFD2f9WSSLvCSzDvQJc92jyM8+M2kqJ6LyQAmeH r03EH19SvHAXM4IQQEs7FSA3l/fvsF2YFFqBE8bQT2EaGiZBhl6QfMCWv78OW3ttsTvX zmETdBbOvxVFC2YqZs0f+UL0BTHlVPLbKAennRuj/N0xcYrkiMN3bhp8UVUuXYkdjxSM /QEobAexr5fLapOBIt+8z8le/mCJ9deRq/6MCPBEgNU4+S9KAxSy6h5IEe4TVAJKVqaw SPVw== X-Gm-Message-State: AOJu0YygWLZ7LdA2pBsS6IGHFlcsOSzQ70OvNJeiq9d7dkooiJgSL8Pm qMNzpbB2sUBxKrqcGtgHkVulLG3DS152XopONK0= X-Google-Smtp-Source: AGHT+IHnXNJaK4sVw6Mt2yVXR8ww41dZr11W8Rsse9tdJyMD4BHOJga7+uiIwBa+e1IKe0Do86zrmg== X-Received: by 2002:a05:6870:455:b0:1bf:8a8:dfa with SMTP id i21-20020a056870045500b001bf08a80dfamr14418578oak.11.1692130568779; Tue, 15 Aug 2023 13:16: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 v7 01/12] target/riscv/cpu.c: split CPU options from riscv_cpu_extensions[] Date: Tue, 15 Aug 2023 17:15:48 -0300 Message-ID: <20230815201559.398643-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::32; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130615467100005 Content-Type: text/plain; charset="utf-8" We'll add a new CPU type that will enable a considerable amount of extensions. To make it easier for us we'll do a few cleanups in our existing riscv_cpu_extensions[] array. Start by splitting all CPU non-boolean options from it. Create a new riscv_cpu_options[] array for them. Add all these properties in riscv_cpu_add_user_properties() as it is already being done today. 'mmu' and 'pmp' aren't really extensions in the usual way we think about RISC-V extensions. These are closer to CPU features/options, so move both to riscv_cpu_options[] too. In the near future we'll need to match all extensions with all entries in isa_edata_arr[], and so it happens that both 'mmu' and 'pmp' do not have a riscv,isa string (thus, no priv spec version restriction). This further emphasizes the point that these are more a CPU option than an extension. No functional changes made. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 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 Nov 1 00:13:39 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=1692130630; cv=none; d=zohomail.com; s=zohoarc; b=n27wMakAg72bydwmbU33/FXrIHuYGCfj5b/9UxxtcV2QiEr4OCVbfTVyNn1ry85o/LC6vHr41uoQhaByA9KKtCdXTJ8Dfvf/bcZL7/jpeviqZO9OHauKVKrxG1CFDSCyHUXhgYRouKq4aRQbWcY0ZD35w3Guhkq3DV9RlDB94+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130630; 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=JVSg3FvFMlVPKgJZPs8D6iscZuPhVU/+zg+fMi3q4cjTYAZJSzmRmttUNXHARRlvIVQ8EMhxaLtDy/1LkQy3YHIbjRbPAV10jXCNUYeM6tu5ZdBzKQB/0XdlJ1ZYPEOFvoyEVPSzoqvtS3RF89uozL6MTekxzaaVSiQNF4Kx8dE= 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 1692130630934306.12583799387687; Tue, 15 Aug 2023 13:17:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Sh-0001VT-6y; Tue, 15 Aug 2023 16:16:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0Sf-0001Uz-4T for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:17 -0400 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Sb-0004vY-6l for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:16 -0400 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-56c85b723cfso3737435eaf.3 for ; Tue, 15 Aug 2023 13:16:12 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130571; x=1692735371; 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=cuPKye4ftSE2bQsWLVzJyFLZG6ZPR9gb1PdO0OuPQyjpL3hw6pPAIAvigzeT9usq8c HDFCKGQkl/TSwsinizMo/099CgXhO+JDSmVhsk9lFJwCtsjcaNYj0sS72dKPFywGg6cC VuSxLmVmrwAVymAPev7P4iOVA/ksoYf5ONmg8zjXbF6CiBsC+qsyubTRAS1i2MN1anfs /jZnFJI8FuEx5jYn0dESaNjqGkEbLvVXpZ8erEsMSfyjgNjkMUkPmIWnUcy72yRJstH7 YlNmvzqKHRiu7EIOp0FuoEw/PYBJITf6Rdaha5XR456bmVUdjksJ/7ZEPi5xh3q7Wq5A 3bNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130571; x=1692735371; 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=O4OPIcv8Xz59j3q98C//O8OvV9l9P1Jw1I4xVx5q6QU0fSczFV8HqoskbBeWvZLfpN 3SiRPu2bXiHrircBCMBvp15I6ypgPzoQx6e4phXLowk7ZwAayjXHuIcqbWaj20L9KYo8 hphgfp4qt0SJ+aWQbZHUxIoVXLzMOFAj8B5nNfUpzD5eBqAYXWQ9bdno6tI7COieiByA bBByxtqbHoihXKXdYvKhETeLcmr0W4X54kzHm1GkTl7xoNRUi1HVDOemRnWiEakjcttD ieRwI3IABUqS0v2YGGYjkRF3SwXcxU2sYGgiCRKnWKRrKwTY3+lCoNIDNH4SgdSn0khM Cugw== X-Gm-Message-State: AOJu0Yw4T8qYbnSAPANf1ZlmlqXRaqNxAe/J7megh99rziD0THEoMppU EA3aAUzr+NvctIRJLYt8AZCc5rFccXxccyRShF0= X-Google-Smtp-Source: AGHT+IF/CB18TZq1uMu8r5/ScwM+24/BOl5fxrcZ3vcIzorDYOfK8tBFQT5tWJBtByU4cFPLuuBNYA== X-Received: by 2002:a05:6870:7023:b0:1bb:933b:e6da with SMTP id u35-20020a056870702300b001bb933be6damr15229318oae.27.1692130571608; Tue, 15 Aug 2023 13:16: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 v7 02/12] target/riscv/cpu.c: skip 'bool' check when filtering KVM props Date: Tue, 15 Aug 2023 17:15:49 -0300 Message-ID: <20230815201559.398643-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::c36; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc36.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130633039100001 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 Nov 1 00:13:39 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=1692130613; cv=none; d=zohomail.com; s=zohoarc; b=Vrf3JFj8BScr+ZZwjZBr58YiBmmZQAwOp3L0VqUZRoRf43F9dfz/ZbuFCINWLhgi25uKywkoqNxlJcBf1SQlmIlR1Yi5wSOQp/bU4A2CU3UkXwnxvQFbvYkJB/bvhubWVouSyLETqrCmT1hE6GNOfdVOug0n2owFnLvsW+4B47E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130613; 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=HKxo5YuCZUjw8nEJxLWI8Q+BuLO4vaQHkEhOsQ8xDE0=; b=DcvocGXoYVLSfv/NwpcbPL6M4kkFkxMIEIP2J9qZkYMPfIbFaUGry03/w7M77mcpyzmMoF1lFWD5UE4N67VXCemYwzZu4gSNTIHGaF1M/Lmfiyp0C+Qma8viXLC0AQ8RbTO1S94n2VyOx0e2wPS8e2SxbeZJzvjjqjcZ/A+3bo4= 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 1692130613589890.4746135308416; Tue, 15 Aug 2023 13:16:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Sk-0001Vy-WE; Tue, 15 Aug 2023 16:16:23 -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 1qW0Sg-0001VQ-Ly for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:18 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Se-0004wD-Cn for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:18 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1c4d5cc56e2so1438436fac.2 for ; Tue, 15 Aug 2023 13:16:16 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130575; x=1692735375; 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=HKxo5YuCZUjw8nEJxLWI8Q+BuLO4vaQHkEhOsQ8xDE0=; b=VAzR02I3NBbep1Q28FGCvlllnQJFuqESNZ6a906ZDzD4aFbUiTqy3OAjKNq78aQ7tK hUVRnt4EEUV+emLryOG1WsXHIL9/o8pXvePj/CyGcSwR0SK9UdHLDl+z9yWiQl1BnhdN s4hU6nqXzNqybCmkGgfLBipHkEHpK4BtFN+oKUb1sl+t1jsKJmkiK3DO0DIa1k3FYRkP AFDoUiGUi+ClCvP3ORmulHuxvAiTOdAOGl45yJKxXHpErARI2IXme9YGqbqp6IDkYUzJ /9HcSDxgyyHGfoeXQkAn+SU/H/pd1Ar6mzIFKTgOZ4pRHMsKYq5ym2UnLzqsAE6fuWhd jqIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130575; x=1692735375; 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=HKxo5YuCZUjw8nEJxLWI8Q+BuLO4vaQHkEhOsQ8xDE0=; b=Uj8Y9p9tb4vW9YbHshhVq1Z0/+3GecF7o4ojAFVgSlhLsqd8th/B5TLDBY9hnlLukK bT5Dd4cAbrqVJJfYD+7FdDIBOA4R9/VyTAVK+rDSgH7iFlnCurhNLuoosRjxubZt9P8O MIuzipCc/V3PoGls5JcYkUMkpGKPjvcxpD4Me95x1waHb4+9As67ca+FpiHnxlNYZogp Bx3kIgYQDIBi/Pjd961eEDeVwL0wVge08UijrYB/7bLe76ZneB7lQt7i34SLNwtl/Jfc lcH+RI1MtxmUQsWZpWO6Eft88qbcYaSWgiWQu2n8P7dIVn7stY+bN4OBEUMoPubipLBR o5FA== X-Gm-Message-State: AOJu0YzHbOGI8La/H3eMAePMjocws/QHXClSzrfuIGwjCEluo8zEss19 Ek57/CZyQ3m3e7sIO/TEX9Lh7Z4ophCi6tpXgGc= X-Google-Smtp-Source: AGHT+IHqFH38w1cU6oIJEH7fRENGJ3jnmsQhR4dPcL2WFWGnMQaWzhHvwerzV7qlz4D4FOecYxDCbw== X-Received: by 2002:a05:6870:41d1:b0:1bb:a468:9e6c with SMTP id z17-20020a05687041d100b001bba4689e6cmr12131982oac.23.1692130574990; Tue, 15 Aug 2023 13:16:14 -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 v7 03/12] target/riscv/cpu.c: split kvm prop handling to its own helper Date: Tue, 15 Aug 2023 17:15:50 -0300 Message-ID: <20230815201559.398643-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::2c; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x2c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130625202100001 Content-Type: text/plain; charset="utf-8" Future patches will split the existing Property arrays even further, and the existing code in riscv_cpu_add_user_properties() will start to scale bad with it because it's dealing with KVM constraints mixed in with TCG constraints. We're going to pay a high price to share a couple of common lines of code between the two. Create a new riscv_cpu_add_kvm_properties() that will be forked from riscv_cpu_add_user_properties() if we're running KVM. The helper includes all properties that a KVM CPU will add. The rest of riscv_cpu_add_user_properties() body will then be relieved from having to deal with KVM constraints. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 65 ++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 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 Nov 1 00:13:39 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=1692130698; cv=none; d=zohomail.com; s=zohoarc; b=h2vh5pYYw2j0JRSQuU7GHa1klDPBrwHsEt9tygfPXLS5Q8/O8QhG/duNLrc2jsxx9FsR70c3MR//vZzA7clJfERwIpgCBqTpWhTEcG9jfHcJtFwkb3bZuwhrtLXVsnSsv6afe0LyoFn64KNbkVI8B6XNeFYb28ZJdDUSmxdTO2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130698; 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=CV+Q96BqDr+yYM6mYpaiFr+4tsWPyiV37nU28yNXcuM=; b=PWcLXVSh+c3uZZyj4x0PPTZCPKTWLbmoTlnkvEIJKtjENy9yCiTyFVGd6vUwuTlxKrxEJbS5CZCe/VovgBIFTdHRHOEbADjitaKiVUrJsqc4OAmEOEhLcV5l2V1t/LQ33qpQFGNApHZa4eJ3SwyayeVCUIFpiE60dbUlpslMJoI= 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 169213069868838.016769981596326; Tue, 15 Aug 2023 13:18:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Sm-0001Wm-6q; Tue, 15 Aug 2023 16:16:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0Sl-0001WI-60 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:23 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Sh-0004x1-DE for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:21 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6bcbb0c40b1so4757076a34.3 for ; Tue, 15 Aug 2023 13:16:19 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130578; x=1692735378; 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=CV+Q96BqDr+yYM6mYpaiFr+4tsWPyiV37nU28yNXcuM=; b=Axz2hn/ofjBZtjuTCFdaWxxl/q22x2NBZO3BIwHiNX4FJ3aTd4/bbQwtLXPJSpMopz K3pQswCrlqYibFIdjzZXGl7DRKy8EXDMDBR0Eg4irvKqNYuy7yO2KbnTdDlwt90VZe59 zvjYp2JPrk3dZO/2IShzQGABWJ3NAQbNnGj0YnJDMogxQAP1SECZTOXUlfzR0qno8Gfs Ve7MmjcYyVmheahxIBFpL7vMNWnkak6nTm9Rgetu4BP2qo/Co81q4STiluymd5apazHI QHcRbXZjh4sMI8Pt/KPelObvCxedMGLRMT8Z18+B9MbeUElxsGQlpG5xcMWkQM9K4Yda 9zdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130578; x=1692735378; 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=CV+Q96BqDr+yYM6mYpaiFr+4tsWPyiV37nU28yNXcuM=; b=OEej2jHspqL/phwNYF8S1O7XtNB6WQkhc3vaemrzpith8ifYQWnaOdelkOTg5JS0NM Y8sPWZyUhKG6Hxd6LXlpWLS8JgIdghdBqbzOsxgqja/WWBmwlWIJlsTcD8zzTb0WnH0r d2sfjH9fZYg6Ymkl+M9TsUvNEQafbzb+2E6pTuB0ctXC8bj5soe5mGhhhRlS3eF2q00u tnt5ckCQk6XJjxxV3pOhn/ibBZRpXPyWWToYROI+rYDZbrjnmHwxCV6GWIXjpnCru2Rm hIS0st92kokZw9z49BZiKa6o/LqrVYa5Dc1fPFO878eFe1KlfPgfDBDnO2puGbUHsHfp OEEQ== X-Gm-Message-State: AOJu0YzHUlz3DJpSIdYf3Md8FL6qSO4+p3ZjMF42uPZO0fXWrhYPcxDv GsQs2zj0HgZjt/OW505SlT5ifGk9njwO5U0sdNM= X-Google-Smtp-Source: AGHT+IFlWZHnYPoV+cnU5CMg6QSjdfeUx/zEN2Jdu2/DiN55CKQP4HmZkfMei8dzeUs/dUQJhq6pew== X-Received: by 2002:a05:6870:15d5:b0:1bb:ac7:2e34 with SMTP id k21-20020a05687015d500b001bb0ac72e34mr15176523oad.40.1692130577885; Tue, 15 Aug 2023 13:16:17 -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 v7 04/12] target/riscv: add DEFINE_PROP_END_OF_LIST() to riscv_cpu_options[] Date: Tue, 15 Aug 2023 17:15:51 -0300 Message-ID: <20230815201559.398643-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::32e; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130700682100003 Content-Type: text/plain; charset="utf-8" Add DEFINE_PROP_END_OF_LIST() and eliminate the ARRAY_SIZE() usage when iterating in the riscv_cpu_options[] array, making it similar to what we already do when working with riscv_cpu_extensions[]. We also have a more sophisticated motivation behind this change. In the future we might need to export riscv_cpu_options[] to other files, and ARRAY_LIST() doesn't work properly in that case because the array size isn't exposed to the header file. Here's a future sight of what we would deal with: ./target/riscv/kvm.c:1057:5: error: nested extern declaration of 'riscv_cpu= _add_misa_properties' [-Werror=3Dnested-externs] n file included from ../target/riscv/kvm.c:19: home/danielhb/work/qemu/include/qemu/osdep.h:473:31: error: invalid applica= tion of 'sizeof' to incomplete type 'const RISCVCPUMultiExtConfig[]' 473 | #define ARRAY_SIZE(x) ((sizeof(x) / sizeof((x)[0])) + \ | ^ ./target/riscv/kvm.c:1047:29: note: in expansion of macro 'ARRAY_SIZE' 1047 | for (int i =3D 0; i < ARRAY_SIZE(_array); i++) { \ | ^~~~~~~~~~ ./target/riscv/kvm.c:1059:5: note: in expansion of macro 'ADD_UNAVAIL_KVM_P= ROP_ARRAY' 1059 | ADD_UNAVAIL_KVM_PROP_ARRAY(obj, riscv_cpu_extensions); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ home/danielhb/work/qemu/include/qemu/osdep.h:473:31: error: invalid applica= tion of 'sizeof' to incomplete type 'const RISCVCPUMultiExtConfig[]' 473 | #define ARRAY_SIZE(x) ((sizeof(x) / sizeof((x)[0])) + \ | ^ ./target/riscv/kvm.c:1047:29: note: in expansion of macro 'ARRAY_SIZE' 1047 | for (int i =3D 0; i < ARRAY_SIZE(_array); i++) { \ Homogenize the present and change the future by using DEFINE_PROP_END_OF_LIST() in riscv_cpu_options[]. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7f0852a14e..854c56b6d0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1853,6 +1853,8 @@ static Property riscv_cpu_options[] =3D { =20 DEFINE_PROP_UINT16("cbom_blocksize", RISCVCPU, cfg.cbom_blocksize, 64), DEFINE_PROP_UINT16("cboz_blocksize", RISCVCPU, cfg.cboz_blocksize, 64), + + DEFINE_PROP_END_OF_LIST(), }; =20 #ifndef CONFIG_USER_ONLY @@ -1904,12 +1906,12 @@ static void riscv_cpu_add_kvm_properties(Object *ob= j) riscv_cpu_add_kvm_unavail_prop(obj, prop->name); } =20 - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { + for (prop =3D riscv_cpu_options; prop && prop->name; prop++) { /* Check if KVM created the property already */ - if (object_property_find(obj, riscv_cpu_options[i].name)) { + if (object_property_find(obj, prop->name)) { continue; } - qdev_property_add_static(dev, &riscv_cpu_options[i]); + qdev_property_add_static(dev, prop); } } #endif @@ -1940,8 +1942,8 @@ static void riscv_cpu_add_user_properties(Object *obj) qdev_property_add_static(dev, prop); } =20 - for (int i =3D 0; i < ARRAY_SIZE(riscv_cpu_options); i++) { - qdev_property_add_static(dev, &riscv_cpu_options[i]); + for (prop =3D riscv_cpu_options; prop && prop->name; prop++) { + qdev_property_add_static(dev, prop); } } =20 --=20 2.41.0 From nobody Fri Nov 1 00:13:39 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=1692130686; cv=none; d=zohomail.com; s=zohoarc; b=LuwI7pIQ1U9dOvRdp2jCzkTCCMZcIToSEO3Q6/7Xd99EENfHB49lsl0kpfLtsymrPrJIS7SmL7ojCAMnHw/66xTcf72SU9VUgcG7FfM6ZdqBj0MjouVAqBF3W5syOwnf5p4pkILw0NSqzGIvPctcLkAktZeTZnBxwn9aGQUIvnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130686; 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=U6Gqq8xsXFn/VlblXeiMzNhXqLfn/OYfOtsv/+5rfiY=; b=O4D7mjK8FZAHxpNkn7/1wfGcNUhMcwCQlzK6B9+ZNlBsY3eChOCI7VQRXFDBDqvbwydnvbcvNn48gGx9RwGtPt4vD++5FqsXyZ1XPYy1mmfvPFvYmOiOUnkcNcuAhS4xskMiQEGTaV/a87dcseLioO0f9sS05xY7YRPAP1jD4XY= 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 1692130686752227.79286353670477; Tue, 15 Aug 2023 13:18:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0So-0001Xj-Ot; Tue, 15 Aug 2023 16:16:26 -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 1qW0Sn-0001XO-An for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:25 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Sk-0004xV-U2 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:25 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6bd0a0a675dso4891769a34.2 for ; Tue, 15 Aug 2023 13:16:22 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130581; x=1692735381; 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=U6Gqq8xsXFn/VlblXeiMzNhXqLfn/OYfOtsv/+5rfiY=; b=HO2KPJ2/2qkyjUmrDo1pVBoC5XdAxlzANX41RmQWnSIo995vcbxQTjmv0MXpbeplOv SVRZUOP+vzb1/wESWtQnshCjqFSCdi7KM1Ae4x1K5VV0yRARivh0hPccnjojjzrP7RjZ tIY08reNseLSEkw1dBL3us8hJ/1a64z5RN8PvCf5cGRLd9KnzZCUY5k1p0whE1ibvcS8 XWwOW968cZOMY7I0PtDSbARn03kk3jmj4KMwXiheZm5iXtotsgi5qqm8p2rIiKsM+jjK 4BE+n4u05aOm0/+PfpQ7oUv18g2pKtkrb7RuDDoeN1xihG3sXtOgcedT3FnwpuYAM0PC h4Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130581; x=1692735381; 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=U6Gqq8xsXFn/VlblXeiMzNhXqLfn/OYfOtsv/+5rfiY=; b=c5FgykAq0OgOnWTLhS75hUwQPdVsM+piGQKNHVi2uV6TqVbEAY0gr1yBtF/krr0HqS SVEYcNYUjPthx6w56LmmT7YGMH5QVQ7k9thc6WIJSK6CHoqheXXhS5hyEwPFTgOqBa+S 8DQyHTIyUKBPHtgKlijPYZ1fCWI7RIclBei5+yBy2nPlqEsxiGb+8NAP091XCnifpCKB 9TRaDBz78y/kMyWzALz2CLZMGBdmbtbdcEdTvGl8Nr8RQv8zHNseUHu/P217OUW6M8Zy yg6yrS4jyIP4nE06cK7jdjjcCdGkt4ttvKDY+EVCEGghVgOeUvVUOGY15iqCcPUD0xks BpxQ== X-Gm-Message-State: AOJu0Ywhx9QuMfb71EopmaSLVM7jvspPz5huHXfmDpZ+N6tQUIX7RUMy i2OAVITEhKKRPg7DkdVn7A5DT7v6L/Sm3IMUGSQ= X-Google-Smtp-Source: AGHT+IHF29wNEwMMnVYslHYyxGK2YsoDYsi2NdAKFvGFv2+5+ntMhgYprHYKK0GyL9p0TQ+gQZS18A== X-Received: by 2002:a05:6870:5814:b0:1ba:989b:ca65 with SMTP id r20-20020a056870581400b001ba989bca65mr15182555oap.19.1692130581394; Tue, 15 Aug 2023 13:16:21 -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 v7 05/12] target/riscv/cpu.c: split vendor exts from riscv_cpu_extensions[] Date: Tue, 15 Aug 2023 17:15:52 -0300 Message-ID: <20230815201559.398643-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::32e; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130688172100001 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 | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 854c56b6d0..3cd025b678 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 @@ -1839,6 +1825,23 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_END_OF_LIST(), }; =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), + + DEFINE_PROP_END_OF_LIST(), +}; + static Property riscv_cpu_options[] =3D { DEFINE_PROP_UINT8("pmu-num", RISCVCPU, cfg.pmu_num, 16), =20 @@ -1906,6 +1909,10 @@ static void riscv_cpu_add_kvm_properties(Object *obj) riscv_cpu_add_kvm_unavail_prop(obj, prop->name); } =20 + for (prop =3D riscv_cpu_vendor_exts; prop && prop->name; prop++) { + riscv_cpu_add_kvm_unavail_prop(obj, prop->name); + } + for (prop =3D riscv_cpu_options; prop && prop->name; prop++) { /* Check if KVM created the property already */ if (object_property_find(obj, prop->name)) { @@ -1945,6 +1952,10 @@ static void riscv_cpu_add_user_properties(Object *ob= j) for (prop =3D riscv_cpu_options; prop && prop->name; prop++) { qdev_property_add_static(dev, prop); } + + for (prop =3D riscv_cpu_vendor_exts; prop && prop->name; prop++) { + qdev_property_add_static(dev, prop); + } } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Fri Nov 1 00:13:39 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=1692130683; cv=none; d=zohomail.com; s=zohoarc; b=lhiu815858ugQPG7qDatAl65QeLCLXndS6m1SvXK6eFxhNTG1u0IcWkDLAxJxSVQu9Een9kp3yBHoehe6ASimPttx7RUPsYzs3/tlHgsVkTrrjTxBzv29+sSn2dkiVVC0recg+zD6omcZslohft3fkFvGX6Ot2aiQk7LaHx1GCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130683; 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=+V2uJDGM7UK+i6uFrn6LQi2aVYMe08c1CeeSTBFBbVk=; b=MpVhUTx5Ov+TeM5xmwuRTfW9qKmGLvV3PsEiSy5cWIcOf074ElmYYajK55tNtQUPClAq09i2lDm1SqqWBj7X3KXzFyhAawQcUxdJjCrBByOBoSv3bzx1oA1M5tzhDlb0tNTJtkx1/qZSlvyQccO5RZXbylSSNTmTusjveQfWu1o= 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 169213068301650.931148426629534; Tue, 15 Aug 2023 13:18:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Ss-0001Yp-AT; Tue, 15 Aug 2023 16:16:30 -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 1qW0Sq-0001YU-NP for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:28 -0400 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0So-000514-BI for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:28 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1c4d8eaa8ebso2077199fac.0 for ; Tue, 15 Aug 2023 13:16:25 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130584; x=1692735384; 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=+V2uJDGM7UK+i6uFrn6LQi2aVYMe08c1CeeSTBFBbVk=; b=GBryA3G21Bcv5bLg914ivFjldQboVaK2XTbqdqkePInTeWUD41ZOYetgUsUNkfzxO/ H9U8pILN3eyZ/jx5xmxIND6C3xkwaqrwfKeCSz71d2Qfm/LnLyg39lUzFmhucs65J6Is Z92XiyQlACzmarjvzwZfyAFVSlcBP7GFIK7qYgJABLq63UGveAcPx+Y338yDdH+bqhBu sIy57PyYEfBLjMOGtE/DwQw0Jieko1az6/5o3Amg7bRb4JJwlz2NsEmV117kLbpenOEl Ioz5HHEC0VUBDxOGhQOHJ10XDTa/OjPYO0mtWErmG9VIKrEuslok9iienM5Xq5BnAY5u o43Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130584; x=1692735384; 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=+V2uJDGM7UK+i6uFrn6LQi2aVYMe08c1CeeSTBFBbVk=; b=FSAuNmrpbhVjW5iAd3s1M1sRyUlfO7oiCWfHRww3JlmGRAcjY4YwPfDaRuTQlIrMoJ e1QkpCl3bXMsmdS29ZwvKodhw7c15feIZ+JgyomUabT/guIGd6gY4U/QeMLHORvR1xAq 5ANJB27UYYykblLPEF/7VIe73G2nnz8bTE/3yK5czRMtUUli+e43R/fEc7IOO/ZfBHbC mAJKQXMhqXbNFDy89mKBEfVoC/kteMSYyVeEjGBJujqv8QOGZj/1ZEYbKskStIi9mNvk iEbKysgU0IqMGDCrqkf7j3uc6L0/u1BQYDcPCctQWkQswtvAcT7ZnFbD1RvYKNeH0Xko hjxA== X-Gm-Message-State: AOJu0YxUbW1gqP6m8745M694gg5gYVIeeD+rgFKn6wA6FhSXKdzOCb7k p0tOsAeEPnaE5D3yU4z5xM7YD0jvtI32vZxw1J0= X-Google-Smtp-Source: AGHT+IGwaeWOmPZPk8Qy0EZ7JhJ3UKI4rJhHJ8NqiLrKts+qhGhK54Ny0vOOEGtncikV3M+HfwV9Sw== X-Received: by 2002:a05:6870:2498:b0:1a5:4e57:e5d1 with SMTP id s24-20020a056870249800b001a54e57e5d1mr13355981oaq.49.1692130584194; Tue, 15 Aug 2023 13:16:24 -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 v7 06/12] target/riscv/cpu.c: split non-ratified exts from riscv_cpu_extensions[] Date: Tue, 15 Aug 2023 17:15:53 -0300 Message-ID: <20230815201559.398643-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::30; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692130683486100001 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 | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3cd025b678..520c5c9f96 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1807,21 +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 - /* 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), - DEFINE_PROP_END_OF_LIST(), }; =20 @@ -1842,6 +1827,25 @@ static Property riscv_cpu_vendor_exts[] =3D { DEFINE_PROP_END_OF_LIST(), }; =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), + + DEFINE_PROP_END_OF_LIST(), +}; + static Property riscv_cpu_options[] =3D { DEFINE_PROP_UINT8("pmu-num", RISCVCPU, cfg.pmu_num, 16), =20 @@ -1913,6 +1917,10 @@ static void riscv_cpu_add_kvm_properties(Object *obj) riscv_cpu_add_kvm_unavail_prop(obj, prop->name); } =20 + for (prop =3D riscv_cpu_experimental_exts; prop && prop->name; prop++)= { + riscv_cpu_add_kvm_unavail_prop(obj, prop->name); + } + for (prop =3D riscv_cpu_options; prop && prop->name; prop++) { /* Check if KVM created the property already */ if (object_property_find(obj, prop->name)) { @@ -1956,6 +1964,10 @@ static void riscv_cpu_add_user_properties(Object *ob= j) for (prop =3D riscv_cpu_vendor_exts; prop && prop->name; prop++) { qdev_property_add_static(dev, prop); } + + for (prop =3D riscv_cpu_experimental_exts; prop && prop->name; prop++)= { + qdev_property_add_static(dev, prop); + } } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Fri Nov 1 00:13:39 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=1692130646; cv=none; d=zohomail.com; s=zohoarc; b=G+bMzjbwgS/adjGXFs8UMkRDIGIMWrUIXwQn0xXSoTpVTUuWOnevksuOP9rdwSu65UtnLVMeT/cUk8dNCt5RE1FJAlYkoA6X+n1nj2gqplL+Yc+h9lErBoFkfpd+RoNhIWh6Scx8qIo1JqXsKzQXCGk9rzmMfKhVz14WySBS+18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130646; 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=UCOWjm+U/PUrL3cAWmcaZPHqvp8GhXWkgFHPJPAiHMQ=; b=kYYHjMmorgxdKsceULTt61+MrhgB0Y8lKVl4q/ijc6k1KIF7xu2OwPM5Zr62RtCzBwHpn2fKxenBHsw3djFfPkgeN5rRPiO3iQBPMzMuJ/Z+kryXi0Skqo1OgVX0VdkpNlyDp7BJPUNEjJIdxxzbV0dQQpv6ImunuSv8gc4fLDY= 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 1692130645981796.7067830372747; Tue, 15 Aug 2023 13:17:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Sv-0001ZX-36; Tue, 15 Aug 2023 16:16: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 1qW0St-0001ZF-Bx for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:31 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Sr-00052X-3O for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:31 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6bd0c953fd9so3982237a34.3 for ; Tue, 15 Aug 2023 13:16:28 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130587; x=1692735387; 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=UCOWjm+U/PUrL3cAWmcaZPHqvp8GhXWkgFHPJPAiHMQ=; b=I2DtZW/Xk3rN8GN8E6Ply8IPgwK1JirNED5XaplYABPbF3DTioJpxovKYO7suTCvK8 elCmQyboXkJp5k019SC3W7+mr2kh1FomO5HDhyWagNykrMlQkzrXvzeRY3Nt9sxLFzil 2x0x3jFO+b85uSgjbVc/Uq9Jed/vHuHPmFxbH5i0zvyvxX8SGYcghg0Isa1nAEJ7rLiN yzENQ7xI8bQWKpAOJlzNjQB0kc410+9M9sWKzXJQslYYbHB5zA1CSgwZTd9eLX8AIFk/ BWuUwgOZPTCWPJkOftKQSLK7VX6Pi0TEMTY1bUx036zHv9ruvNND5dzbNXkyCQ7ASjIn VbvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130587; x=1692735387; 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=UCOWjm+U/PUrL3cAWmcaZPHqvp8GhXWkgFHPJPAiHMQ=; b=UmaXBdphrhZrQNrOQg87B3AFulBZB61+j9z9TrjdsrNyRGMUONggj2XW8n+OojUrtN S94C+YydBVTjNgbtZvCDj+Mbqb04S+Ah51y4Ww0Nr8dNZAcN3ddkMir8yf5YTeyJETpR hWurXytaJSS3Wc8YdbNPBo4MTzjKANZ4x5KI7Udg16XIO7ljKXC42CloPRreMTp1mOyF Ptvq2jKsbfao3mo7HzIDAk8cJgRWwCykaHHTV2LdOssppyrOskSvRiKSedEv9Db7EEtA J5e9/y9Ev/r3adJTjnFzvoJBrev2/ZXpzr3IQnaLoNngQ/crBUVfOlCb2Y/UuUyrIy+P 4xog== X-Gm-Message-State: AOJu0YwbMI6DJbXL1gUpYBduV270UqkEPC+0cStJFmXvPgvPSIlHLIga UWqhVhyXbeWEwITsnsYHDJOz1GqXAR1aLNmhC6Y= X-Google-Smtp-Source: AGHT+IGsx4pJnIaMi8mnGGMk2EfftxzHUKnbUT+22sm7bgrDSc5AUY22CFLhROLzXbGRAUXdWv1acA== X-Received: by 2002:a05:6870:ac2b:b0:1ba:3ff0:4934 with SMTP id kw43-20020a056870ac2b00b001ba3ff04934mr11971961oab.12.1692130587576; Tue, 15 Aug 2023 13:16:27 -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 v7 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro Date: Tue, 15 Aug 2023 17:15:54 -0300 Message-ID: <20230815201559.398643-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692130647447100001 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 | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 520c5c9f96..8e1d944957 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1883,6 +1883,13 @@ static void cpu_set_cfg_unavailable(Object *obj, Vis= itor *v, } #endif =20 +#define ADD_CPU_QDEV_PROPERTIES_ARRAY(_dev, _array) \ + do { \ + for (Property *prop =3D _array; prop && prop->name; prop++) { \ + qdev_property_add_static(_dev, prop); \ + } \ + } while (0) + #ifndef CONFIG_USER_ONLY static void riscv_cpu_add_kvm_unavail_prop(Object *obj, const char *prop_n= ame) { @@ -1939,7 +1946,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 @@ -1953,21 +1959,10 @@ static void riscv_cpu_add_user_properties(Object *o= bj) =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 (prop =3D riscv_cpu_options; prop && prop->name; prop++) { - qdev_property_add_static(dev, prop); - } - - for (prop =3D riscv_cpu_vendor_exts; prop && prop->name; prop++) { - qdev_property_add_static(dev, prop); - } - - for (prop =3D riscv_cpu_experimental_exts; prop && prop->name; prop++)= { - qdev_property_add_static(dev, prop); - } + 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 Nov 1 00:13:39 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=1692130715; cv=none; d=zohomail.com; s=zohoarc; b=OjMCb+tbvHv+05LhyI5orbklFthT5+u0LdqzbcCrr4EN4HZMP8yunJtJoC0nRYpQGh1w/sgG7+QeDmeFIcrDXlOEc53C087crFtEeCf1jayDVgwqhW8wX0dD/8Hbdh5pKRc4k2gUf4xSHTuEtTe8ML7m66DbJgsz/1UFKno5kLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130715; 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=DzconJ7fLnpBfc1vkSCW+1DNOKMIUmiFwiaSTlBrr+U=; b=EdSbuFf1Zl62WUy3wsecGxUTAYzcthFsBPjLGL2BdphCgXs7cktFmgwCgixmHayzH+ZyoFXJ7wX1q8wMj5B6opkMp8qYGvrPpBORue9mX/CPWJS7anzB8cMAd0RXgxm+JC+VEpg1HnPHa3NR12dLBW/NiLyV0iOcpXrRZA0oYrM= 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 1692130715384334.78740994331883; Tue, 15 Aug 2023 13:18:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0Sy-0001dK-Jh; Tue, 15 Aug 2023 16:16:36 -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 1qW0Sw-0001aQ-Ah for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:34 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0St-000562-RK for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:33 -0400 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6bca66e6c44so5014550a34.0 for ; Tue, 15 Aug 2023 13:16:31 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130590; x=1692735390; 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=DzconJ7fLnpBfc1vkSCW+1DNOKMIUmiFwiaSTlBrr+U=; b=hBGq9oHbm/TV2ZR8G8aUT7k8gg8tUgxyl9bEA+mYHMi2udlWVPMAnxdrNX+x/q+nkV KkY6YkSzMzHrtkHGW8UlDMzYhoYlSpDUevWltl9yIV8ye9SLOBQ/HZnlBCIPkJVLooT9 n2+Qdtd1gUiZXOV0ytG4yK6/r5CSeA5M+kVdgyCLc4dYGM3/GJanPk9nVn05lqcth7U6 0vGCj+uhiju6fRR5Xof/sLfHweAR/9t56jNyArA6+Fr4SQd3VGN+j2F7112hFn/th0yh 0vVAsZI8hAsvwehBRqE+YFSeNQ2NFtSNG75YvAVLzxJlWOm2V1y+A6x4nvndvZKxuTLG 8KVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130590; x=1692735390; 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=DzconJ7fLnpBfc1vkSCW+1DNOKMIUmiFwiaSTlBrr+U=; b=Ryhgkny38NUdu1K6YnvQO6CsYcbcmEnzz0TGjPsjtLdv8GK6auhyTtyAAaZKqiD2B4 1snEuQ3PnGrxeS2LA5pdaSxyIBxgzryCyagMEdo3adivMnvZj1Xxq5Yy3iqkt0D2rqw8 1qUYTf5jeoCRQ09hmMYltvquPDMME+xKJssoQ0LuQftEdnw/lCp4JOl+UbIJb4LE0hSb HucOGememmAGs6mr2d3Vn0qwMBSri+iDclNI9wPSrOuPXtAduQIbikp8Itd5Jl5EjV8Y F9UEuZ5IFIjcbxIXDTAA2rJlnYMKt6cBe5SVaG4XdlJwmNaaJA/Bu3MflvNW7dbJTS2i InTg== X-Gm-Message-State: AOJu0YzG/Fj5gB8wtOy9ehRUAcWane3xE7acPTJnxzr2zB10cjpJUihh W89a7niapljYNNDQEJ863bH7Vax5or/g8Sm+iTs= X-Google-Smtp-Source: AGHT+IHIpN2wWSyD1KlorqSlt57K20e/Yb9/prNZjIZybMhTGA5Q27FnKr91JSJmeepuQytFbnS3Wg== X-Received: by 2002:a05:6871:821:b0:1bd:f87e:6ad3 with SMTP id q33-20020a056871082100b001bdf87e6ad3mr15044879oap.30.1692130590550; Tue, 15 Aug 2023 13:16:30 -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 v7 08/12] target/riscv/cpu.c: add ADD_UNAVAIL_KVM_PROP_ARRAY() macro Date: Tue, 15 Aug 2023 17:15:55 -0300 Message-ID: <20230815201559.398643-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::32a; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130715890100001 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 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 8e1d944957..42f209cd17 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1908,6 +1908,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 (Property *prop =3D _array; prop && prop->name; prop++) { \ + riscv_cpu_add_kvm_unavail_prop(_obj, prop->name); \ + } \ + } while (0) + static void riscv_cpu_add_kvm_properties(Object *obj) { Property *prop; @@ -1916,17 +1923,9 @@ static void riscv_cpu_add_kvm_properties(Object *obj) 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 (prop =3D riscv_cpu_vendor_exts; prop && prop->name; prop++) { - riscv_cpu_add_kvm_unavail_prop(obj, prop->name); - } - - for (prop =3D riscv_cpu_experimental_exts; prop && prop->name; prop++)= { - riscv_cpu_add_kvm_unavail_prop(obj, prop->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 (prop =3D riscv_cpu_options; prop && prop->name; prop++) { /* Check if KVM created the property already */ --=20 2.41.0 From nobody Fri Nov 1 00:13:39 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=1692130694; cv=none; d=zohomail.com; s=zohoarc; b=HfjjomPIILyt9l2XkFXhfzzSGf4IahORxTORXlZvn0pVZtd+Iuj8PQB4w+Zdz+A63G55B/v6QdifQAb4PWbj+w9pOuturV9yAPgo2p1I3/l+4lsQwBKQRlM/eVtCCqLs0BOru1xmK8A9UyyOHj5TvjqBBI4RMvPhvaW+LichK/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130694; 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=nMO9L7h6GcuPUuObNtRQb+2ZZDJJDdxAjypEQ+5BnIE=; b=Y3HRjfZUQf6A5MftzqxCFizFFfBLoSgMOIa3RKLrgaP0llSqID9Uf5kKPKYxPwJCh3iN69A9ishhgljY9BAkBiazIcrG4vCkjeBYsI1Hc+2Tnx3m4Mw6llDM8/n5mNgywl5RYTG/Ytig9ydcOMwVXEbOzU07rhUZM32obrEYREU= 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 1692130694386511.13941620439925; Tue, 15 Aug 2023 13:18:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0T7-0001iE-Tl; Tue, 15 Aug 2023 16:16:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0T0-0001e6-Rx for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:43 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0Sw-00056Z-RY for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:38 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6bc9c01e154so4005784a34.0 for ; Tue, 15 Aug 2023 13:16:34 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130593; x=1692735393; 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=nMO9L7h6GcuPUuObNtRQb+2ZZDJJDdxAjypEQ+5BnIE=; b=F6HuHQiroNIU4+0ksdZ8JR3r1SatOlIR+70Z/BuFAEhlRxNh1ZXd2EOhdmcAvTiU8f GBzZShLETXq3Av/c2oPMPxhrwgdOHMrYper3QGNbaZe5RSVpdjTNdzkjvOKdlxd0uzfO Y7N/S0hy8aYWu80w8A/5H43DUhSq/tXDNdb8XuxiUGpEKRrf52rj5dYspMuR9k3uBBak Q+dMj5/Rx1Ap8+HIRvgn5GrkRC8SzVVdzmvTuabHSnpWdl/4heuN2pmA5CySVEzhxhmr XyE2iTNEQ54dPE4fzKOEpoKweppUp9aoSf5fIbZeBdYPdPSgIu0zeTo0nypJfXi287uI 0ijw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130593; x=1692735393; 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=nMO9L7h6GcuPUuObNtRQb+2ZZDJJDdxAjypEQ+5BnIE=; b=i/pwScxD00FG+qoknBRtSiHHigEEQWy1F0r/4k0k22g+p/XtDjRcUUnS77kbqEI5No QG2iazlQMtHlpb9HS6w8GFrUHpR5F1BuppwGPQzSDXuv/2CFj3Gh6OPyLuUDyOL2PkNF iYLXAWcrXiOu0imL+3O+O4p8c3T+U4R6gwcO9YCocFmpvhpvW6BGrZZqUR3VqzLf2f1n QVmM4kmGq0IpoJIW0Hqkt20sq4M1xntVqst17NZ/gp6xfheBI4ksKLrPf5z8xBMkFdO0 N10J3hGzdypAOjCyNsCmOjSYydJQn3T1T37PAWI10vWxVH98TfNye5MFXVvGNq31tnb0 JosA== X-Gm-Message-State: AOJu0YyzV0aNHyXCsxNzpLDKF6EHg1H+2DSQKgqqU9R/M56dUxojRw8E lIvjt8lnWOtLSYy4x1PuZ0ADVwwXLVCiLGiqqxA= X-Google-Smtp-Source: AGHT+IHFJRJETPz0PtJQfdN/fZftU58PGZPbMs1G3MRiXCs8jekNqFsnlGy+yc4m5Teg5wajt2toVA== X-Received: by 2002:a05:6870:3929:b0:1c1:e6da:f890 with SMTP id b41-20020a056870392900b001c1e6daf890mr886oap.9.1692130593326; Tue, 15 Aug 2023 13:16:33 -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 v7 09/12] target/riscv/cpu.c: limit cfg->vext_spec log message Date: Tue, 15 Aug 2023 17:15:56 -0300 Message-ID: <20230815201559.398643-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692130697355100007 Content-Type: text/plain; charset="utf-8" Inside riscv_cpu_validate_v() we're always throwing a log message if the user didn't set a vector version via 'vext_spec'. We're going to include one case with the 'max' CPU where env->vext_ver will be set in the cpu_init(). But that alone will not stop the "vector version is not specified" message from appearing. The usefulness of this log message is debatable for the generic CPUs, but for a 'max' CPU type, where we are supposed to deliver a CPU model with all features possible, it's strange to force users to set 'vext_spec' to get rid of this message. Change riscv_cpu_validate_v() to not throw this log message if env->vext_ver is already set. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Weiwei Li --- target/riscv/cpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 42f209cd17..33d7fa41d8 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -937,8 +937,6 @@ static void riscv_cpu_disas_set_info(CPUState *s, disas= semble_info *info) static void riscv_cpu_validate_v(CPURISCVState *env, RISCVCPUConfig *cfg, Error **errp) { - int vext_version =3D VEXT_VERSION_1_00_0; - if (!is_power_of_2(cfg->vlen)) { error_setg(errp, "Vector extension VLEN must be power of 2"); return; @@ -961,17 +959,18 @@ static void riscv_cpu_validate_v(CPURISCVState *env, = RISCVCPUConfig *cfg, } if (cfg->vext_spec) { if (!g_strcmp0(cfg->vext_spec, "v1.0")) { - vext_version =3D VEXT_VERSION_1_00_0; + env->vext_ver =3D VEXT_VERSION_1_00_0; } else { error_setg(errp, "Unsupported vector spec version '%s'", cfg->vext_spec); return; } - } else { + } else if (env->vext_ver =3D=3D 0) { qemu_log("vector version is not specified, " "use the default value v1.0\n"); + + env->vext_ver =3D VEXT_VERSION_1_00_0; } - env->vext_ver =3D vext_version; } =20 static void riscv_cpu_validate_priv_spec(RISCVCPU *cpu, Error **errp) --=20 2.41.0 From nobody Fri Nov 1 00:13:39 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=1692130721; cv=none; d=zohomail.com; s=zohoarc; b=b9dNI2m5tU/sbe4Qh8OVghOS5UGCvEHOP/9ZPsMHDWYMCGozCDMQQwFhJc0xGpwnUGmqq5bjZB6qvf1pb38PKB2BGZ71uUvXgmsJBcVA/AYkG7y0nygsEwrsuV3a5vQSUsroTMQ3iPhMtcFjjG/aeVOxCZMI/RX2HIp7DFXiaFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130721; 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=SQa80frBZDzPMInF9YH9siPx+DRekb7+dleQtZpjcHk=; b=g+SIqSgE7PgSdnrNXrIWXRPUwBvI2QmBVfIIR9cQC/40t2YrIoUkOqDisMCt3nOSNnwSD3m1ryVNupEx1nHXy4yw0ulH6zj1xQ/Fm12VZKCzGOhRQG1HXz9cog1HnnxSUiUrSorb4ZcqRNwHEQXuYmj7AsDR0QZWAUbv+jxF0C4= 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 1692130721444686.4372321891396; Tue, 15 Aug 2023 13:18:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0T7-0001hR-Dl; Tue, 15 Aug 2023 16:16:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0T3-0001eG-4T for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:43 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0T0-00056x-Kd for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:40 -0400 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6b9cf1997c4so4856222a34.3 for ; Tue, 15 Aug 2023 13:16:37 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130596; x=1692735396; 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=SQa80frBZDzPMInF9YH9siPx+DRekb7+dleQtZpjcHk=; b=YuMgEBzCCANFVMl+1tn/om4KjcL6Y58AjbTTdoTGKPM1SYZfa2jDet77djQQNGsg7d PYGXxEN/M64wtIaV6tgaFg3DP4ReL432Izgp4uvlnkZWw3Ioa2tREUcIiaAWZEw/Co2O rAjmdLL00R/Axi4WBGjrSmWqcERN8KhkfvO6Mxtc5g0d0pMOic7VEcOWsRB43wpMMFkH DRWCZyfu6quTY/N8T/EdoScu3mzx1qXNqsW3uCOtp+IYMu1ogBQEMuOuKr3nTXeKOZyL 1IpLDdRAMb4LDzC6OfcCc1lV9/W3Ii8AVJDfENlvCvZwu+KcGVy3daSxUY2PCjomvduw D5ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130596; x=1692735396; 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=SQa80frBZDzPMInF9YH9siPx+DRekb7+dleQtZpjcHk=; b=I4NBSliDudojqcXpwjKZKziDOUDs4bRyDJKW6n+MtY3p6WSND+TfVNRswG4DYt3zo6 MgMKRqpV0tHTH5JRxVOJuaMtx9HsfdWzG8ZOJ3eK9nLMRAHwTVFNSIlVBiux0+j0kCb/ 4ErKfJEMJuIAzFo5U8ddst1xR79uImhuv6uvisNI2lF5kyNyXjKKQnGun4iBQrO9YlsU WVLcMKddfbpcWjT75+eHSOgHFZKP4wkUPEfPDjnFXkVsTWD4moRCOKCMWDDxdMf8r+5U TvfueWm42bnI/xcpJEibqitgAqovw3ZuqPTy2mAag7PPsfLXzPhL/6WbB+AWqjEQbKvB 48Ag== X-Gm-Message-State: AOJu0YzNpRrjWJ0F2tjrQ/Jhg/cS9suBI07AUhsJzHsYSpkGdigp8Ra8 BcQwgn1m9JBC0puXBKA+eccGbL9rRVI+LslNorw= X-Google-Smtp-Source: AGHT+IGwL5Uz0ZTx6EkCWLGK/FykNTGYW62FFtdAvMk6JYBBOQIhsDadk3D9G6YlnIsO56X82Idw0A== X-Received: by 2002:a05:6870:ac2b:b0:19f:6711:8e0a with SMTP id kw43-20020a056870ac2b00b0019f67118e0amr16027888oab.32.1692130596202; Tue, 15 Aug 2023 13:16:36 -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 v7 10/12] target/riscv: add 'max' CPU type Date: Tue, 15 Aug 2023 17:15:57 -0300 Message-ID: <20230815201559.398643-11-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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::330; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1692130723632100003 Content-Type: text/plain; charset="utf-8" The 'max' CPU type is used by tooling to determine what's the most capable CPU a current QEMU version implements. Other archs such as ARM implements this type. Let's add it to RISC-V. What we consider "most capable CPU" in this context are related to ratified, non-vendor extensions. This means that we want the 'max' CPU to enable all (possible) ratified extensions by default. The reasoning behind this design is (1) vendor extensions can conflict with each other and we won't play favorities deciding which one is default or not and (2) non-ratified extensions are always prone to changes, not being stable enough to be enabled by default. All this said, we're still not able to enable all ratified extensions due to conflicts between them. Zfinx and all its dependencies aren't enabled because of a conflict with RVF. zce, zcmp and zcmt are also disabled due to RVD conflicts. When running with 64 bits we're also disabling zcf. MISA bits RVG, RVJ and RVV are also being set manually since they're default disabled. This is the resulting 'riscv,isa' DT for this new CPU: rv64imafdcvh_zicbom_zicboz_zicsr_zifencei_zihintpause_zawrs_zfa_ zfh_zfhmin_zca_zcb_zcd_zba_zbb_zbc_zbkb_zbkc_zbkx_zbs_zk_zkn_zknd_ zkne_zknh_zkr_zks_zksed_zksh_zkt_zve32f_zve64f_zve64d_ smstateen_sscofpmf_sstc_svadu_svinval_svnapot_svpbmt Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 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 33d7fa41d8..592808939f 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) { @@ -1963,6 +1983,42 @@ 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; + Property *prop; + + /* Enable RVG, RVJ and RVV that are disabled by default */ + set_misa(env, env->misa_mxl, env->misa_ext | RVG | RVJ | RVV); + + + for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { + object_property_set_bool(obj, prop->name, true, NULL); + } + + /* set vector version */ + env->vext_ver =3D VEXT_VERSION_1_00_0; + + /* Zfinx is not compatible with F. Disable it */ + object_property_set_bool(obj, "zfinx", false, NULL); + object_property_set_bool(obj, "zdinx", false, NULL); + object_property_set_bool(obj, "zhinx", false, NULL); + object_property_set_bool(obj, "zhinxmin", false, NULL); + + object_property_set_bool(obj, "zce", false, NULL); + object_property_set_bool(obj, "zcmp", false, NULL); + object_property_set_bool(obj, "zcmt", false, NULL); + + if (env->misa_mxl !=3D MXL_RV32) { + object_property_set_bool(obj, "zcf", false, NULL); + } +} + static Property riscv_cpu_properties[] =3D { DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true), =20 @@ -2301,6 +2357,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 Nov 1 00:13:39 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=1692130694; cv=none; d=zohomail.com; s=zohoarc; b=lDh+32WFvZmKEu+SZvY0w+ntLFST6sdtf3bDgdBxHIaswAkvR0zmYBS4ihE4lKdgDjh/fhe3nBc03CQc1PyLesj0Dlg+3LRgciO+zv/ptHM2tzi0eXMSuKTtgKwHRhiO0p20qvqyj9p4Mz7bwjqWxRsSGvmLY3CtDt3I9dqupgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130694; 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=pO3wz5fop7wDys5r1Ax7UI+xFmY6OiD4k73j8kol0RM=; b=Zp0UWmItrayIr6GDtEy2Zkd4sAIz/hFL7YuM65WhjFFj9Q+zzljpf5yovPuJED16Jt9qHcqHCSW1nzZADhlP6Qr3npdcgT+s1qqHacMQZOFAaIWf80HcmMYf3HrTmQ+o5weFy0awjkDW3wMcVyyFUZW7cAV4U/jrpzN2PnODcvI= 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 169213069475787.80976735798163; Tue, 15 Aug 2023 13:18:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0T7-0001iB-T0; Tue, 15 Aug 2023 16:16:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0T6-0001h2-4H for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:44 -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 1qW0T3-00057g-W4 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:43 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-56d0f4180bbso4303628eaf.1 for ; Tue, 15 Aug 2023 13:16:41 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130600; x=1692735400; 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=pO3wz5fop7wDys5r1Ax7UI+xFmY6OiD4k73j8kol0RM=; b=Qk8qEsQ7Oap0rO4/dmESf+FGyxAX/N6Ptw++P+t3NuGCNCs14OCMKMe/o58KUn2h5v DoWDn91woZ5kqyJnIi64dvGgYhYUIqQyOhiyWp2SgBnVWxsHiyzJWO4KN6erdcY9E8Fo yrnnFUOvNNzGaDw62pAeKEHXGHlP7cFDy9ZK5olAifl8LEB8RAq/J/XI/Zslom8BGu7+ 6rVqmKLxc3il87ZCzXdGw/TPOzzhlbW+tm49tao9UcxLv8grXDsGrF2ubHKdkJ3nv1EN 7G+rM2PVIdpD+0f8H3YYZcdGvV6vyfDk6Z1Y4n7bXJY/obaCQly1wKY0yjoSR02ThL+o Xo9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130600; x=1692735400; 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=pO3wz5fop7wDys5r1Ax7UI+xFmY6OiD4k73j8kol0RM=; b=NHFwydP/b4OL8iAfwMkZVVljs5VqQNavu2rkmGMNFylIPNHccbFjqqpZHTDuIObWbr mJ2s1ccePXykSsx29mR04lELxKhh7cV3Olfgo0PS+ws/hVdpSp9QEucQWPXDtezXtGdH KCR6/kRUv/VAjbyVaReHPaSS/Z5U7P3M9XmOPCwRCtcSWyF/tvEe8wSNGZRm1brlByQh R2scLPGD5+vyuztftlJMi6zl75JJerkTQkhTsCNcRZIic7cH/to+NMgZwyn4jR3s7mBp IkSorP3CeHcEUv5F2wuFHxeUcBscfGJ6bbjH/NYPVnlPN0O75lnkevnc/1XC+mHMS5fX gCxQ== X-Gm-Message-State: AOJu0Yw/yB0ycevTOjgFcA5N9K8Ql9xpvamZvXsAP9R8ggArNnT1nKKA P8HNP1H3r5505j1s3xBNisFkkmbhyCp/r8EmXBc= X-Google-Smtp-Source: AGHT+IHAxYdFaeFyjR9KpuIaRf+PuBmvtTQn/JwH/ddlTGp4HqQf2TWRTgnF1Ah1n9eIWxZuK5ePQg== X-Received: by 2002:a05:6870:3102:b0:1bf:d8a:b5bf with SMTP id v2-20020a056870310200b001bf0d8ab5bfmr16341109oaa.36.1692130599168; Tue, 15 Aug 2023 13:16:39 -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 v7 11/12] avocado, risc-v: add opensbi tests for 'max' CPU Date: Tue, 15 Aug 2023 17:15:58 -0300 Message-ID: <20230815201559.398643-12-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-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 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: 1692130695587100005 Content-Type: text/plain; charset="utf-8" Add smoke tests to ensure that we'll not break the 'max' CPU type when adding new ratified extensions to be enabled. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- tests/avocado/riscv_opensbi.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/avocado/riscv_opensbi.py b/tests/avocado/riscv_opensbi.py index bfff9cc3c3..15fd57fe51 100644 --- a/tests/avocado/riscv_opensbi.py +++ b/tests/avocado/riscv_opensbi.py @@ -61,3 +61,19 @@ def test_riscv64_virt(self): :avocado: tags=3Dmachine:virt """ self.boot_opensbi() + + def test_riscv32_virt_maxcpu(self): + """ + :avocado: tags=3Darch:riscv32 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Dcpu:max + """ + self.boot_opensbi() + + def test_riscv64_virt_maxcpu(self): + """ + :avocado: tags=3Darch:riscv64 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Dcpu:max + """ + self.boot_opensbi() --=20 2.41.0 From nobody Fri Nov 1 00:13:39 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=1692130703; cv=none; d=zohomail.com; s=zohoarc; b=VLIWt7gpg2j7W07XIT+wU0QSgAFg6v9xqSfwKhxj5w00dDr6E3dYOB4OVcGsm2ctVzUn4NEoRIvj7U4q/zosIkMTTOZq1mm9rY2IekY50FlpxTnPXTcv+zilaDgZjPtDj16MBTmHLwmpd7isvOJiyij1dgAMdvL8z9LrAMqj1zY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692130703; 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=Lo3i5N5BbKo6DP4yawS4oeiSuoKJHFlJGeBJBU9cGgc=; b=PzPNyyp0Bda0Rvvz8aD+Nfd6JBffSFqEX9B6O4zTXstdsBGTVht0s1pqREyqkhq6Lys4hIVy5n+MCKI/6DYZVw/tCnvK0xzAkywt21xROnfAMhM6h8y2Dac+jR0XZVxXWmD4yMY5/KWl6QUGp5oiHlkYoAXnENkK9XPd9kElDvE= 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 1692130703475528.5026879283221; Tue, 15 Aug 2023 13:18:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW0TA-0001kL-5w; Tue, 15 Aug 2023 16:16:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW0T8-0001iV-Cf for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:46 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW0T5-00059F-9H for qemu-devel@nongnu.org; Tue, 15 Aug 2023 16:16:46 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6bd0911c95dso5174845a34.3 for ; Tue, 15 Aug 2023 13:16:42 -0700 (PDT) Received: from grind.. (189-69-160-189.dial-up.telesp.net.br. [189.69.160.189]) by smtp.gmail.com with ESMTPSA id o14-20020a056870e80e00b001bb5b2a958csm6658203oan.23.2023.08.15.13.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 13:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692130602; x=1692735402; 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=Lo3i5N5BbKo6DP4yawS4oeiSuoKJHFlJGeBJBU9cGgc=; b=gmKq3fJjJzeUjvSGnsU7oCh34vwqmuckT9Bu3NFRHArW7gp6Qa+YSSq9ZmUCgWfzGN eZSpFB5MwI63HhQy5zQxzcRAS8HQX+gyQnFyt1Px+Hiod+fM7Hysac3PXuT5erkBS96L hZQsWG5NT3GGvZkRxnrJS4LjIr8nPVcsu7hNjZPEtMi8o2B663C+3/w2CHAAAsbN4oM3 ijgUVzWgrc8LAUEZTeyytfHlyjzjyqdl1Mwjg6ntE+vQwJn34AG4Ka/idV60X6eXUOS/ jYwT4nwg5z7CIQj+8zN0d04Cri/6F15jG5jXipx4e+0eiU/mjxSOjyTjTcHY8A2gnUCN zKRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692130602; x=1692735402; 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=Lo3i5N5BbKo6DP4yawS4oeiSuoKJHFlJGeBJBU9cGgc=; b=djt4pxb03sTqrcZSc/m+8QdRk9c3IdpEidYhSVJ/kJUo6+KtTu22lgbHDToaOd5CQn HX0ZW+CUBkZxYqmmGQjLWjdAvRnlJRcePVklyaPlUvaHbl7cJq5UqhsNSqy8iZA65CX0 9l0IGB7eFU5JgF9jz6DROLrC5BOSt0lRIUUbzSove+IHzGxAQLBZzOmUyEe0uPhMwINn KDcluwU/QZd0pPD5rh1eMM41roIAhgzYrpfbKE0IQR3DrCqs3xGCAtv0rXtY5/xs9YHt bE4J3n31mN5UkSTftSfwcMf04YtIf28iMMYI0g86NlUYM/5qPOMIR51tqUG0XNaEM86B wafw== X-Gm-Message-State: AOJu0YzAcYXwDMcn1CmNYXS+Xc9mUtpRG0pCQyXYF1YFNIfpNKhJVB6e wvVUn2BTacMKxQmr1nf0192qzsg9cuagv8Td3ds= X-Google-Smtp-Source: AGHT+IGXcxoL6ufyaRynV1T+E9EvKyBaUfKSUqnQcO2PsXCrtjamS4w9CNZZmBVjATPGvvEZb2EzEw== X-Received: by 2002:a05:6870:6091:b0:1bf:440:a055 with SMTP id t17-20020a056870609100b001bf0440a055mr12901224oae.4.1692130602032; Tue, 15 Aug 2023 13:16:42 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v7 12/12] target/riscv: deprecate the 'any' CPU type Date: Tue, 15 Aug 2023 17:15:59 -0300 Message-ID: <20230815201559.398643-13-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815201559.398643-1-dbarboza@ventanamicro.com> References: <20230815201559.398643-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692130705253100003 Content-Type: text/plain; charset="utf-8" The 'any' CPU type was introduced in commit dc5bd18fa5725 ("RISC-V CPU Core Definition"), being around since the beginning. It's not an easy CPU to use: it's undocumented and its name doesn't tell users much about what the CPU is supposed to bring. 'git log' doesn't help us either in knowing what was the original design of this CPU type. The closest we have is a comment from Alistair [1] where he recalls from memory that the 'any' CPU is supposed to behave like the newly added 'max' CPU. He also suggested that the 'any' CPU should be removed. The default CPUs are rv32 and rv64, so removing the 'any' CPU will have impact only on users that might have a script that uses '-cpu any'. And those users are better off using the default CPUs or the new 'max' CPU. We would love to just remove the code and be done with it, but one does not simply remove a feature in QEMU. We'll put the CPU in quarantine first, letting users know that we have the intent of removing it in the future. [1] https://lists.gnu.org/archive/html/qemu-devel/2023-07/msg02891.html Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- docs/about/deprecated.rst | 12 ++++++++++++ target/riscv/cpu.c | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 92a2bafd2b..4ced7427ac 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 reimplementation 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 592808939f..3930c85341 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1470,6 +1470,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