From nobody Tue Feb 10 14:54:04 2026 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697084042; cv=none; d=zohomail.com; s=zohoarc; b=fTRRzbzdliErPN1fAs3QhQVPpLFFXflbMAusjVE6jWNNSYc22J98sDZhcoE0NBsG170p/5pmazzkjuWWRxoMk0w3fzK4GAAxxpReygdFGNmmNA/4qKzmPQjdUW/qgmXX/56X5VUuVuw5NTCq1gGg5HGlMUxFlleNh8sz8fl26t4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697084042; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BZZD9Xx0PTI5oMjWNryPKTgPO2boAzXqZDzTWwKiXuc=; b=abKhwsK5/o9x/55txSxDNqzxtEW973fZc9uFLxffE3HFFfR77ryMpM+apNr6RD4kYUmpX/jgYiiS1ociGm/WpNGw6rmxK9sLGImvy9R8PYWfkk8fkTM7uR2WSGNNIrvMIB9aKBangTYRuN/HL235I0AbD9U1H8S0ow85y7TBaW4= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697084042660603.8017880345075; Wed, 11 Oct 2023 21:14:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqn3S-0001cv-Ap; Thu, 12 Oct 2023 00:12:10 -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 1qqn3P-0001Vp-7l for qemu-devel@nongnu.org; Thu, 12 Oct 2023 00:12:07 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqn3N-0002MR-BF for qemu-devel@nongnu.org; Thu, 12 Oct 2023 00:12:06 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9bf22fe05so4618205ad.2 for ; Wed, 11 Oct 2023 21:12:02 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id ja20-20020a170902efd400b001c1f4edfb9csm726348plb.173.2023.10.11.21.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 21:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697083921; x=1697688721; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BZZD9Xx0PTI5oMjWNryPKTgPO2boAzXqZDzTWwKiXuc=; b=WVEds+h2B17hGN4ET4JoQ2fssF/QJ3dGdqwIV4h/8NWuqFIhvYdw6y1hxiEMNtxtVS tvAGlNF1eczpWsOjUVEaCTqOE9hwKwLsCFxQuXj2rAcTwBTm99WN5hnl/rLyKip0qlFY QMSB+p3Gl/CSRMqB83k+Z9Ytfms8jafYB3I0YadrEnlUKpXMHW7YeiJ9HPsmxby9SWPr DLULczUvd3CTOLlb5QaSy8s1D3gJAjE2t7MVPC8JsmMCCnLY7Q6zaTDunxu/u2yJfyMm 9PY7C7K3MZqsFXhLsVZWzhruvc7IyrDM85Pt7qQ+jwoX+Cj8SXlyvNcKEAnWDN/KP6bk Rw0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697083921; x=1697688721; 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=BZZD9Xx0PTI5oMjWNryPKTgPO2boAzXqZDzTWwKiXuc=; b=AQNtvGOTMR03o0prXi+ezfWt4YzNcAYCvoy8t9GI+GuDIEo1UDGLBHZX7Rfx1ALfbe ldjUbF3+G0h9yTQzlcbrGJ0BLChKJEPXCizWtDfI9rpFWZ6P0GGIxa1hq9VFixlzcOTC ARqJxBuL8fUd7dxDc+ir1UnCRpyTuf3mGLJl+xbLqsXLfV/xCu/bg6X1wrXb6fPGvS4k dKAtLYqJZG0gQlqHEzWJByqMwH09hdPXnwuGs7cv2XqjGLahohV8RyvPIVhbC7ImZJgq IjsKhaIZ3EuMEgavNyYHt6+3wArGirBjF605BtiHufY45gF5JJmWcugyW1PIiGCZ5mFY tGFg== X-Gm-Message-State: AOJu0YzfSxWHx2kds3SwYwStLdbGPIuMlGwhSTyRMAjpPsPXRpZ7a8AR 95p/1hr6a0fcwMGwTH9s/DNvIFGKJLIGCg== X-Google-Smtp-Source: AGHT+IGBY0La+FdnOOHODW8fazqGyG0HdXTFl5VT3S5jOw22OBYuszgj82JCWKd4IGZkqCznvjYcHg== X-Received: by 2002:a17:902:d214:b0:1c7:398c:a437 with SMTP id t20-20020a170902d21400b001c7398ca437mr18518554ply.69.1697083920888; Wed, 11 Oct 2023 21:12:00 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Daniel Henrique Barboza , Alistair Francis , Andrew Jones Subject: [PULL 16/54] target/riscv/cpu.c: use cpu_cfg_ext_auto_update() during realize() Date: Thu, 12 Oct 2023 14:10:13 +1000 Message-ID: <20231012041051.2572507-17-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012041051.2572507-1-alistair.francis@wdc.com> References: <20231012041051.2572507-1-alistair.francis@wdc.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::62f; envelope-from=alistair23@gmail.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1697084044152100001 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza Let's change the other instances in realize() where we're enabling an extension based on a certain criteria (e.g. it's a dependency of another extension). We're leaving icsr and ifencei being enabled during RVG for later - we'll want to error out in that case. Every other extension enablement during realize is now done via cpu_cfg_ext_auto_update(). The end goal is that only cpu init() functions will handle extension flags directly via "cpu->cfg.ext_N =3D true|false". Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Andrew Jones Message-ID: <20230912132423.268494-17-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index bd73b61d3c..25fef13ef0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1193,7 +1193,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu,= Error **errp) } =20 if (cpu->cfg.ext_zfh) { - cpu->cfg.ext_zfhmin =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zfhmin), true); } =20 if (cpu->cfg.ext_zfhmin && !riscv_has_ext(env, RVF)) { @@ -1219,17 +1219,17 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cp= u, Error **errp) } =20 /* The V vector extension depends on the Zve64d extension */ - cpu->cfg.ext_zve64d =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64d), true); } =20 /* The Zve64d extension depends on the Zve64f extension */ if (cpu->cfg.ext_zve64d) { - cpu->cfg.ext_zve64f =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64f), true); } =20 /* The Zve64f extension depends on the Zve32f extension */ if (cpu->cfg.ext_zve64f) { - cpu->cfg.ext_zve32f =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32f), true); } =20 if (cpu->cfg.ext_zve64d && !riscv_has_ext(env, RVD)) { @@ -1243,7 +1243,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu,= Error **errp) } =20 if (cpu->cfg.ext_zvfh) { - cpu->cfg.ext_zvfhmin =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvfhmin), true); } =20 if (cpu->cfg.ext_zvfhmin && !cpu->cfg.ext_zve32f) { @@ -1273,7 +1273,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu,= Error **errp) =20 /* Set the ISA extensions, checks should have happened above */ if (cpu->cfg.ext_zhinx) { - cpu->cfg.ext_zhinxmin =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); } =20 if ((cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) && !cpu->cfg.ext_zfi= nx) { @@ -1294,12 +1294,12 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cp= u, Error **errp) } =20 if (cpu->cfg.ext_zce) { - cpu->cfg.ext_zca =3D true; - cpu->cfg.ext_zcb =3D true; - cpu->cfg.ext_zcmp =3D true; - cpu->cfg.ext_zcmt =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcb), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmp), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmt), true); if (riscv_has_ext(env, RVF) && env->misa_mxl_max =3D=3D MXL_RV32) { - cpu->cfg.ext_zcf =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true); } } =20 @@ -1367,26 +1367,26 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cp= u, Error **errp) } =20 if (cpu->cfg.ext_zk) { - cpu->cfg.ext_zkn =3D true; - cpu->cfg.ext_zkr =3D true; - cpu->cfg.ext_zkt =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkn), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkr), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkt), true); } =20 if (cpu->cfg.ext_zkn) { - cpu->cfg.ext_zbkb =3D true; - cpu->cfg.ext_zbkc =3D true; - cpu->cfg.ext_zbkx =3D true; - cpu->cfg.ext_zkne =3D true; - cpu->cfg.ext_zknd =3D true; - cpu->cfg.ext_zknh =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkb), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkc), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkx), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zkne), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zknd), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zknh), true); } =20 if (cpu->cfg.ext_zks) { - cpu->cfg.ext_zbkb =3D true; - cpu->cfg.ext_zbkc =3D true; - cpu->cfg.ext_zbkx =3D true; - cpu->cfg.ext_zksed =3D true; - cpu->cfg.ext_zksh =3D true; + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkb), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkc), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zbkx), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zksed), true); + cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zksh), true); } =20 /* --=20 2.41.0