From nobody Fri May 17 03:54:47 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=1692139099; cv=none; d=zohomail.com; s=zohoarc; b=l5UCJPEWAHTZ83jLO03T4B6ZU4aDjBoeCX3gbIhOrc9aZvaAuQ5YZqp0/79Pt/tq/MgzNegTZ/oKPapcD9PkOxbLeKv+9Ck7G8uI0PgacMxpjIUh4V3tm7fHWbBILNLcW+08TB45NVgqmEsxsl6P68QeLKz1GDakLL3O2/phGec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139099; 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=EaDpy9ATWf2wKeHlYGDHFl0DDcpSCO0WhgOqpOHCmHrNncDrj1bv4qHuU4y3ilPOtQdQwl3mECwvAOwXWowGCxBX14lE0i8WIfKTQrM8ttsuS21jb5+XmuxB08JMde62Eb8IFi4V8jGKnMRnf+XiuVCdxVEUuTPs1xLQn9982ns= 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 1692139099211556.4042662397421; Tue, 15 Aug 2023 15:38:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2fm-0004p6-6w; Tue, 15 Aug 2023 18:37:58 -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 1qW2fj-0004oD-PA for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:37:55 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2fh-000643-8j for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:37:55 -0400 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3a76d882080so5003666b6e.2 for ; Tue, 15 Aug 2023 15:37:52 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139072; x=1692743872; 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=oXaHOCx8Lox9WSOUp0THx9W6I044tQwjJG4kPGB9ZKL0elGFJpGhwWPWEX4sPVBoXy 3CKlHPajJ9FyzDfhcVKG/1EMi+N7uj8xJq70/Kls9d87ocJECuVJnj+9oH8vcr2Y2n7q hPgqcyaV3M8WyCnc/Bqt8apRBSviCyNdxSWLMGmLNcjEpdxqF8EidxCieDrrdBIa3mkS beSq6G/FtTRL14XJHzMe6CznYuRPbOaqshQulPqnTpbu25cb8s3X7gdmkxBp+2j2dZqu JvtmGa6wvWRH6PEMt9UUPJewGqWT9TIllNNreCyb2jSqjnqkOfKdteKFXQN5M88o2JAS 0ZWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139072; x=1692743872; 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=StMTm0xRjMg515nHm3bTCdtjEUbzkTHrEd85hFr4e+T4BFJp/iQ+RPvxS9+qBzc/cz lR/EE+4o3jCJ2dgWK7SWnEdpN+glkzudZyMhv8bbRFnD7Z5G9SxV8bXNVLW944jBOzGZ hQ6643c/fRukVso+zyTPZnJFI551p4SS5GRj1Uxgl2KQhAUy46jw82GUchoBZwjNjOGr kuYGjuvPUPytNq+IfAtjCEd2fttdwKmh+W1dB2WOTbx3ke5yTSrD6T3CL7FabQ8QnTuZ SI1bkMgD7tGttaAh6MqYIXl2dWVHojnsXq+ao1xVby3S1ENNYBG9+dW8+5RtUsazNahr 8rZQ== X-Gm-Message-State: AOJu0YwJf6yElOaaMAE61ox3h/Bg1XGwsIMD0laMH2maJxDHsjh2bgiR YFUJPNNwOIiHwLB13xbw6w1um3FtjLfIdjSLBrE= X-Google-Smtp-Source: AGHT+IHa5BDubx02rYyu7jjbiYiugA6yvulQMJKXiSO+SZSjevZqTd8nAZuUggC0gTkJFXiIejxE5w== X-Received: by 2002:a05:6808:d48:b0:3a7:b3e7:54d1 with SMTP id w8-20020a0568080d4800b003a7b3e754d1mr34190oik.45.1692139071948; Tue, 15 Aug 2023 15:37:51 -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 v8 01/12] target/riscv/cpu.c: split CPU options from riscv_cpu_extensions[] Date: Tue, 15 Aug 2023 19:37:30 -0300 Message-ID: <20230815223741.433763-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-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::235; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x235.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: 1692139100432100005 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 May 17 03:54:47 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=1692139190; cv=none; d=zohomail.com; s=zohoarc; b=WHf9G7x6moxhJLxmOoVz2L8e+tSs4oxQmGzHl24U5+3sTneJOYzIxukX7zhC2xDArFtSAwTxYG2p86QlpufS4bbtD2ahqPCXifeCHmUAFukJUZC/JYlcoPXKeFQfaZvIhBZsOsRxnzf0EPndfAbHM2cARd7rRLIEpiGq1ANINSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139190; 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=P5eVVROlWyAIKomeRqrGmDAn8rBwEFQJe2/1Fxl2Yb9ac30ZrOEHdaOg40S7tEXKq6juDCggZdF2CVYdlfgb8J0YZJmDud2u27RAOehaC2/95x8Si+CtBJdXe6RiO63BTf9unyexEvoTHo46WyTb9N88AMYCVCzME6MCVdK4tbU= 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 1692139190881990.0564692471684; Tue, 15 Aug 2023 15:39:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2fp-0004pu-Ey; Tue, 15 Aug 2023 18:38:01 -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 1qW2fn-0004pG-3D for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:37:59 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2fk-00066b-L3 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:37:58 -0400 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3a80e665410so1484159b6e.2 for ; Tue, 15 Aug 2023 15:37:55 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139075; x=1692743875; 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=BXMjiSwsfjkLnabGqsDa05Sg+fR11HLaCewNOpy2OCkzCHpNab+0baHhI3kcclI997 EXyo+PY1KmiHA3+E7X/fk0snUnrFSglxsksCV52UYUvk5wiKkqu06MA31dkACo/pxuMY OY0exDPTCbKmdm2+suM0Y4DwnitIjrybIKaD4ZBbhbVTUg7nSCovN0XGNMv4n3z5ZvqZ b6ZloKJDx6HHHFD91fIUyYXJ3c/3suQsX9Dsm79tWgHO0rUUcQKQHorOo0NxkoRa7jIU NWNNnAdSYjzBcD4b5QikdUyR7fogsgWSqEOiIrdqT/rv9ipD13vTjglacUVRdUuIcJWq XeVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139075; x=1692743875; 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=Q2iPYBEaMtZtMs4ogyBL+TE1ElpQDKAxDGYxvnHJiF7LS8iQL5XbrSc2/AAG9rVqRG /6AZS3477I9DPG2jg0Sb1ipfZBEbyuguZn5+d6OdpOEkZnPXT07frM0H/45ePH4kBdhQ kyn2o7ibZ6KEqzlCmiO7F5wlY/v3YVzQkj4m6PUzLe6oPikXCAcoCxTGknODw0A13VHw LSUbz3yZatN+Ssbjwl0ydftmSVXsgGAOXZ/XaxO10HjnzGpSdAPkB1QBA6N1pjBVpyny N9tCdBR/85K3LGJsbjKWfUh/gFjIqzzmjISdp4t8NOIJL1/WzWuxJwP5oWmGjPoAh7TE hZtQ== X-Gm-Message-State: AOJu0YwyIpC2hbLt7ngrqpfaVyvqG292AqZXqDCwrZQS32G6npg1PI2K q69FBTL8Ax9zN5+QaPZEHQRSuGpPOnprrSOGBhM= X-Google-Smtp-Source: AGHT+IGAswS5ZX6imJDIPlqKJviOea6/cqfLthXLSK0V8wmgDNJrztK1OAxCSaYT6PDlKNAqemLKwg== X-Received: by 2002:a05:6808:1407:b0:3a7:96b4:cbe8 with SMTP id w7-20020a056808140700b003a796b4cbe8mr52906oiv.36.1692139074834; Tue, 15 Aug 2023 15:37:54 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 02/12] target/riscv/cpu.c: skip 'bool' check when filtering KVM props Date: Tue, 15 Aug 2023 19:37:31 -0300 Message-ID: <20230815223741.433763-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-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::235; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x235.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: 1692139192279100003 Content-Type: text/plain; charset="utf-8" After the introduction of riscv_cpu_options[] all properties in riscv_cpu_extensions[] are booleans. This check is now obsolete. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 9a3afc0482..f10d40733a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1907,17 +1907,11 @@ static void riscv_cpu_add_user_properties(Object *o= bj) * Set the default to disabled for every extension * unknown to KVM and error out if the user attempts * to enable any of them. - * - * We're giving a pass for non-bool properties since they're - * not related to the availability of extensions and can be - * safely ignored as is. */ - if (prop->info =3D=3D &qdev_prop_bool) { - object_property_add(obj, prop->name, "bool", - NULL, cpu_set_cfg_unavailable, - NULL, (void *)prop->name); - continue; - } + object_property_add(obj, prop->name, "bool", + NULL, cpu_set_cfg_unavailable, + NULL, (void *)prop->name); + continue; } #endif qdev_property_add_static(dev, prop); --=20 2.41.0 From nobody Fri May 17 03:54:47 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=1692139138; cv=none; d=zohomail.com; s=zohoarc; b=aMeGUdQ3YXzCxCheTXnH1ANA6fClacg0oP1+nKlx0uQqjNfys4JtGvtwIHCVh6FAVmMSqFQgekK/OYUBtOc1u8eLGnUy7OZ4yt1Vev6V9XNWj4MvC6Cce1dP6tuvCjxi71hrd6nCp7nQod86ahVBCHTQ0u2juX57vZydKXLl8H4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139138; 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=CBnWc40G4j1AbvND35Cr1EYsB73MHkm3H+SZi/tyNod0nHf0Ogi5cktrjsOREXjdbojUVMegdrjc0z1o3l+uWHslFgMSpdewTngxd7PQAYM/3zt2Kw1fKERR3G/KbKHX2SiwXHzf3Fa2vRNb7SO5gSxgeFS5kLcfVD0eParTI50= 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 1692139138261953.5885360688573; Tue, 15 Aug 2023 15:38:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2fs-0004qi-O3; Tue, 15 Aug 2023 18:38:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW2fq-0004q3-OR for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:02 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2fn-00067W-Bq for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:02 -0400 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3a7aedc57ffso4613691b6e.2 for ; Tue, 15 Aug 2023 15:37:58 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139078; x=1692743878; 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=LLEcLBfR4nYoIkaeN70AUS2oKQeb5NoUB22Wau3Lrcc02o7mGFG+a6KjluFf7Ifb/q y6CauNefmQ+u79fIiDg6WtT4ZQVzAXIGavuqWMX0/nQmO8RWKZxhrUI+RkKhvnzUBlT/ 1MvwwtTUWy94r4KAy2Z3UJfJcb0Ou+gNVKXQ0kZWVOLxPUqwyBtVUUnKLBJCPiQD6Y3y KuTsqw+yEfAbMpbjwsKx13Qp7GcpBP5orAvzm5CIkCjIjBymL3x0rh6jkln6SGq0itqy AnnMp3KjtdHMbD6S55HBf/JommymXyLGomC2hYe7UG15KSSZc2kq44n72NtI59JdVOHS sZEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139078; x=1692743878; 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=IuJf1UUEUqoS/VfWsCZe51gctFR9Kztqt/2vi3Y1MTgkilE3NJu5buJZtiBFsnZy9o MDg0M5Ng82GOvgmOsLgyb4kPOVgCoz+pvf4KPJi5dwHwEOjSreTigCYFi/QSZclc9aJF y350Gh+eJOzWo4eY0UYDXzX9lvwzK9L7CemzUYBGglHjU1ZyIvF3IubXv+SI4rCNtDE1 3CtNOpel3K/6R9c8u+Yp1eY6tbP+6UrygRrdwxPjukxQUl5MZOO+V69BWnb1t8K4wYyF b4uugyjjrXftiXzeCUNijpBzEyVIS3ywqW1ZcTP+v8KqvpKnTQy0meebciLQFP/Y4OqD aPrg== X-Gm-Message-State: AOJu0YxvVB5J6Hxodrvcna6tw+NxAfFmGPUYCkS8u/yhzabe00+eJIYd RpQTh02kN9uep66MXDnS7TyeVAyuNM4KyQVtyeM= X-Google-Smtp-Source: AGHT+IGc0Xhb3RIqACyDhf4xBdspDRJECTbPkQKhsUngL0xFxlhyZj2r9LjXdqzPgPvAun9/VIFIfQ== X-Received: by 2002:a05:6808:209a:b0:3a7:b5ea:f5e5 with SMTP id s26-20020a056808209a00b003a7b5eaf5e5mr93572oiw.10.1692139077847; Tue, 15 Aug 2023 15:37:57 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 03/12] target/riscv/cpu.c: split kvm prop handling to its own helper Date: Tue, 15 Aug 2023 19:37:32 -0300 Message-ID: <20230815223741.433763-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-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::235; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x235.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: 1692139140126100003 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 May 17 03:54:47 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=1692139099; cv=none; d=zohomail.com; s=zohoarc; b=awaC+f9Iqf8Kdw79rhpc1ERJU+IBcRdEiW9IYiypZcZBSkI4aEzXM2tu2BBDwajNptdH88TxpLnLSfMf66rznZNn5JPzVlTgtdNGRavuz1KNJMvG/feLzpB8C6oNqR8gLUV5Gv327kI3KC1dSaUnCXmOrMPsstXBO7/mj5yQto4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139099; 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=cCntIDept8BL79LNideYqzvTt8bzrPjJqf81zKeH4DPYb+qtknvYn0vpJM/cWgEM5TAMVG4uq5zVjthcHCw5psmHfUnldmVXEhh80fDQkC1Z0BxkVjJkqzVN6GajV7fWaghro0cA6N4WuFKqshbbUOBpvwn4kklQkJ+XpD7RDTs= 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 1692139099515634.8726370579136; Tue, 15 Aug 2023 15:38:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2fx-0004sA-G0; Tue, 15 Aug 2023 18:38:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW2fv-0004rB-5J for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:07 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2fs-00068s-Do for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:06 -0400 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3a7d4030621so3131396b6e.3 for ; Tue, 15 Aug 2023 15:38:02 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139081; x=1692743881; 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=etRYTNo6ZNvTMMyD6TnsjvDlFmqc1imXyRw7ss/EzsStmAJjhAZBLEXio3YZjQQR0u AVbFeW/yZLZpjqfrOQH+5IpWin5abSTAKQrAkjWojI3/MfrxvN7iUOmwZFUUGYF3Rxoy AyMW9hlKNTO8Ume0wICttiwoNJkMwN+s8MAU+j+4PaFYkAUKymk+/9rGKwBBwhEDRtv5 JD+sVqtaxRaozr8ZHgWD2pNGD6sTPQeTU4io1MPFQOlEx6NihH1P6TtUSu76neOvaeAm vGbaJ9mRhWGrPvk51JqBiTC8BsojU/Zaw5CKfZFOtlU4GcMNB64XWXZlefAKx2T7naMS n/vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139081; x=1692743881; 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=M7f36BecFG+zOKEWPOhrKv0rzEG2484raWPPcHXrDP1g1H16IX7KpCYIxXesufzGOL kQvUc1eLsDz5qPxLdRhs8LMv1FmWwnJoXspMXwiGjHJUOPe2HbdP1nlSrlVEy5VFsYaf ZUtGW74bRfh7yfNgTqnvLuu4OdjQ5lj/dI850bJsKGcNkXzZQLNTo/sWsG/gtjO2744m dDOe03S765ExEnjz3PyQ/lhlyP/PSmgizqaRNmNB8QAlNu12d6AQCIr3vO2Y16c30j6u jie/qeupHYPGtiFFK1zlRSps/Q80cxMkFdD+cEjW8EJ61EEYILq7POeVv3T1dkImCvHv 2kWA== X-Gm-Message-State: AOJu0YzqWBWRqjVrsj1r7pE0h3klm4nZ0lHcFtkfv+hJm4SFlm5FzP5n P1TualjG5CqM+wWyaA4GVuIMybXHtpU1SOoUnUw= X-Google-Smtp-Source: AGHT+IEG8WCGlgqzaxt+CRtAEj5n1az60J0tGeV0JUcWCLVcHeQLjdrIQBrN/HKu+D1Es336D9s7MQ== X-Received: by 2002:aca:6508:0:b0:3a3:4314:8dc0 with SMTP id m8-20020aca6508000000b003a343148dc0mr51347oim.5.1692139080853; Tue, 15 Aug 2023 15:38:00 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 04/12] target/riscv: add DEFINE_PROP_END_OF_LIST() to riscv_cpu_options[] Date: Tue, 15 Aug 2023 19:37:33 -0300 Message-ID: <20230815223741.433763-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692139100356100003 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 May 17 03:54:47 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=1692139180; cv=none; d=zohomail.com; s=zohoarc; b=DL0f+k08DbIGYDyCpbopxVTkWQkP21ABO3MDlJXHrViZ+yM6U+njK2mX/6LvOr9UbpCD7REOG/WT8VTXeMqsFRNzNT0hiAoMZqmEWDmudeaQ6Jhm4bPw2U6n2tiG5dTwDTeJ3cLE9Xro5Yar9mzjk+5pIIE+kH3yLkDMSxQGSNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139180; 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=IZRWolWTOVZvq/590BFYCP71w0gbvoOxW5/bEmipeDkoCrG03Gl9HiaqScroj1YKoWrvapVPR07ROGOsq9cJnemBOjlgpmGLIWgT3F3iHygL/DPrguLRLbMtULkvawjb7XE5CE59Z3u1w+UEJ7NtIsYNr5gxCmBrS8AyadySS3U= 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 1692139180886616.336929868405; Tue, 15 Aug 2023 15:39:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2fz-0004tj-DW; Tue, 15 Aug 2023 18:38:11 -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 1qW2fw-0004rd-DT for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:08 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2ft-00069R-FZ for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:08 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3a76d882080so5003794b6e.2 for ; Tue, 15 Aug 2023 15:38:04 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139084; x=1692743884; 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=OWwBFBHb9uvgW1CGBY99jpoWPpvfFItSXTsKumvsz+BXOy23PXhgMPL19AetQvYie7 QGigy0kT7N5IE7l/kmZtLW5Z044tx815mcS4fL3KhP0huo1/pdRYJ0sQIKEKV4KUCJqu Ew4h/PNndtDES75AY9yyKKof46UJMPvSogde/t/5wHcs2QvzbGesODQC24bCgSoHLJty JW4KAmOZ2TEGv0pot29nqLq1Fs/IM2K6jlYOm0S8K2OxveUmYdasc3flimTZqzuFmWWL gJHRFnFuOIULGtH6f4wtI75gHmk7DXc4XRydyKSQlxIZVkCGYIw/i4nngqv9kr758gXy M02Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139084; x=1692743884; 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=l7n7CMjVnEHtZWxdeA5HI5ftn0/bCncX9nqckeG681gpRUux7DLfXDSzHLdpr9ET14 rYf1t/GVO05eF4LyZ8oDFQFHclqWdICtr0Zga9YxRnfXKuwW3/oVKQJiJiFhaIOET60G O+p5d2zXAtP9YKuZYdYi64Ls14i5dT6DtWKrl6KWHHrvKuhLtV3kZxBdGzdMV9Trey9u TPQry2Q4hNwMCsIsoeKLFYLH5r3ErEsTCvxikLCE2cv5KmsanVKh7kclgZxxagTyWDSP 0iX8YRGde9YgkFudCgY8HHIcsa3NK6bOPTjxf65ulHvPKlBmLdTEhXTFIIdl0Di/F/9t iuOw== X-Gm-Message-State: AOJu0YykBHoO/FkI9225rFmXTFsG0d3xtiXHmqvsPGumKDHureI68qkW aFU0o1B+hlnxXvxGTLTRhlIffvkTcnxEnlgfXBg= X-Google-Smtp-Source: AGHT+IE4arw4G0a2PJRzCL3mia+ypnQsHXfkh6T/VGuYXWogJQYdjGP/jn6a1BXmHfu1osDjOIgmXQ== X-Received: by 2002:a05:6808:1393:b0:3a7:e6fb:c8a9 with SMTP id c19-20020a056808139300b003a7e6fbc8a9mr71830oiw.8.1692139083946; Tue, 15 Aug 2023 15:38:03 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 05/12] target/riscv/cpu.c: split vendor exts from riscv_cpu_extensions[] Date: Tue, 15 Aug 2023 19:37:34 -0300 Message-ID: <20230815223741.433763-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-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::231; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x231.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: 1692139182248100003 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 May 17 03:54:47 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=1692139202; cv=none; d=zohomail.com; s=zohoarc; b=HNOGLPkZN7b6KT39n63HssAZVmFrUM0S9Brtn9Jkh/mdQz1coHYceAXQSeLB24jAMMSLs+TWSh9rzWPQd2p3Ts/fwf1O9gRMHTAm/gbQyuw0ZzWfbO8CurMhQ2PJqm1/unSTWKTYenQIGTcRw66rDgZO61v1PImTPdDo4FeCZq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139202; 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=dM1w+xol9uFHmI44xgxVysC8AOVjog2Gr34lAbVD0TQW3sTn4BZ9uNWCsvDw0DNL2c5s/IXE7//PJ0BSRFgB2TsY2y7MNrPriRNXbJwhCO/O9KasVKjy1pA6bd800aYMM15tYO2JM2gFcn6aQ/uaUsFPAmnT+YzQagslKQYqZBc= 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 1692139202378536.1173841853719; Tue, 15 Aug 2023 15:40:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2g1-0004vj-JV; Tue, 15 Aug 2023 18:38:13 -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 1qW2fz-0004to-E0 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:11 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2fw-0006Bc-Dp for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:11 -0400 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3a5ad44dc5aso4993336b6e.3 for ; Tue, 15 Aug 2023 15:38:07 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139086; x=1692743886; 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=TGxtVyZnj3KbmA/V3RlQfebFZbFd7OVQ4SGZsWK9zQ/UMMFBBYRcf1Dudpu8blwb+a LAfQN5eTBH9b9Ab/VXQOap0QpYUAvd9EJ4hYqszufNxDIjDsgu0enMTXM3uDOu3IvV1G V10tHiGZpzhVkPvWsEbmNjaMSQxnduCpYlPpELHiQpjYCDAULgUD+fbfo9UPAC3gwGYt SZjy36xn9gsiYUlfdQBb6WFe8AtvboASGYkGPW2pOrtXCeX4jcFqJclRWdN6eMuD07aZ aLMKigCuCUPJenqzbe9BswtSbTUapChpgWZbK14a997BKkUF3TDbvL5gj34vxcinboKY tKUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139086; x=1692743886; 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=XDQmJsSAwmlsSiF28F/XkDJrFlY1c42nmwIP9s55sEAue9w+ZatQD5n96MXwmZJGnF R0/KUwRSbdkqeL/PQ8BHEi/HuddryWG+X9kNv3TDBYFa7GlXyATxnwKVB1OD4r45DvN3 OhMhliHNPTerSnKxtZytTlGKjIC6Wyl3MpBT38N/3LuTLSOQ7N54ixaQviEOhsVLJXDS r3YPT4MpZIvgMRe5Pmh7xY+REiiCYtVXhdUjKk11UUcYx9w/Y+FyOoSVEzPGdFKY+fl6 /sU5t1SjBpl0VcjaXsYsjnPwTOcnQ1sDrCjXC3c7/2XBMkFU+Oa69+8BwzGEn3XdzOSG 0IuA== X-Gm-Message-State: AOJu0Yzjm9vuyc5Ej0IMcnGIYIiovGwTjg/7KAsKra4bhjsCgpvQJMWd ci+A9s6DLLl8uDw8sU5LhMBNXGCQ/JbykfoIogQ= X-Google-Smtp-Source: AGHT+IFxVsBy0eWzcPZL+lSToCDaogS9qAMSInEQNEdexRpmMeSXHMAdI8QaPUEdti2h74C76FBEAg== X-Received: by 2002:a05:6808:159:b0:3a7:a379:63a with SMTP id h25-20020a056808015900b003a7a379063amr44791oie.41.1692139086806; Tue, 15 Aug 2023 15:38:06 -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 v8 06/12] target/riscv/cpu.c: split non-ratified exts from riscv_cpu_extensions[] Date: Tue, 15 Aug 2023 19:37:35 -0300 Message-ID: <20230815223741.433763-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692139203224100001 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 May 17 03:54:47 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=1692139166; cv=none; d=zohomail.com; s=zohoarc; b=a5Tzl/0Qwiih9T5nrjhJlhZmBRY42ItgdvzQ+JQTTnnOYGiD17BOiOy05E7OXjeQsPTdqUyKNO7PWo618HB+Y9ZwSce5ki+Q5jJ0o7MTbyIZzrxSbnC9gJ7RpaoKN2NTZnu6/UKRh0G6R5LlEcFQ7pwn1mDx+ULsHzA7QLtb/SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139166; 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=Ijcnw0rMIsKYXNXEvhEuvRumM2r6rsE7c0XzS7gCaHg=; b=nBkFSlhncXobOJ2buUHo11RsvRhaZ+BOD3zSbGbki0qCNCVAl1MMQ93smCy6PhlKtuJjoCrHEOsfFlhmYU8RjwDFhLGEyr0l5HyAEQELoGCvVxX6etIv2qktK6qmyWJ72bS+kh8jd9mgRaWRk/rKpJ7RTV4yzI2h1TPi201Atn8= 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 1692139166450481.71018412091826; Tue, 15 Aug 2023 15:39:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2g3-0004wK-KU; Tue, 15 Aug 2023 18:38:15 -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 1qW2g2-0004w6-GV for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:14 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2fz-0006Er-Kw for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:13 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a7a180c3faso4805514b6e.2 for ; Tue, 15 Aug 2023 15:38:11 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139089; x=1692743889; 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=Ijcnw0rMIsKYXNXEvhEuvRumM2r6rsE7c0XzS7gCaHg=; b=DtVGE+mLabqVmDycHoVn79gzSgGqukBsAts6o+ue4DjGcJM1Z4AkYf16WvrZ/ws7Z4 xMhkqSpkF1X/DLw1SlHBdU1x7Qlxsm8/11qV//93rxsh+VwVKTFgsiICO3UB/9e/Lb4H Xw5MSwgRKNEshSEssHkLUA4dexxDrtXZpg5BXN7U/UKTnEWrT1w+BFgnZxluIU9fXpGa kS5nvphlEXSUUA5l+ZL5U2sbigm0rbac2KNnmbad9xRY9zhrLDBsyenylXVFUKoHHM8r 7JbQGuAsG2q4QhIsIv7atBHQHggQFizLOeFTd4ACni+5+QGPZhmREXBhtE22xLgfjMpV 75zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139089; x=1692743889; 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=Ijcnw0rMIsKYXNXEvhEuvRumM2r6rsE7c0XzS7gCaHg=; b=IbVsTjg5hp8lCF8XpIh8OfboUEX+ZV+WdlvFod2rRFuys8qzHPDL4Y+zHUQ38l6jHE vpFKRrLZVoKjTJ5hU+9lTExb31g1MIW+Fmkv66CCpTw+fLdsYyLpkGfv4IJFyCk/ZrEZ Lvfv7n5agcZOwuBbEYSCOVri6gMZ+frcF2Nm1udMMLTifP6QLbgttKkTpKF1z1kXA718 eILQoJbniiJZMWMbryjiYj92vPht6i85rYUm1/O8jy4qtq5PVtWvkkEc6EjxXr9j/7pH tWNNF8UbtChvzLoShattrD8857nc0QlkE8rKdvWoNoN58g2eK0ysNSmeu1iwLeDCB255 pqIQ== X-Gm-Message-State: AOJu0YwvF6ohxGZ+j3lZshVei6mqYZrHm8zrie1QMMXxWNJeNC2emcIQ 0mbDjCYtYQOv6b4uxgfNTZixEWhVqI98aqGD5wU= X-Google-Smtp-Source: AGHT+IFbdTJ27FOLUrzs9ga7Qp9PZL1hC79zrqiuWxsD+ATyuOthaStDJdKK+XJ4XjSl4LfBpVFvuQ== X-Received: by 2002:a05:6808:11c5:b0:3a4:317d:eb7c with SMTP id p5-20020a05680811c500b003a4317deb7cmr116747oiv.0.1692139089645; Tue, 15 Aug 2023 15:38:09 -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 v8 07/12] target/riscv/cpu.c: add riscv_cpu_add_qdev_prop_array() Date: Tue, 15 Aug 2023 19:37:36 -0300 Message-ID: <20230815223741.433763-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692139166783100001 Content-Type: text/plain; charset="utf-8" The code inside riscv_cpu_add_user_properties() became quite repetitive after recent changes. Add a helper to hide the repetition away. Signed-off-by: Daniel Henrique Barboza --- 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..a0c14d1a0c 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 +static void riscv_cpu_add_qdev_prop_array(DeviceState *dev, Property *arra= y) +{ + for (Property *prop =3D array; prop && prop->name; prop++) { + qdev_property_add_static(dev, prop); + } +} + #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); - } + riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_extensions); + riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_options); + riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_vendor_exts); + riscv_cpu_add_qdev_prop_array(dev, riscv_cpu_experimental_exts); } =20 static Property riscv_cpu_properties[] =3D { --=20 2.41.0 From nobody Fri May 17 03:54:47 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=1692139160; cv=none; d=zohomail.com; s=zohoarc; b=Q1LxA1RwWi+jusOepZJDhpuzBkX8n04O4NtmItKVyturyv5i/6HB5+Meo5eP4eyTfTvY0/bed1Zt1y/De9Jjitv4lwih1z5NBWw9pu9A7GZIPedeHgYjKJdTfgqdvo+hEo7Mdn4LI13rjhHObyju/HLs7G6PwU72L1xaf9+UQhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139160; 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=SBT3xPmW4aLd290yWQMEvBlcruF1kLAk2oFCE88UVBQ=; b=VbmE9mEMx+eQljoJ4nicazfO9avxo+f0Dt+p/CYFWiPaFHOfJT5WYaBIsVLLPQ2Gfp+YIBGsj+oyWPkUUf0jhvKnG1kpp822c8jeIBlfzfePHMHDqOb5N3jCb9DlENKrdsTwj5w2EIiqZhw8lXVc+oVQMd8UugmBgiwp4qd9b18= 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 1692139160797316.56481733004375; Tue, 15 Aug 2023 15:39:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2g8-00054X-GP; Tue, 15 Aug 2023 18:38:20 -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 1qW2g6-00050v-VF for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:18 -0400 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2g3-0006FY-QB for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:18 -0400 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3a7f74134e7so2331866b6e.1 for ; Tue, 15 Aug 2023 15:38:13 -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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139092; x=1692743892; 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=SBT3xPmW4aLd290yWQMEvBlcruF1kLAk2oFCE88UVBQ=; b=nso7y5GY/rZYBgLZTkjBR1EQW/uSFZwnLy2mL1Ebs+XVojAXg4/VdYknWjNzxKhGmQ HdIZ41VtgSFnmLKGed6LKC5hZWbpSwhx1UAnN3Kdc23F5RpMMTblVqaN6sye2mY6C/qO OQgApCb5JNLCfQz7PQBQ6datA1gDVOw4lY0Jdy34oO3+1unXgxD24qs8e6bGrtuu3nsk bwak86G/tGROH5OJvKpN7Fd23pvuhLq2CgYcOgqLzcrJDInTwGAUPJyMcb+ejFn/bBZl 9PtEOYeiTlirZLAZoMG4g8eW+0M8pI4dx2AfBVkFcvPhfL7XvLz1ZLmlclw6+LWtDFUY C7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139092; x=1692743892; 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=SBT3xPmW4aLd290yWQMEvBlcruF1kLAk2oFCE88UVBQ=; b=DbMJkcZqPY/dw1SUFV+G+UsOrddLx6c1hkOXFJUQ5zNpv1LcZKwlyCqRDLm5IiyMzq Rlt9y0Mq773awIecuVide+isbsp16cXJbUFFoYUTFF7nAX9tK5fcbaJ2MJoaIKiqpyiN X1Yis8GR3nSPWfF8VWkGU5pWjwoYRlZoRKwWpZR+oqwPi+UdifqwiMwA2LksyQUogGNq GoMZUdnG7wGvcrLRhezrUOtMjhlWqfHIXcIZu22FiWJV/bKW1axwYfaTrxlv9ztHWj5B MBBJNkoEukJ/OjK3ZiLioeVj1mecsUzZ0gYYiLTgRdOSvqSrHd9ws+i724h58M5JMYUo UzKg== X-Gm-Message-State: AOJu0YziPQnrtBVseWjUsroSxQaFFAhlaCYMSxY/Vy5yScC3wE+WQ7xe 6TzlQwk/vkXeKvoX/1CIgfgUTUfEIrKSOk3c4iE= X-Google-Smtp-Source: AGHT+IEFOYm/eojdn+ocGQ9ZgNpyBHFlBhWh1I/ym4wWuGtNw9qz4afzVSprMP700cXWg+fqPH3ntA== X-Received: by 2002:a05:6808:bd2:b0:3a7:44a1:512c with SMTP id o18-20020a0568080bd200b003a744a1512cmr69382oik.5.1692139092784; Tue, 15 Aug 2023 15:38:12 -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 v8 08/12] target/riscv/cpu.c: add riscv_cpu_add_kvm_unavail_prop_array() Date: Tue, 15 Aug 2023 19:37:37 -0300 Message-ID: <20230815223741.433763-9-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692139162192100002 Content-Type: text/plain; charset="utf-8" Use a helper in riscv_cpu_add_kvm_properties() to eliminate some of its code repetition. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index a0c14d1a0c..3636cfaf2f 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1908,6 +1908,14 @@ static void riscv_cpu_add_kvm_unavail_prop(Object *o= bj, const char *prop_name) NULL, (void *)prop_name); } =20 +static void riscv_cpu_add_kvm_unavail_prop_array(Object *obj, + Property *array) +{ + for (Property *prop =3D array; prop && prop->name; prop++) { + riscv_cpu_add_kvm_unavail_prop(obj, prop->name); + } +} + static void riscv_cpu_add_kvm_properties(Object *obj) { Property *prop; @@ -1916,17 +1924,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); - } + riscv_cpu_add_kvm_unavail_prop_array(obj, riscv_cpu_extensions); + riscv_cpu_add_kvm_unavail_prop_array(obj, riscv_cpu_vendor_exts); + riscv_cpu_add_kvm_unavail_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 May 17 03:54:47 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=1692139199; cv=none; d=zohomail.com; s=zohoarc; b=ZiHaykn0qxFgFpVsMBTTyIpNMCZyiLCpgiCcnWQspr0+OoBnErRa+WZjPbeUpS1OoH65DKd0ftJtBl9cs7iWG99cHHlyxy8cpolmaP6a67I8Z7k4Dc8youBSk8OgxE7Urjt2eheL+M4jPT5Cch1S7wu9rxUmvSWEB+xMHtL1I7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139199; 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=jdvtnTfpm5nlHaJOuQRLHTGZ2dN8WukD/+/ZCb/h8bk=; b=a0nTciyl83hLXVRRn5sGoqJCm8RUXT/RGtvn0sBKDElCNdxdFKpdLmz6wbWEBFIaKTrEHWMdqZUZG1r3Cha1iMeNTYR4NLYvkrPnE8DIFhyk+tEXlVs5h8lKc8+eQUbREpQ4cRFVzeWrvuMn/9YZiDoapPSuH4nIOTmVie4anQg= 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 1692139198998794.7862181455474; Tue, 15 Aug 2023 15:39:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2gI-00055W-Jd; Tue, 15 Aug 2023 18:38:32 -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 1qW2g8-00054h-OI for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:20 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2g6-0006GJ-4z for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:20 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-56dd683e9b3so3066652eaf.3 for ; Tue, 15 Aug 2023 15:38: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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139095; x=1692743895; 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=jdvtnTfpm5nlHaJOuQRLHTGZ2dN8WukD/+/ZCb/h8bk=; b=nysIkfgAJ+c+RU/yye69SKouRfhPiOBKcF3ow0KYT+8Y9oQ1vSuQccarCwLgIRQAHA ZCjkRMQVxSCEtsRPaYXcbCb3SOXjuqiSCQIn1oDkwNGJZGLH+I4zvXb0fAX5re/wS5ER D87Tad8/bZbGxUiZicuSsd6YhMcDvpF7bwacXyBc/l8cY4+ySsgcJDXzUdFhR8v5DyLU ezgHueFs0PHlKc3rWenFVn+/KofqiDf+aqnn++hFGuMbwsOm/5qTRYjWojAapqOgXKi9 z2wa7JMViQqL3deg8foTJyFXRKTUbrT8Ryv7kjMZNyeBZhReswi8jXKfpAIlBeVAj+eA W08A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139095; x=1692743895; 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=jdvtnTfpm5nlHaJOuQRLHTGZ2dN8WukD/+/ZCb/h8bk=; b=ekO5ltW3CTXvrlpEIGuEZtq1Vd2Blr9JB9JP7kGnQGzH7DtwYTwLEqStmIZp+37Hsn sNS74hTW9x8J56QZA0qChzzSx/QSjVv+Rqdy75duFIVEO/RHhWSZ6hHYFgBZvBZldiK2 QQ4tWoUeVXzbwbvs7xT+0Dw2l/2cX2MfULLmUOZC1frkBikua9DmNG4fd9+Hf8RtPdmW TXq031p0gIFoQl1X8CmJE/8CeyLXsx4APD42GKiN/vR4m060bfxwq7MW1RDT8H5PeaTZ tAWotmVdXZDai1ZRM1AR88VC+/Czu9SumZAYiwCTJLmjSmExXx+KyIPLXxf8DJ8K06Ir jySA== X-Gm-Message-State: AOJu0YzglZSaK/jd8nTBDSugNKLRULTzzvk1brhWDRJHUNZRaihbO+VF j6DGRQtZsmxvEDb1/HeZ8nayXVDDhMT9PnI+Ozs= X-Google-Smtp-Source: AGHT+IFbnD4n36W2w4aTkcC5DO5q5KgDxflExOn6OwDXbUz/yn+yX/JmYXq0mceArGyFrYQR7hYSBQ== X-Received: by 2002:a05:6808:2809:b0:3a7:5453:a622 with SMTP id et9-20020a056808280900b003a75453a622mr46222oib.17.1692139095602; Tue, 15 Aug 2023 15:38:15 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 09/12] target/riscv/cpu.c: limit cfg->vext_spec log message Date: Tue, 15 Aug 2023 19:37:38 -0300 Message-ID: <20230815223741.433763-10-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-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::c34; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc34.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: 1692139200359100001 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 3636cfaf2f..eb5fe93030 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 May 17 03:54:47 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=1692139149; cv=none; d=zohomail.com; s=zohoarc; b=PxgbA5ov5ti8s9UrmpnycgcZUuqSQAOdUYAcD10Rx3Zvs/ecJ99L7g7To0E5gbirFEdFHar+Y2oMPFw5FyydKup4TGPq0KI33MyJ3wOxS6nfzjKJevi3Vg44jNIGr6wDGz2w0dfj7SKx+xmp7Jp7qPCZp/1JAbtaCwgYInqulbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139149; 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=F0m0U3CwyMqA7c8h8MiNjHPBNyyKu0YsOLLOxEO+RzE=; b=UJJ5H/obxe+8u+zm1xAWGb2+P2Q0S9zEMp3IjxtTrPGxCEbodQMJ4mT5R/lekREIH5co7LqR0DoNwnRGv6c0WbEsCBbwSs2gcckpfK3WFAJMfigdvMdKI6X+LT2oRKpZFB6n8ILPseTe3oVggwkcy+O1qu6G/hsa8p5WP2L/6Xk= 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 1692139149301823.9571533868792; Tue, 15 Aug 2023 15:39:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2gT-0005JG-FF; Tue, 15 Aug 2023 18:38:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW2gE-00058k-B8 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:29 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2g8-0006Hu-Ea for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:23 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a7e68f4214so3653033b6e.1 for ; Tue, 15 Aug 2023 15:38: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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139098; x=1692743898; 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=F0m0U3CwyMqA7c8h8MiNjHPBNyyKu0YsOLLOxEO+RzE=; b=ov6fOhzW9LYdB1n1xoGIi0t2wmTxrIeOklo1PhyXfw2Ez6cn0Y9Ips7wXkCmHcZ+LE ofIhKg4Dd9claZ5qabdX0KcnDKYsG32Mrklc3He1mHiGhA0p7AFyohZ57JisdIfvCFjs 6BW/5aU0AJJ/oaBFLhu4KLPOAU00/0u04Fb1vu2v6jOTXwGuvrk00vk5t7unSwFRa7V9 5VAQV7S7OFeySZT/hAbaNT36OPlCXOkZ4I35gsFpLeSMYQDPtVj0wJPJZEGI93o7Ow2O CyNB6m11NmbKuW61YQpYLroIWm80oiDWlUT+nKO8Dw9C8OVmVD31EnTvfvgmCAdTQBsl 3trA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139098; x=1692743898; 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=F0m0U3CwyMqA7c8h8MiNjHPBNyyKu0YsOLLOxEO+RzE=; b=k/iIUabb0s6hDjpH42FQIw3TOkDB9lP5j2q+tkJ1gbBqAQLj028NMq/IWxoYw/e+tM 6Uusru9htrr8nagsAOrwREr6xW+Ue2469Ljw79NhubAxjyQmhBNWlEVc0tbK2ze1V6Uq fUJODsvo/kniDgNH4ckOam27LLE4Ou6AGd7NqbW0EFXRPZ7zCYhCANbsjtukSRnArf1S NkVcWKEo4GjmNhARbhZe+8/SFbG8nIx/t9sI6CfXejJcMUE73ckN+RAUzR4KJk6+nJVT FIpYAVAb2D3YRrKasjKrZ4O+YQnMar88l8snbrmLVEcHYpBSZ7ugKC+7IbxpzD++lJvz OdIQ== X-Gm-Message-State: AOJu0Yy67iIIgtpbaLaj6J3i2aCWSPJ1x2S1ZygeDUsM2b9SSaqusQli JNvLEb62miqsuC0tPynO+Rq/qCNpFWMYJ5uGdHY= X-Google-Smtp-Source: AGHT+IExFs1aLvD6bdwaC6hyo8QtP8IiUvyXK7viOEpofp0MewtzOlcIZGYnPwl0ONUiBhDgXRhzHA== X-Received: by 2002:a05:6808:f10:b0:3a7:4a89:7531 with SMTP id m16-20020a0568080f1000b003a74a897531mr77810oiw.10.1692139098454; Tue, 15 Aug 2023 15:38:18 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH v8 10/12] target/riscv: add 'max' CPU type Date: Tue, 15 Aug 2023 19:37:39 -0300 Message-ID: <20230815223741.433763-11-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692139150791100001 Content-Type: text/plain; charset="utf-8" The 'max' CPU type is used by tooling to determine what's the most capable CPU a current QEMU version implements. Other archs such as ARM implements this type. Let's add it to RISC-V. What we consider "most capable CPU" in this context are related to ratified, non-vendor extensions. This means that we want the 'max' CPU to enable all (possible) ratified extensions by default. The reasoning behind this design is (1) vendor extensions can conflict with each other and we won't play favorities deciding which one is default or not and (2) non-ratified extensions are always prone to changes, not being stable enough to be enabled by default. All this said, we're still not able to enable all ratified extensions due to conflicts between them. Zfinx and all its dependencies aren't enabled because of a conflict with RVF. zce, zcmp and zcmt are also disabled due to RVD conflicts. When running with 64 bits we're also disabling zcf. MISA bits RVG, RVJ and RVV are also being set manually since they're default disabled. This is the resulting 'riscv,isa' DT for this new CPU: rv64imafdcvh_zicbom_zicboz_zicsr_zifencei_zihintpause_zawrs_zfa_ zfh_zfhmin_zca_zcb_zcd_zba_zbb_zbc_zbkb_zbkc_zbkx_zbs_zk_zkn_zknd_ zkne_zknh_zkr_zks_zksed_zksh_zkt_zve32f_zve64f_zve64d_ smstateen_sscofpmf_sstc_svadu_svinval_svnapot_svpbmt Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index 04af50983e..f3fbe37a2c 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -30,6 +30,7 @@ #define CPU_RESOLVING_TYPE TYPE_RISCV_CPU =20 #define TYPE_RISCV_CPU_ANY RISCV_CPU_TYPE_NAME("any") +#define TYPE_RISCV_CPU_MAX RISCV_CPU_TYPE_NAME("max") #define TYPE_RISCV_CPU_BASE32 RISCV_CPU_TYPE_NAME("rv32") #define TYPE_RISCV_CPU_BASE64 RISCV_CPU_TYPE_NAME("rv64") #define TYPE_RISCV_CPU_BASE128 RISCV_CPU_TYPE_NAME("x-rv128") diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index eb5fe93030..326b016723 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) { @@ -1964,6 +1984,41 @@ static void riscv_cpu_add_user_properties(Object *ob= j) riscv_cpu_add_qdev_prop_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 @@ -2302,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 May 17 03:54:47 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=1692139161; cv=none; d=zohomail.com; s=zohoarc; b=Gx+ad70eni+1L1TOhq7OU41T3ZQ5O0d9xgeAxdlybDr76IV877u4o6I8ViLpNnufe02LxoEzDiuUtKfPJhvvn0UEIJbN4qEQsqqU1gTeyHh3Qw0X/AFyyeH55Ft1VFcLlVM+Xn+CtcNZarcir0dHerkEA310uTIAFBgN3oy29Y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139161; 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=AFz35c42aWFKMFpPR+j81v47x2qKqH5KSQ0+ZgEkmmSrLj3uFKKlhBEbdCX9eLrQWIJsJw0dfXUXlreEGyIccQLPy5WJd3iJgZvQd5NMEfrsOOK4ZXBLYZwlFgrRCbjthTVGTedlJ5uOSSH7xCjExCu4L1UFROGCf0mDBjGyhAk= 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 1692139161282321.51557515695094; Tue, 15 Aug 2023 15:39:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2gT-0005KM-Ge; Tue, 15 Aug 2023 18:38:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qW2gH-0005AJ-5m for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:31 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2gC-0006K3-0u for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:27 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a81437be28so903083b6e.0 for ; Tue, 15 Aug 2023 15:38: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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139101; x=1692743901; 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=M4UOeNlv5GieXNvhJRpvbH6ZW6aDS0epwrw7dPfq1ldFUy7Fv3wCGJmsqIZbd/5yQH wXT2ZS2NGvc77Bf+zuwzHzv8r4ESVQlehtwj2hp4miIwbhGLxJdfDzn6fQ5bfvPK4rDR 09tID2DgwP9dyozRGBy96kEyGKTTz5kwnmmgBKx5fgs942rjIn75DkeK9SzQyYQ6d6Tx X+AGkaXyYaFh0wIu7p+VcpbQBfnx25jZsuZrnGc/TCbhWLEsiNMK1sRnockItTZt+pkI eb8Kzmp9efkYzauBcAVWtNrt+Qn9AV7J+jpFNaM3lYDTETAj+IxuBbgPQ/AM4V1utDUe dvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139101; x=1692743901; 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=VMWm8Q7YwxQFT+1qIZIfVfmkuuQuLIh/GZ7M4TRZFeiCRUnhzyirS08n2GNw5Lovzq h5O+if3+6mXTFjk9NhFEqlA0DmTHU8s9Qe4HRNDkVRzdXQEyy88pzDbmoZbdCyA8jSj9 HtXVwGTyXwG/UWiWZoRjka6Cu9jQww2dE7FkBlQBZbxvdpa/4iBiYTMVPrPo8r6uERsS 2U1z8O9ZfXBoqrMM2YgfKQ9ksk350oDH7xGnfTCNk6SZDba8Nb+lmkJeEqROHAu9h4t3 xuLw7Kl/Fbbj9U4G62RDi828LcR7T2QhpbZgtP9rzwz4wjhyNsopJt8wcYrCLJ6Dpeum 3d1w== X-Gm-Message-State: AOJu0YzCIM1q8RFnLhp9lbsnAFjHTol5HgrKfAVUKNzyNuix3nsddc5N u0xCtHSOgJiiE6Tg9ofdwZWG6dojCkbXAurmYjw= X-Google-Smtp-Source: AGHT+IFJfqCpD+nmO5pqP0YuZgapB63Sa+jkOEDreYvO/jea5P75GHm1q0EWcjGEF+tRaX6UI7vJGQ== X-Received: by 2002:a54:4d06:0:b0:3a5:a78b:f773 with SMTP id v6-20020a544d06000000b003a5a78bf773mr61043oix.6.1692139101343; Tue, 15 Aug 2023 15:38: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 v8 11/12] avocado, risc-v: add opensbi tests for 'max' CPU Date: Tue, 15 Aug 2023 19:37:40 -0300 Message-ID: <20230815223741.433763-12-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1692139162192100001 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 May 17 03:54:47 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=1692139217; cv=none; d=zohomail.com; s=zohoarc; b=R37oqqw1eHLg9St2NyL+1+20iMj+Ti4eOe0TFgN6AbljjRuKmxCSX00Mb5WZHlWT7izD4tniYD2sW5I3QXA5Or0doZvXD3+hD+9fI+DYfHsg0UTryccmGAZUXMQe+sS3KJLzRlg9la0AL9ZcPMWPst1pWCHWvB7/v1/JT52YYiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692139217; 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=H4pnnHXPSSjR2BrIC+lFb47RzccWp4/dbdlHeRAoFGs=; b=GH/tgMfWOx7lE6SHBz09p5iPPiFHXeb1AG/OGZmxtSwdpcneK31Gvo0BGf+ntJ2T17LrlJhZVjRRYUcps9pg1SkkCiGiegPmHgcfOFkq5nbOtPe64OhFapUBy/V72oNnM0fJIqZcY72PnhREPxnM5Zk1GL8NgiFk849TQwmfC9U= 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 16921392178713.4102657572977932; Tue, 15 Aug 2023 15:40:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW2gV-0005NT-07; Tue, 15 Aug 2023 18:38:43 -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 1qW2gM-0005CX-6x for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:34 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW2gF-0006MM-15 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 18:38:31 -0400 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3a751d2e6ecso5016741b6e.0 for ; Tue, 15 Aug 2023 15:38: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 be15-20020a056808218f00b003a40b3fce01sm5903418oib.10.2023.08.15.15.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 15:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1692139104; x=1692743904; 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=H4pnnHXPSSjR2BrIC+lFb47RzccWp4/dbdlHeRAoFGs=; b=Zi9UwB/rTwnhnxKJ8Th1/cMqzdD6UZVIP/UGk3mWgUGrZHaNXW1O2wjdUp4OuHbZIf pEoEZ0FyGDXYySUspctuGRDnpWjBMGXhyYqa/9YchoZdu/w6ttCGMCpL7sdf+SxE39H5 2dU4bpHz8+hUvZINjSbWGbTc5t8wsbItpxAYOB1xGqZaIjLdy2lQMnaZwoU3SUvMJLw3 Cfc4vT6aLrWd9tevv8Qg9rGlLzYfLmBRw/tfQd+cRHERhPiHQoq5BF65PkQrCQTKi7dH vcs9/2xibcaXBehpmXHQg/F9Z6ioz4C0xzsKg+uo1nxEzYZfAqbEoN+nX1n/ozhaZeOw CeFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692139104; x=1692743904; 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=H4pnnHXPSSjR2BrIC+lFb47RzccWp4/dbdlHeRAoFGs=; b=QxbdLckkrer7UYNIZ5R7nkJsM3+Dh7EbryzgX+V/t9LSH53J+s0sn64mZb7LvToTGM vlGogehgGGC/p9aQ7pyPAWDwyfpYRP7noGGpwEkB6EdU5q+C9ZwAnJP7jra5Gr2QuKLx BGUx9Tyu1uzQPi1+9yPdTbEMJe+iqOmCby+q4249elbxmI6ERMIeK0md5SLFjiE0TdM7 In0nfzPX55VGLdVwY8vT0wtVZkmVb6PiJNaxlXs8VqIDiiJl+tW+/eXMcGUFir3u/Mfo 1IIT45/3DUYZOG18zzlUfOx1ro9aQy2XG4ODHsOI9V9KO8ncTUzwFq9o9wz7XD9lpvrr f2yw== X-Gm-Message-State: AOJu0Yz506aRUSb2IhwLshMekB7knGxetGkxUeuMvV6oUtLQ7RfOhHWb pDt3EBx3pcyMX6aYD52bE4GImnQsHOXnm2VtI/4= X-Google-Smtp-Source: AGHT+IHrun8S8aLUXsYgmCBeOiPLKKg10i0BdKbIhnKmyiMgeVL8HqRikPi3opKkSny+hpHXT08bIQ== X-Received: by 2002:a05:6808:1902:b0:3a7:e4a:5cbd with SMTP id bf2-20020a056808190200b003a70e4a5cbdmr72651oib.31.1692139104282; Tue, 15 Aug 2023 15:38: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 v8 12/12] target/riscv: deprecate the 'any' CPU type Date: Tue, 15 Aug 2023 19:37:41 -0300 Message-ID: <20230815223741.433763-13-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230815223741.433763-1-dbarboza@ventanamicro.com> References: <20230815223741.433763-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::234; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x234.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: 1692139219087100003 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 326b016723..59bd37e033 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