From nobody Tue Feb 10 13:24:08 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=1697084331; cv=none; d=zohomail.com; s=zohoarc; b=eC5z+t36sD+rhMvSsrfoiFgKlInR4FpmqvPj/T6FVOAH3e3p6fEu+oopp/NBWCb0tcURy1JJEHGRhhDhql9L+e4I31UhJz2EGAu19dKEczZdYlWvLXffjmyVRnwxzKXskchu4Yd/jZ+k6+x4ha63aYabsC1o7zg3eSVZDFUDOEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697084331; 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=BMp2lHSR5uHgHhonKYor0HnZCHcuwQbcRPOvEOqLEbE=; b=QKVrqqTZKkMs4PUukQRqr4Mud7jS0bTccwbQRJBk7plB6hOIplu72vTNLAQkTUXSjiQnGhG4qd2LdZDpcBxXI0hzXZJhyjB6sKYsZLYvsMUzOoQptNpJXu/f8l+c9FtcnQwVjQnRzXBtEa+jO0PW7hdc23MZStvH8Lh5RreUp2c= 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 1697084331928386.90750617061303; Wed, 11 Oct 2023 21:18:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqn3O-0001T8-RT; Thu, 12 Oct 2023 00:12:06 -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 1qqn3B-0000zc-Uk for qemu-devel@nongnu.org; Thu, 12 Oct 2023 00:11:54 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqn3A-0002Ka-Bc for qemu-devel@nongnu.org; Thu, 12 Oct 2023 00:11:53 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c894e4573bso4499625ad.0 for ; Wed, 11 Oct 2023 21:11:52 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 21:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697083911; x=1697688711; 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=BMp2lHSR5uHgHhonKYor0HnZCHcuwQbcRPOvEOqLEbE=; b=J22ldC7bII+6ZQtCZEO0/S+N2t60tE1C2rcRQ+Q9pHuO5UGDWBkqB9WVWETr9nPr9M 7Ez0F+uV/HIOlB1ugK/fgRSTFz0d851r6T2wA8fDsHmgE9g4iB+F4txc38EB+03kY5Qf sbBwDCYieSG7Dbh5u96YdPavojoa36RlrygAj11US3nF3qLRqg1BizjxFQx1BTsmCgSj 51sr93Mk57CQZo06NZdc9eqb3myz73UdXxRRHH/XzTeJR0g9mBXmvlp+l1syFihFatRN e5r1l1B9KlQ83DSV/GMSplnRWknUqCKckj8h2vuvM2VLXnlviurqOkhSw57+kR4R2sU6 9cXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697083911; x=1697688711; 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=BMp2lHSR5uHgHhonKYor0HnZCHcuwQbcRPOvEOqLEbE=; b=WtDTtvxXCu5PusHVt3iYgRZswS0X6fZb3AlrOs5uERoyrZJ8826T3VCBEtrBUWuJed LApdmYJJSM8o4G9HrM4VARgB0XPWkQDupr2rZuf+YR6/PtkDRTay1NnI/CbkTLmFQ7ku 39L68IqYTE5lQMPMyDR2bI3EPIr49VprkBuxNzw9m1iOGGFXcsYWF/idoJsWbNZ88paG GkhzcRcbwLNjLSCB9c7FH5ZlCvM6mKKdaanOMgsfBchEJirILwsdZXpb5Un+0+O6HN8h YTXJTQ1g0SAA0RHDr7iquYqVVyYsluDXziw5GP8K/+t3Nruc7uqeHLDhVw/ZNUQYNSWQ ZUeQ== X-Gm-Message-State: AOJu0YywONfH/eK+P9f4wZRujmQcbNZu/XqF8fM3AzD7WnptBRz3aKCj IFYuSiA+EYIDNr1wWxXrJ9sSC4EVmoR9ww== X-Google-Smtp-Source: AGHT+IEP9R/O7U4tE7806IevsXB8tBLdguMHFVVcZVaytigcr81iu4fBGfP3ohjJ0AsNoZyiklQEEQ== X-Received: by 2002:a17:902:f68b:b0:1c8:a68e:7f1 with SMTP id l11-20020a170902f68b00b001c8a68e07f1mr12001790plg.66.1697083910714; Wed, 11 Oct 2023 21:11:50 -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 13/54] target/riscv/cpu.c: use offset in isa_ext_is_enabled/update_enabled Date: Thu, 12 Oct 2023 14:10:10 +1000 Message-ID: <20231012041051.2572507-14-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::634; envelope-from=alistair23@gmail.com; helo=mail-pl1-x634.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: 1697084333150100007 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza We'll have future usage for a function where, given an offset of the struct RISCVCPUConfig, the flag is updated to a certain val. Change all existing callers to use edata->ext_enable_offset instead of 'edata'. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Andrew Jones Message-ID: <20230912132423.268494-14-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 115c2d2fa4..5287569e5a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -162,18 +162,17 @@ static const struct isa_ext_data isa_edata_arr[] =3D { ISA_EXT_DATA_ENTRY(xventanacondops, PRIV_VERSION_1_12_0, ext_XVentanaC= ondOps), }; =20 -static bool isa_ext_is_enabled(RISCVCPU *cpu, - const struct isa_ext_data *edata) +static bool isa_ext_is_enabled(RISCVCPU *cpu, uint32_t ext_offset) { - bool *ext_enabled =3D (void *)&cpu->cfg + edata->ext_enable_offset; + bool *ext_enabled =3D (void *)&cpu->cfg + ext_offset; =20 return *ext_enabled; } =20 -static void isa_ext_update_enabled(RISCVCPU *cpu, - const struct isa_ext_data *edata, bool = en) +static void isa_ext_update_enabled(RISCVCPU *cpu, uint32_t ext_offset, + bool en) { - bool *ext_enabled =3D (void *)&cpu->cfg + edata->ext_enable_offset; + bool *ext_enabled =3D (void *)&cpu->cfg + ext_offset; =20 *ext_enabled =3D en; } @@ -1045,9 +1044,10 @@ static void riscv_cpu_disable_priv_spec_isa_exts(RIS= CVCPU *cpu) =20 /* Force disable extensions if priv spec version does not match */ for (i =3D 0; i < ARRAY_SIZE(isa_edata_arr); i++) { - if (isa_ext_is_enabled(cpu, &isa_edata_arr[i]) && + if (isa_ext_is_enabled(cpu, isa_edata_arr[i].ext_enable_offset) && (env->priv_ver < isa_edata_arr[i].min_version)) { - isa_ext_update_enabled(cpu, &isa_edata_arr[i], false); + isa_ext_update_enabled(cpu, isa_edata_arr[i].ext_enable_offset, + false); #ifndef CONFIG_USER_ONLY warn_report("disabling %s extension for hart 0x" TARGET_FMT_lx " because privilege spec version does not match", @@ -2340,7 +2340,7 @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char = **isa_str, int i; =20 for (i =3D 0; i < ARRAY_SIZE(isa_edata_arr); i++) { - if (isa_ext_is_enabled(cpu, &isa_edata_arr[i])) { + if (isa_ext_is_enabled(cpu, isa_edata_arr[i].ext_enable_offset)) { new =3D g_strconcat(old, "_", isa_edata_arr[i].name, NULL); g_free(old); old =3D new; --=20 2.41.0